<?php session_start();
include ('../inc/dbcon.php');
include ('../inc/functions.php');
if(isset($_SESSION["axeslogin"]) && $_SESSION["axeslogin"] == true){
$_SESSION['cuPages']='war_deliverd.php';   
$cuPage='war_deliverd.php';    
$aid=$_SESSION['uid'];
$brid=$_SESSION['abrid'];     
}else{
header('Location:../index.php');
exit;    
}
$mhead='waaranty';
$menuh='Warranty Management';
$phead='wapdeli';
$page='Product Deliverd';
$dtnow = date("Y-m-d h:i:s", time());
?>
<?php
include('../layout/head.php');
include('../layout/header.php');
include('../layout/side_nav.php');
?>

<div class="content-wrapper">
<?php include('../layout/page_head.php'); ?>
<!-- Main content -->
<section class="content">

<div class="row">
<div class="col-md-9">
<div class="box box-solid">
<div class="box-header with-border">
<h3 class="box-title">All Warranty Delivered Record</h3>
</div>
<div class="box-body">
<?php echo display_msg();?>    
<div class="col-md-12 table-responsive">
<table class="table table-bordered table-striped" id="datarec">
<thead>
<tr>
<th style="width:40px; text-align:center;">SN</th>   
<th>Date</th>
<th>Claim No</th>   
<th>Product</th> 
<th>Serial</th>
<th>D.Product</th> 
<th>D.Serial</th>
<th>Settelment</th>     
<th>Delivery Note</th>
<th>Status</th>       
<th style="width:40px; text-align:center;">Action</th>    
</tr>
</thead>    
<tbody id="itemdata">  
  
</tbody>   
</table>
</div>    
</div>
</div>
</div>
<div class="col-md-3">
<div class="row">
<div class="col-md-12">
<div class="box box-solid">
<div class="box-header">
<h3 class="box-title">History </h3>
</div>
<!-- /.box-header -->
<div class="box-body" id="hisdata">

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

<?php include('../layout/quick.php');?>    
</section>
<!-- /.main content -->
<?php include('../layout/rside.php'); ?>
<?php include('../layout/details.php'); ?>    
</div>
<?php
include('../layout/footer.php');
?>
<!-- page script -->
<script type="text/javascript">
ReadITEM();
function ReadITEM() {
$.ajax({
url: "war_cla_cart.php",
method: "POST",
data:{viewdeliver:1},
beforeSend: function () {
$('#datarec').DataTable().clear().destroy();    
},    
success: function(data) {
$('#itemdata').html(data);
$('#datarec').DataTable({stateSave: true});    
}
})
    
$.ajax({
url: "war_cla_cart.php",
method: "POST",
data:{viewitemhis:1},    
success: function(data) {
$('#hisdata').html(data);     
}
})   
} 
    
$(document).on('click', '.details-wardeli', function(e) {    
id_arr = $(this).attr('id');
id = id_arr.split("_");
ids=id[1];    
$.ajax({
url: "war_cla_cart.php",
method: "POST",
data:{manwadeliver:1,item:ids},
success: function(data){
$('#addsitem').html(data);
$('.right-side-add').toggle('slide', { direction: 'right' }, 300);     
}
})    
e.preventDefault();    
});    
    
$(document).on('click', '#closepop', function() {
if($('.right-side-add').is(':visible')) { $('.right-side-add').toggle('slide', { direction: 'right' }, 300); }
$('#addsitem').html('');    
});

$(document).on('click', '#additem', function() { 
var cash_data = $('.addservice input, .addservice select, .addservice textarea');
toastr.options = {'positionClass': 'toast-top-center'};    

$.ajax({
url: "war_cla_cart.php",
data: cash_data,
type: 'post',
dataType: 'json',        
success: function(data){
if(data.status === "success"){
if($('.right-side-add').is(':visible')) { $('.right-side-add').toggle('slide', { direction: 'right' }, 300); }
$('#addsitem').html('');    
toastr.success(data.message);
ReadITEM();    
}else{
toastr.error(data.message);    
}         
}
})    
});    
    
$(document).on('click', '#closedet', function() {
$('#profile').html('');
$('#details').html('');    
if($('.right-side-details').is(':visible')) {
$('.right-side-details').toggle('slide', { direction: 'right' }, 300);
}    
});
    
$(document).on('click', '.detailsrec', function(e) {    
id_arr = $(this).attr('id');
id = id_arr.split("_");
if(id[1]==0)return;
$.ajax({
url: 'axe_details.php',
method: "POST",
data:{ 
cusdet: 1,cusid: id[1],type:id[0]
},
success: function(data){
$('#profile').html(data);    
}
});    
    
$.ajax({
url: 'axe_details.php',
method: "POST",
data:{ 
tradet: 1,cusid: id[1],type:id[0]
},
success: function(data){
$('#details').html(data);   
}
});    
    
$('.right-side-details').toggle('slide', { direction: 'right' }, 300);    
e.preventDefault();    
});    
</script>    
<!-- /page script -->
</html>    