<!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">
  <style>
#tooltip
{
    text-align: center;
    color: #FFF;
    background: #777777;
    position: absolute;
    z-index: 100;
    padding: 8px 15px;
	font-size:12px;
	font-family: 'Roboto', sans-serif;
}
 
    #tooltip:after /* triangle decoration */
    {
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 10px solid #777777;
        content: '';
        position: absolute;
        left: 50%;
        bottom: -10px;
        margin-left: -10px;
    }
 
        #tooltip.top:after
        {
            border-top-color: transparent;
            border-bottom: 10px solid #777777;
            top: -20px;
            bottom: auto;
        }
 
        #tooltip.left:after
        {
            left: 10px;
            margin: 0;
        }
 
        #tooltip.right:after
        {
            right: 10px;
            left: auto;
            margin: 0;
        }
.fulldiv {
    float: left;
    width: 100%;
    height: 100%;
    top: 0;
    bottom: 0;
    background-color: rgba(38, 53, 68, 0.80);
    background: rgba(38, 53, 68, 0.80);
    z-index: 1500;
    position: fixed;
}
	  .message_maindiv_new {
    width: 430px;
    height: auto;
    margin: 0px auto;
}
	  .message_div_new {
    float: left;
    width: 100%;
    height: auto;
    padding: 3%;
    background-color: #FFFFFF;
    margin-top: 300px;
}
	  .message_title {
    float: left;
    width: 100%;
    height: auto;
    text-align: center;
    font-size: 20px;
    color: #000000;
    margin-bottom: 20px;
    text-transform: capitalize;
	  }
	  
	  .bg-maroon{
	  background-color:#d5042d !important;
	  }
	  


        .col-sm-12 {
        -ms-flex: 0 0 100%;
        flex: 0 0 100%;
        max-width: 100%;
        font-size: 13px;
    }


    th{

        font-size: 13px;

        
    }

button:focus{

outline: none;

}


</style>
<script>
$( function()
{
    var targets = $( '[rel~=tooltip]' ),
        target  = false,
        tooltip = false,
        title   = false;
 
    targets.bind( 'mouseenter', function()
    {
        target  = $( this );
        tip     = target.attr( 'title' );
        tooltip = $( '<div id="tooltip"></div>' );
 
        if( !tip || tip == '' )
            return false;
 
        target.removeAttr( 'title' );
        tooltip.css( 'opacity', 0 )
               .html( tip )
               .appendTo( 'body' );
 
        var init_tooltip = function()
        {
            if( $( window ).width() < tooltip.outerWidth() * 1.5 )
                tooltip.css( 'max-width', $( window ).width() / 2 );
            else
                tooltip.css( 'max-width', 340 );
 
            var pos_left = target.offset().left + ( target.outerWidth() / 2 ) - ( tooltip.outerWidth() / 2 ),
                pos_top  = target.offset().top - tooltip.outerHeight() - 20;
 
            if( pos_left < 0 )
            {
                pos_left = target.offset().left + target.outerWidth() / 2 - 20;
                tooltip.addClass( 'left' );
            }
            else
                tooltip.removeClass( 'left' );
 
            if( pos_left + tooltip.outerWidth() > $( window ).width() )
            {
                pos_left = target.offset().left - tooltip.outerWidth() + target.outerWidth() / 2 + 20;
                tooltip.addClass( 'right' );
            }
            else
                tooltip.removeClass( 'right' );
 
            if( pos_top < 0 )
            {
                var pos_top  = target.offset().top + target.outerHeight();
                tooltip.addClass( 'top' );
            }
            else
                tooltip.removeClass( 'top' );
 
            tooltip.css( { left: pos_left, top: pos_top } )
                   .animate( { top: '+=10', opacity: 1 }, 50 );
        };
 
        init_tooltip();
        $( window ).resize( init_tooltip );
 
        var remove_tooltip = function()
        {
            tooltip.animate( { top: '-=10', opacity: 0 }, 50, function()
            {
                $( this ).remove();
            });
 
            target.attr( 'title', tip );
        };
 
        target.bind( 'mouseleave', remove_tooltip );
        tooltip.bind( 'click', remove_tooltip );
    });
});
</script>
	
	</head>
	<body class="hold-transition sidebar-mini">
		
		
