

<!DOCTYPE html>
<html lang="en">
<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Chandrani Pearls Gold Billing</title>
  <link rel="icon" type="image/jpg" href="dist/img/favicon.png?v=2">
  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  
  <!-- DataTables -->
  <link rel="stylesheet" href="plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <link rel="stylesheet" href="plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/adminlte.min.css">
	<link rel="stylesheet" href="dist/css/custom.css?v=2">
	<style>
	    label {
    display: inline-block;
    margin-bottom: 0rem;
}

.text-primary{
    color:#0a6abb !important;
}

	</style>

</head>
	


<body class="hold-transition sidebar-mini">
	
<div class="wrapper">




  <!-- Navbar -->
    <?php include ("topheader.php"); ?>
  <!-- Main Sidebar Container -->
    <?php include ("sidemenu.php"); ?>








  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
 
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h3>Add Product</h3>
                </div>
                <div class="col-sm-6">
                    
                </div>
            </div>
        </div>
    </section>
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            
            <!-- /.card -->
            <div class="card">
            
              
              <!-- /.card-header -->
			  
	
			  
              <div class="card-body">






<div class="row">
    
    
    
    
    
              
<div class="col-3" id="form_select">
<div class="form-group">
<label>Product Category <span style="color:crimson;font-weight:bold;">*</span></label>
<select class="form-control err" id="p_cate" name="p_cate" onchange="remove_error(),get_design_code()">
<option value="">--- please select---</option>
<?php
$fetch_p_cate=$Mainclass->Fetch_multiple_data("product_category_master","*","SLN!=''");
foreach ($fetch_p_cate as $get_p_cate)
{
?>
<option value="<?php echo $get_p_cate['SLN']?>"><?php echo $get_p_cate['Category']?></option>
<?php
}
?>
</select>
</div>
</div>

<div class="col-3" id="form_select">
<div class="form-group">
<label>Select Metal Type<span style="color:crimson;font-weight:bold;">*</span></label>
<select class="form-control err" id="p_cate" name="p_cate" onchange="remove_error(),get_design_code()">
<option value="">--- please select---</option>
<option value="Gold">Gold</option>
<option value="Silver">Silver</option>
</select>
</div>
</div>


<div class="col-3" id="form_select">
<div class="form-group">
<label>Design Code <span style="color:crimson;font-weight:bold;">*</span></label>
<select class="form-control err" id="design_id" name="design_id" onchange="remove_error(),get_data()">
<option value="">--- please select---</option>

</select>
</div>
</div>


<div class="col-3" id="form_select">
<div class="form-group">
<label>Quantity  <span style="color:crimson;font-weight:bold;">*</span></label>
<select class="form-control err" id="design_qty" name="design_qty" >
<option value="">--- please select---</option>

</select>
</div>
</div>

<div class="col-3" id="form_select">
<div class="form-group">
<label>Vendor Name  <span style="color:crimson;font-weight:bold;">*</span></label>
<select class="form-control err" id="vendor_name" name="vendor_name" >
<option value="">--- please select---</option>

</select>
</div>
</div>


<div class="col-3" id="form_select">
<div class="form-group">
<label>Vendor Design Code <span style="color:crimson;font-weight:bold;">*</span></label>
<input type="text" name="v_designcode" id="v_designcode" placeholder="Vendor Design Code" class="form-control err"  autocomplete="off" >
</div>
</div>


<div class="col-2 mt-lg-4" >
<input type="button" class="btn btn-primary" value="Next" style="width:100px;background-color:#0979d8;border: none;" >
</div>






</div>

<!--###### Product Details  #########-->

<div class="row mt-4 mb-5 border-bottom pb-4">
    
<div class="col-lg-2"><img src="https://placehold.co/200x200" class="w-100" /></div>    
    
<div class="col-lg-10">
    
<div class="row m-0">
<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Product Category</b></br>Bracelet</lable></div>    
    
<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Design Code</b></br>Bracelet</lable></div>

<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Product Name</b></br>Bracelet</lable></div> 
<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">HSN Code</b></br>Bracelet</lable></div> 

<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Gold Purity
</b></br>Bracelet</lable></div>

<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Gold Weight</b></br>Bracelet</lable></div> 

<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Stone</b></br>Bracelet</lable></div>

<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Stone Value</b></br>Bracelet</lable></div>

<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Diamond Purity</b></br>Bracelet</lable></div>

<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Diamond Value</b></br>Bracelet</lable></div> 

<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Making Charges Type</b></br>Bracelet</lable></div>

