<?php require_once('../auth/auth.php');?>
<?php  
$comid=$_GET['comid'];
$custom_prefix_query= mysqli_query($conn,"SELECT * FROM custom_prefix WHERE coid ='$comid'  LIMIT 1 ") or die (mysql_error());
 $rowpp= mysqli_fetch_assoc ($custom_prefix_query);
 $cpid=$rowpp['cpid'];




$cpid_check_default = mysqli_query($conn,"SELECT cpid  FROM custom_prefix WHERE coid='$comid'");
 $count = mysqli_num_rows($cpid_check_default);
if($count < 1){
mysqli_query($conn,"INSERT INTO `custom_prefix`( `coid`) VALUES ('$comid')")or die(mysqli_error($conn));
}


?>
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-3">
                <div class="card card-primary 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: 5px 8px;"><h3 class="card-title"><?php echo language(372);?></h3> <div class="card-tools"> <button type="button" class="btn btn-tool" data-card-widget="remove"> <i class="fas fa-times"></i>  </button> </div>
                </div>
                    <div class="card-body">
                        <div class="col-md-12">
                            <div class="row mt-2">

            


                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(373);?> <b class="text-danger"> *</b></label>
                                        <input type="text" maxlength="5" name="customer_prefix"  value="<?php echo $rowpp['customer_prefix'];?>" col_name="customer_prefix" cpid="<?php echo $cpid;?>" class="form-control form-control-sm inputselect onlive" required="true">
                                    </div>
                                </div>

                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(374);?>  <b class="text-danger"> *</b></label>
                                        <input type="text" maxlength="5" name="supplier_prefix"  value="<?php echo $rowpp['supplier_prefix'];?>" col_name="supplier_prefix" cpid="<?php echo $cpid;?>" class="form-control form-control-sm inputselect onlive" required="true">
                                    </div>
                                </div>
                                
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(417);?>  <b class="text-danger"> *</b></label>
                                        <input type="text" maxlength="5" name="pinv_prefix"  value="<?php echo $rowpp['pinv_prefix'];?>" col_name="pinv_prefix" cpid="<?php echo $cpid;?>" class="form-control form-control-sm inputselect onlive" required="true">
                                    </div>
                                </div>
                                
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(418);?>  <b class="text-danger"> *</b></label>
                                        <input type="text" maxlength="5" name="tran_prefix"  value="<?php echo $rowpp['tran_prefix'];?>" col_name="tran_prefix" cpid="<?php echo $cpid;?>" class="form-control form-control-sm inputselect onlive" required="true">
                                    </div>
                                </div>
                     

                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        <div class="col-md-9"   id="row_show<?php echo $rowps['layout'];?>">  </div>
    </div>
</div>
</section>
                             

<script type="text/javascript">
  $(document).ready(function() {
        $("select").select2();
    $(".onlive").on(' change blur', function(){
      cpid = $(this).attr("cpid");
      col_name = $(this).attr("col_name");
      col_value = $(this).val();
      $.ajax({
        type: "POST",
        url: "../company_setup/printer_setup_db.php",
        data: ({cpid: cpid,col_name: col_name,col_value:col_value}),
        cache:false,
      });


      $.post('../company_setup/prefix_index.php?comid='+'<?php echo $comid ;?>',{},function(res){
       $('#com_profile_view').html(res);
     }); 

       toastr.success(Showing, '<?php echo "Data Load Succefully " ?>');

    });
  });
</script>
