File: /home/cafsindia/refimac_cafsjobs_com/op_call_updation.php
<div id="contentwrapper">
<div class="main_content">
<div class="page-head">
<div class="container">
<!-- BEGIN PAGE TITLE -->
<div class="page-title">
<h1>Call Updation <small>Manage your Complaints.</small></h1>
</div>
</div>
</div>
<div class="page-content">
<div class="container">
<div class="row-fluid">
<div class="span12">
<?php
if($nav=="1"||$nav=="3")
echo "<div class='alert alert-success'>
<span>Given information successfully updated !</span>
</div>";
elseif($nav=="2"||$nav=="4"||$nav=="6")
echo "<div class='alert alert-warning'>
<span>sorry, given information not updated, please try again !</span>
</div>";
elseif($nav=="5")
echo "<div class='alert alert-danger'>
<span>Selected Record successfully deleted !</span>
</div>";
?>
</div>
</div>
<div class="page-content-inner">
<div class="portlet light">
<div class="page-content-inner">
<div class="row">
<div class="col-md-12">
<div class="portlet light ">
<div class="portlet-body">
<ul class="nav nav-tabs">
<li class="active">
<a href="#tab_1_1" data-toggle="tab"> Manage Complaints </a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="tab_1_1">
<div id="call_serchdiv">
<form name="form1" id="form1" method="post">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label> Complaint No. :</label>
<input name="searchtext" type="text" class="form-control col-md-4" id="searchtext" value="<?php echo $searchtext;?>" />
</div>
<div class="col-md-3"><br />
<input type="button" id="search" class="btn green" value="Search" >
</div>
</div>
</div>
</br>
</br>
<span id="searchresult">
</span>
</div>
</div>
</form>
</div>
<div class="row">
<div class="col-md-12">
<input type="image" src="assets/global/plugins/jquery-file-upload/img/loading.gif" id="searchloading" style="display:none;"/>
<div id="bookcomplaint" style="display:none">
</div>
</div>
</div>
<div class="clearfix margin-bottom-20"> </div>
</div>
</div>
</div>
</div>
</div>
<!--<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Brand Name<span class="f_req">*</span></label>
<input name="Brand_name" type="text" class="form-control" id="Brand_name" value="<?php echo $MAKE_NAME;?>" />
<span class="help-block">Please enter Brand Name</span>
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<button type="submit" class="btn green">Submit</button>
<button type="button" class="btn grey-salsa btn-outline cancel">Cancel</button>
</div>
</div>
</div>-->
</div>
<!--update customer customer start-->
<div class="modal fade" id="updatecustomermodel" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-full">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">Update Customer</h4>
</div>
<div class="modal-body" id="updatecustomer"> </div>
<div class="modal-footer">
<!--<button type="button" class="btn dark btn-outline" data-dismiss="modal">Close</button>
<button type="button" class="btn green">Save changes</button>-->
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!--update customer End-->
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function()
{
$('#loading').hide(); //initially hide the loading icon
$('#loading').ajaxStart(function(){
$(this).show();
console.log('shown');
});
$("#loading").ajaxStop(function(){
$(this).hide();
console.log('hidden');
});
// complaint Search
$( "#search" ).click(function(e) {
//show loading
//$('#searchloading').show();
// hide loading
$('#searchresult').hide();
//searchby = $('#searchby').val();
searchtext = $('#searchtext').val();
$.ajax({
type: "POST",
url: "ajax/loaddata.php",
data: {type:"1",pageid:"2_1_3",searchtext:searchtext},
success: function(msg) {
$('#searchloading').hide();
$('#searchresult').show();
$('#searchresult').html(msg);
table = $('#viewmachineinfo').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print','pageLength'
], lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
]
} );
}
});
});
//get search result
//model show
$( "#newcall" ).click(function(e) {
$('#fullmodel').modal('show');
});
});
//viewmachine
//model show
// save or update call completion
function addupdatecustomer()
{
event.preventDefault();
postvalue=($('#cust_form_update').serialize());
$.ajax({
type: "POST",
url: "add_details.php?type=1&pid=2_1_1",
data: postvalue,
success: function(msg) {
result=msg.split('|');
if(result[0]=="1")
{
$('#updatecustomermodel').modal('hide');
$('.msgsuccess').show();
//alert(result[1]);
//$('.msgsuccess').html('Data Save Scuessfully customer code'.result[0]);
searchcuatomerrecall('cust',result[1]);
}
else
{
alert("please try once again!");
return false;
}
}
});
}
// customer table function recall for fetch data
function searchcuatomerrecall(searchby,searchtext)
{
$.ajax({
type: "POST",
url: "ajax/loaddata.php",
data: {type:"3",pageid:"2_1_3",searchby:searchby,searchtext:searchtext},
success: function(msg) {
$('#complaint_cust_info').html(msg);
//
}
});
}
// update customer model
function updatecustomer(value)
{
$.ajax({
type: "POST",
url: "ajax/loaddata.php",
data: {type:"9",pageid:"2_1_1",custcode:value},
success: function(msg) {
$('#updatecustomer').html(msg);
$('#updatecustomermodel').modal('show');
}
});
}
//add new machine
//add new machine
function addnewmachine(value1,value)
{
$.ajax({
type: "POST",
url: "ajax/loaddata.php",
data: {type:"6",pageid:"2_1_1",custcode:value,salesid:value1},
success: function(msg) {
$('#addnewmachine').html(msg);
$('#serviceinfo').hide();
$('#addnewmachine').show();
$("#contentwrapper").find("[id^=mac_installdate]").each(function () {
bindDatePicker(this);
});
$("#contentwrapper").find("[id^=mac_invoice_date]").each(function () {
bindDatePicker(this);
});
$("#contentwrapper").find("[id^=mac_purchase_billdate]").each(function () {
bindDatePicker(this);
});
}
});
}
var bindDatePicker = function(element) {
$(element).datepicker(
{
});
};
// hide machine view
function hideaddnewmac()
{
$('#addnewmachine').hide();
}
function fetchmachineinfo()
{
//T023685^O.GENERAL^ASGA18FETA^21-11-2016^TN63206604^AC6159^23-02-2017
//T023685^O.GENERAL^ASGA18FETA^21-11-2016^TN63206604^AC6159^23-02-2017
event.preventDefault();
var macsource = $('.fetchmachineinfoval').attr("alt")
console.log(macsource);
macval=macsource.split('^');
$('#mac_serialno').val(macval[0]);
$('#mac_brand_name').val(macval[1]);
$('#mac_model_val').html(macval[2]);
$('#mac_model_id').val(macval[9]);
$('#mac_purchase_billdate').val(macval[3]);
$('#mac_purchase_billno').val(macval[4]);
$('#mac_invoice_no').val(macval[5]);
$('#mac_invoice_date').val(macval[6]);
$('#mac_brand_name').val(macval[7]);
$('#PURCHASE_ID').val(macval[8]);
$('#viewserialdetails').hide();
}
//calculate wrty date.
function calcuatewrty()
{
var mac_installdate= $('#mac_installdate').val();
var mac_wrty= $('#mac_wrty').val();
var mac_service_year= $('#mac_service_year').val();
if(mac_installdate!="" && mac_wrty!="")
{
$.ajax({
type: "POST",
url: "ajax/loaddata.php",
data: {type:"12",pageid:"2_1_1",mac_installdate:mac_installdate,mac_wrty:mac_wrty},
success: function(msg) {
$('#mac_maturitydate').val($.trim(msg));
//$('#searchresult').html(msg);
//$('#searchloading').hide();
//$('#searchresult').show();
}
});
}
else
{
// alert('Make Sure WRTY and INSTALLATION DATE is not empty');
}
//alert(date);
}
function savemachineinfo()
{
event.preventDefault();
postvalue=($('#form1').serialize());
$.ajax({
type: "POST",
url: "add_details.php?type=3&pid=2_1_1",
data: postvalue,
success: function(msg) {
result=msg.split('|');
if(result[0]=="1")
{
$('.msgsuccess').show();
//alert(result[1]);
//$('#machineadd_success').html('Machine Info Updated Successfully');
$('#sales_ID').val(result[1]);
//searchcuatomerrecall('cust',result[1]);
var cust_code=$('#custcode').val();
viewmachine(cust_code);
alert('Machine Info Updated Successfully');
}
else
{
alert("please try once again!");
return false;
}
}
});
}
//viewmachine
function viewmachine(value)
{
$.ajax({
type: "POST",
url: "ajax/loaddata.php",
data: {type:"4",pageid:"2_1_3",custcode:value},
success: function(msg) {
$('#complaint_machineinfo').html(msg);
table = $('#viewmachineinfo').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print','pageLength'
], lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
]
} );
}
});
}
function getmachine(e){
var keynum;
keynum = e.keyCode || e.which;
if(keynum==96)
{
var value=$('#mac_serialno').val();
$.ajax({
type: "POST",
url: "ajax/loaddata.php",
data: {type:"11",pageid:"2_1_1",serialno:value},
success: function(msg) {
$('#purchseandsalesinfo').html(msg);
$('#mac_serialno').val(value);
//$('#searchresult').html(msg);
//$('#searchloading').hide();
//$('#searchresult').show();
//
}
});
}
}
function savecallcomp()
{
// alert(111);
event.preventDefault();
postvalue=($('#form1').serialize());
$.ajax({
type: "POST",
url: "add_details.php?type=1&pid=2_1_3",
data: postvalue,
success: function(msg) {
result=msg.split('|');
if(result[0]=="1")
{
alert('Information Submited Successfully');
location.reload();
//alert(result[1]);
//$('.msgsuccess').html('Data Save Scuessfully customer code'.result[0]);
searchcuatomerrecall('cust',result[1]);
}
else
{
alert("please try once again!");
return false;
}
}
});
}
function getradiovalue()
{
alert($('input[name=selectsaleid]:checked').val());
}
// upload file ajax service
function uploadservice()
{
var file_data = $('#service_upload').prop('files')[0];
var form_data = new FormData();
form_data.append('file', file_data);
alert(form_data);
$.ajax({
url: 'ajax/uploadcompservice.php?id=1', // point to server-side PHP script
// dataType: 'text', // what to expect back from the PHP script, if anything
cache: false,
contentType: false,
processData: false,
data: form_data,
type: 'post',
success: function(php_script_response){
$('#hid_service_upload').val(php_script_response);
}
});
}
// upload file ajax service
function uploaddealer()
{
var file_data = $('#dealer_upload').prop('files')[0];
var form_data = new FormData();
form_data.append('file', file_data);
alert(form_data);
$.ajax({
url: 'ajax/uploadcompservice.php?id=2', // point to server-side PHP script
// dataType: 'text', // what to expect back from the PHP script, if anything
cache: false,
contentType: false,
processData: false,
data: form_data,
type: 'post',
success: function(php_script_response){
$('#hid_dealer_upload').val(php_script_response);
}
});
}
</script>