<?php 

class modLotDescriptionView {
  
  public function __construct(modLotDescription $lotDescription) {
    if (isset($lotDescription)) {

      $this->loginName = $lotDescription->login_name;
      $this->pw_id = $lotDescription->pw_id;
      
      $menu = new MainMenu('lotdescription', $lotDescription->lo_id);
      $this->beforeMenu = $menu->before();
      $this->afterMenu  = $menu->after();

      $controlsControls = new EntryInit('lotdescription');
      $entryInit = $controlsControls->get("entryInit");
      foreach ($entryInit as $control) {
//print_r ($control);
//print_r ("<br>");        
        eval ($control);
      }
    }  
  }
  
  public function output() {

  $layout = "

  $this->beforeMenu

<div id='divlotdescription' style='border:1px solid black;border-bottom:none;'>

  <div class='container'>	
    <div class='row'>
      <div class='col-md-12'>
    $this->cxtLotDefinitionLayout

        <label>Lot Definition</label>
        <table class='table table-condensed'>
          <tbody>
            <tr>
              <td  colspan='2' style='width:20%'>
    $this->frmSetLotNameLayout
              </td>
              <td colspan='3' style='width:30%'>
    $this->sasLotNameLayout
              </td>
              <td colspan='3' style='width:30%'>
              </td>
              <td colspan='2' style='width:20%'>
              </td>
            </tr>
            <tr>
              <td colspan='5'>
                <div id='valmsgfrmSetLotName' style='color:red'></div>
              </td>
            </tr>
            <tr>
              <td colspan='5'>
              </td>
            </tr>
            <tr>
            <tr>
              <td colspan='3' style='width:30%;'> 
    $this->selLotTypeLayout
              </td>
              <td colspan='4' style='width:40%;'>
    $this->inpLotRationaleLayout
              </td>
              <td colspan='3' style='width:30%;'> 
    $this->selInterpretationLayout
              </td>
            </tr>
            <tr>
              <td colspan='10'>
                <div id='valmsgfrmLotDefinition' style='color:red'></div>
              </td>
            </tr>
          </tbody>
        </table> 
        <div style='width:85%;margin-top:15px;background-color:#f1f1f1;border-style:outset;border-width:5px;'>
        <table class='table table-condensed' 
          style='width:95%;margin-left:20px;'>
          <tbody>
            <tr>
              <td colspan='6'>
                <label>Composition</label>
              </td>
              <td colspan='4'>
                <label>Inclusions</label>
              </td>
            </tr>
            <tr>
              <td colspan='2' style='width:20%;'>
    $this->selCompMaterialLayout
              </td>
              <td colspan='2' style='width:20%;'> 
    $this->selCompColourLayout
              </td>
              <td colspan='2' style='width:20%;'>
    $this->selCompCompactionLayout
              </td>
              <td colspan='4' rowspan='4' style='width:40%;'>
    $this->mulCompInclusionsLayout
              </td>
            </tr>
            <tr>
              <td colspan='2' style='width:20%;'>
    $this->selCompTextureLayout
              </td>
              <td colspan='2' style='width:20%;'> 
    $this->selCompSphericityLayout
              </td>
              <td colspan='2' style='width:20%;'>
    $this->selCompRoundingLayout
              </td>
            </tr>    
            <tr>    
              <td colspan='6' rowspan='3'>
    $this->inpCompositionNoteLayout
              </td>
            </tr>    
            <tr>    
              <td colspan='1'>
    $this->frmLotCompositionLayout
              </td>
            </tr>
            <tr>
              <td colspan='10'>
                <div id='valmsgfrmLotComposition' style='color:red'></div>
              </td>
            </tr>
            <tr>
              <td colspan='10'>
    $this->sumLotCompositionsLayout
              </td>
            </tr>
            <tr>
              <td colspan='10'>
    $this->delLotCompositionLayout
              </td>
            </tr>
          </tbody>
        </table>    
      </div>
      <table class='table table-condensed' style='margin-top:15px;'>
        <tbody>
          <tr>
            <td style='width:85%;'>
     $this->inpParcelLotNoteLayout
           </td>
            <td style='width:15%;'>
     $this->frmLotDefinitionLayout
           </td>
          </tr>
        </tbody>
      </table>    
      <table class='table table-bordered' style='margin-top:5px;'>
        <tbody>
          <tr>
            <td>
    $this->sumLotDefinitionsLayout
            </td>
          </tr>
          <tr>
            <td>
    $this->delLotDefinitionLayout
            </td>
          </tr>
        </tbody>
      </table>    
    </div>
  </div>    
</div>
</div>
<div id='debug' style='border:1px solid black;border-bottom:0px;'>  
  <div class='container'>	
    <div class='row' style='margin-top:10px;margin-bottom:10px;'>
      <div class='col-md-12'>
        <button class='btn btn-inverse' onclick='clearMessages();'>
          Clear
        </button>
        <table id='logmessages' class='table table-condensed'>
          <tr>
            <th>Funtion</th><th>Key</th><th>To</th><th>Value</th><th>Text</th>
            <th>Source</th><th>Index</th><th>Reason</th>
        </table>
      </div>
    </div>
  </div>
</div>

$this->afterMenu

<script>

function logMessage (message) {
  $('#logmessages').append ('<tr>' + message + '</tr>');
}

function clearMessages () {
  document.getElementById('logmessages').innerHTML = '';
}

document.getElementById('taglotdescription').click();
document.getElementById('loginlotdescription').innerHTML='Login: $this->loginName'

if ($this->pw_id == 0) {
  document.getElementById('divlotdescription').style.display='none';
  document.getElementById('hdrmsglotdescription').innerHTML=
    'Pre-select a Project Work Event';    
}

$this->frmSetLotNameScript
$this->frmLotDefinitionScript
$this->frmLotCompositionScript
$this->cxtLotDefinitionScript
$this->fkyProjectParcelScript
$this->sasLotNameScript
$this->selLotTypeScript
$this->inpLotRationaleScript
$this->selInterpretationScript
$this->selCompMaterialScript
$this->selCompColourScript
$this->selCompCompactionScript
$this->mulCompInclusionsScript
$this->selCompTextureScript
$this->selCompSphericityScript
$this->selCompRoundingScript
$this->inpCompositionNoteScript
$this->sumLotCompositionsScript
$this->delLotCompositionScript
$this->inpParcelLotNoteScript
$this->sumLotDefinitionsScript
$this->delLotDefinitionScript

</script>
    ";
	
    return $layout;
 
  }
}

?>