<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Making Charges Value</b></br>Bracelet</lable></div>

<div class="col-lg-3 col-12 mb-1"><lable><b class="text-primary">Wastage Cost</b></br>Bracelet</lable></div> 

<div class="col-lg-12 col-12 mb-1"><lable><b class="text-primary">Product Description</b></br>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it</lable></div> 
    
</div>    
    
    
</div>      
    
</div>

<!--###### Product Details  #########-->


<!--###### No of Product   #########-->


<div class="row mt-4 ">
<div class="col-3" id="form_select">
<div class="form-group">
<label>Gold Weight <span style="color:crimson;font-weight:bold;">*</span></label>
<input type="text" name="g_weight" id="g_weight" placeholder=" Enter Gold Weight " class="form-control err" onkeypress="remove_error()" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" autocomplete="off">
</div>
</div>

<div class="col-3" id="form_select">
<div class="form-group">
<label>Diamond Carat <span style="color:crimson;font-weight:bold;">*</span></label>
<input type="text" name="g_weight" id="g_weight" placeholder=" Enter Diamond Carat " class="form-control err" onkeypress="remove_error()" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" autocomplete="off">
</div>
</div>

<div class="col-3" id="form_select">
<div class="form-group">
<label>IGI No <span style="color:crimson;font-weight:bold;">*</span></label>
<input type="text" name="g_weight" id="g_weight" placeholder=" Enter IGI No " class="form-control err" onkeypress="remove_error()" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" autocomplete="off">
</div>
</div> 

<div class="col-3" id="form_select">
<div class="form-group">
<label>Hallmark No <span style="color:crimson;font-weight:bold;">*</span></label>
<input type="text" name="g_weight" id="g_weight" placeholder=" Enter Hallmark No" class="form-control err" onkeypress="remove_error()" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" autocomplete="off">
</div>
</div>

<div class="col-3" id="form_select">
<div class="form-group">
<label>Making Charge <span style="color:crimson;font-weight:bold;">*</span></label>
<input type="text" name="g_weight" id="g_weight" placeholder=" Enter Making Charge" readonly class="form-control err" onkeypress="remove_error()" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" autocomplete="off">
</div>
</div> 
    
</div>

<!--###### No of Product   #########-->

<!--###### Total MRP   #########-->

<div class="row mt-4">
 <div class="col-12"><hr>  </div> 
<div class="col-3" id="form_select">
<div class="form-group">
<label>MRP <span style="color:crimson;font-weight:bold;">*</span></label>
<input type="text" name="v_designcode" id="v_designcode" readonly placeholder="MRP" class="form-control err" autocomplete="off">
</div>
</div>

<div class="col-2 mt-lg-4">
<input type="button" class="btn btn-primary" value="Submit" style="width:100px;background-color:#0979d8;border: none;">
</div>
    
    
</div>











<!--<div class="row">

<div class="col-12">
<div class="form-group d-flex align-items-center justify-content-end" style="gap:30px;">
<div class="" role="alert" id="con-alrt" style="color: #e85c5c;text-align: center;font-size: 15px;display: none;">* Please provide information in all the required fields</div>
<input type="button" class="btn btn-primary" value="Submit"  style="width:100px;background-color:#0979d8;border: none;" onclick="Product_Val()">  
</div>
</div>


</div>-->



             
	




              <!-- /.card-body -->

            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->


    <?php include ("footer.php"); ?>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->


  </aside>
  <!-- /.control-sidebar -->
</div>




<!-- ./wrapper -->
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables  & Plugins -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="plugins/jszip/jszip.min.js"></script>
<script src="plugins/pdfmake/pdfmake.min.js"></script>
<script src="plugins/pdfmake/vfs_fonts.js"></script>
<script src="plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
<!-- Page specific script -->
<script>
  $(function () {
    $("#example1").DataTable({
      "responsive": true, "lengthChange": false, "autoWidth": false,
     // "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
    $('#example2').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,
    });
  });
</script>





<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" ></script>

  
<script type="text/javascript">


