<?php $this->view("includes/Inc_pagehead");?>
<!-- Page Styles Goes Here-->
<style>
@page {
  size: A4;
  margin: 0;
}
@media print {
  html, body {
    width: 210mm;
    height: 297mm;
  }
  .table-bordered td{
    padding: .75rem !important;
  }
  .table-bordered th{
    white-space: nowrap;
    padding: .75rem !important;
  }
  .table-bordered .table thead th {
    border-top: 2px solid #f4f5f8 !important;
  }

  body * {
    visibility: hidden;
  }
  #print_div * {
    visibility: visible;
    overflow: visible !important;
  }
  @page {size: landscape}
}
</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">
          Labour Attendance Report
        </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().'reports/labour_attendance' ?>" class="m-nav__link">
              <span class="m-nav__link-text">
                Labour Attendance Report
              </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;">
        <form  autocomplete="off" id="form_report_view" method="post" action="<?php echo base_url()?>reports/labour_attendance" enctype="multipart/form-data" class=" form m-form m-form--fit m-form--state m-form--label-align-right ">
          <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">
                  <div class="col-md-4">
                    <div class="form-group m-form__group">
                      <label> Start Date:</label>
                      <div class="input-group m-input-group--air m-input-group--pill date">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="la la-calendar"></i>
                          </span>
                        </div>
                        <input  name="start_date" autocomplete="off" id="start_date" required type="text" class="form-control form_client_payment_add_fields m-input " placeholder="Start Date" >
                      </div>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="form-group m-form__group">
                      <label> End Date:</label>
                      <div class="input-group m-input-group--air m-input-group--pill date">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="la la-calendar"></i>
                          </span>
                        </div>
                        <input  name="end_date" autocomplete="off" id="end_date" required type="text" class="form-control form_client_payment_add_fields m-input " placeholder="End Date" >
                      </div>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <br/>
                    <button style="margin-top: 7px" type="submit" id="btn_go" class="btn btn-focus m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
                      <span>
                        <i class="la la-search"></i>
                        <span>
                          Go
                        </span>
                      </span>
                    </button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
    <?php if($start_date!='' && $end_date!=''){ ?>
      <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">
                Labour Attendance Report
              </h3>
            </div>
          </div>
          <div class="m-portlet__head-tools">
            <!-- <a href="javascript:;" onclick="window.print()"  style="margin-left: 5px;margin-right: 5px" class="btn m-btn--gradient-from-danger m-btn--gradient-to-warning  m-btn  m-btn--icon m-btn--air m-btn--pill">
            <span>
            <i class="fa fa-print"></i>
            <span>
            Print Rport
          </span>
        </span>
      </a> -->
      <a id="btn_print" href="javascript:;" style="margin-left: 5px;margin-right: 5px" class="btn m-btn--gradient-from-danger m-btn--gradient-to-warning  m-btn  m-btn--icon m-btn--air m-btn--pill">
        <span>
          <i class="fa fa-print"></i>
          <span>
            Print Labour Attendance Report
          </span>
        </span>
      </a>
    </div>
  </div>
  <div class="m-portlet__body" >
    <!--begin: Datatable -->
    <div id="print_div" style="overflow-x: scroll;">
      <?php $this->view('modules/include_tables/table_report_labour_attendance');?>
    </div>
  </div>
</div>

<?php } ?>
</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 -->
<script>
$("#report_menu").addClass('m-menu__item--active m-menu__item--open');
$("#report_menu_11").addClass('m-menu__item--active');
$("#start_date").datepicker( {
  todayHighlight:!0, orientation:"bottom left",format: "dd-mm-yyyy",templates: {
    leftArrow: '<i class="la la-angle-left"></i>', rightArrow: '<i class="la la-angle-right"></i>'
  }
})
$("#end_date").datepicker( {
  todayHighlight:!0, orientation:"bottom left",format: "dd-mm-yyyy",templates: {
    leftArrow: '<i class="la la-angle-left"></i>', rightArrow: '<i class="la la-angle-right"></i>'
  }
})
var start_date = "<?php echo date('d-m-Y',strtotime($start_date)) ?>";
var end_date = "<?php echo date('d-m-Y',strtotime($end_date)) ?>";
$('#start_date').datepicker("setDate", start_date);
$('#end_date').datepicker("setDate", end_date);
$("#form_report_view").validate( {
  rules: {
    receiptno_to: {
      number: !0
    },receiptno_from: {
      number: !0
    }
  }
  , invalidHandler:function(e, r) {
    var i=$("#"+form_id+"_msg");
    i.removeClass("m--hide").show(), mUtil.scrollTo(i, -200)
  }
  , submitHandler:function(e) {
    this.submit();
  }
});
$('body').on('click', '#btn_print', function() {
  window.open('<?php echo base_url()."reports/labour_attendance/print?start_date=".$start_date."&end_date=".$end_date ?>','newwindow','width=800,height=700'); return false
})
</script>
