
<?php 

class modClientContactView {
    
  public function __construct(modClientContact $clientContact) {
    if (isset($clientContact)) {

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

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

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

    $layout = "
    
$this->beforeMenu 

<div id='divclientcontact' style='border:1px solid black;border-bottom:none;'>
  <div class='container'>
    <div class='row' style='margin-top:10px;'>
      <div class='col-md-12'>
          <table class='table table-condensed'>
            <tr>
              <td  colspan='2' style='width:20%'>
    $this->frmSetClientContactLayout
              </td>
              <td colspan='3' style='width:30%'>
    $this->sasContactNameLayout
              </td>
              <td colspan='3' style='width:30%'>
    $this->sasOrganizationLayout
              </td>
              <td colspan='2' style='width:20%'>
    $this->frmSetOrganizationLayout
              </td>
            </tr>
            <tr>
              <td colspan='2' style='width:20%'>
    $this->inpFirstNameLayout
              </td>
              <td colspan='2' style='width:20%'>
    $this->inpMiddleNameLayout
              </td>
              <td colspan='1' style='width:10%'>
    $this->selNameTitleLayout
              </td>
              <td colspan='5' style='width:50%'>
              </td>
            </tr>
            <tr>
              <td colspan='5'>
                <div id='valmsgfrmSetClientContact' style='color:red'></div>
              </td>
              <td colspan='5'>
                <div id='valmsgfrmSetOrganization' style='color:red'></div>
              </td>
            </tr>
            <tr>
              <td colspan='10' style='height:37px;'>
    $this->frmContactAffiliationLayout
              </td>
            </tr>
            <tr>
              <td colspan='4' style='width:40%'>
    $this->addTelnoTypeLayout
              </td>
              <td colspan='6' style='width:60%'>
    $this->addContactJobstatusesLayout
              </td>
            </tr>
            <tr>
              <td colspan='10'>
    $this->togContactAddressLayout
              </td>
            </tr>
          </table>

          <div class='panel12 slidetogContactAddress'>		  
            <table class='table table-condensed'>
              <tr>
                <td colspan='6' style='width:50%'>
                </td>
                <td colspan='2' style='width:20%'>
    $this->sosAddressTypeLayout
                </td>
                <td colspan='2' rowspan='4' style='width:20%'>
    $this->frmContactAddressLayout
                </td>
              </tr>
              <tr>
                <td colspan='1' style='width:10%'>
    $this->sasStreetNoLayout
                </td>
                <td colspan='5' style='width:50%'>
    $this->inpStreetNameLayout
                </td>
                <td colspan='1' style='width:10%'>
    $this->selStreetTypeLayout
                </td>
                <td colspan='1' style='width:10%'>
    $this->selStreetDirLayout
                </td>
              </tr>
                <td colspan='2' style='width:20%'>
    $this->inpAddrSuiteLayout
                </td>
                <td colspan='2' style='width:20%'>
    $this->inpAddrPOBoxLayout
                </td>
                <td colspan='2' style='width:20%'>
    $this->inpAddrStationLayout
                </td>
                <td colspan='2' style='width:20%'>
    $this->inpRuralRouteLayout
                </td>
              </tr>
              <tr>
                <td colspan='4' style='width:40%'>
    $this->inpCityNameLayout
                </td>
                <td colspan='1' style='width:10%'>
    $this->selProvinceLayout
                </td>
                <td colspan='2' style='width:20%'>
    $this->inpCountryLayout
                </td>
                <td colspan='1' style='width:10%'>
    $this->inpPostalCodeLayout
                </td>
              </tr>
              <tr>
                <td colspan='10'>
                <div id='valmsgfrmContactAddress' style='color:red'></div>
                </td>
              </tr>
            </table>
          </div>

          <table class='table table-condensed'>
            <tr>
              <td colspan='6' style='width:60%'>
    $this->inpContactEmailLayout
              </td>
              <td colspan='4' style='width:40%'>
              </td>
            </tr>
            <tr>
              <td colspan='6' rowspan='3' style='width:60%'>
    $this->inpContactNoteLayout
              </td>
              <td colspan='2' style='width:30%;'>
    $this->inpSiteLoginLayout
              </td>
              <td colspan='1' style='width:10%;'>
              </td>
            </tr>
            <tr>
              <td colspan='3' style='width:40%;'>
    $this->inpSitePasswordLayout
              </td>
            </tr>
            <tr>
              <td colspan='4' style='width:40%;height:37px;'>
    $this->frmContactAffiliationLayout
              </td>
            </tr>
            <tr>
              <td colspan='10'>
              <div id='valmsgfrmContactAffiliation' style='color:red'></div>
              </td>
            </tr>
          </table>
 

    $this->sumContactAffiliationsLayout
        </div>		
      </div>
    </div>
  </div>
</div>

$this->cnfContactUpdateLayout 
$this->cnfOrganizUpdateLayout 

<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('tagclientcontact').click();
document.getElementById('loginclientcontact').innerHTML='Login: $this->loginName'

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

$this->frmContactAffiliationScript
$this->frmContactAddressScript
$this->frmSetClientContactScript
$this->frmSetOrganizationScript
$this->sasContactNameScript
$this->sasOrganizationScript
$this->inpFirstNameScript
$this->inpMiddleNameScript
$this->selNameTitleScript
$this->addContactJobstatusesScript
$this->mapClientContactScript
$this->mapOrganizationScript
$this->fkyOrganizationContactScript
$this->inpContactEmailScript
$this->togContactAddressScript
$this->sosAddressTypeScript
$this->addTelnoTypeScript
$this->fkyAddressLinkScript
$this->sasStreetNoScript
$this->inpStreetNameScript
$this->selStreetTypeScript
$this->selStreetDirScript
$this->inpAddrSuiteScript
$this->inpAddrPOBoxScript
$this->inpAddrStationScript
$this->inpRuralRouteScript
$this->inpCityNameScript
$this->selProvinceScript
$this->inpCountryScript
$this->inpPostalCodeScript
$this->inpContactNoteScript
$this->inpSiteLoginScript
$this->inpSitePasswordScript
$this->sumContactAffiliationsScript
$this->cnfContactUpdateScript 
$this->cnfOrganizUpdateScript 

</script>
  ";

  return $layout;
  }	

}

?>