<?php  use Cake\ORM\TableRegistry;
       $companies = TableRegistry::get('companies');  
        $branches = TableRegistry::get('branches'); 
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
      <?= $this->element('admin_sidebar') ?>
</nav>
<div class="customers view large-9 medium-8 columns content">
  <h3>Customer Detail</h3>
     <div><?= $this->Html->link(__('List Customers'), ['action' => 'index'],['class' => 'green-btn']) ?> </div>
    
    <table class="vertical-table">
        <tr>
            <th scope="row"><?= __('Accountno') ?></th>
            <td><?= h($customer->accountno) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Firstname') ?></th>
            <td><?= h($customer->firstname) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Lastname') ?></th>
            <td><?= h($customer->lastname) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Dob') ?></th>
            <td><?= h($customer->dob) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Panno') ?></th>
            <td><?= h($customer->panno) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Email') ?></th>
            <td><?= h($customer->email) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Gender') ?></th>
            <td><?= h($customer->gender) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Address') ?></th>
            <td><?= h($customer->address) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('City') ?></th>
            <td><?= h($customer->City) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('State') ?></th>
            <td><?= h($customer->State) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Country') ?></th>
            <td><?= h($customer->Country) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Zipcode') ?></th>
            <td><?= h($customer->Zipcode) ?></td>
        </tr>
   
        <tr>
            <th scope="row"><?= __('Company') ?></th>
             <td>
                 <?php
                    if($customer->company_id > 0){                       
                          $cstid = $companies->find()->where(['id' => $customer->company_id]);
                          $data1 = $cstid->toArray();
                          echo ((!empty($data1))? $data1[0]->company : '');
                     }
                 ?>
                </td>
        </tr>
        <tr>
            <th scope="row"><?= __('Branch') ?></th>
           <td>
                 <?php
                    if($customer->branch_id > 0){                       
                          $branchid = $branches->find()->where(['id' => $customer->branch_id]);
                          $data2 = $branchid->toArray();
                       echo ((!empty($data2))? $data2[0]->branchname : '');
                     }
                 ?>
                </td>
        </tr>
        <tr>
            <th scope="row"><?= __('Id') ?></th>
            <td><?= $this->Number->format($customer->id) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Phoneno') ?></th>
            <td><?= h($customer->phoneno) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Created') ?></th>
            <td><?= h($customer->created) ?></td>
        </tr>
        <tr>
            <th scope="row"><?= __('Modified') ?></th>
            <td><?= h($customer->modified) ?></td>
        </tr>
    </table>
<div class="btn-link"><input type="button" value="Back" onclick="window.history.back()" class="green-btn" /> </div>
</div>
