<?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>
                  <th><strong>Ation</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['enqId']; ?>" /></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 $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['addedDate'], 3); ?></td>
                    <td>
                      <span class="db-list-ststus">
                        <?php echo ($rval['status'] == '1') ? 'Active' : 'Inactive'; ?>
                      </span>
                      <br />
                      <a href="javascript:void(0);" class="db-list-edit addComments" data-dismiss="modal" data-toggle="modal" data-enqId="<?php echo $rval['enqId']; ?>" data-vendId="<?php echo $rval['id']; ?>" data-target="#addCommentModalFooter">Add Comment</a>
                     
                      <a href="javascript:void(0);" class="db-list-edit"onclick="view_shared_comments(<?php echo $rval['enqId']; ?>);" data-dismiss="modal" data-toggle="modal" data-target="#viewCommentModalFooter">View Comment</a>
                    </td>
                  </tr>
                  <?php
                  $slno++;
                }
                ?>
              </tbody>
            </table>
            </div>
            <table class="list" width="100%"> 
              <tr>
                <td class="table_50" align="left">
                  <input name="status_action" type="submit"  value="Activate" class="btn btn-success btn-xs" id="Activate" onClick="return validcheckstatus('arr_ids[]', 'Activate', 'Record', 'u_status_arr[]');"/>

                  <input name="status_action" type="submit" class="btn btn-warning btn-xs" value="Deactivate" id="Deactivate"  onClick="return validcheckstatus('arr_ids[]', 'Deactivate', 'Record', 'u_status_arr[]');"/>
                  <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>





<!-- Add Comment Popup START -->
<div class="modal fade dir-pop-com" id="addCommentModalFooter" role="dialog">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h4 class="modal-title">Add Comments</h4>
      </div>
      <div class="modal-body">
        <form id="add_cv_formFooter" method="post" class="form-horizontal tz2-form-pay tz2-form-com" action="">
          <div class="form-group has-feedback">
            <div class="col-lg-12">
              <em class="text-danger">All fields are required.</em>
            </div>
          </div>
          <div class="form-group has-feedback type_option ">
            <div class="col-md-4">Comment Type</div>
            <div class="col-md-3"><label><input type="radio" name="conversation_typeFooter" checked value="1">Conversation</label></div>
            <div class="col-md-3"><label><input type="radio" name="conversation_typeFooter" value="2">Chat</label></div>
            <div class="col-md-2"><label><input type="radio" name="conversation_typeFooter" value="3">Others</label></div>
          </div>
          <div class="form-group has-feedback ak-field">
            <div class="col-md-4">Comment</div>
            <div class="col-md-8">
              <textarea name="commentsFooter" id="commentsFooter" class="form-control" placeholder="Your Comment"></textarea>
            </div>
          </div>
          <div class="form-group has-feedback">
            <div class="col-md-4">Move To</div>
            <div class="col-md-8">
              <div class="input-field col s12">
                <select name="stageFooter" id="stageFooter" class="select_country_pop">
                  <option value="">--Select Stage--</option>
                  <option value="1">Follow Up</option>
                  <option value="2">Interested</option>
                  <option value="3">Not Interested</option>
                  <option value="4">Paid</option>
                </select>
              </div>
            </div>
          </div>
          <div class="form-group fldate1">
            <div class="col-md-4">Follow Up Date</div>
            <div class="col-md-8">
              <input type="date" name="follow_up_dateFooter" id="follow_up_dateFooter" value="<?php echo date('Y-m-d', strtotime("+1 days")); ?>" class="form-control">
            </div>
          </div>
          <div class="form-group has-feedback fltime1">
            <div class="col-md-4">Follow Up Time</div>
            <div class="col-md-8">
              <div class="input-field">
                <select name="follow_up_timeFooter" id="follow_up_timeFooter" class="select_country_pop">
                  <?php
                  foreach ($times as $t => $tv) {
                    ?><option value="<?php echo $tv; ?>"><?php echo $tv; ?></option><?php
                  }
                  ?>
                </select>
              </div>
            </div>
          </div>
          <div class="form-group has-feedback ak-field" >
            <div class="col-md-12">
              <input type="hidden" id="enqId" value="" />
              <input type="hidden" id="vendId" value="" />
              <button id="add_cv_btnFooter" type="button" class="btn btn-primary pull-right">Add Comment</button>
            </div>
          </div>
          <div class="form-group has-feedback ak-field">
            <div id="add_cv_err_msg"></div>
          </div>

        </form>
      </div>

    </div>
  </div>
</div>
<!-- End Add Comment Modal -->


<!-- View Added Coments List -->
<div id="viewCommentModalFooter" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Comments List</h4>
      </div>
      <div class="modal-body">
        <div class="row" style="padding-bottom: 5px;">
         <div class="table-responsive">
          <table id="commentListTable" class="table table-hover">
            <thead>
              <tr>
                <th>Comment ID</th>
                <th>Comment</th>
                <th>Stage</th>
                <th>Added Date</th>
              </tr>
            </thead>
            <tbody>
            </tbody>
          </table>
            </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<!-- End of View Added Coments List -->
<?php $this->load->view("bottom_application"); ?>

