<?php $this->view("includes/Inc_pagehead"); ?>
<!-- Page Styles Goes Here-->
<style>
  .symbol {
    display: inline-block;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    position: relative;
    border-radius: 0.42rem;
  }

  .symbol.symbol-60 .symbol-label {
    width: 60px;
    height: 60px;
  }

  .symbol .symbol-label {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    font-weight: 500;
    line-height: 0;
    color: #3F4254;
    background-color: #F3F6F9;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    border-radius: 0.42rem;
  }
</style>
<?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">
          Manage Subcontract Labours Profiles
        </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() . 'subcontracts/labours' ?>" class="m-nav__link">
              <span class="m-nav__link-text">
                Labours
              </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-4">
                  <div class="m-form__label">
                    <label class="m-label m-label--single">
                      Date:
                    </label>
                  </div>
                  <div class="row">
                    <div class="col-md-6">
                      <div class="m-form__control">
                        <input autocomplete="off" value="" data-date-format="dd-mm-yyyy" id="table_filter_start_date" type="text"  class="form-control m-input table_filter  m-input--pill m-input--air" placeholder="Start Date" >
                      </div>
                    </div>
                    <div class="col-md-6">
                      <div class="m-form__control">
                        <input autocomplete="off" value="" data-date-format="dd-mm-yyyy" id="table_filter_end_date" type="text"  class="form-control m-input table_filter  m-input--pill m-input--air" placeholder="End Date" >
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-group m-form__group">
                    <label>
                      Contractor :
                    </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_contractor" name="contractor" data-placeholder="Select Work">

                      </select>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
                <div class="col-lg-4">
                  <div class="form-group m-form__group"  >
                    <label for="user_name">
                      Subcontract Work
                    </label>
                    <div class="m-select2 m-select2--air m-select2--pill">
                      <select required id="table_filter_subcontract" name="subcontract" style="width: 100%" class="form-control m-input table_filter"  aria-describedby="basic-addon1" data-placeholder="Select Subcontract">

                      </select>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
                <?php if (!empty($this->config->item('company_branches'))) { ?>
                  <div class="col-lg-3">
                    <div class="form-group m-form__group">
                      <label>
                        Company Branch
                      </label>
                      <div class="m-select2 m-select2--air m-select2--pill">
                        <select width="100%" required class="form-control m-select2 table_filter company-branch-select2" id="company_branch_1">
                          <option selected value="all"> All Branches</option>
                          <option value="0">NO BRANCH</option>
                          <?php foreach ($this->config->item('company_branches') as $key => $value) { ?>
                            <option value="<?php echo $value->branch_id ?>"><?php echo $value->branch_name ?></option>
                          <?php } ?>
                        </select>
                      </div>
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                <?php } ?>

              </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 Subcontract Labours
            </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="#" style="margin-right:5px;margin-left:5px;" data-toggle="modal" data-target="#labour_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 New Labour
                </span>
              </span>
            </a>
            <a href="<?php echo base_url() ?>subcontracts/labour_attendance" style="margin-right:5px;margin-left:5px;" class="btn btn-warning m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
              <span>
                <i class="la la-plus"></i>
                <span>
                  Add Labour Attendance
                </span>
              </span>
            </a>
          <?php } ?>
        </div>
      </div>
      <div class="m-portlet__body">
        <!-- table -->
        <?php $this->view("modules/include_tables/table_subcontract_labours"); ?>
        <!-- modal -->
        <?php $this->view("modules/include_modals/modal_subcontract_labours"); ?>
      </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">
              List of Labour Attendance
            </h3>
          </div>
        </div>
        <div class="m-portlet__head-tools">
          <?php if ($this->session->userdata('user_role') != 'auditor') { ?>
            <a href="<?php echo base_url() ?>subcontracts/labour_attendance" style="margin-right:5px;margin-left:5px;" class="btn btn-warning m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
              <span>
                <i class="la la-plus"></i>
                <span>
                  Add Labour Attendance
                </span>
              </span>
            </a>
          <?php } ?>

        </div>
      </div>
      <div class="m-portlet__body">
        <!--begin: Datatable -->
        <table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="labour_attendance_view_table">
          <thead>
            <tr class="">
              <th>Id</th>
              <th>Branch</th>
              <th>Date</th>
              <th>Labour Name</th>
              <th>Wage</th>
              <th>Work Type</th>
              <th>Contractor</th>
              <th>Sub Contract</th>
              <th>Project</th>
              <th>Created By</th>
              <th>Created On</th>
              <th>Actions</th>
            </tr>
          </thead>
          <tbody>
          </tbody>
        </table>

      </div>
    </div>
    <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">
              Labour Attendance Summary
            </h3>
          </div>
        </div>
        <div class="m-portlet__head-tools">

        </div>
      </div>
      <div class="m-portlet__body">
        <!--begin: Datatable -->
        <table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="labour_attendance_summary_view_table">
          <thead>
            <tr class="">
              <th>SlNo</th>
              <th>Branch</th>
              <th>Date Period</th>
              <th>Labour Name</th>
              <th>Work Type</th>
              <th>Contractor</th>
              <th>Sub Contract</th>
              <th>Project</th>
              <th>Total Wage</th>
            </tr>
          </thead>
          <tbody>
          </tbody>
        </table>

      </div>
    </div>

    <div class="modal fade" tabindex="-1" id="labour_attendance_delete_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog " role="document" >
        <form id="form_labour_attendance_delete" data-modal-id="labour_attendance_delete_modal" autocomplete="off" method="post" action="<?php echo base_url().'subcontracts/delete_labour_attendance'?>" class="form-horizontal">
          <div class="modal-content">
            <div class="alert alert-danger" role="alert" style="margin-bottom: 0px">
              <button type="button" class="close" data-dismiss="modal"></button>
              <br/>
              <h4 class="alert-heading">Warning! Please Confirm Your Action</h4>
              <br/>
              <p> Are You Sure to Delete this Data ?. All the Associated Data will Lost. </p>
              <p>
                <button class="btn btn-danger form_submit_btn" type="submit" name="submit">Confirm & Delete</button>
                <button type="button" class="btn btn-primary modal-dismiss" data-dismiss="modal">Cancel</button>
              </p>
              <input type="hidden" name="attendance_id" id="attendance_id_delete">
            </div>
          </div>
        </form>
      </div>
    </div>

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

  </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"); ?>
<?php $this->view("modules/include_scripts/bill_scripts"); ?>
<?php $this->view("modules/include_scripts/transaction_scripts"); ?>

<?php $this->view("modules/include_scripts/subcontractor_labours_scripts"); ?>

<!--begin::Page Snippets -->
<script type="text/javascript">
  $("#subcontract_menu").addClass('m-menu__item--active m-menu__item--open');
  $("#subcontract_menu_4").addClass('m-menu__item--active');
</script>
