<?php 

class modCrewView {
  private $pw_id;
  private $searchCrewLayout;
  private $searchCrewScript;
  private $selectParcelLayout;
  private $selectParcelScript;
  private $selectDateLayout;
  private $selectDateScript;
  private $status;

  public function __construct(modCrew $crew) {
    if (isset($crew)) {
      $lo_id = (isset($_SESSION['login'])) ? $_SESSION['login'] : 0;
      $this->pw_id = (isset($_SESSION['projectworkday'])) ? $_SESSION['projectworkday'] : 0;

      $menu = new MainMenu('crew', $lo_id);
      $this->beforeMenu = $menu->before();
      $this->afterMenu  = $menu->after();

      $crewControls = new EntryInit('crew');
      $entryInit = $crewControls->get("entryInit");
      foreach ($entryInit as $control) {
//print_r ("$control<br>");          
        eval ($control);
      }
    }
  }

  public function output() {
  
    $layout = "
$this->beforeMenu
<div id='divcrew' style='border:1px solid black;border-bottom:0px'>  
  <div class='container'>
    <div class='row' style='margin-top:10px;margin-bottom:10px;'>
      <div class='col-sm-8'>
    $this->assignCrewLayout
      </div>
      <div class='col-sm-4'>
        <table class='table'>
          <tr>
            <td>
          $this->projectRolesLayout
            </td>
          </tr>
        </table>        
      </div>
    </div>
  </div>    
  <div class='container'>
    <div class='row' style='margin-top:10px;margin-bottom:10px;'>
      <div class='col-md-6'>
        <h4>Travel to project:</h4>
        <table class='table table-condensed'>
        $this->tr_idtoKeyLayout
          <tr>
            <td style:'width:20%'>
          $this->toTypeLayout
            </td>
            <td colspan='4' rowspan='3' style:'width:80%'>
          $this->toTravelLayout
            </td>
          </tr>
          <tr>
            <td style:'width:20%'>
          $this->toVehicleLayout
            </td>
          </tr>
          <tr>
            <td style:'width:20%'>
          $this->delTravelToLayout
            </td>
          </tr>
          <tr>
            <td style:'width:20%'>

            </td>
            <td style:'width:20%'>
          $this->toStartTimeLayout
            </td style:'width:20%'>
            <td>
          $this->toDurationLayout
            </td style:'width:20%'>
            <td>
           $this->toMileageLayout
            </td style:'width:20%'>
            <td style:'width:20%;vertical-align:bottom;'>
          $this->putToMeasuresLayout
          $this->putToMeasuresReqLayout
            </td>
          </tr>
        </table>
      </div>  

      <div class='col-md-6'>
        <h4>Travel from project:</h4>
        <table class='table'>
        $this->tr_idfromKeyLayout
          <tr>
            <td>
          $this->fromTypeLayout
            </td>
            <td colspan='4' rowspan='3'>
          $this->fromTravelLayout
            </td>
          </tr>
          <tr>
            <td>
          $this->fromVehicleLayout
            </td>
          </tr>
          <tr>
            <td>
          $this->delTravelFromLayout
            </td>
          </tr>
          <tr>
            <td>
          $this->dupToFromLayout
            </td>
            <td>
          $this->fromStartTimeLayout
            </td>
            <td>
          $this->fromDurationLayout
            </td>
            <td>
          $this->fromMileageLayout
            </td>
            <td>
          $this->putFromMeasuresLayout
          $this->putFromMeasuresReqLayout
            </td>
          </tr>
        </table>
      </div> 
    </div>
  </div>
</div>

$this->cnfAdjustTimeLayout
$this->cnfDeleteRoleLayout
$this->afterMenu
<script>

document.getElementById('tagcrew').click();

if ($this->pw_id == 0) {
  document.getElementById('divcrew').style.display='none';
  document.getElementById('hdrmsgcrew').innerHTML='Pre-select a Project Workday';    
}

$this->assignCrewScript

$this->projectRolesScript

$this->toTypeScript

$this->fromTypeScript

$this->toTravelScript 

$this->fromTravelScript

$this->toVehicleScript

$this->fromVehicleScript 

$this->toDriverScript

$this->toStartTimeScript

$this->fromStartTimeScript

$this->toDurationScript

$this->fromDurationScript

$this->fromDriverScript

$this->delTravelToScript

$this->delTravelFromScript

$this->putToMeasuresReqScript

$this->putFromMeasuresReqScript

$this->cnfAdjustTimeScript

$this->cnfDeleteRoleScript

</script>

    ";
	
  return $layout;
  } 
}

?>