<?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">
          Manage Enquiries
        </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 $this->session->userdata("dashboard_link")?>" 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().'enquiries' ?>" class="m-nav__link">
              <span class="m-nav__link-text">
                Enquiries
              </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__head">
        <div class="m-portlet__head-caption">
          <div class="m-portlet__head-title">
            <h3 class="m-portlet__head-text">
              List of Enquiries
            </h3>
          </div>
        </div>
        <div class="m-portlet__head-tools">

          <?php if($this->session->userdata('user_role')!='auditor') { ?>

            <a href="#" data-toggle="modal" data-target="#enquiry_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>
                  Create New Enquiry
                </span>
              </span>
            </a>

          <?php } ?>

        </div>
      </div>
      <div class="m-portlet__body">
        <!--begin: Datatable -->
        <?php if (!empty($this->config->item('company_branches'))) { ?>
          <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-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="table_filter_company_branch">
                          <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>
                  <div class="col-lg-3">
                    <div class="form-group m-form__group">
                      <label>
                        Customer
                      </label>
                      <div class="m-select2 m-select2--air m-select2--pill">
                        <select width="100%" required class="form-control m-select2 table_filter" id="table_filter_customer">

                        </select>
                      </div>
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                  <div class="col-lg-3">
                    <div class="form-group m-form__group">
                      <label>
                        Service
                      </label>
                      <div class="m-select2 m-select2--air m-select2--pill">
                        <select width="100%" required class="form-control m-select2 table_filter" id="table_filter_service">
                          <option selected value="all"> All Services</option>
                          <?php foreach ($services as $key => $value) { ?>
                            <option value="<?= $value->service_id ?>"><?= $value->service_name ?> </option>
                          <?php } ?>
                        </select>
                      </div>
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                  <div class="col-lg-3">
                    <div class="form-group m-form__group">
                      <label>
                        Status
                      </label>
                      <div class="m-select2 m-select2--air m-select2--pill">
                        <select width="100%" required class="form-control m-select2 table_filter" id="table_filter_status">
                          <option selected value="all"> All Status</option>
                          <option value="Open">Open</option>
                          <option value="Quote Pending">Quote Pending</option>
                          <option value="Quotation Created">Quotation Created</option>
                          <option value="Work Order Created">Work Order Created</option>
                          <option value="Project Created">Project Created</option>
                          <option value="Waiting For Approval">Waiting For Approval</option>
                          <option value="Work Under Progress">Work Under Progress</option>
                          <option value="Closed">Closed</option>
                          <option value="Cancelled">Cancelled</option>
                        </select>
                      </div>
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                  <div class="col-lg-3">
                    <div class="form-group m-form__group">
                      <label>
                        Assigned To
                      </label>
                      <div class="m-select2 m-select2--air m-select2--pill">
                        <select width="100%" required class="form-control m-select2 table_filter" id="table_filter_assigned_to">
                          <option selected value="all"> All Staff</option>
                          <?php foreach ($sales_staffs as $key => $value) { ?>
                            <option value="<?= $value->user_id ?>"><?= $value->user_alias ?> </option>
                          <?php } ?>
                        </select>
                      </div>
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        <?php } ?>
        <?php $this->view("modules/include_tables/table_enquiries");?>
        <!--end: Datatable -->

        <!--end: Datatable -->
        <?php $this->view("modules/include_modals/modal_enquiries");?>
      </div>
    </div>
  </div>
</div>
</div>
<!-- end:: Body -->
<!-- begin::Footer -->

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

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

<script>
$("#enquiries_menu").addClass('m-menu__item--active');
</script>
