<?php
$this->load->view("top_application");
$messurement = $this->config->item('unit_measurement');
$times = create_time_range('9:30', '18:30', '15 mins', '24');
//$stageArr = $this->config->item('stages');
?>
<!-- PAGE TITLE -->
<section>
  <div class="tz">
    <!--LEFT SECTION-->
    <div class="tz-l">
      <?php $this->load->view("members/left"); ?>
    </div>
    <!--CENTER SECTION-->
    <div class="tz-4">
      <div class="tz-2-com tz-2-main">
        <h4><?php echo $heading_title; ?></h4>
        <div class="db-list-com tz-db-table">
          <?php
          if (is_array($res) && !empty($res)) {
            echo form_open("", 'id="data_form"');
            ?>
            <div class="table-responsive">
            <table>
              <thead>
                <tr>
                  <th>
                    <label style="left:0px!important;" class="containerdash"><input type="checkbox" class="dashcheckbox" onclick="$('input:checkbox').not(this).prop('checked', this.checked);" /></label>
                  </th>
                  <th><strong>Enquiry Details</strong></th>
                  <th><strong>Contact Info</strong></th>
                  <th><strong>Date</strong></th>
                </tr>
              </thead>
              <tbody>
                <?php
                $slno = 1;
                foreach ($res as $rkey => $rval) {
                  //trace($rval);
                  $product = get_db_single_row('wps_products', 'product_name, unit_measurement', "products_id = '" . $rval['products_id'] . "'");
                  ?>
                  <tr>
                    <td>
                      <label style="left:0px!important;" class="containerdash"><input type="checkbox" class="dashcheckbox" name="arr_ids[]" value="<?php echo $rval['id']; ?>" /></label>
                    </td>
                    <td>
                      <b>Product :</b> <?php echo $product['product_name']; ?><br />
                      <b>MSG :</b> <?php echo $rval['message']; ?><br />
                      <b>QTY :</b> <?php echo $rval['quantity']; ?><?php echo (isset($product['unit_measurement']) && !empty($product['unit_measurement']))?' / '.$messurement[$product['unit_measurement']]:''; ?><br />
                      <b>URL :</b> <?php echo $rval['post_url']; ?><br />
                    </td>
                    <td>
                      <b>Name :</b> <?php echo $rval['first_name']; ?><br />
                      <b>Email :</b> <?php echo $rval['email']; ?><br />
                      <b>Mobile :</b> <?php echo $rval['mobile_number']; ?><br />  
                      <?php
                      if($rval['location']){
                        ?><b>Location :</b> <?php echo $rval['location']; ?><br /><?php
                      }
                      ?>
                    </td>
                    <td><?php echo getDateFormat($rval['receive_date'], 3); ?></td>
                  </tr>
                  <?php
                  $slno++;
                }
                ?>
              </tbody>
            </table>
            </div>
            <table class="list" width="100%"> 
              <tr>
                <td class="table_50">
                  <input name="status_action" type="submit" class="btn btn-danger btn-xs" id="Delete" value="Delete"  onClick="return validcheckstatus('arr_ids[]', 'delete', 'Record');"/>
                </td>
                <td class="table_50 text-right">
                  <p class="paging"><?php echo $page_links; ?></p>
                </td>
              </tr>
            </table>
            <?php
            echo form_close();
          } else {
            ?>
            <div class="alert alert-danger" role="alert">
              <strong>Oh snap!</strong> No Enquiries Found.
            </div>
            <?php
          }
          ?>
        </div>
      </div>
    </div>
    <!--RIGHT SECTION-->
  </div>
</section>
<?php $this->load->view("bottom_application"); ?>