<?php 
//check if current user role is allowed access to the pages
$can_add = ACL::is_allowed("multiple_values/add");
$can_edit = ACL::is_allowed("multiple_values/edit");
$can_view = ACL::is_allowed("multiple_values/view");
$can_delete = ACL::is_allowed("multiple_values/delete");
?>
<?php
$comp_model = new SharedController;
$page_element_id = "view-page-" . random_str();
$current_page = $this->set_current_page_link();
$csrf_token = Csrf::$token;
//Page Data Information from Controller
$data = $this->view_data;
//$rec_id = $data['__tableprimarykey'];
$page_id = $this->route->page_id; //Page id from url
$view_title = $this->view_title;
$show_header = $this->show_header;
$show_edit_btn = $this->show_edit_btn;
$show_delete_btn = $this->show_delete_btn;
$show_export_btn = $this->show_export_btn;
?>
<section class="page" id="<?php echo $page_element_id; ?>" data-page-type="view"  data-display-type="table" data-page-url="<?php print_link($current_page); ?>">
    <?php
    if( $show_header == true ){
    ?>
    <div  class="bg-light p-3 mb-3">
        <div class="container">
            <div class="row ">
                <div class="col ">
                    <h4 class="record-title">View  Multiple Values</h4>
                </div>
            </div>
        </div>
    </div>
    <?php
    }
    ?>
    <div  class="">
        <div class="container">
            <div class="row ">
                <div class="col-md-12 comp-grid">
                    <?php $this :: display_page_errors(); ?>
                    <div  class="card animated fadeIn page-content">
                        <?php
                        $counter = 0;
                        if(!empty($data)){
                        $rec_id = (!empty($data['id']) ? urlencode($data['id']) : null);
                        $counter++;
                        ?>
                        <div id="page-report-body" class="">
                            <table class="table table-hover table-borderless table-striped">
                                <!-- Table Body Start -->
                                <tbody class="page-data" id="page-data-<?php echo $page_element_id; ?>">
                                    <tr  class="td-id">
                                        <th class="title"> Id: </th>
                                        <td class="value"> <?php echo $data['id']; ?></td>
                                    </tr>
                                    <tr  class="td-empid">
                                        <th class="title"> Empid: </th>
                                        <td class="value">
                                            <span <?php if($can_edit){ ?> data-source='<?php print_link('api/json/multiple_values_empid_option_list'); ?>' 
                                                data-value="<?php echo $data['empid']; ?>" 
                                                data-pk="<?php echo $data['id'] ?>" 
                                                data-url="<?php print_link("multiple_values/editfield/" . urlencode($data['id'])); ?>" 
                                                data-name="empid" 
                                                data-title="Select a value ..." 
                                                data-placement="left" 
                                                data-toggle="click" 
                                                data-type="select" 
                                                data-mode="popover" 
                                                data-showbuttons="left" 
                                                class="is-editable" <?php } ?>>
                                                <?php echo $data['empid']; ?> 
                                            </span>
                                        </td>
                                    </tr>
                                    <tr  class="td-detailno">
                                        <th class="title"> Detailno: </th>
                                        <td class="value">
                                            <span <?php if($can_edit){ ?> data-value="<?php echo $data['detailno']; ?>" 
                                                data-pk="<?php echo $data['id'] ?>" 
                                                data-url="<?php print_link("multiple_values/editfield/" . urlencode($data['id'])); ?>" 
                                                data-name="detailno" 
                                                data-title="Enter Detailno" 
                                                data-placement="left" 
                                                data-toggle="click" 
                                                data-type="text" 
                                                data-mode="popover" 
                                                data-showbuttons="left" 
                                                class="is-editable" <?php } ?>>
                                                <?php echo $data['detailno']; ?> 
                                            </span>
                                        </td>
                                    </tr>
                                    <tr  class="td-amount">
                                        <th class="title"> Amount: </th>
                                        <td class="value">
                                            <span <?php if($can_edit){ ?> data-step="0.1" 
                                                data-value="<?php echo $data['amount']; ?>" 
                                                data-pk="<?php echo $data['id'] ?>" 
                                                data-url="<?php print_link("multiple_values/editfield/" . urlencode($data['id'])); ?>" 
                                                data-name="amount" 
                                                data-title="Enter Amount" 
                                                data-placement="left" 
                                                data-toggle="click" 
                                                data-type="number" 
                                                data-mode="popover" 
                                                data-showbuttons="left" 
                                                class="is-editable" <?php } ?>>
                                                <?php echo $data['amount']; ?> 
                                            </span>
                                        </td>
                                    </tr>
                                    <tr  class="td-portid">
                                        <th class="title"> Portid: </th>
                                        <td class="value">
                                            <span <?php if($can_edit){ ?> data-source='<?php 
                                                $dependent_field = (!empty($data['empid']) ? urlencode($data['empid']) : null);
                                                print_link('api/json/multiple_values_portid_option_list/'.$dependent_field); 
                                                ?>' 
                                                data-value="<?php echo $data['portid']; ?>" 
                                                data-pk="<?php echo $data['id'] ?>" 
                                                data-url="<?php print_link("multiple_values/editfield/" . urlencode($data['id'])); ?>" 
                                                data-name="portid" 
                                                data-title="Select a value ..." 
                                                data-placement="left" 
                                                data-toggle="click" 
                                                data-type="select" 
                                                data-mode="popover" 
                                                data-showbuttons="left" 
                                                class="is-editable" <?php } ?>>
                                                <?php echo $data['portid']; ?> 
                                            </span>
                                        </td>
                                    </tr>
                                    <tr  class="td-col">
                                        <th class="title"> Col: </th>
                                        <td class="value">
                                            <span <?php if($can_edit){ ?> data-source='<?php 
                                                $dependent_field = (!empty($data['portid']) ? urlencode($data['portid']) : null);
                                                print_link('api/json/multiple_values_col_option_list/'.$dependent_field); 
                                                ?>' 
                                                data-value="<?php echo $data['col']; ?>" 
                                                data-pk="<?php echo $data['id'] ?>" 
                                                data-url="<?php print_link("multiple_values/editfield/" . urlencode($data['id'])); ?>" 
                                                data-name="col" 
                                                data-title="Select a value ..." 
                                                data-placement="left" 
                                                data-toggle="click" 
                                                data-type="select" 
                                                data-mode="popover" 
                                                data-showbuttons="left" 
                                                class="is-editable" <?php } ?>>
                                                <?php echo $data['col']; ?> 
                                            </span>
                                        </td>
                                    </tr>
                                    <tr  class="td-employee_details_id">
                                        <th class="title"> Employee Details Id: </th>
                                        <td class="value"> <?php echo $data['employee_details_id']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_employee_name">
                                        <th class="title"> Employee Details Employee Name: </th>
                                        <td class="value"> <?php echo $data['employee_details_employee_name']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_portfolio_id">
                                        <th class="title"> Employee Details Portfolio Id: </th>
                                        <td class="value"> <?php echo $data['employee_details_portfolio_id']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_basic_pay">
                                        <th class="title"> Employee Details Basic Pay: </th>
                                        <td class="value"> <?php echo $data['employee_details_basic_pay']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_bank_acc_no">
                                        <th class="title"> Employee Details Bank Acc No: </th>
                                        <td class="value"> <?php echo $data['employee_details_bank_acc_no']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_bank_name">
                                        <th class="title"> Employee Details Bank Name: </th>
                                        <td class="value"> <?php echo $data['employee_details_bank_name']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_email">
                                        <th class="title"> Employee Details Email: </th>
                                        <td class="value"> <?php echo $data['employee_details_email']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_dob">
                                        <th class="title"> Employee Details Dob: </th>
                                        <td class="value"> <?php echo $data['employee_details_dob']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_date_of_join">
                                        <th class="title"> Employee Details Date Of Join: </th>
                                        <td class="value"> <?php echo $data['employee_details_date_of_join']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_date_of_retirement">
                                        <th class="title"> Employee Details Date Of Retirement: </th>
                                        <td class="value"> <?php echo $data['employee_details_date_of_retirement']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_department">
                                        <th class="title"> Employee Details Department: </th>
                                        <td class="value"> <?php echo $data['employee_details_department']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_IFSC">
                                        <th class="title"> Employee Details Ifsc: </th>
                                        <td class="value"> <?php echo $data['employee_details_IFSC']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_designation">
                                        <th class="title"> Employee Details Designation: </th>
                                        <td class="value"> <?php echo $data['employee_details_designation']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_caste">
                                        <th class="title"> Employee Details Caste: </th>
                                        <td class="value"> <?php echo $data['employee_details_caste']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_relegion">
                                        <th class="title"> Employee Details Relegion: </th>
                                        <td class="value"> <?php echo $data['employee_details_relegion']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_nominee">
                                        <th class="title"> Employee Details Nominee: </th>
                                        <td class="value"> <?php echo $data['employee_details_nominee']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_payscale">
                                        <th class="title"> Employee Details Payscale: </th>
                                        <td class="value"> <?php echo $data['employee_details_payscale']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_gender">
                                        <th class="title"> Employee Details Gender: </th>
                                        <td class="value"> <?php echo $data['employee_details_gender']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_identification_mark">
                                        <th class="title"> Employee Details Identification Mark: </th>
                                        <td class="value"> <?php echo $data['employee_details_identification_mark']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_place_of_birth">
                                        <th class="title"> Employee Details Place Of Birth: </th>
                                        <td class="value"> <?php echo $data['employee_details_place_of_birth']; ?></td>
                                    </tr>
                                    <tr  class="td-employee_details_balanceleave">
                                        <th class="title"> Employee Details Balanceleave: </th>
                                        <td class="value"> <?php echo $data['employee_details_balanceleave']; ?></td>
                                    </tr>
                                    <tr  class="td-portfolio_id">
                                        <th class="title"> Portfolio Id: </th>
                                        <td class="value"> <?php echo $data['portfolio_id']; ?></td>
                                    </tr>
                                    <tr  class="td-portfolio_name">
                                        <th class="title"> Portfolio Name: </th>
                                        <td class="value"> <?php echo $data['portfolio_name']; ?></td>
                                    </tr>
                                    <tr  class="td-portfolio_pid">
                                        <th class="title"> Portfolio Pid: </th>
                                        <td class="value"> <?php echo $data['portfolio_pid']; ?></td>
                                    </tr>
                                </tbody>
                                <!-- Table Body End -->
                            </table>
                        </div>
                        <div class="p-3 d-flex">
                            <div class="dropup export-btn-holder mx-1">
                                <button class="btn btn-sm btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                    <i class="fa fa-save"></i> Export
                                </button>
                                <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                                    <?php $export_print_link = $this->set_current_page_link(array('format' => 'print')); ?>
                                    <a class="dropdown-item export-link-btn" data-format="print" href="<?php print_link($export_print_link); ?>" target="_blank">
                                        <img src="<?php print_link('assets/images/print.png') ?>" class="mr-2" /> PRINT
                                        </a>
                                        <?php $export_pdf_link = $this->set_current_page_link(array('format' => 'pdf')); ?>
                                        <a class="dropdown-item export-link-btn" data-format="pdf" href="<?php print_link($export_pdf_link); ?>" target="_blank">
                                            <img src="<?php print_link('assets/images/pdf.png') ?>" class="mr-2" /> PDF
                                            </a>
                                            <?php $export_word_link = $this->set_current_page_link(array('format' => 'word')); ?>
                                            <a class="dropdown-item export-link-btn" data-format="word" href="<?php print_link($export_word_link); ?>" target="_blank">
                                                <img src="<?php print_link('assets/images/doc.png') ?>" class="mr-2" /> WORD
                                                </a>
                                                <?php $export_csv_link = $this->set_current_page_link(array('format' => 'csv')); ?>
                                                <a class="dropdown-item export-link-btn" data-format="csv" href="<?php print_link($export_csv_link); ?>" target="_blank">
                                                    <img src="<?php print_link('assets/images/csv.png') ?>" class="mr-2" /> CSV
                                                    </a>
                                                    <?php $export_excel_link = $this->set_current_page_link(array('format' => 'excel')); ?>
                                                    <a class="dropdown-item export-link-btn" data-format="excel" href="<?php print_link($export_excel_link); ?>" target="_blank">
                                                        <img src="<?php print_link('assets/images/xsl.png') ?>" class="mr-2" /> EXCEL
                                                        </a>
                                                    </div>
                                                </div>
                                                <?php if($can_edit){ ?>
                                                <a class="btn btn-sm btn-info"  href="<?php print_link("multiple_values/edit/$rec_id"); ?>">
                                                    <i class="fa fa-edit"></i> Edit
                                                </a>
                                                <?php } ?>
                                                <?php if($can_delete){ ?>
                                                <a class="btn btn-sm btn-danger record-delete-btn mx-1"  href="<?php print_link("multiple_values/delete/$rec_id/?csrf_token=$csrf_token&redirect=$current_page"); ?>" data-prompt-msg="Are you sure you want to delete this record?" data-display-style="modal">
                                                    <i class="fa fa-times"></i> Delete
                                                </a>
                                                <?php } ?>
                                            </div>
                                            <?php
                                            }
                                            else{
                                            ?>
                                            <!-- Empty Record Message -->
                                            <div class="text-muted p-3">
                                                <i class="fa fa-ban"></i> No Record Found
                                            </div>
                                            <?php
                                            }
                                            ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