<div class="wrapper">
  <!-- Navbar -->
    <?php include ("topheader.php"); ?>
  <!-- /.navbar -->
  <!-- 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">
                    <h1></h1>
                </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">
      <div class="card">
                        <div class="card-header">
        <h4>Export For Certification 
            <!-- <button type="button" class="btn btn-custom" style="float: right; background-color: #ffd700; color: #062e50;" data-toggle="modal" data-target="#ratemodal"><i class="fa-solid fa-circle-plus fa-beat"></i> ADD RATE</button> -->
        </h4>
    </div>




            <div class="card-body">
<!--             <a href="export-for-certification.php"><button type="button" class="btn btn-custom" style="float: right; background-color: #17a2b8; color: #ffff;" data-toggle="modal" data-target="#ratemodal"> Export</button></a> -->

<div class="d-flex justify-content-end" >

<div><input type="button" class="btn btn-primary btn-block mt-2" value="Send For Certification" onClick="update_igi()" style="width:200px; margin-top:30px !important;"></div>

</div>

<?php 


$table_name = "gold_temp_product_master";
$fields = "*";
$condition = "SLN>0 and add_to_product='No' and igi_updation='No' and confirm='Yes' and update_for_certification!='Yes' ORDER BY SLN DESC"; // Modify as necessary

// Fetch data from the table
$temp_product = $Mainclass->Fetch_multiple_data($table_name, $fields, $condition);




?>

<table id="example1" class="table table-bordered table-striped" >
    <thead >
        <tr >
         <th> <input onclick="check_all()" type="checkbox" name="allselect" id="allselect" style="margin-right:4px;"> </th>

            <th>Product Id</th>

            <th>Gold Weight</th>

            <th>Metal Type</th>

            <th>Metal Color</th>

            <th>Stone</th>
            <th>Stone Qty</th>

            <th>Diamond Type</th>
            <th>Diamond Quality</th>
            <th>Diamond Color</th>
            <th>Diamond Size</th>
            <th>Diamond Qty</th>

            <th>Solitaire Type</th>
            <th>Solitaire Quality</th>
            <th>Solitaire Color</th>
            <th>Solitaire Size</th>
            <th>Solitaire Qty</th>

        </tr>
    </thead>
    <tbody>
        <?php
        $i = 1;
        foreach ($temp_product as $temp_product) {



$metal_type = "Gold";

if($temp_product['has_stone']=="Yes"){

$stone_name = $temp_product['StoneName'];
$stone_qty  = $temp_product['No_Stone'];

}

else{

$stone_name = "-";
$stone_qty  = "-";

}

if($temp_product['has_diamond']=="Yes"){

$Diamond_Creation_Type = $temp_product['Diamond_Creation_Type'];
$DiamondQuality  = $temp_product['DiamondQuality'];
$DiamondColor = $temp_product['DiamondColor'];
$DiamondType  = $temp_product['DiamondType'];
$No_Diamond  = $temp_product['No_Diamond'];
}

else{
$Diamond_Creation_Type = "-";
$DiamondQuality  = "-";
$DiamondColor = "-";
$DiamondType  = "-";
$No_Diamond  = "-";

}


if($temp_product['has_solitaire']=="Yes"){

$Solitaire_Creation_Type = $temp_product['Solitaire_Creation_Type'];
$SolitaireQuality  = $temp_product['SolitaireQuality'];
$SolitaireColor = $temp_product['SolitaireColor'];
$SolitaireType  = $temp_product['SolitaireType'];
$No_Solitaire  = $temp_product['No_Solitaire'];
}

else{
$Solitaire_Creation_Type = "-";
$SolitaireQuality  = "-";
$SolitaireColor = "-";
$SolitaireType  = "-";
$No_Solitaire  = "-";

}


        ?>
        

        <tr>
            <td> <input class="chkall" type="checkbox" name="selectitem<?php echo $i;?>" id="selectitem<?php echo $i;?>"> </td>

                 <input type="hidden" value="<?php echo $temp_product['SLN']; ?>" id="itemsln<?php echo $i;?>" />

            <td><?php echo $temp_product['Product_Id']; ?></td>
            <td><?php echo $temp_product['GoldWeight']; ?> GM</td>
            <td><?php echo $metal_type; ?></td>
            <td><?php echo $temp_product['Color']; ?></td>
            <td><?php echo $stone_name; ?></td>
            <td><?php echo $stone_qty; ?></td>
            <td><?php echo $Diamond_Creation_Type; ?></td>
            <td><?php echo $DiamondQuality; ?></td>
            <td><?php echo $DiamondColor; ?></td>
            <td><?php echo $DiamondType; ?></td>
            <td><?php echo $No_Diamond; ?></td>
            <td><?php echo $Solitaire_Creation_Type; ?></td>
            <td><?php echo $SolitaireQuality; ?></td>
            <td><?php echo $SolitaireColor; ?></td>
            <td><?php echo $SolitaireType; ?></td>
            <td><?php echo $No_Solitaire; ?></td>


        </tr>
        <?php
            $i++;
        }
        ?>
    </tbody>
