<?php 

class modAddonFormView {
  private $scope;
    
  public function __construct(modAddonForm $addonForm) {
    if (isset($addonForm)) {

      $this->loginName = $addonForm->login_name;
      $this->lo_id = $addonForm->lo_id;

      $menu = new MainMenu('addonform', $addonForm->lo_id);
      $this->beforeMenu = $menu->before();
      $this->afterMenu  = $menu->after();
      
      $panelFields = new FieldInit('addonform'); 
      $fields = $panelFields->get("fieldInit");
      foreach ($fields as $field) {
//print_r ($field);
//print_r ("<br>");        
        eval ($field);
      }
    }
  }  

  public function output() {

    $layout = "

<div class='container'>	
    $this->beforeMenu
  <div id='divaddonform' style='border:1px solid black;border-bottom:none;'>
    <div class='row'>
      <div class='col-md-12'>
        <table class='table table-condensed'>
          <tr>
            <td colspan='2'>
    Select Car Wash Options by Vehicle 
            </td>
          </tr>
          <tr>
            <td style='width:35%'>
    $this->selSupplierLayout 
            </td>
            <td style='width:65%'>
            </td>
          </tr>
          <tr>
            <td style='width:65%;border:1px solid black;border-bottom:none;'>
    $this->addAddonFormLayout
            </td>
            <td style='width:35%'>
            </td>
          </tr>
          <tr>
            <td style='width:35%'>
    $this->rerAddonFormLayout
            </td>
            <td style='width:65%'>
            </td>
          </tr>
        </table>
      </div> 
    </div>

  </div>
    $this->afterMenu
</div>	


<script>

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

if ($this->lo_id == 0) {
  document.getElementById('divaddonform').style.display='none';
  document.getElementById('hdrmsgaddonform').innerHTML='Login';    
}

$this->addAddonFormScript
$this->selSupplierScript 
$this->rerAddonFormScript

</script>
  ";
 
  return $layout;
  }	

}

?>