<?php
echo $this->Html->script('jquery-1.11.2.js');
$menu_modules = unserialize($this->request->session()->read('modules'));

?>

<div class="row">
    <div class="col-md-12">
        <div class="box box-primary">
            <div class="box-body">
                <div class="row" style="text-align:left;" >
                    <div class="col-md-6 col-xs-6 tile">
                        <div class="icon-frame col-md-2" id="light">
                            <i class="fa fa-folder-open-o" style="color:white"></i>
                        </div>
                        <h3 class="box-title no-margin" style="line-height: 3;float: left;"><?php echo __('&nbspView Student'); ?></h3>
                    </div>

                    <div class="col-md-6">



                        <div class="row">

                            <div class="col-md-12 text-right" style="line-height: 5;">
                                <?php
                                if (array_key_exists("add", $module_pages)):
                                    $page_id = $module_pages["index"];
                                    foreach ($user_permission as $permission):
                                        if ($permission['page_id'] == $page_id):
                                            ?>

                                            <a href="<?php echo $this->Url->build('/student/'); ?>"  class="btn btn-success btn-flat btn-grid">
                                                <i class="fa fa-list"></i>
                                                <?php echo __('LIST'); ?>
                                            </a>

                                            <?php
                                            break;
                                        endif;
                                    endforeach;
                                endif;
                                ?>

                            </div>
                        </div>


                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="box box-primary">
    <!-- /.box-header -->
    <div class="box-body">
        <div class="row">
            <div class="col-md-12  main-view-section">
                <div class="pull-right">
                    <?php if($student->status != 1 ) {?>

                            <?= $this->Form->postLink('<i class="fa fa-university"></i>'.__('Student Enrollment'),
                            ['controller' => 'Student' ,'action' => 'enrollstudent',$student->id],
                            [
                                'confirm' => __('Are you sure you want to enroll student for {0}?', $student->title. ' '.$student->first_name),
                                'escape'=>false,
                                'class'=>'btn btn-success btn-flat'
                            ]) ?>

                    <?php }?>
                </div>
                <div id="basic_info_div">
                    <div class="col-md-6 view-section">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th> <span><?= __('Course') ?></span> </th>
                                <th> <?= h($courses->name)?> </th>

                            </tr>
                            <tr>
                                <th> <span><?= __('Session') ?></span> </th>
                                <th> <?= h($sessions->name)?> </th>

                            </tr>
                            <tr>
                                <th> <span><?= __('Reference Number') ?>:</span></th>
                                <th>   <span><?= h($student->reference_number)?></span></th>
                            </tr>
                            <tr>
                                <th>  <span><?= __('Name') ?>:</span></th>
                                <th> <span><?= h($student->title.' '.$student->first_name.' '.$student->surname)?></span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Email') ?>:</span></th>
                                <th>   <span><?= h($student->email)?></span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Phone Number') ?>:</span></th>
                                <th>   <span><?= h($student->phone_number)?></span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Birth Date') ?>:</span></th>
                                <th>   <span><?= h($student->date_of_birth->format('Y-m-d'))?></span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Birth Place') ?>:</span></th>
                                <th>   <span><?= h($student->birth_place)?></span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Gender') ?>:</span></th>
                                <th>   <span><?= h($student->gender)?></span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Nationality') ?>:</span></th>
                                <th>   <span><?= h($student->nationality)?></span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Passport') ?>:</span></th>
                                <th>   <span><?= h($student->passport_number)?></span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Speak Language') ?>:</span></th>
                                <th>   <span><?= h($student->speak_language)?></span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Status') ?>:</span></th>
                                <th>   <span><?= h(json_decode(MEMBER_STATUS)[$student->status])?></span></th>
                            </tr>
                            </thead>

                        </table>

                    </div>

                    <div class="row col-md-6">
                        <h4><?= __('Address') ?>:</h4>
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th> <?= __('Address1')?> </th>
                                <th> <?= h($student->address1)?> </th>
                            </tr>
                            <tr>
                                <th> <span><?= __('City') ?>:</span></th>
                                <th>   <span><?= h($student->city)?> </span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('State') ?>:</span></th>
                                <th>   <span><?= h($student->state)?> </span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Zip Code') ?>:</span></th>
                                <th>   <span><?= h($student->zip_code)?> </span></th>
                            </tr>
                            <tr>
                                <th> <span><?= __('Country') ?>:</span></th>
                                <th>   <span><?= h($student->country)?> </span></th>
                            </tr>
                            </thead>

                        </table>
                    </div>
                    <div class="row col-md-6">
                        <h4><?= __('Emergency Contact') ?>:</h4>
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th> <?= __('Name')?> </th>
                                <th> <?= h($student->emergency_contact_name)?> </th>

                            </tr>
                            <tr>
                                <th> <?= __('Relation')?> </th>
                                <th> <?= h($student->emergency_contact_relation)?> </th>
                            </tr>
                            <tr>
                                <th> <?= __('Email')?> </th>
                                <th> <?= h($student->emergency_contact_email)?> </th>

                            </tr>
                            <tr>
                                <th> <?= __('Phone Number')?> </th>
                                <th> <?= h($student->emergency_contact_phone_number)?> </th>
                            </tr>
                            </thead>

                        </table>
                    </div>
                    <div class="row col-md-6">
                        <h4><?= __('Education') ?>:</h4>
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>Education </th>
                                <th>Year</th>
                                <th>School / College</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td><?= h($student->education_name1) ?> </td>
                                <td><?= h($student->education_year1) ?> </td>
                                <td><?= h($student->education_institution1) ?> </td>
                            </tr>
                            <tr>
                                <td><?= h($student->education_name2) ?> </td>
                                <td><?= h($student->education_year2) ?> </td>
                                <td><?= h($student->education_institution2) ?> </td>
                            </tr>
                            <tr>
                                <td><?= h($student->education_name3) ?> </td>
                                <td><?= h($student->education_year2) ?> </td>
                                <td><?= h($student->education_institution3) ?> </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="col-md-12 col-offset-12 back-btn-section">
                        <a href="<?php echo $this->Url->build('/student'); ?>"  class="btn btn-success btn-flat btn-orange-color" id="back-btn">
                            <i class="fa fa-arrow-left"></i>
                            <?php echo __('Back'); ?>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