</table>

<input type="hidden" name="count" id="count" value="<?php echo $i-1?>">

<div class="d-flex justify-content-end" >

<div><input type="button" class="btn btn-primary btn-block mt-2" value="Send For Certification" onClick="update_igi()" style="width:200px; margin-top:30px !important;"></div>

</div>


                        </div>
                    </div> 
				</div>
            <!-- /.card -->
			</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,
      "searching": true,
      "scrollX": true, // Enable horizontal scroll
      "paging": false,
      "buttons": ["csv", "excel"]
    }).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,
      "scrollX": true, // Enable horizontal scroll
      "columnDefs": [
        { "width": "25%", "targets": 2 }, // Set width for the third column
      ]
    });
  });
  
  
</script>
	<script>
    /*ClassicEditor
        .create( document.querySelector( '#responsibility' ) )
        .catch( error => {
            console.error( error );
        } );*/
		var myEditor;

    ClassicEditor
        .create( document.querySelector( '#responsibility' ) )
        .then( editor => {
            console.log( 'Editor was initialized', editor );
            myEditor = editor;
        } )
        .catch( err => {
            console.error( err.stack );
        } );
    
</script>
	<script>
		function close_modal()
  {
    $(':input').val('');
    $('#ratemodal').modal('hide');
    $(':input').css('border-color','');
  }	
  

  
		</script>	
	
	<script>


            function check_all()

        {

            if ($('#allselect').is(":checked"))

            {

             $('.chkall').prop('checked', true);



            }

            else

            {

                $('.chkall').prop('checked', false);

            }

        }

function update_igi(){
    

var count=$("#count").val();

            var slno="";

            for(var a=1; a<=count; a++)

            {

                var select_sln=$("#itemsln"+a).val();

               // alert(select_sln);

                if ($('#selectitem'+a).is(":checked"))

                {

                   // alert(select_sln);

                    slno=slno+","+select_sln;

                }

           

            }

$.ajax({
url:'ajax-data-check.php',
type:'POST',
data:{slno:slno},
success:function(f){
    
if(f==1){


Swal.fire({
icon: 'warning',
title: 'Warning',
text: 'Please select at least one data',
width: '450px',
showConfirmButton:false,
timer:2000,
});

}

else{



$.ajax({
url:'ajax-update-for-certification.php',
type:'POST',
data:{slno:slno},
success:function(f){


Swal.fire({
icon: 'success',
title: 'Success',
text: 'Products have been successfully sent for certification update.',
width: '450px',
showConfirmButton:false,
timer:2000,
}).then(function() {
window.location.href="add_product_igi.php";
});
  
}

});




}


}

});


}
    

    
</script>   
		
</body>
</html>