

<?php $__env->startSection('pageTitle', 'Vega Soft'); ?>
<?php $__env->startSection('page-content'); ?>

<input type="hidden" id="table_settings_field" branch_id="" branch_name=""  column_heading="<?= $rows->column_heading;?>" column_width="<?= $rows->column_width;?>" column_alighn="<?= $rows->column_alighn;?>"  column_conversion="<?= $rows->column_conversion;?>" settings_row_id="<?= $id;?>" sp_date_picker="<?= $rows->sp_date_picker;?>"  header_from_date="<?=date('d-m-Y', strtotime('-7 days')); ?>"   header_till_date="<?=date('d-m-Y'); ?>"  sp_sort="<?= $rows->menu_id; ?>"  active_mn="<?= $rows->root;?>"  active_mnt="<?= $rows->menu_type;?>">

<div id="form-div">
<input type="hidden" id="hidden_status" value="0">
<input type="hidden" id="row_id" value="0">


<div class="page-header form-header" >
  <h3 class="page-title text-white"> <?= $rows->menu_name;?> </h3>
    <nav aria-label="breadcrumb">
      <ol class="breadcrumb">
      
        <li class="breadcrumb-item text-white  icon-md " aria-current="page"><i class="icon-list slide1"></i> </li>
      </ol>
    </nav>
    

    <input type="hidden" id="table_settings_field" branch_id="" branch_name=""  column_heading="<?= $rows->column_heading;?>" column_width="<?= $rows->column_width;?>" column_alighn="<?= $rows->column_alighn;?>"  column_conversion="<?= $rows->column_conversion;?>" settings_row_id="<?= $id;?>" sp_date_picker="<?= $rows->sp_date_picker;?>"  header_from_date="<?=date('d-m-Y', strtotime('-7 days')); ?>"   header_till_date="<?=date('d-m-Y'); ?>"  sp_sort="<?= $rows->menu_id; ?>"   >
    <?php if($rows->sedp != ""): ?>
  <?php $__currentLoopData = explode(',', $rows->sedp); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $z=>$info): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> 
     <?php if($info == "1" && $z==1): ?>
       <input type="hidden" class="additional_btns" btn_text="Edit" btn_click_function="call_edit_modal" btn_class="btn btn-success btn-sm btn-dtbl" col_width="30" >
     <?php endif; ?> 
     <?php if($info == "1" && $z==2): ?>
        <input type="hidden" class="additional_btns" btn_text="Cancel Bill" btn_click_function="call_remove_modal" btn_class="btn btn-danger btn-sm btn-dtbl" col_width="40"  >
     <?php endif; ?> 
     <?php if($info == "1" && $z==3): ?>
          <input type="hidden" class="additional_btns" btn_text="Print" btn_click_function="call_print_function2" btn_class="btn btn-info btn-sm btn-dtbl" col_width="40"  >
     <?php endif; ?>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
</div>
<style type="text/css">
  table { border-collapse: collapse; width: 100%; }
