<!DOCTYPE html>
<html lang="zxx">

    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="keyword" content="">
        <meta name="author" content="theme_ocean">
        <!--! The above 6 meta tags *must* come first in the head; any other head content must come *after* these tags !-->
        <!--! BEGIN: Apps Title-->
        <title>Agent || Employee View</title>
        <!--! END:  Apps Title-->
        <!--! BEGIN: Favicon-->
        <link rel="shortcut icon" type="image/x-icon" href="<?= base_url(); ?>/assets/images/favicon.ico">
        <!--! END: Favicon-->
        <!--! BEGIN: Bootstrap CSS-->
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>/assets/css/bootstrap.min.css">
        <!--! END: Bootstrap CSS-->
        <!--! BEGIN: Vendors CSS-->
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>/assets/vendors/css/vendors.min.css">
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>/assets/vendors/css/select2.min.css">
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>/assets/vendors/css/select2-theme.min.css">
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>/assets/vendors/css/datepicker.min.css">
        <!--! END: Vendors CSS-->
        <!--! BEGIN: Custom CSS-->
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>/assets/css/theme.min.css">
        <!--! END: Custom CSS-->
        <!--! HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries !-->
        <!--! WARNING: Respond.js doesn"t work if you view the page via file: !-->
        <!--[if lt IE 9]>
            <script src="https:oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
            <script src="https:oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>
        <?= $this->include('layouts/header') ?>
        <?= $this->include('layouts/sidebar_agent') ?>
        <!-- [ Main Content ] start -->
        <main class="nxl-container">
            <div class="nxl-content">
                <!-- [ page-header ] start -->
                <div class="page-header">
                    <div class="page-header-left d-flex align-items-center">
                        <div class="page-header-title">
                            <h5 class="m-b-10">Employee</h5>
                        </div>
                        <ul class="breadcrumb">
                            <li class="breadcrumb-item"><a href="<?= base_url() . 'agent-dashboard' ?>">Dashboard</a></li>
                            <li class="breadcrumb-item">Employee Details</li>
                        </ul>
                    </div>
                </div>
                <!-- [ page-header ] end -->
                <div class="main-content">
                    <div class="row">
                        <div class="col-lg-1 mb-2">
                            <a class="btn btn-primary" href="<?= base_url() . 'agent-employee/' . $employee['field_manager_id'] ?>">Back</a>
                        </div>
                        <div class="col-lg-1 mb-2">
                            <a class="btn btn-primary" href="<?= base_url() . 'agent/employee-export/' . $employee['id'] ?>">Download</a>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-xxl-12 col-xl-12">
                            <div class="card border-top-0">
                                <div class="card-header p-0">
                                    <!-- Nav tabs -->
                                    <ul class="nav nav-tabs flex-wrap w-100 text-center customers-nav-tabs" id="myTab" role="tablist">
                                        <li class="nav-item flex-fill border-top" role="presentation">
                                            <a href="javascript:void(0);" class="nav-link active" data-bs-toggle="tab" data-bs-target="#overviewTab" role="tab">Personal Information</a>
                                        </li>
                                        <li class="nav-item flex-fill border-top" role="presentation">
                                            <a href="javascript:void(0);" class="nav-link" data-bs-toggle="tab" data-bs-target="#billingTab" role="tab">Bank Details</a>
                                        </li>
                                        <li class="nav-item flex-fill border-top" role="presentation">
                                            <a href="javascript:void(0);" class="nav-link" data-bs-toggle="tab" data-bs-target="#activityTab" role="tab">Documents</a>
                                        </li>
                                    </ul>
                                </div>
                                <div class="tab-content">
                                    <div class="tab-pane fade show active p-4" id="overviewTab" role="tabpanel">
                                        <div class="profile-details mb-5">
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Person Name:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['person_name'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Organization:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['organization'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Person Gender:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['gender'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Marital Status:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['marital_status'] ?? "" ?></div>
                                            </div>
                                            <?php if ($employee['marital_status'] == "Married") { ?>
                                                <div class="row g-0 mb-4">
                                                    <div class="col-sm-6 text-muted">Spouse Name:</div>
                                                    <div class="col-sm-6 fw-semibold"><?= $employee['spouse_name'] ?? "" ?></div>
                                                </div>
                                            <?php } ?>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Date of Birth:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['person_dob'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Mother name:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['mother_name'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Father name:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['father_name'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Education:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['education'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Experience:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['experience'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Height:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['height'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Local Address:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['local_address'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Permanent Address:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['permanent_address'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Contact No:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['contact_no'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Ref No 1:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['ref_no_1'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Ref No 2:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['ref_no_2'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">ESIC No:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['esic_no'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">PF No:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['pf_no'] ?? "" ?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="tab-pane fade p-4" id="billingTab" role="tabpanel">
                                        <div class="profile-details mb-5">
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Bank name:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['bank_name'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Bank Account:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['bank_account_no'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">IFSC code:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['bank_ifsc_code'] ?? "" ?></div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Branch name:</div>
                                                <div class="col-sm-6 fw-semibold"><?= $employee['bank_branch_name'] ?? "" ?></div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="tab-pane fade p-4" id="activityTab" role="tabpanel">
                                        <?php $filePath = base_url() . '/public/uploads/' ?>
                                        <div class="profile-details mb-5">
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Person Photo:</div>
                                                <div class="col-sm-6 fw-semibold">
                                                    <?= isset($employee['doc_person_photo']) ? '<img width="150" height="150" src="' . $filePath . $employee['doc_person_photo'] . '" />' : "" ?>
                                                    <?php
                                                    if (!empty($employee['doc_person_photo'])) {
                                                        echo '<a href="' . $filePath . $employee['doc_person_photo'] . '">Download</a>';
                                                    }
                                                    ?>
                                                </div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Aadhar card photo:</div>
                                                <div class="col-sm-6 fw-semibold">
                                                    <?= isset($employee['doc_aadhar_card']) ? '<img width="150" height="150" src="' . $filePath . $employee['doc_aadhar_card'] . '" />' : "" ?>
                                                    <?php
                                                    if (!empty($employee['doc_aadhar_card'])) {
                                                        echo '<a href="' . $filePath . $employee['doc_aadhar_card'] . '">Download</a>';
                                                    }
                                                    ?>
                                                </div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Pancard photo:</div>
                                                <div class="col-sm-6 fw-semibold">
                                                    <?= isset($employee['doc_pancard']) ? '<img width="150" height="150" src="' . $filePath . $employee['doc_pancard'] . '" />' : "" ?>
                                                    <?php
                                                    if (!empty($employee['doc_pancard'])) {
                                                        echo '<a href="' . $filePath . $employee['doc_pancard'] . '">Download</a>';
                                                    }
                                                    ?>
                                                </div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Pass book/ cheque photo: </div>
                                                <div class="col-sm-6 fw-semibold">
                                                    <?= isset($employee['doc_passbook_cheque']) ? '<img width="150" height="150" src="' . $filePath . $employee['doc_passbook_cheque'] . '" />' : "" ?>
                                                    <?php
                                                    if (!empty($employee['doc_passbook_cheque'])) {
                                                        echo '<a href="' . $filePath . $employee['doc_passbook_cheque'] . '">Download</a>';
                                                    }
                                                    ?>
                                                </div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">reference Aadhaar photo 1:</div>
                                                <div class="col-sm-6 fw-semibold">
                                                    <?= isset($employee['doc_reference_aaddhar_photo_1']) ? '<img width="150" height="150" src="' . $filePath . $employee['doc_reference_aaddhar_photo_1'] . '" />' : "" ?>
                                                    <?php
                                                    if (!empty($employee['doc_reference_aaddhar_photo_1'])) {
                                                        echo '<a href="' . $filePath . $employee['doc_reference_aaddhar_photo_1'] . '">Download</a>';
                                                    }
                                                    ?>
                                                </div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">reference Aadhaar photo 2:</div>
                                                <div class="col-sm-6 fw-semibold">
                                                    <?= isset($employee['doc_reference_aaddhar_photo_2']) ? '<img width="150" height="150" src="' . $filePath . $employee['doc_reference_aaddhar_photo_2'] . '" />' : "" ?>
                                                    <?php
                                                    if (!empty($employee['doc_reference_aaddhar_photo_2'])) {
                                                        echo '<a href="' . $filePath . $employee['doc_reference_aaddhar_photo_2'] . '">Download</a>';
                                                    }
                                                    ?>
                                                </div>
                                            </div>
                                            <div class="row g-0 mb-4">
                                                <div class="col-sm-6 text-muted">Education certificate photo:</div>
                                                <div class="col-sm-6 fw-semibold">
                                                    <?= isset($employee['doc_education_certificate']) ? '<img width="150" height="150" src="' . $filePath . $employee['doc_education_certificate'] . '" />' : "" ?>
                                                    <?php
                                                    if (!empty($employee['doc_education_certificate'])) {
                                                        echo '<a href="' . $filePath . $employee['doc_education_certificate'] . '">Download</a>';
                                                    }
                                                    ?>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>

        <!-- [ Main Content ] end -->
        <?= $this->include('layouts/footer') ?>
        <script type="text/javascript">
            function tableToCSV() {

                // Variable to store the final csv data
                let csv_data = [];

                // Get each row data
                let rows = document.getElementsByTagName('tr');
                for (let i = 0; i < rows.length; i++) {

                    // Get each column data
                    let cols = rows[i].querySelectorAll('td,th');

                    // Stores each csv row data
                    let csvrow = [];
                    for (let j = 0; j < cols.length; j++) {

                        // Get the text data of each cell
                        // of a row and push it to csvrow
                        csvrow.push(cols[j].innerHTML);
                    }

                    // Combine each column value with comma
                    csv_data.push(csvrow.join(","));
                }

                // Combine each row data with new line character
                csv_data = csv_data.join('\n');

                // Call this function to download csv file  
                downloadCSVFile(csv_data);

            }

            function downloadCSVFile(csv_data) {

                // Create CSV file object and feed
                // our csv_data into it
                CSVFile = new Blob([csv_data], {
                    type: "text/csv"
                });

                // Create to temporary link to initiate
                // download process
                let temp_link = document.createElement('a');

                // Download csv file
                temp_link.download = "employee-details.csv";
                let url = window.URL.createObjectURL(CSVFile);
                temp_link.href = url;

                // This link should not be displayed
                temp_link.style.display = "none";
                document.body.appendChild(temp_link);

                // Automatically click the link to
                // trigger download
                temp_link.click();
                document.body.removeChild(temp_link);
            }
        </script>