function Product_Val(){


var p_cate = $('#p_cate').val();
var design_id = $('#design_id').val();
var p_name = $('#p_name').val();
var h_code = $('#h_code').val();
var g_purity = $('#g_purity').val();
var g_weight = $('#g_weight').val();
var s_name = $('#s_name').val();
var stone_weight = $('#stone_weight').val();
var d_purity = $('#d_purity').val();
var diamond_weight = $('#diamond_weight').val();
var mk_ch = $('#mk_ch').val();
var mk_ch_val = $('#mk_ch_val').val();
var remark = $('#remark').val();
var wc = $('#wc').val();



var flag = 0;


if(p_cate==""){

$('#p_cate').css('border-color', '#e85c5c');

$('#con-alrt').show();

flag++;

}
else{

$('#p_cate').css('border-bottom-color', '');
}


if(design_id==""){

$('#design_id').css('border-color', '#e85c5c');

$('#con-alrt').show();

flag++;

}
else{

$('#design_id').css('border-bottom-color', '');
}



if(p_name==""){

$('#p_name').css('border-color', '#e85c5c');

$('#con-alrt').show();

flag++;

}
else{

$('#p_name').css('border-bottom-color', '');
}




if(g_weight==""){

$('#g_weight').css('border-color', '#e85c5c');

$('#con-alrt').show();

flag++;

}
else{

$('#g_weight').css('border-bottom-color', '');

$('#con-alrt').hide();
}


if(s_name!="" && stone_weight==""){

$('#stone_weight').css('border-color', '#e85c5c');

$('#con-alrt').show();

flag++;

}

else if(s_name=="" && stone_weight!=""){


$('#s_name').css('border-color', '#e85c5c');  

$('#con-alrt').show();

flag++;

}

else{

$('#con-alrt').hide();

$('#s_name').css('border-color', '');  

$('#stone_weight').css('border-color', '');

}




if(d_purity!="" && diamond_weight==""){

$('#diamond_weight').css('border-color', '#e85c5c'); 

$('#con-alrt').show();

flag++;

}

else if(d_purity=="" && diamond_weight!=""){


$('#d_purity').css('border-color', '#e85c5c'); 

$('#con-alrt').show();

flag++;

}

else{

$('#d_purity').css('border-bottom-color', '');

$('#diamond_weight').css('border-bottom-color', '');

$('#con-alrt').hide();

}



if(mk_ch==""){

$('#mk_ch').css('border-color', '#e85c5c'); 

flag++;

}
else{

$('#mk_ch').css('border-bottom-color', '');

}


if(mk_ch_val==""){

$('#mk_ch_val').css('border-color', '#e85c5c'); 

flag++;

}
else{

$('#mk_ch_val').css('border-bottom-color', '');

}


if(flag>0){

return false ;

}



else{

var data = {
    p_cate: p_cate,
    design_id: design_id,
    p_name: p_name,
    h_code: h_code,
    g_purity: g_purity,
    g_weight: g_weight,
    s_name: s_name,
    stone_weight: stone_weight,
    d_purity: d_purity,
    diamond_weight: diamond_weight,
    mk_ch: mk_ch,
    mk_ch_val: mk_ch_val,
    wc: wc,
    remark: remark
};

$.ajax({
  url:'ajax-add-gold-pro.php',
  type:'POST',
 data: data,
  success:function(f){


Swal.fire({
icon: 'success',
title: 'Success',
text: 'Product added successfully',
width: '450px',
showConfirmButton:false,
timer:3000,
}).then(function() {
window.location.href="add_product.php";
});


  }
  }); 

}

}

function remove_error(){

$('.err').css('border-color', '');

$('.label.ui.selection.fluid.dropdown.multiple').css('border-bottom-color', '');


}


function val_cha(){

var r_type = $('#r_type').val();

if(r_type=="Fixed"){

   $('#form_select1').show();
}

else{

   $('#form_select1').hide();

}



}


function get_design_code(){

var p_cate = $('#p_cate').val();

$.ajax({
url:'ajax-get-design-code.php',
type:'POST',
data:{p_cate:p_cate},
success:function(f){

$('#design_id').html(f);

}
});



}



function get_data(){

var design_id = $('#design_id').val();

$.ajax({
url:'ajax-get-data.php',
type:'POST',
data:{design_id:design_id},
success:function(f){

var data=f.split("*");

$('#p_name').val(data[0]);
$('#h_code').val(data[1]);
$('#g_purity').val(data[2]);
$('#s_name').val(data[3]);
$('#d_purity').val(data[4]);
$('#mk_ch').val(data[5]);
$('#remark').val(data[6]);


//$('#design_id').html(f);

}
});


}

</script>



<script type="text/javascript">
  

// $(document).ready(function(){

// $("input").on('input',function(){

// $('.err').css('border-bottom-color', '');

// });

// });


</script>


<!-- -=---- searchable dropdown link script ------ -->

<link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" rel="stylesheet" />

<script src="https://code.jquery.com/jquery-3.1.1.min.js"integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script>
<script>
        $('.ui.dropdown').dropdown();
</script>
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>



</body>
</html>