<?php
  include('common/header.php');
  $lable_branch_from=$this->page_data['lable_branch_from'];
  $lable_branch_To=$this->page_data['lable_branch_To'];
  $lable_transfer_comments=$this->page_data['lable_transfer_comments'];
?>
<div id="messages" style="color: red;"><h5><?php echo $this->session->flashdata('message'); ?></h5></div>
  <div class="">
    <div class="col-xm-12">
      <div class="widget-box light-border">
        
        <div class="widget-body">
          <div class="widget-main">
            <div class="row">
              <div class="col-sm-12">
                  <form class="form-horizontal" method="post" action="<?php echo base_url();?>index.php/<?php echo DISPENSER_SALES_DATA;?>transfer_to_branch" name="manage_client" id="manage_client">
                    <input type="hidden" value="<?php echo $product_category_id ?>" name="hidden" id="hidden">
                  <section class="panel panel-default">
                  <header class="panel-heading bg-info lt font-bold"></header>
                  <!-- panel body start -->
                  <div class="panel-body bs-example form-horizontal">
                    <div class="">
                     <div class="hr hr12 dotted"></div>
                       <div class="">
                        <!-- main col-sm-12 -->
                      <div class="col-sm-12"> 

                        
                          <div class="col-sm-6">
                            <div class="form-group" id="client_code">
                              <label for="client_code" class="col-sm-5 control-label required"><?php echo $lable_branch_from; ?>:<font style="color:red">*</font></label>
                              <div class="col-sm-7">
                                    <select name="from_branch" id="from_branch" onchange="get_branch(this.value);">
                                  <option value="default">Select from Branch Name</option>
                               
                                     
                                           
                                  </select>
                              </div>
                               
                            </div>
                          </div>
                       

                         <div class="col-sm-6">
                           <div class="form-group">
                             <label for="client_code" class="col-sm-5 control-label required"><?php echo $lable_branch_To; ?>:<font style="color:red">*</font></label>
                              <div class="col-sm-7">
                                 <select name="to_branch_name" id="to_branch_name">
                                  <option value="default">Select To Branch Name</option>
                                
                                     
                                           
                                  </select> 
                                  <div>
                                  <span id="parent_category_name1" class="text-danger font-weight-bold"></span>
                                <?php echo form_error('parent_category_name');?> 
                                </div>          
                              </div>
                            </div>
                          </div>


                          <div class="col-sm-6">
                           <div class="form-group">
                             <label for="client_code" class="col-sm-5 control-label required"><?php echo $lable_transfer_comments; ?>:</label>
                              <div class="col-sm-7">
                                   <textarea name="transer_comments" style="margin: 0px; width: 245px; height: 50px;"></textarea>
                                  <div>
                                </div>          
                              </div>
                            </div>
                          </div>
                       </div>



                    
                      
                        


                         <!-- </div> -->
                         <!-- main col-sm-12  close-->
                       </div> <!-- blank close -->
        </div><!-- blank close -->
      </div>   <!-- panel body close -->
    </section> <!-- section close -->

      <section class="panel panel-default">
        <!-- <header class="panel-heading bg-info lt font-bold">List City -->
     <!--  <ul class="nav nav-pills pull-right">
        <li class="bg-info lt"><a href="http://project.nityam.in/nityamhygiene/index.php/admin/client/manage_client"> + Add New Client</a></li>
        <li class="bg-info lt"><a href="http://project.nityam.in/nityamhygiene/index.php/admin/client/manage_client_n_location"> + Add New Client</a></li>
      </ul> -->
   <!--  </header> -->
        <div class="panel-body bs-example form-horizontal">
          <div class="table-responsive">
            <table id="example" class="table table-bordered" cellspacing="0" width="100%">
          	
          		<thead>
                            <tr>
                              <th class="text-center">Action</th>
                              <th class="text-center">Sr no</th>
                              <th class="text-center">Customer Name</th>
                              <th class="text-center">Dispenser Name</th>
                              <th class="text-center">Sale Type</th>
                              <th class="text-center">Branch Name</th>
                              <th class="text-center">Sale Person Name</th>
                              <th class="text-center">Refill Date</th>
                              <th class="text-center">Next Refill Date</th>
                              <th class="text-center">Tracking Number</th>
                              <th class="text-center">Returned</th>
                            </tr>   
                </thead>

     		 	<tbody id="dispensers">  
       
        		</tbody>
            </table>
          </div>
        </div>
        <input type="text" name="hidden_transfer" id="dispenser_sales_id">
      </section>

       <!-- customer contact start -->
   


    <!-- customer location start -->
    
              </div>
            </div>
          </div>  
        </div>
      </div>
    </div>
   
    <!-- /.col -->
  </div>
  <div class="clearfix form-actions">
    <div class="col-md-offset-5 col-md-5">
      
      <button class="btn btn-info" type="submit"  id="pc" >
         Transfer Dispensers
      </button>
    </div>
  </div>
   </form>
  <div class="space-4"></div>
    <!-- /.page-row -->
        <!-- /.page-content --> 
    </div>
    <!-- /.main-content --> 
  </div>
    <!-- /#ace-settings-container --> 
  </div>
<?php
  include('common/footer.php');
?>
<script type="text/javascript">
$(document).ready(function() {
    $('#example').DataTable( {
    destroy: true,
    searching: true,
    "order": [],
    "columnDefs": [
      { "orderable": false, "targets":  [3] }
      ]
  } );

    $.ajax({
    url:"<?php echo base_url();?>index.php/gc/dispenser_sale_data/branch",
    method:"POST",
    success:function(data)
    {
     $('#from_branch').html(data);
    }
   });

  
});

function get_branch(){
	var from_branch_id = $('#from_branch').val();
 	$.ajax({
    url:"<?php echo base_url();?>index.php/gc/dispenser_sale_data/branch",
    method:"POST",
    data:{
      from_branch_id:from_branch_id
    },
    success:function(data)
    {
     $('#to_branch_name').html(data);
    }
   });
    $.ajax({
        url:"<?php echo base_url();?>index.php/gc/dispenser_sale_data/fetch_dispenser_track",
        method:"POST",
        dataType: 'json',
        data:{
          from_branch_id:from_branch_id
        },
        success:function(data){   
                
                  $('#dispensers').html(data); 
                                 
        }
     });
}
 function get_check_value(){
    var fav = [];
    $("input[name='check_action[]']:checked").each(function(){
       fav.push($(this).val());
    });
    document.getElementById("dispenser_sales_id").value = fav;
    // console.log(fav);
  }
</script> 
