<?php $this->load->view('site/layout'); ?>
<link href="<?php echo base_url() ?>public/css/student_profile.css"
      rel="stylesheet" type="text/css" />
      <?php $this->load->view('site/navbar'); ?>
<?php $controller_path = dirname(__DIR__, 3); ?>
<style>
    .header_icons i {
        margin-right: 10px;
        font-size: 20px;
    }

    .display-4 {
        font-size: 3.5rem !important;
    }

    .attach_img{
        border: 2px #ccc solid;
        border-radius: 10%;
        padding: 20px;
    }
</style>

<div
    class="kt-content  kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor"
    id="kt_content">
    <!-- begin:: Content Head -->
    <div class="kt-subheader  kt-grid__item" id="kt_subheader">
        <div class="kt-container  kt-container--fluid ">
            <div class="kt-subheader__main">
                <h3 class="kt-subheader__title">
                    <a href="<?php echo base_url() ?>Dashboard/"><?php echo $this->lang->line('dashboard'); ?></a>
                </h3>
                <span class="kt-subheader__separator kt-subheader__separator--v"></span>
                <span class="kt-subheader__desc"><?php echo $this->lang->line('products'); ?></span>
            </div>

        </div>
    </div>
    <div class="parent">
        <div class="card card-custom gutter-b">
            <div class="card-body">
                <!--begin::Details-->
                <div class="d-flex mb-9">
                    <!--begin: Pic-->
                    <div class="flex-shrink-0 mr-7 mt-lg-0 mt-3">
                        <div class="symbol symbol-50 symbol-lg-120">
                            <img
                                src="<?= base_url() ?>public/upload/userimage/<?= $show['image'] ?>"
                                alt="image">
                        </div>
                        <div class="symbol symbol-50 symbol-lg-120 symbol-primary d-none">
                            <span class="font-size-h3 symbol-label font-weight-boldest">JM</span>
                        </div>
                    </div>
                    <!--end::Pic-->
                    <!--begin::Info-->
                    <div class="flex-grow-1">
                        <!--begin::Title-->
                        <div class="d-flex justify-content-between flex-wrap mt-1">
                            <div class="d-flex mr-3">
                                <a href="#"
                                   class="text-dark-75 text-hover-primary font-size-h5 font-weight-bold mr-3"
                                   style="font-weight: 600 !important"><?= $show['username'] ?></a>
                                <a href="#" class="header_icons">
                                    <?php if ($show['sex'] == 'male') { ?>
                                        <i class="fas fa-male"
                                           title=<?= $this->lang->line('male') ?>></i>
                                       <?php } else { ?>
                                        <i class="fas fa-female"
                                           title=<?= $this->lang->line('female') ?>></i>
                                       <?php } ?>
                                       <?php if ($show['block']) { ?>
                                        <i class="flaticon2-delete text-danger font-size-h5"
                                           title="<?= $this->lang->line('block') ?>"></i>
                                       <?php } else { ?>
                                        <i class="flaticon2-correct text-success font-size-h5"
                                           title="<?= $this->lang->line('active') ?>"></i>
                                       <?php } ?>

                                    <?php if ($show['approve_status'] == 0) { ?>
                                        <i class="flaticon2-delete text-danger font-size-h5"
                                           title="Not Approved"></i>
                                       <?php } else { ?>
                                        <i class="flaticon2-correct text-success font-size-h5"
                                           title="Approved"></i>
                                       <?php } ?>

                                </a>
                            </div>
                        </div>
                        <!--end::Title-->
                        <!--begin::Content-->
                        <div class="d-flex flex-wrap justify-content-between mt-1">
                            <div class="d-flex flex-column flex-grow-1 pr-8">
                                <div class="d-flex flex-wrap mb-4">
                                    <?php if (in_array('email', $show_fields)) { ?>
                                        <a href="#"
                                           class="text-dark-50 text-hover-primary font-weight-bold mr-lg-8 mr-5 mb-lg-0 mb-2"
                                           title="<?= $this->lang->line('email') ?>"> <i
                                                class="flaticon2-new-email mr-2 font-size-lg"></i><?= $show['email'] ?></a>
                                        <?php } ?>
                                        <?php if (in_array('phone', $show_fields)) { ?>
                                        <a href="#"
                                           class="text-dark-50 text-hover-primary font-weight-bold mr-lg-8 mr-5 mb-lg-0 mb-2"
                                           title="<?= $this->lang->line('student') . ' ' . $this->lang->line('phone') ?>">
                                            <i class="flaticon2-calendar-3 mr-2 font-size-lg"></i><?= $show['phone'] ?></a>
                                    <?php } ?>
                                    <?php if (in_array('phone_father', $show_fields)) { ?>
                                        <a href="#"
                                           class="text-dark-50 text-hover-primary font-weight-bold mr-lg-8 mr-5 mb-lg-0 mb-2"
                                           title="<?= $this->lang->line('guardian') . ' ' . $this->lang->line('phone') ?>">
                                            <i class="flaticon2-calendar-3 mr-2 font-size-lg"></i><?= $show['phone_father'] ?></a>
                                    <?php } ?>
                                    <?php if (in_array('age', $show_fields)) { ?>
                                        <a href="#"
                                           class="text-dark-50 text-hover-primary font-weight-bold mr-lg-8 mr-5 mb-lg-0 mb-2"
                                           title="<?= $this->lang->line('date-of-birth') ?>"> <i
                                                class="fas fa-birthday-cake mr-2 font-size-lg"></i><?= $show['age'] ?></a>
                                        <?php } ?>
                                        <?php if (in_array('cid_user', $show_fields)) { ?>
                                        <a href="#"
                                           class="text-dark-50 text-hover-primary font-weight-bold mr-lg-8 mr-5 mb-lg-0 mb-2"
                                           title="<?= $this->lang->line('civil-no') ?>"> <i
                                                class="far fa-address-card mr-2 font-size-lg"></i><?= $show['cid_user'] ?></a>
                                        <?php } ?>
                                        <?php if (in_array('country', $show_fields) || in_array('city', $show_fields) || in_array('street', $show_fields)) { ?>
                                        <a href="#"
                                           class="text-dark-50 text-hover-primary font-weight-bold"
                                           title="<?= $this->lang->line('address') ?>"> <i
                                                class="flaticon2-placeholder mr-2 font-size-lg"></i><?= $show['nationality'] . ',' . $show['region'] . ',' . $show['street'] ?></a>
                                        <?php } ?>
                                </div>
                                <!--<span class="font-weight-bold text-dark-50"><?//= $show['title'] ?></span>-->
                                <?php if (in_array('note', $show_fields)) { ?>
                                    <span class="font-weight-bold text-dark-50"><?= $show['note'] ?></span>
                                <?php } ?>
                            </div>

                        </div>
                        <!--end::Content-->
                    </div>
                    <!--end::Info-->
                </div>
                <!--end::Details-->
                <div class="separator separator-solid"></div>
                <!--begin::Items-->
                <div class="d-flex align-items-center flex-wrap mt-8">
                    <!--begin::Item-->
                    <?php if (in_array('father_work', $show_fields)) { ?>
                        <div class="d-flex align-items-center flex-lg-fill mr-5 mb-2">
                            <span class="mr-4"> <i class="fas fa-user-tie "
                                                   style="font-size: 3.5rem !important; color: #B5B5C3 !important; line-height: 1.2;"></i>
                            </span>
                            <div class="d-flex flex-column text-dark-75">
                                <span class="font-weight-bolder font-size-sm"><?= $this->lang->line('father_work') ?></span>
                                <span class="font-weight-bolder font-size-h5"> <span
                                        class="text-dark-50 font-weight-bold"></span><?= $show['father_job'] == '' ? '---' : $show['father_job'] ?></span>
                            </div>
                        </div>
                    <?php } ?>
                    <!--end::Item-->
                    <!--begin::Item-->
                    <?php if (in_array('mother_work', $show_fields)) { ?>
                        <div class="d-flex align-items-center flex-lg-fill mr-5 mb-2">
                            <span class="mr-4"> <i
                                    class="flaticon-businesswoman display-4 text-muted font-weight-bold"></i>
                            </span>
                            <div class="d-flex flex-column text-dark-75">
                                <span class="font-weight-bolder font-size-sm"><?= $this->lang->line('mother_work') ?></span>
                                <span class="font-weight-bolder font-size-h5"> <span
                                        class="text-dark-50 font-weight-bold"></span><?= $show['mother_job'] == '' ? '---' : $show['mother_job'] ?></span>
                            </div>
                        </div>
                    <?php } ?>
                    <!--end::Item-->
                    <!--begin::Item-->
                    <?php if (in_array('social_status', $show_fields)) { ?>
                        <div class="d-flex align-items-center flex-lg-fill mr-5 mb-2">
                            <span class="mr-4"> <i
                                    class="flaticon-pie-chart display-4 text-muted font-weight-bold"></i>
                            </span>
                            <div class="d-flex flex-column text-dark-75">
                                <span class="font-weight-bolder font-size-sm"><?= $this->lang->line('social_status') ?></span>
                                <span class="font-weight-bolder font-size-h5"> <span
                                        class="text-dark-50 font-weight-bold"></span><?= $show['social_status'] == '' ? '---' : $show['social_status'] ?></span>
                            </div>
                        </div>
                    <?php } ?>
                    <!--end::Item-->
                    <!--begin::Item-->
                    <div class="d-flex align-items-center flex-lg-fill mr-5 mb-2">
                            <span class="mr-4"> <!--	<i class="flaticon-file-2 display-4 text-muted font-weight-bold"></i> -->
                        </span>
                        <div class="d-flex flex-column flex-lg-fill">
                                <!--	<span class="text-dark-75 font-weight-bolder font-size-sm">73 Tasks</span>
                                                                                <a href="#" class="text-primary font-weight-bolder">View</a> -->
                        </div>
                    </div>
                    <!--end::Item-->
                    <!--begin::Item-->
                    <div class="d-flex align-items-center flex-lg-fill mr-5 mb-2">
                            <span class="mr-4"> <!--	<i class="flaticon-chat-1 display-4 text-muted font-weight-bold"></i> -->
                        </span>
                        <div class="d-flex flex-column">
                                <!-- <span class="text-dark-75 font-weight-bolder font-size-sm">648 Comments</span>
                                                                                <a href="#" class="text-primary font-weight-bolder">View</a>-->
                        </div>
                    </div>
                    <!--end::Item-->

                </div>
                <!--begin::Items-->
            </div>
        </div>

        <br />
        <div class="card card-custom gutter-b">
            <div class="card-body">
                <ul class="nav nav-tabs nav-tabs-line mb-10">
                    <?php
                    $active = 0;
                    if (get_ap('spro_invoices', $this->operator_id)) {
                        ?>
                        <li class="nav-item"><a class="nav-link <?= !$active ? 'active' : '' ?>" data-toggle="tab"
                                                href="#kt_tab_pane_1"> <span class="nav-icon"> <i
                                        class="flaticon2-document"></i>
                                </span> <span class="nav-text"><?= $this->lang->line('invoices') ?></span>
                            </a></li>
                        <?php
                        $active = 1;
                    }
                    ?>
                    <?php if (get_ap('spro_subscription', $this->operator_id)) { ?>
                        <li class="nav-item"><a class="nav-link <?= !$active ? 'active' : '' ?>" data-toggle="tab"
                                                href="#kt_tab_pane_2"> <span class="nav-icon"> <i
                                        class="flaticon2-contract"></i>
                                </span> <span class="nav-text"><?= $this->lang->line('subscription') ?></span>
                            </a></li>
                        <?php
                        $active = 1;
                    }
                    ?>
                    <?php
                   
                    if (get_license_per('attendance')) {
                        if (file_exists($controller_path . '/controllers/absent')) {
                            if (get_ap('spro_attendance', $this->operator_id) && get_ap('attendance_module', $this->operator_id)) {
                                ?>
                                <li class="nav-item"><a class="nav-link <?= !$active ? 'active' : '' ?>" data-toggle="tab"
                                                        href="#kt_tab_pane_3"> <span class="nav-icon"> <i
                                                class="far fa-list-alt"></i>
                                        </span> <span class="nav-text"><?= $this->lang->line('attendance') ?></span>
                                    </a></li>
                                <?php
                                $active = 1;
                            }
                        }
                    }
                    ?>
                    <?php if (get_ap('spro_attachments', $this->operator_id)) { ?>
                        <li class="nav-item"><a class="nav-link <?= !$active ? 'active' : '' ?>" data-toggle="tab"
                                                href="#kt_tab_pane_4"> <span class="nav-icon"> <i
                                        class="fas fa-paperclip"></i>
                                </span> <span class="nav-text"><?= $this->lang->line('attachments') ?></span>
                            </a></li>
                        <?php
                        $active = 1;
                    }
                    ?>

                    <?php
                    if (get_ap('points_module', $this->operator_id)) {
                        if (file_exists($controller_path . '/controllers/points')) {
                            if (get_ap('spro_points', $this->operator_id)) {
                                ?>
                                <li class="nav-item"><a class="nav-link <?= !$active ? 'active' : '' ?>" data-toggle="tab"
                                                        href="#kt_tab_pane_5"> <span class="nav-icon"> <i
                                                class="fas fa-certificate"></i>
                                        </span> <span class="nav-text"><?= $this->lang->line('points') ?></span>
                                    </a></li>
                                <?php
                            }
                        }
                    }
                    ?>
                </ul>

                <div class="tab-content mt-5" id="myTabContent">
                    <?php
                    $active = 0;
                    if (get_ap('spro_invoices', $this->operator_id)) {
                        ?>
                        <div class="tab-pane fade <?= !$active ? 'show active' : '' ?>" id="kt_tab_pane_1"
                             role="tabpanel" aria-labelledby="kt_tab_pane_2">
                                 <?php $active = 1; ?>
                            <table class="table table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th><?php echo $this->lang->line('sno') ?></th>
                                        <th><?php echo $this->lang->line('date-added') ?></th>
                                        <th><?php echo $this->lang->line('invoice-number') ?></th>
                                        <th> <?php echo $this->lang->line('fees') ?></th>
                                        <th><?php echo $this->lang->line('payment') ?></th>
                                        <th><?php echo $this->lang->line('status') ?></th>
                                        <th><?php echo $this->lang->line('print') ?></th>
                                        <th><?php echo $this->lang->line('show') ?></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                    $count = 1;
                                    foreach ($invoices as $row) {
                                        ?>
                                        <tr>
                                            <td><?php echo $count++; ?></td>
                                            <td><?= $row['date_now']; ?></td>
                                            <td><?= $row['id_orders']; ?></td>

                                            <td><?= $row['total_price'] ?> </td>

                                            <td><?php
                                                if ($row['paid'] == '2')
                                                    echo '<span class="label label-danger">' . $this->lang->line("not-paid") . '</span>';

                                                if ($row['paid'] == '1')
                                                    echo '<span class="label label-success">' . $this->lang->line("payment-is-made") . '</span>';

                                                if ($row['paid'] == '3')
                                                    echo '<span class="label label-warning">' . $this->lang->line("is-free") . '</span>';
                                                if ($row['paid'] == '4')
                                                    echo '<span class="label label-primary">' . $this->lang->line('retriever') . '</span>';
                                                ?></td>

                                            <td><?php
                                                if ($row['active'] != '0')
                                                    echo '<span class="label label-danger">' . $this->lang->line('not-active') . '</span>';

                                                if ($row['active'] == '0')
                                                    echo '<span class="label label-success">' . $this->lang->line('active') . '</span>';
                                                ?></td>


                                            <td class="text-center"><a target="_block"
                                                                       href="<?= base_url('orders/printorder/' . $row['id']) ?>"
                                                                       class="btn btn-icon btn-facebook" title="Print"> <i
                                                        class="fa fa-print" style="color: #fff"></i>
                                                </a></td>

                                            <td class="text-center">
                                                <a href="<?= base_url('orders/show_invoice/' . $row['id']) ?>" class="btn btn-icon btn-danger mr-2" title="Show Invoice">
                                                    <i class="fa fa-eye"></i>
                                                </a> 
                                            </td>



                                        </tr>
                                    <?php } ?>

                                </tbody>
                            </table>
                        </div>
                    <?php } ?>
                    <?php if (get_ap('spro_subscription', $this->operator_id)) {
                        ?>
                        <div class="tab-pane fade <?= !$active ? 'show active' : '' ?>" id="kt_tab_pane_2" role="tabpanel"
                             aria-labelledby="kt_tab_pane_2">
                                 <?php $active = 1; ?>
                            <table class="table table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th><?php echo $this->lang->line('sno') ?></th>
                                        <th><?php echo $this->lang->line('date-added') ?></th>
                                        <th><?php echo $this->lang->line('invoice-number') ?></th>
                                        <th><?php echo $this->lang->line('the-product') ?></th>
                                        <th><?php echo $this->lang->line('the-beginning') ?></th>
                                        <th><?php echo $this->lang->line('end') ?></th>
                                        <th><?php echo $this->lang->line('status') ?></th>
                                        <th><?php echo $this->lang->line('print') ?></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                    $count = 1;
                                    foreach ($membership as $row) {
                                        ?>
                                        <tr>
                                            <td><?php echo $count++; ?></td>
                                            <td><?= $row['date_now']; ?></td>
                                            <td><?= $row['id_orders']; ?></td>

                                            <td><?= $row['name_order']; ?> </td>
                                            <td><?= $row['start_date']; ?> </td>
                                            <td><?= $row['expiry_date']; ?> </td>



                                            <td><?php
                                                if ($row['active'] != '0')
                                                    echo '<span class="label label-danger label-inline">' . $this->lang->line('not-active') . '</span>';

                                                if ($row['active'] == '0')
                                                    echo '<span class="label label-success label-inline">' . $this->lang->line('active') . '</span>';
                                                ?></td>


                                            <td class=text-center><a target="_block"
                                                                     href="<?= base_url('Orders/printorder/' . $row['id']) ?>"
                                                                     class="btn btn-icon btn-facebook" title="Print"> <i
                                                        class="fa fa-print" style="color: #fff"></i>
                                                </a></td>

                                        </tr>
                                    <?php } ?>

                                </tbody>
                            </table>
                        </div>
                    <?php } ?>
                    <?php
                    if (get_license_per('attendance')) {
                        if (file_exists($controller_path . '/controllers/absent')) {
                            if (get_ap('spro_attendance', $this->operator_id) && get_ap('attendance_module', $this->operator_id)) {
                                ?>
                                <div class="tab-pane fade <?= !$active ? 'show active' : '' ?>" id="kt_tab_pane_3" role="tabpanel"
                                     aria-labelledby="kt_tab_pane_3">
                                         <?php $active = 1; ?>
                                    <table class="table table-bordered table-hover "
                                           id="summary_table">
                                        <thead>
                                            <tr>
                                                <th><?php echo $this->lang->line('sno') ?></th>
                                                <th><?php echo $this->lang->line('product') ?></th>
                                                <th><?= $this->lang->line('present') ?></th>
                                                <th><?= $this->lang->line('absent') ?></th>
                                                <th><?= $this->lang->line('late') ?></th>
                                                <th><?php echo $this->lang->line('total_days') ?></th>
                                            </tr>
                                        </thead>
                                        <tbody>

                                            <?php
                                            $count = 1;
                                            foreach ($attendance as $row) {
                                                ?>
                                                <tr>
                                                    <td><?php echo $count++; ?></td>
                                                    <td><?= $row->name ?></td>
                                                    <td><?= $row->present ? "<a href=" . base_url('absent/detailed_absent/' . $row->product_id . '/' . $user_id . '/1') . ">" . $row->present . "</a>" : $row->present ?></td>
                                                    <td><?= $row->absent ? "<a href=" . base_url('absent/detailed_absent/' . $row->product_id . '/' . $user_id . '/0') . ">" . $row->absent . "</a>" : $row->absent ?></td>
                                                    <td><?= $row->late ? "<a href=" . base_url('absent/detailed_absent/' . $row->product_id . '/' . $user_id . '/2') . ">" . $row->late . "</a>" : $row->late ?></td>
                                                    <td><?= $row->total_days ? "<a href=" . base_url('absent/detailed_absent/' . $row->product_id . '/' . $user_id) . ">" . $row->total_days . "</a>" : $row->total_days ?></td>
                                                </tr>
                                            <?php } ?>
                                        </tbody>
                                    </table>
                                </div>
                                <?php
                            }
                        }
                    }
                    ?>

                    <?php if (get_ap('spro_attachments', $this->operator_id)) {
                        ?>
                        <div class="tab-pane fade <?= !$active ? 'show active' : '' ?>" id="kt_tab_pane_4" role="tabpanel"
                             aria-labelledby="kt_tab_pane_4">
                                 <?php $active = 1; ?>
                                 <?php
                                 if ($attachments) {
                                     $attach = explode(',', $attachments->image);
                                     foreach ($attach as $img) {
                                         ?>
                                    <div class="col-2" style="float:left;padding-left: 20px">
                                        <i class="far fa-window-close fa-2x text-danger delete_img" data-img="<?= $img ?>" style="cursor: pointer;" title="Delete image"></i>
                                        <img
                                            src="<?= base_url() ?>public/upload/userimage/<?= $img ?>"
                                            alt="image" width="100%" height="120px" class="attach_img">
                                    </div>
                                    <?php
                                }
                            }
                            ?>
                            <div class="clearfix"></div>
                            <br/><br/>
                            <hr/>
                            <?php echo form_open_multipart(base_url('' . $thispage . '/add_attachment/' . $user_id)); ?> 
                            <div class="form-group row">
                                <label for="example-email-input" class="col-2 col-form-label"><?php echo $this->lang->line('add') . ' ' . $this->lang->line('attachments') ?></label>
                                <div class="col-10">
                                    <input type="file" class="form-control" id="exampleInputFile" name="imageuser[]" multiple>
                                </div>
                            </div>
                            <div class="kt-portlet__foot">
                                <div class="kt-form__actions">
                                    <div class="row">
                                        <div class="col-2">
                                        </div>
                                        <div class="col-10">
                                            <button type="submit" class="btn btn-primary" name="submit" value="pl"><?php echo $this->lang->line('addition') ?></button>
                                            <button type="reset" class="btn btn-secondary">Cancel</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php echo form_close(); ?>
                        </div>
                    <?php } ?>

                    <?php
                    if (file_exists($controller_path . '/controllers/points')) {
                        if (get_ap('spro_points', $this->operator_id)) {
                            ?>
                            <div class="tab-pane fade <?= !$active ? 'show active' : '' ?>" id="kt_tab_pane_5" role="tabpanel"
                                 aria-labelledby="kt_tab_pane_3">
                                     <?php $active = 1; ?>

                                <table class="table  table-bordered">
                                    <tr><td><?php echo $this->lang->line('points'); ?> # </td><td><?php echo $this->lang->line('student_tag'); ?></td><td><?php echo $this->lang->line('the_type'); ?> </td><td><?php echo $this->lang->line('points'); ?> </td><td><?php echo $this->lang->line('balance'); ?></td><td><?php echo $this->lang->line('category'); ?></td><td><?php echo $this->lang->line('notes'); ?></td><td><?php echo $this->lang->line('credit_date'); ?></td><td><?php echo $this->lang->line('action'); ?></td></tr>
                                    <?php
                                    if ($history) {
                                        $s = 1;
                                        foreach ($history as $key => $history_value) {

                                            $award_name = $history_value->award_name ? $history_value->award_name : "";

                                            if ($history_value->type == 1)
                                                $type = "<span class='btn btn-success btn-sm'>" . $this->lang->line('credit') . "</span>";
                                            else if ($award_name != "")
                                                $type = "<span class='btn btn-primary btn-sm'>" . $this->lang->line('debit') . "</span>";
                                            else
                                                $type = "<span class='btn btn-danger btn-sm'>" . $this->lang->line('debit') . "</span>";
                                            $category = $history_value->cname ? $history_value->cname : "";
                                            $notes = $history_value->notes_name ? $history_value->notes_name : "";
                                            $discount = $history_value->discount_name ? $history_value->discount_name : "";
                                            $memo_notes = $history_value->memo_notes ? $history_value->memo_notes : "";

                                            $tpoint = $history_value->type == 1 ? $history_value->points : " - " . $history_value->points;
                                            $tbalance = $history_value->type == 1 ? $history_value->balance : "-" . $history_value->balance;


                                            if ($history_value->upload_filename) {
                                                if (strpos($history_value->upload_filename, 'http') !== false) {
                                                    $file_name = $history_value->upload_filename;
                                                } else {
                                                    $file_name = base_url('uploads/students/' . $history_value->upload_filename);
                                                }
                                            }
                                            ?>
                                            <tr>
                                                <td><?php echo $s++; ?></td>
                                                <td><?php echo $history_value->tag_name2; ?></td>
                                                <td><?php echo $type; ?></td>
                                                <td><?php echo $tpoint; ?></td>
                                                <td><?php echo $tbalance; ?></td>
                                                <td><?php echo $category; ?><?php echo $discount; ?><?php echo $award_name; ?></td>
                                                <td><?php echo $notes; ?><?php echo $memo_notes; ?></td>
                                                <td><?php echo date("d-m-Y", strtotime($history_value->update_on)); ?></td>
                                                <td>
                                                    <?php if ($history_value->upload_filename) { ?>
                                                        <a href="<?php echo $file_name; ?>" class="btn btn-warning btn-sm" target="_new" ><i class="fa fa-paperclip text-white"></i></a>
                                                    <?php } ?>
                                                        <?php if (get_ap('remove_points', $this->operator_id) == 1) { ?><a href="<?php echo base_url(); ?>admin/student/remove_points/<?php echo $history_value->history_id; ?>" class="btn btn-danger  btn-sm" onclick="return  confirm('are you sure?');"><i class="fa fa-trash"></i></a><?php } ?></td>
                                            </tr>
                                            <?php
                                        }
                                    }
                                    ?>
                                </table>



                            </div>
                            <?php
                        }
                    }
                    ?>
                </div>
            </div>


        </div>
    </div>

    <?php $this->load->view('site/footer_2') ?>

    <script>
        $(function () {
<?php if ($success != '') { ?>
                $('.nav-tabs a[href="#kt_tab_pane_4"]').tab('show');
                //$("#kt_tab_pane_4").
<?php } ?>
            $(".delete_img").click(function () {
                $.ajax({
                    method: "POST",
                    url: "<?php echo base_url() ?>User/delete_img/<?= $user_id ?>",
                                    data: {'img_name': $(this).data('img')},
                                    success: function (e) {
                                        location.href = "<?= base_url() ?>User/show/<?= $user_id ?>/sucess";
                                    }
                                });
                            });
                        });
                        function alert_box(id) {
                            var result = confirm("Are You Confirm!")
                            if (result) {
                                window.location.href = "<?= base_url('' . $this->thispage . '/del/') ?>" + id;

                            }
                        }
    </script>