<?php $this->view("includes/Inc_pagehead");?>
<!-- Page Styles Goes Here-->

<?php $this->view("includes/Inc_navigation");?>
<div class="m-grid__item m-grid__item--fluid m-wrapper">
  <!-- BEGIN: Subheader -->
  <div class="m-subheader ">
    <div class="d-flex align-items-center">
      <div class="mr-auto">
        <h3 class="m-subheader__title m-subheader__title--separator">
          User Account Payments
        </h3>
        <ul class="m-subheader__breadcrumbs m-nav m-nav--inline">
          <li class="m-nav__item m-nav__item--home">
            <a href="#" class="m-nav__link m-nav__link--icon">
              <i class="m-nav__link-icon la la-home"></i>
            </a>
          </li>
          <li class="m-nav__separator">
            -
          </li>
          <li class="m-nav__item">
            <a href="<?php echo base_url().'dashboard'?>" class="m-nav__link">
              <span class="m-nav__link-text">
                Home
              </span>
            </a>
          </li>
          <li class="m-nav__separator">
            -
          </li>
          <li class="m-nav__item">
            <a href="<?php echo base_url().'user_payments' ?>" class="m-nav__link">
              <span class="m-nav__link-text">
                User Payments
              </span>
            </a>
          </li>


        </ul>
      </div>
      <div>

      </div>
    </div>
  </div>
  <!-- END: Subheader -->
  <div class="m-content">
    <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
      <div class="m-portlet__body">
        <div class="m-form m-form--label-align-right m--margin-bottom-10">
          <div class="row align-items-center">
            <div class="col-xl-12 order-2 order-xl-1">
              <div class="form-group m-form__group row ">
                <div class="col-md-6">
                  <div class="m-form__group ">
                    <label>
                      Date:
                    </label>
                    <input  id="table_filter_date_range"   type="text" class="form-control m-input m-input--air m-input--pill"  >
                  </div>
                </div>
                <div class="col-md-6">
                  <?php if($this->session->userdata('user_role')!='supervisor'){?>
                    <div class="form-group m-form__group">
                      <label>
                        Employee:
                      </label>
                      <div class="m-select2 m-select2--air m-select2--pill">
                        <select style="width: 100%" class="form-control m-select2 table_filter" id="table_filter_user"  name="user" data-placeholder="Select Clients">
                          <option value="all">All Employees</option>
                          <?php
                          foreach($user_accounts as $row):
                            $department = "[".$row->department_name."]";
                            if($row->role_title!=''){
                              $department .= "[".$row->role_title."]";
                            }
                            ?>
                            <option value="<?php echo $row->acc_head_id?>"><?php echo $row->employee_name?> <?php echo $department?></option>
                            <?php
                          endforeach;
                          ?>
                        </select>
                      </div>
                      <span class="m-form__help"></span>
                    </div>
                  <?php } ?>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
      <div class="m-portlet__head">
        <div class="m-portlet__head-caption">
          <div class="m-portlet__head-title">
            <h3 class="m-portlet__head-text">
              <?php   if($this->session->userdata('user_role')=='admin' || $this->session->userdata('user_role')=='admin') {?>
                List of Payments Towards Users
              <?php }else{ ?>
                List of Payments Receipts
              <?php } ?>
            </h3>
          </div>
        </div>
        <div class="m-portlet__head-tools">
          <?php   if($this->session->userdata('user_role')!='supervisor' && ($this->session->userdata('user_role')=='admin' || $this->session->userdata('user_role')=='accounts_manager' || ($this->session->userdata('user_role')=='general_manager' && $this->config->item('User_general_manager_user_payments_enable')==1) || ($this->session->userdata('user_role')!='auditor' || $this->session->userdata('user_data_permission')['adding']==1))) {?>
            <a data-bill-type="user_payment_receipt"  id="btn_add_bill_payment" href="#bill_payment_add_modal" data-toggle="modal" class="btn btn-focus m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
              <span>
                <i class="la la-plus"></i>
                <span>
                  Add New Payment
                </span>
              </span>
            </a>
          <?php } ?>
        </div>
      </div>
      <div class="m-portlet__body">
        <!--begin: Datatable -->
        <?php $this->view("modules/include_tables/table_user_payment_receipts");?>
        <!--end: Datatable -->
      </div>
    </div>
    <div class="m-portlet m-portlet--mobile m-portlet--focus m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
      <div class="m-portlet__head">
        <div class="m-portlet__head-caption">
          <div class="m-portlet__head-title">
            <h3 class="m-portlet__head-text">
              <?php   if($this->session->userdata('user_role')=='admin' || $this->session->userdata('user_role')=='admin' || ($this->session->userdata('user_role')=='general_manager' && $this->config->item('User_general_manager_user_payments_enable')==1)) {?>
                List of Payments Returns From Users
              <?php }else{ ?>
                List of Payments Returns
              <?php } ?>
            </h3>
          </div>
        </div>
        <div class="m-portlet__head-tools">
          <?php   if($this->session->userdata('user_role')!='supervisor' && ($this->session->userdata('user_role')=='admin' ||  (($this->session->userdata('user_role')=='general_manager' || $this->session->userdata('user_role')=='accounts_manager') && $this->config->item('User_general_manager_user_payments_enable')==1) || ($this->session->userdata('user_role')!='auditor' || $this->session->userdata('user_data_permission')['adding']==1))) {?>
            <a data-bill-type="user_payment_return"  id="btn_add_bill_payment" href="#bill_payment_add_modal" data-toggle="modal" class="btn btn-info m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
              <span>
                <i class="la la-plus"></i>
                <span>
                  Add New Payment Return
                </span>
              </span>
            </a>
          <?php } ?>
        </div>
      </div>
      <div class="m-portlet__body">
        <!--begin: Datatable -->
        <?php $this->view("modules/include_tables/table_user_payment_returns");?>
        <!--end: Datatable -->
      </div>
    </div>
    <?php if($this->config->item('User_project_commission_payment')==1){ ?>
      <div class="m-portlet m-portlet--mobile m-portlet--brand m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
        <div class="m-portlet__head">
          <div class="m-portlet__head-caption">
            <div class="m-portlet__head-title">
              <h3 class="m-portlet__head-text">
                Project Commission Payment For Assigned Users
              </h3>
            </div>
          </div>
          <div class="m-portlet__head-tools">

          </div>
        </div>
        <div class="m-portlet__body">
          <table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="user_commission_payment_view_table">
            <thead>
              <tr class="">
                <th>Sl No</th>
                <th>TR ID</th>
                <th>Paid Date</th>
                <th>Bill ID</th>
                <th>User Name</th>
                <th>User Role</th>
                <th>Project</th>
                <th></th>
                <th>Bill No</th>
                <th>Consignee</th>
                <th>Paid Amount</th>
                <th>Debit Acc</th>
                <th>Payment Mode</th>
                <th>TR Ref No</th>
                <th>TR Ref Date</th>
                <th>Remarks</th>
                <th>Created By</th>
                <th>Created Date</th>
                <th>Actions</th>
                <th>Debit Acc</th>
              </tr>
            </thead>
            <tbody>
            </tbody>
          </table>
        </div>
      </div>
    <?php } ?>
  </div>
  <?php $this->view("modules/include_modals/modal_bills");?>
  <?php $this->view("modules/include_modals/modal_transaction_delete");?>
</div>
</div>
<!-- end:: Body -->
<!-- begin::Footer -->

<?php $this->view("includes/Inc_footer");?>
<!-- end::Footer -->
</div>
<!-- end:: Page -->

<?php $this->view("includes/Inc_sidebar");?>
<?php $this->view("includes/Inc_scripts");?>

<?php $this->view("modules/include_scripts/bill_scripts");?>
<?php $this->view("modules/include_scripts/transaction_scripts");?>
<script>
$("#user_payments_menu").addClass('m-menu__item--active');

</script>
<!-- User Payment  Scripts -->
<?php $this->view("modules/include_scripts/user_payments_scripts");?>