th, td { background: #fff; padding: 8px 16px; }


.tableFixHead {
  overflow: auto;
  height: 500px;
  scrollbar-width: thin;
}

.tableFixHead thead th {
  position: sticky;
  top: 0;
}

</style>
<div class="card">
    <div class="card-body">
      <form class="forms-sample" autocomplete="off">






<div class="rows">
  <div class="tableFixHead poem">
  <table class="table table-hover">
    <thead>
      <tr class="table-info">
        <th>TH 1</th><th>TH 2</th>
      </tr>
    </thead>
    <tbody>
      <tr><td>A1</td><td>A2</td></tr>
      <tr><td>B1</td><td>B2</td></tr>
      <tr><td>C1</td><td>C2</td></tr>
      <tr><td>D1</td><td>D2</td></tr>
      <tr><td>E1</td><td>E2</td></tr>
    </tbody>
  </table>
</div>
</div>







                      <div class="template-demo">
                        
                     <button id="save_btn" type="button" onclick="save_submit_form();" class="btn btn-success btn-icon-text save_btn btn-sm" >
                            <i class="icon-doc btn-icon-prepend"></i> Submit </button>
                        
                     <button id="edit_btn" type="button" onclick="save_submit_form();" class="btn btn-primary btn-icon-text save_btn btn-sm" >
                            <i class="icon-doc btn-icon-prepend"></i> Edit </button>


                      <button type="reset" class="btn btn-danger btn-icon-text reset_btn btn-sm"  >
                            <i class="icon-reload btn-icon-prepend"></i> Reset </button>
                            <input type="hidden" id="row_id" value="0">
                          </div>
                    </form>
    </div>
</div>
</div>

<div id="table-div">
<div class="page-header form-header" >
  <h3 class="page-title text-white">  <?= $rows->menu_name;?> </h3>
    <nav aria-label="breadcrumb">
      <ol class="breadcrumb">
      
        <li class="breadcrumb-item text-white  icon-md " aria-current="page"><i class="icon-plus slide2"></i> </li>
      </ol>
    </nav>
</div>

  

<div class="card">
  


    <div class="col-lg-12 col-sm-12 col-md-12" id="table_result">
                                            
                                            </div>


    
    
</div>
</div>





<script type="text/javascript">

set_date();

function save_submit_form() {
 status=0;
 if($.trim($('#po_no').val())==''){
    alert('P.O NO is mandatory');
    $('#po_no').focus();
    status==1;
    return;
 }
 sup_con=$.trim($('input[name="optradio"]:checked').val());
if(sup_con==1){
    lab='Supplier'
 }else{
  lab='Contractor';
 }
  if($.trim($('#con_sup_name').val())==''){
    alert(lab+' Name is mandatory');
    $('#con_sup_name').focus();
    status==1;
    return;
 }
if(sup_con==1){
  if($.trim($('#product_id').val())==''){
    alert(' Material is mandatory');
    $('#product_id').focus();
    status==1;
    return;
 }
}

 if($.trim($('#bill_amount').val())==''){
    alert('Amount is mandatory');
    $('#bill_amount').focus();
    status==1;
    return;
 }


 if($.trim($('#bill_no').val())==''){
    alert('Bill No is mandatory');
    $('#bill_no').focus();
    status==1;
    return;
 }

 if (status==0) {
Save_form();
 }
}


function  show_form(){
    $("#form-div").show(500);
$("#table-div").hide();
}




function set_edit_form(row_id) {
  show_form();
$('#row_id' ).val(row_id);
$("#edit_btn").show();
$("#save_btn").hide();

    $('#row_id').val(row_id);
    $('#hidden_status').val(1);
        $.ajax({
              type: 'POST',
               async: false,
                url: '/edit_bill_submit',
                data: {
                     '_token': "<?php echo e(csrf_token()); ?>",
                    'cid':"<?php echo e(Session::get('cid')); ?>",
                     row_id: row_id
         
                },
                error: function (request, error) {
                    alert("Please Wait, Loading...");
                },
                success: function (response) {
 datas=response;

     
        
            $('#po_con_no').val(datas.po_con_no); 
            $('#po_no').val(datas.po_no); 
            $('#po_date').val(datas.po_date); 
            $('#phone2').val(datas.phone2); 
            $('#po_description').val(datas.po_description); 
            $('#po_amount').val(datas.po_amount); 
            $('#po_limit').val(datas.po_limit); 
            $('#est_comp_date').val(datas.est_comp_date); 
     
   
            
       // start_focus();   
        }
          
     });  
}









  function Save_form() {

           $.ajax({
          url: "/op_bill_submit",
          type: "POST",
          data:{
             '_token': "<?php echo e(csrf_token()); ?>",
             'hidden_status':$.trim($('#hidden_status').val()),
              'row_id':$.trim($('#row_id').val()),
              'po_id':$.trim($('#po_no').attr('pod_a_id')),
              'po_no':$.trim($('#po_con_no').val()),
              'product_id':$.trim($('#product_id').attr('product_id')),
              'c_type':$.trim($('input[name="optradio"]:checked').val()),
              'c_name':$.trim($('#con_sup_name').val()),
              'c_id':$.trim($('#con_sup_name').attr('c_id')),
              'bill_date':$.trim($('#bill_date').val()),
              'bill_amt':$.trim($('#bill_amount').val()),
              'bill_no':$.trim($('#bill_no').val()),
              'submsn_date':$.trim($('#sub_date').val()),
              'remark':$.trim($('#Remark').val()),
              'added_by':"<?php echo e(Session::get('user_id')); ?>",
              'company_id':"<?php echo e(Session::get('CID')); ?>"
         
             
          },
          success:function(response){

            
            alert(response.msg);
if(response.flag!=0){
  $('#row_id').val(0);

$('.input_txt').val('');
}
         
           


          },
          error: function(response) {
          }
         });
  }


//.......................script.............................................
  get_bill_for_settle();
function get_bill_for_settle() {

        $.ajax({
              type: 'POST',
               async: false,
                url: '/get_bill_for_settle',
                data: {
                     '_token': "<?php echo e(csrf_token()); ?>",
                    
         
                },
                error: function (request, error) {
                    alert("Please Wait, Loading...");
                },
                success: function (response) {
 datas=response;

     
        
            $('#po_con_no').val(datas.po_con_no); 
            $('#po_no').val(datas.po_no); 
            $('#po_date').val(datas.po_date); 
            $('#phone2').val(datas.phone2); 
            $('#po_description').val(datas.po_description); 
            $('#po_amount').val(datas.po_amount); 
            $('#po_limit').val(datas.po_limit); 
            $('#est_comp_date').val(datas.est_comp_date); 
     
   
            
       // start_focus();   
        }
          
     });  
}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\xampp\htdocs\petro\resources\views/bill_settelment.blade.php ENDPATH**/ ?>