<?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">
          Vehicle Work Slips & 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().'vehicle_work_slips' ?>" class="m-nav__link">
              <span class="m-nav__link-text">
                Vehicle Work Slips & Payments
              </span>
            </a>
          </li>


        </ul>
      </div>
      <div>

      </div>
    </div>
  </div>
  <!-- END: Subheader -->
  <div class="m-content">
    <div class="m-portlet  m-portlet--rounded m-portlet--bordered">
      <div class="m-portlet__body" style="padding: 1rem 2.2rem;">
        <div class="m-form m-form--label-align-right m--margin-bottom-10">
          <div class="row ">
            <div class="col-xl-12 order-2 order-xl-1">
              <div class="form-group m-form__group row" style="padding-bottom: 0px">
                <div class="col-md-4">
                  <div class="form-group m-form__group" >
                    <label> Date:</label>
                    <input  id="table_filter_date"  type="text" class="form-control  m-input  m-input--air m-input--pill"  >
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-group m-form__group">
                    <label>
                      Work:
                    </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_work" >
                        <option value="all">All Works</option>
                        <?php
                        foreach($work_contracts as $row): ?>
                        <option data-work-status="<?php echo $row->work_status?>" value="<?php echo $row->work_id?>"><?php echo $row->work_name?></option>
                        <?php
                      endforeach;
                      ?>
                    </select>
                  </div>
                  <span class="m-form__help"></span>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group m-form__group">
                  <label>
                    Vehicle:
                  </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_vehicle"  >
                      <option value="all">All Vehicles</option>
                      <?php
                      foreach($vehicles as $row): ?>
                      <option value="<?php echo $row->id?>"><?php echo $row->consignee_name." [ ".$row->vehicle_name ." : ".$row->vehicle_no." ]"?></option>
                      <?php
                    endforeach;
                    ?>
                  </select>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <?php if($this->config->item('app_module_vehicle_management')==1){ ?>
              <div class="col-md-4">
                <div class="form-group m-form__group">
                  <label>
                    Driver:
                  </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_driver"  >
                      <option value="all">All Drivers</option>
                      <?php
                      foreach($driver_employees as $row): ?>
                      <option value="<?php echo $row->employee_id?>"><?php echo $row->employee_name?></option>
                      <?php
                    endforeach;
                    ?>
                  </select>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
          <?php } ?>
          <div class="col-md-3">
            <div class="form-group m-form__group">
              <label>
                Payment Status:
              </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_payment_status"  name="payment_status" data-placeholder="Select Supplier">
                  <option selected value="all">All Bills</option>
                  <option value="1">Paid</option>
                  <option value="0">Not Paid</option>
                </select>
              </div>
              <span class="m-form__help"></span>
            </div>
          </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">
          List of Vehicle Work Slips
        </h3>
      </div>
    </div>
    <div class="m-portlet__head-tools">
      <?php if($this->session->userdata('user_role')!='auditor' || $this->session->userdata('user_data_permission')['adding']==1) { ?>
        <a href="#" data-toggle="modal" data-target="#vehicle_work_slip_add_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 Work Slip
            </span>
          </span>
        </a>
      <?php } ?>
    </div>
  </div>
  <div class="m-portlet__body">
    <!--begin: Datatable -->
    <?php $this->view("modules/include_tables/table_vehicle_work_slips");?>
    <!--end: Datatable -->
  </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">
          List of Vehicle Work Payments
        </h3>
      </div>
    </div>

  </div>
  <div class="m-portlet__body">
    <!--begin: Datatable -->
    <?php $this->view("modules/include_tables/table_vehicle_work_slip_transaction");?>
    <!--end: Datatable -->
  </div>
</div>

<?php $this->view("modules/include_modals/modal_bills");?>
<?php $this->view("modules/include_modals/modal_transaction_delete");?>
<?php $this->view("modules/include_modals/modal_vehicle_add");?>


</div>
</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");?>

<!--begin::Page Snippets -->
<?php $this->view("modules/include_scripts/bill_scripts");?>
<?php $this->view("modules/include_scripts/transaction_scripts");?>
<?php $this->view("modules/include_scripts/vehicles_scripts");?>

<script>
$("#vehicle_menu").addClass('m-menu__item--active m-menu__item--open');
$("#vehicle_menu_2").addClass('m-menu__item--active');
</script>
<?php $this->view("modules/include_scripts/vehicle_work_scripts");?>
