<?php require_once('../auth/auth.php'); ?>
<section class="content">
   <div class="container-fluid">
<div class="row">
   <div class="col-md-3"></div>
   <div class="col-md-6">
      <div class="card card-danger card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #969c9d;">
         <div class="card-header" style="padding: 3px 8px;">
            <h3 class="card-title"><?php echo language(180);?></h3>
            <div class="card-tools m-0">
               <button type="button" class="btn btn-tool" data-card-widget="remove">
               <i class="fas fa-times"></i>
               </button>
            </div>
         </div>
         <form id="sp_form" class="mt-2" action="#" method="post" autocomplete="off">
            <div class="card-body">
               <div class="col-md-12">
                  <div class="row">
                    <div class="col-md-3 pr-0">
                    </div>
                     <div class="col-md-6">
                      <div class="form-group">
                         <label><?php echo language(104);?></label>
                         <select  name="wh_id" class="form-control select2" required="true">
                          <option value=""></option>
                        <?php
                          $bw= mysqli_query($conn,"SELECT bwid,war_location,warehouse_code FROM business_w_house WHERE coid='$coid' AND bid='$bid' AND brid='$brid' AND active=1 ORDER BY bwid ASC") or die(mysqli_error($conn));
                          while($wh= mysqli_fetch_assoc($bw)){
                          echo '<option value='.$wh["bwid"].'>'.$wh["war_location"].'  '.$wh["warehouse_code"].'</option>';
                          }?>
                         </select>
                      </div>
                     </div>
                    <div class="col-md-3 pl-0">
                      <button type="submit" id="save" class="btn btn-success btn-xs" style="margin-top:19px;"><i class="fa fa-search"></i> <?php echo language(68);?></button>
                    </div>                     
                  </div>
               </div>
            </div>
         </form>
      </div>
   </div>
   <div class="col-md-3"></div>
</div>

</div>
</section>
<script>
  $("select").select2();   

   $(document).ready(function(){
     $('#sp_form').on('submit', function(e){
      e.preventDefault();
     $('#save').prop('disabled', true);
     $('#save').html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> '+'Loading...');
     e.preventDefault();  
     $.post("../item_transfer/transfer_index.php",$(this).serialize(),function(data){
      $('#sp_form')[0].reset();
      $('#save').prop('disabled', false);
      $('#save').html('Save');
      $('#stockhome').html(data);
       toastr.success(Showing, '<?php echo "Data Load Succefully" ?>'); 
    });
   });
  });  
</script>