<link href="<?php echo base_url();?>admin_assets/plugins/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
  <div class="body-content">
            <div class="row">
                <div class="col-md-4">
                	<?php //if($this->session->flashdata("msg")!==""){echo $this->session->flashdata("msg"); }?>
                    <div class="card mb-4">
                        <div class="card-header">
                            <div class="d-flex justify-content-between align-items-center">
                            <h6 class="fs-17 font-weight-600 mb-0"><i class="fa fa-user"></i> Add/Edit New Client</h6>
                            </div>
                        </div>
                        <div class="card-body">
                        	<?php if($this->uri->segment(3)){
								$edit=$this->db->get_where("e_gatewaymapping",array("gate_id"=>$this->uri->segment(3)))->row();?>
                            <form action="<?php echo base_url();?>admin/update_client" method="post" enctype="multipart/form-data">
                            	  <input type="hidden" name="gate_id" value="<?php echo $edit->gate_id;?>" />
                            	  <div class="form-group"> 
                                    <label for="email">Business Name</label>
                                    <input type="text" required value="<?php echo $edit->gate_name;?>" class="form-control" name="client_comp_name">
                                  </div>
                                  <!-- <div class="form-group"> 
                                    <label for="email">Contact Name</label>
                                    <input type="text" required value="<?php //echo $edit->client_name;?>" class="form-control" name="client_name">
                                  </div> -->
                                  <div class="form-group ">
                                    <label for="email">Email</label>
                                    <input type="email"  class="form-control" value="<?php echo $edit->gate_email;?>" name="client_email" >
                                  </div>
                                  <div class="row">
                                      <div class="form-group col-md-6"> 
                                        <label for="email">Mobile No</label>
                                        <input type="text" required class="form-control" value="<?php echo $edit->gate_mob;?>" name="client_contact">
                                      </div>
                                      <div class="form-group col-md-6"> 
                                        <label for="email">Alternate No</label>
                                        <input type="text" class="form-control" value="<?php //echo $edit->client_contact2;?>" name="client_contact2">
                                      </div>
                                  </div> 
                                  <div class="form-group ">
                                    <label for="email">Static IPs (Comma Seperated)</label>
                                    <input type="text"  required class="form-control" value="<?php echo $edit->gate_ip;?>" name="client_ip" >
                                  </div>                      
                                  <button type="submit" class="btn btn-success">Update Client</button>
                                </form>
                            <?php }else{?>
                            <form action="<?php echo base_url();?>admin/add_client" method="post" enctype="multipart/form-data">
                            	  <input type="hidden" name="client_add_date" value="<?php echo date("Y-m-d");?>" />
                            	  <div class="form-group"> 
                                    <label for="email">Business Name</label>
                                    <input type="text" required class="form-control" name="client_comp_name">
                                  </div>
                                  <!-- <div class="form-group"> 
                                    <label for="email">Contact Name</label>
                                    <input type="text" required class="form-control" name="client_name">
                                  </div> -->
                                  <div class="form-group ">
                                    <label for="email">Email</label>
                                    <input type="email"  class="form-control" name="client_email" required>
                                  </div>
                                  <div class="row">
                                      <div class="form-group col-md-6"> 
                                        <label for="email">Mobile No</label>
                                        <input type="text" required class="form-control" name="client_contact">
                                      </div>
                                      <div class="form-group col-md-6"> 
                                        <label for="email">Alternate No</label>
                                        <input type="text" class="form-control" name="client_contact2">
                                      </div>
                                  </div> 
                                   <div class="form-group ">
                                    <label for="email">Static IPs (Comma Seperated)</label>
                                    <input type="text"  class="form-control" required name="client_ip" >
                                  </div>                           
                                  <button type="submit" class="btn btn-success">Add Client</button>
                                </form>
                            <?php }?>
                        </div>
                     </div>
                </div> 
                <div class="col-md-8">
                    <div class="card mb-4">
                        <div class="card-header">
                            <div class="d-flex justify-content-between align-items-center">
                            <h6 class="fs-17 font-weight-600 mb-0"><i class="fa fa-list"></i> Listed All Clients</h6>
                            </div>
                        </div>
                        <div class="card-body">
                        	<table class="table display table-bordered table-striped table-hover basic">
                                        <thead>
                                            <tr>
                                            	  <th>S.No.</th>
                                                <th>Company/Name</th>
                                                <th>IP/Email/Mobile</th>
                                                <th>Action</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        	<?php $i=1;foreach($clients as $u){?>
                                            <tr>
                                        <td><?php echo $i;?></td>
                                        <td><b><?php echo $u->gate_name;?></b></td>
                                        <td>
                                        <?php $ips =explode(",",$u->gate_ip);foreach($ips as $ip){?>
                                        <span class="badge badge-dark"><?php echo $ip;?></span><br/><?php }?><td>
<a href="<?php echo base_url().'admin/clients/'.$u->gate_id;?>" class="btn btn-sm btn-warning"><i class="fa fa-edit"></i></a>
<a href="#" id="<?php echo $u->gate_id;?>" class="btn btn-sm btn-danger client_delete"><i class="fa fa-trash"></i></a>
<!-- <a href="#<?php //echo base_url().'admin/cdetails/'.$u->gate_ip;?>" class="btn btn-sm btn-dark"><i class="fa fa-eye"></i> VIEW</a>
<a href="#<?php //echo base_url().'admin/soa_view/'.$u->gate_ip;?>" class="btn btn-sm btn-success">SOA</a> -->
<a href="<?php echo base_url().'admin/invoice/'.str_replace(",","-",$u->gate_ip);?>" class="btn btn-sm btn-primary">INVOICE</a>

<a href="#" class="btn btn-sm btn-dark rate_list" id="<?php echo $u->gate_id;?>" data-toggle="modal" data-target="#myModal">
                                        <?php echo $rate=$this->db->get_where("call_rates",array("rate_client"=>$u->gate_id))->num_rows();?> RATE</a>
</td>
                                            </tr>
                                            <?php $i++;}?>
                                        </tbody>
                                    </table>
                                    <div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title">Call Rates List</h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>
      <div class="modal-body rate_list_div">
        <p>Loading...</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>




                        </div>
                     </div>
                </div> 
            </div>
                         
                    </div><!--/.body content-->
                </div><!--/.main content-->
                
                
                

                <footer class="footer-content">
                    <div class="footer-text d-flex align-items-center justify-content-between">
                        <div class="copy">© 2024 CRM</div>
                    </div>
                </footer><!--/.footer content-->
                <div class="overlay"></div>
            </div><!--/.wrapper-->
        </div>
        <!--Global script(used by all pages)-->
        <script src="<?php echo base_url();?>admin_assets/dist/js/popper.min.js"></script>
        <script>
		$(document).ready(function(){
      $(".rate_list").click(function(e){e.preventDefault();
			var id=$(this).attr("id");
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/ajax_rate_list',
							 data: {id:id},
							 success: function(res){
								 $(".rate_list_div").html(res);
							 }
							 });
		});
			$(".client_delete").click(function(e){e.preventDefault();
		if (!confirm("Sure you want to delete?")){
				  return false;
				}
			var id=$(this).attr("id");$(this).closest("tr").remove();
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/ajax_client_delete',
							 data: {id:id},
							 success: function(response){
								 //alert(response);
							 }
							 });
		});
			});
		</script>
        <script src="<?php echo base_url();?>admin_assets/plugins/bootstrap/js/bootstrap.min.js"></script>
        <script src="<?php echo base_url();?>admin_assets/plugins/metisMenu/metisMenu.min.js"></script>
        <script src="<?php echo base_url();?>admin_assets/plugins/perfect-scrollbar/dist/perfect-scrollbar.min.js"></script>
        <!-- Third Party Scripts(used by this page)-->
        <script src="<?php echo base_url();?>admin_assets/plugins/datatables/dataTables.min.js"></script>
        <script src="<?php echo base_url();?>admin_assets/plugins/datatables/dataTables.bootstrap4.min.js"></script>
        <!--Page Active Scripts(used by this page)-->
        <script src="<?php echo base_url();?>admin_assets/plugins/datatables/data-basic.active.js"></script>
        <!--Page Scripts(used by all page)-->
        <script src="<?php echo base_url();?>admin_assets/dist/js/sidebar.js"></script>
    </body>

<!-- Mirrored from bhulua.thememinister.com/tables_data_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 28 Sep 2019 13:44:34 GMT -->
</html>