| Server IP : 162.214.74.102 / Your IP : 216.73.217.111 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_projetos/sopizzas/assets/js/ |
Upload File : |
var webroot = "http://sopizzas.lrsys.com.br/";
//var webroot = "http://www.orderingsystemonline.com/";
var cntrlUrl = webroot + "dashboard/";
var myCsrfHash = $('#myCsrf').attr('value');
var MAP_API_KEY = "AIzaSyA5APqkmsnXrc_rpZtXevo3Rv_lkPMKDwE";
var SITENAME_CURRENCY = "R$";
$(document).ready(function() {
//LiveFeed();
$('input[type="password"]').on({
keydown: function(e) {
if (e.which === 32)
return false;
}
});
$('form').attr('autocomplete', 'off');
$('input').attr('autocomplete', 'false');
$('body').click(function() {
if ($(".alert").is(':visible')==true) {
$('.alert').hide();
}
});
var fake = '<input style="display:none" type="text" value="" name="fakeusernameremembered"/> <input style="display:none" type="email" value="" name="fakeuseremailremembered"/> <input style="display:none" value="" type="password" name="fakepasswordremembered"/>';
$('form').prepend(fake);
});
function LiveFeed()
{
var url=cntrlUrl+'live_feed/';
$.ajax({
type: "post",
url: url,
cache: false,
data: {csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(feeddata){
//OVERVIEW : User
document.getElementById("TotalUsers").innerHTML = feeddata.TotalUsers;
document.getElementById("TotalUsers2").innerHTML = feeddata.TotalUsers;
document.getElementById("ActiveUsers").innerHTML = feeddata.ActiveUsers;
document.getElementById("InactiveUsers").innerHTML = feeddata.InactiveUsers;
document.getElementById("UserJoinedThisWeek").innerHTML = feeddata.UserJoinedThisWeek;
document.getElementById("UserJoinedThisMonth").innerHTML = feeddata.UserJoinedThisMonth;
document.getElementById("UserJoinedThisYear").innerHTML = feeddata.UserJoinedThisYear;
//***********************************************************************************
//OVERVIEW : Restaurants
document.getElementById("TotalOrder").innerHTML = feeddata.TotalOrder;
document.getElementById("TotalMerchant").innerHTML = feeddata.TotalMerchant;
document.getElementById("TotalMerchant2").innerHTML = feeddata.TotalMerchant;
document.getElementById("ActiveRestaurants").innerHTML = feeddata.ActiveRestaurants;
document.getElementById("InactiveRestaurants").innerHTML = feeddata.InactiveRestaurants;
document.getElementById("PendingRestaurants").innerHTML = feeddata.PendingRestaurants;
document.getElementById("RestaurantsJoinedWeek").innerHTML = feeddata.RestaurantsJoinedWeek;
document.getElementById("RestaurantsJoinedMonth").innerHTML = feeddata.RestaurantsJoinedMonth;
document.getElementById("RestaurantsJoinedYear").innerHTML = feeddata.RestaurantsJoinedYear;
//************************************************************************************
//#Dashboard Order List
document.getElementById("DashboardLastOrders").innerHTML = feeddata.DashboardLastOrders;
document.getElementById("DashboardtopDiscountRestaurants").innerHTML = feeddata.DashboardtopDiscountRestaurants;
//Order Statistics - today
document.getElementById("OrdersToday").innerHTML = feeddata.OrdersToday;
document.getElementById("SalesToday").innerHTML = SITENAME_CURRENCY+""+feeddata.SalesToday;
document.getElementById("DeliveredOrderToday").innerHTML = feeddata.DeliveredOrderToday;
document.getElementById("PendingOrderToday").innerHTML = feeddata.PendingOrderToday;
//Order Statistics - week
document.getElementById("OrdersWeek").innerHTML = feeddata.OrdersWeek;
document.getElementById("SalesWeek").innerHTML = SITENAME_CURRENCY+""+feeddata.SalesWeek;
document.getElementById("DeliveredOrderWeek").innerHTML = feeddata.DeliveredOrderWeek;
document.getElementById("PendingOrderWeek").innerHTML = feeddata.PendingOrderWeek;
//Order Statistics - month
document.getElementById("OrdersMonth").innerHTML = feeddata.OrdersMonth;
document.getElementById("SalesMonth").innerHTML = SITENAME_CURRENCY+""+feeddata.SalesMonth;
document.getElementById("DeliveredOrderMonth").innerHTML = feeddata.DeliveredOrderMonth;
document.getElementById("PendingOrderMonth").innerHTML = feeddata.PendingOrderMonth;
//Order Statistics - year
document.getElementById("OrdersYear").innerHTML = feeddata.OrdersYear;
document.getElementById("SalesYear").innerHTML = SITENAME_CURRENCY+""+feeddata.SalesYear;
document.getElementById("DeliveredOrderYear").innerHTML = feeddata.DeliveredOrderYear;
document.getElementById("PendingOrderYear").innerHTML = feeddata.PendingOrderYear;
//document.getElementById("eWallet").innerHTML = "<strong>$"+feeddata.e_Wallet+"</strong>";
},error:function(jqXHR,exception){if (jqXHR.status === 0) {
msg = 'Not connected.\n Verify Network.';
} else if (jqXHR.status == 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
console.log(msg);
}
});
}
function eWallet()
{
url=cntrlUrl+'eWallet/';
$.ajax({
type: "post",
url: url,
cache: false,
data: {csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(feeddata){
document.getElementById("eWallet").innerHTML = "<strong>"+SITENAME_CURRENCY+""+feeddata.e_Wallet+"</strong>";
},error:function(jqXHR,exception){if (jqXHR.status === 0) {
msg = 'Not connected.\n Verify Network.';
} else if (jqXHR.status == 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
//alert(msg);
}
});
}
function only_num(e,f)
{
if(window.e<8 ||(window.e>8 && window.e<46)||(window.e>46 && window.e<48)||window.e>57)
{
return false;
}
else if(e.which<8 ||(e.which>8 && e.which<46)||(e.which>46 && e.which<48)||e.which>57)
{
return false;
}
}
$(function(){
$("#myonoffswitchDine").change(function(){
test = $("#myonoffswitchDine").val();
$(".dine2you").toggleClass('hide');
});
})
function ChangeActiveInactive(table,status,id, myThis)
{
url=webroot+'superadmin/ChangeActiveInactive/';
$.ajax({
method: "POST",
url: url,
data: { table: table,id: id,status: status, csrf_token_apm: myCsrfHash },
beforeSend: function(){
/*$('<?php echo $this->loading; ?>').show();*/
},
success: function(data){
$(myThis).parents('td').find('button').removeClass('active');
$(myThis).addClass('active');
/*$('<?php echo $this->loading; ?>').hide();
$('<?php echo $this->target; ?>').html(data);*/
}
});
}
function ChangePopuler(table,status,id, myThis)
{
//url=cntrlUrl+'ChangePopuler/';
url=webroot+'superadmin/ChangePopuler/';
$.ajax({
method: "POST",
url: url,
data: { table: table,id: id,status: status, csrf_token_apm: myCsrfHash },
beforeSend: function(){
/*$('<?php echo $this->loading; ?>').show();*/
},
success: function(data){
$(myThis).parents('td').find('button').removeClass('active');
$(myThis).addClass('active');
/*$('<?php echo $this->loading; ?>').hide();
$('<?php echo $this->target; ?>').html(data);*/
}
});
}
function DeleteNow(table,id)
{
var result = confirm("Want to delete?");
if (result) {
url=webroot+'superadmin/DeleteNow/';
$.ajax({
method: "POST",
url: url,
data: { table: table,id: id, csrf_token_apm: myCsrfHash },
beforeSend: function(){
/*$('<?php echo $this->loading; ?>').show();*/
},
success: function(data){
$('#'+id+'_row').hide('slow');
alert('Deleted successfully!');
/*$('<?php echo $this->loading; ?>').hide();
$('<?php echo $this->target; ?>').html(data);*/
}
});
}
}
function DeleteNowCondition(table,id) {
url=webroot+'superadmin/DeleteNowCondition/';
$.ajax({
method: "POST",
url: url,
data: { table: table, id: id, why: 'check', csrf_token_apm: myCsrfHash },
beforeSend: function(){
$('#myLoader').show();
},
success: function(data) {
$('#myLoader').hide();
var result = confirm(data);
if (result) {
$.ajax({
method: "POST",
url: url,
data: { table: table, id: id, why: 'delete', csrf_token_apm: myCsrfHash },
beforeSend: function(){
$('#myLoader').show();
},
success: function(data){
$('#myLoader').hide();
$('#'+id+'_row').hide('slow');
alert('Deleted successfully!');
}
});
}
}
})
}
function GetCityByState(state_id)
{
url=webroot+'superadmin/GetCityByState/';
$.ajax({
type: "post",
url: url,
cache: false,
data:{state_id: state_id, csrf_token_apm: myCsrfHash},
success: function(data){
document.getElementById("CityList").innerHTML = data;
}
});
}
function isDecimal(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode == 46 && evt.srcElement.value.split('.').length>1) {
return false;
}
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}
function editContent(my_id) {
url=webroot+'contentmanagement/showContent';
$.ajax({
url: url,
type: 'POST',
data: {id: my_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
$('#content_title').val(data.ShowPageContent.content_title);
$('#metatagtitle').val(data.ShowPageContent.metatagtitle);
$('#metatagkeyword').val(data.ShowPageContent.metatagkeyword);
$('#metatagdescription').val(data.ShowPageContent.metatagdescription);
//$('#editor2').html(data.ShowPageContent.content);
//CKEDITOR.instances['editor2'].setData(content)
CKEDITOR.instances.editor2.setData(data.ShowPageContent.content);
$('#ContentEditId').val(data.ShowPageContent.content_id);
},
error: function(data) {
///alert('error');
console.log(data);
}
})
$('body').css('overflow', 'hidden');
$("#testPopupBottom1").animate({
'top': 0
}, 1000);
}
function editCoupon(coupon_id, coupon_code, offer_percentage, offer_price, offer_valid_from, offer_valid_to) {
document.getElementById('addcbutton').click();
document.getElementById('CouponEditId').value = coupon_id;
document.getElementById('coupon_code').value = coupon_code;
document.getElementById('offer_percentage').value = offer_percentage;
document.getElementById('offer_price').value = offer_price;
document.getElementById('offer_valid_from').value = offer_valid_from;
document.getElementById('offer_valid_to').value = offer_valid_to;
$('button').removeClass('disabled');
}
function update_order_status(orderid,status)
{
//alert(orderid);
//url=cntrlUrl+'ChangeOrderStatus/';
url=webroot+'superadmin/ChangeOrderStatus/';
$.ajax({
method: "POST",
url: url,
data: { order_id: orderid,order_status: status, csrf_token_apm: myCsrfHash },
beforeSend: function(){
/*$('<?php echo $this->loading; ?>').show();*/
},
success: function(data){
//$(myThis).parents('td').find('button').removeClass('active');
//$(myThis).addClass('active');
/*$('<?php echo $this->loading; ?>').hide();
$('<?php echo $this->target; ?>').html(data);*/
}
});
}
function update_invoice_status(invoice_id,status,tbl)
{
//alert(orderid);
//url=cntrlUrl+'ChangeOrderStatus/';
url=webroot+'superadmin/ChangeInvoiceStatus/';
$.ajax({
method: "POST",
url: url,
data: { invoice_id: invoice_id,status: status,tbl:tbl, csrf_token_apm: myCsrfHash },
beforeSend: function(){
/*$('<?php echo $this->loading; ?>').show();*/
},
success: function(data){
//$(myThis).parents('td').find('button').removeClass('active');
//$(myThis).addClass('active');
/*$('<?php echo $this->loading; ?>').hide();
$('<?php echo $this->target; ?>').html(data);*/
}
});
}
/*Added by Arkaprova 18th July 2016*/
function editState(state_id, statecode, statename) {
document.getElementById('addcbutton').click();
document.getElementById('StateEditId').value = state_id;
document.getElementById('statecode').value = statecode;
document.getElementById('statename').value = statename;
$('button').removeClass('disabled');
}
function editCity(city_id, statecode, cityname) {
document.getElementById('addcbutton').click();
document.getElementById('CityEditId').value = city_id;
document.getElementById('statecode').value = statecode;
document.getElementById('cityname').value = cityname;
$('button').removeClass('disabled');
}
function editCuisine(cuisine_id, cuisine_name, cuisine_photo, cuisine_description) {
document.getElementById('CuisineEditId').value = cuisine_id;
document.getElementById('cuisine_name').value = cuisine_name;
document.getElementById('cuisine_description').value = cuisine_description;
if(cuisine_photo!=''){
$('#uploaded_img').attr('src', webroot+'assets/uploaded_image/cuisine/thumbs/'+cuisine_photo).height(95);
$('#uploaded_img_wrap').show();
}
else {
$('#uploaded_img_wrap').hide();
}
$('button').removeClass('disabled');
var drawerTop = '0px';
$('body').css('overflow', 'hidden');
$("#testPopupBottom").animate({
'top': drawerTop
}, 1000);
}
function editCategory(maincateid, restaurant_id, maincatename, status, maincatedesc) {
document.getElementById('addcbutton').click();
document.getElementById('CategoryEditId').value = maincateid;
document.getElementById('maincatename').value = maincatename;
document.getElementById('maincatedesc').value = maincatedesc;
document.getElementById('restaurant_id').value = restaurant_id;
$('.CategoryStatusActive').removeClass('active');
$('.CategoryStatusInactive').removeClass('active');
if (status == '0') {
$('.CategoryStatusInactive').addClass('active');
}
else {
$('.CategoryStatusActive').addClass('active');
}
$('button').removeClass('disabled');
}
function editCategoryRest(maincateid, maincatename, status, maincatedesc) {
document.getElementById('addcbutton').click();
document.getElementById('CategoryEditId').value = maincateid;
document.getElementById('maincatename').value = maincatename;
document.getElementById('maincatedesc').value = maincatedesc;
$('.CategoryStatusActive').removeClass('active');
$('.CategoryStatusInactive').removeClass('active');
if (status == '0') {
$('.CategoryStatusInactive').addClass('active');
}
else {
$('.CategoryStatusActive').addClass('active');
}
$('button').removeClass('disabled');
}
function ChangeCategoryStatus(myStatus, myThis) {
$(myThis).parents('.btn-group-circle').find('button').removeClass('active');
$(myThis).addClass('active');
$('#CategoryStatus').val(myStatus);
}
function editOffer(offer_id, offer_percentage, offer_price, coupon_code, offer_valid_from, offer_valid_to, restaurant_id) {
$('#addCopen').show('slow');
document.getElementById('OfferEditId').value = offer_id;
//document.getElementById('offer_percentage').value = offer_percentage;
//document.getElementById('offer_price').value = offer_price;
if (offer_percentage > 0) {
document.getElementById('my_offer_amount').value = offer_percentage;
$('#my_offer_per').iCheck('check');
$('#my_offer_type').val('per');
}
else if (offer_price > 0) {
document.getElementById('my_offer_amount').value = offer_price;
$('#my_offer_fix').iCheck('check');
$('#my_offer_type').val('fix');
}
document.getElementById('coupon_code').value = coupon_code;
document.getElementById('offer_valid_from').value = offer_valid_from;
document.getElementById('offer_valid_to').value = offer_valid_to;
document.getElementById('restaurant_id').value = restaurant_id;
$('button').removeClass('disabled');
}
function editReward(reward_id, redemption_amount, redemption_point, redemption_code, offer_valid_from, offer_valid_to, partner_id) {
$('#addCopen').show('slow');
//alert(redemption_point);
document.getElementById('OfferEditId').value = reward_id;
//document.getElementById('offer_percentage').value = offer_percentage;
//document.getElementById('offer_price').value = offer_price;
if (redemption_amount > 0) {
document.getElementById('redemption_amount').value = redemption_amount;
// $('#my_offer_per').iCheck('check');
//$('#my_offer_type').val('per');
}
if (redemption_point > 0) {
document.getElementById('redemption_point').value = redemption_point;
//$('#my_offer_fix').iCheck('check');
// $('#my_offer_type').val('fix');
}
document.getElementById('redemption_code').value = redemption_code;
//document.getElementById('offer_valid_from').value = offer_valid_from;
//document.getElementById('offer_valid_to').value = offer_valid_to;
document.getElementById('partner_id').value = partner_id;
$('button').removeClass('disabled');
}
function editPartner(id, partner_name) {
$('#addCopen').show('slow');
//alert(redemption_point);
document.getElementById('OfferEditId').value = id;
document.getElementById('partner_name').value = partner_name;
$('button').removeClass('disabled');
}
function changePointAmount(obj){
//alert($(obj).val()+"\n"+$(obj).find("option:selected").attr("data-point"));
$("#voucher_point").val($(obj).find("option:selected").attr("data-point"));
$("#partner_name").val($(obj).find("option:selected").attr("data-partner_name"));
}
function editCustomer(customer_id, customer_name, customer_lastname, customer_buildtype, customer_street, customer_state, customer_city, customer_zip, customer_phone, customer_landline, customer_landmark, customer_addresslabel, customer_email, customer_password) {
document.getElementById('CustomerEditId').value = customer_id;
document.getElementById('customer_name').value = customer_name;
document.getElementById('customer_lastname').value = customer_lastname;
document.getElementById('customer_buildtype').value = customer_buildtype;
document.getElementById('customer_street').value = customer_street;
// document.getElementById('StateList').value = customer_state;
//GetCityByState(customer_state);
// document.getElementById('CityList').value = customer_city;
document.getElementById('customer_city').value = customer_city;
document.getElementById('customer_state').value = customer_state;
document.getElementById('customer_zip').value = customer_zip;
findAddressByZip(customer_zip);
document.getElementById('customer_phone').value = customer_phone;
// document.getElementById('customer_landline').value = customer_landline;
document.getElementById('customer_landmark').value = customer_landmark;
if (customer_addresslabel == "home") {
$('#adrsHome').iCheck('check');
}
else if (customer_addresslabel == "office") {
$('#adrsOffice').iCheck('check');
}
else if (customer_addresslabel == "other") {
$('#adrsOther').iCheck('check');
}
document.getElementById('customer_addresslabel').value = customer_addresslabel;
document.getElementById('customer_email').value = customer_email;
//document.getElementById('customer_password').value = customer_password;
var drawerTop = '0px';
$('body').css('overflow', 'hidden');
$("#testPopupBottom").animate({
'top': drawerTop
}, 1000);
$('button').removeClass('disabled');
$('#customer_password').attr('required', false);
}
function editZipcode(zipcode_id, statecode, cityid, zipcode, areaname) {
document.getElementById('addcbutton').click();
document.getElementById('ZipcodeEditId').value = zipcode_id;
document.getElementById('StateList').value = statecode;
GetCityByState(statecode);
document.getElementById('CityList').value = cityid;
document.getElementById('zipcode').value = zipcode;
document.getElementById('areaname').value = areaname;
$('button').removeClass('disabled');
}
function viewDriver(driver_id) {
//console.log(data);
$('#myLoader').show();
url=webroot+'drivermanagement/getDriverDataOriginal';
$.ajax({
url: url,
type: 'POST',
data: {driver_id: driver_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
if (data) {
document.getElementById('show_driver_first_name').innerHTML = data.driver_first_name;
document.getElementById('show_driver_middle_name').innerHTML = data.driver_middle_name;
document.getElementById('show_driver_last_name').innerHTML = data.driver_last_name;
//document.getElementById('show_driver_dob').innerHTML = data.driver_birth_day+"-"+data.driver_birth_month+"-"+data.driver_birth_year;
if (data.driver_dob != null) {
var tempDate = data.driver_dob;
tempDateParts = tempDate.split('-');
var driver_dob = tempDateParts[1] + '/' + tempDateParts[2] + '/' + tempDateParts[0];
document.getElementById('show_driver_dob').innerHTML = driver_dob;
}
document.getElementById('show_driver_email').innerHTML = data.driver_email;
document.getElementById('show_driver_mobile_number').innerHTML = data.driver_mobile_number;
document.getElementById('show_driver_device').innerHTML = data.driver_device;
document.getElementById('show_driver_city').innerHTML = data.driver_city;
//document.getElementById('show_driver_vehicle_type').innerHTML = data.driver_vehicle_type;
document.getElementById('show_driver_vehicle_make').innerHTML = data.driver_vehicle_make;
document.getElementById('show_driver_vehicle_model').innerHTML = data.driver_vehicle_model;
document.getElementById('show_driver_vehicle_year').innerHTML = data.driver_vehicle_year;
if (data.driver_photo != '') {
$('#show_driver_photo').attr('src', webroot+'assets/uploaded_image/driver/thumbs/'+data.driver_photo);
}
else {
$('#show_driver_photo').attr('src', webroot+'assets/uploaded_image/driver/thumbs/default.png');
}
document.getElementById('show_driver_license_number').innerHTML = data.driver_license_number;
document.getElementById('show_driver_license_plate_number').innerHTML = data.driver_license_plate_number;
document.getElementById('show_driver_license_state').innerHTML = data.statename;
if (data.driver_license_expire_dob != null) {
var tempDate = data.driver_license_expire_dob;
tempDateParts = tempDate.split('-');
var driver_license_expire_dob = tempDateParts[1] + '/' + tempDateParts[2] + '/' + tempDateParts[0];
document.getElementById('show_license_doe').innerHTML = driver_license_expire_dob;
}
document.getElementById('show_driver_insurance_provider').innerHTML = data.driver_insurance_provider;
document.getElementById('show_driver_insurance_number').innerHTML = data.driver_insurance_number;
document.getElementById('show_driver_state').innerHTML = data.driver_state;
document.getElementById('show_driver_zipcode').innerHTML = data.driver_zipcode;
document.getElementById('show_driver_social_security_number').innerHTML = data.driver_social_security_number;
document.getElementById('show_driver_license_first_name').innerHTML = data.driver_license_first_name;
document.getElementById('show_driver_license_middle_name').innerHTML = data.driver_license_middle_name;
document.getElementById('show_driver_license_last_name').innerHTML = data.driver_license_last_name;
document.getElementById('show_driver_bank_name').innerHTML = data.driver_bank_name;
document.getElementById('show_payee_name').innerHTML = data.payee_name;
var account_type = '';
if (data.payee_name != '') {
if (data.is_savings_account == 1) {
account_type += 'Savings';
}
else if (data.is_savings_account == 0) {
account_type += 'Checking';
}
if (data.is_personal_account == 1) {
account_type += ', Personal';
}
else if (data.is_personal_account == 0) {
account_type += ', Business';
}
document.getElementById('show_account_type').innerHTML = account_type;
}
document.getElementById('show_driver_bank_ac_no').innerHTML = data.driver_bank_ac_no;
document.getElementById('show_driver_routine_no').innerHTML = data.driver_routine_no;
document.getElementById('show_driver_swift_code').innerHTML = data.driver_swift_code;
document.getElementById('ownveichle').innerHTML = data.own_vehicle;
document.getElementById('validage').innerHTML = data.age_confirm;
document.getElementById('haspermit').innerHTML = data.has_work_permit;
document.getElementById('hasabn').innerHTML = data.has_abn;
document.getElementById('workperweek').innerHTML = data.working_hour;
}
},
error: function(data) {
//alert('error');
console.log(data);
}
})
$('#myLoader').hide();
$('body').css('overflow', 'hidden');
$("#testPopupBottom").animate({'top': 0},1000);
}
function viewDriverRestaurant(driver_id) {
//console.log(data);
$('#myLoader').show();
url=webroot+'drivermanagementrestaurant/getDriverDataOriginal';
$.ajax({
url: url,
type: 'POST',
data: {driver_id: driver_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
if (data) {
document.getElementById('show_driver_first_name').innerHTML = data.driver_first_name;
document.getElementById('show_driver_middle_name').innerHTML = data.driver_middle_name;
document.getElementById('show_driver_last_name').innerHTML = data.driver_last_name;
//document.getElementById('show_driver_dob').innerHTML = data.driver_birth_day+"-"+data.driver_birth_month+"-"+data.driver_birth_year;
if (data.driver_dob != null) {
var tempDate = data.driver_dob;
tempDateParts = tempDate.split('-');
var driver_dob = tempDateParts[1] + '/' + tempDateParts[2] + '/' + tempDateParts[0];
document.getElementById('show_driver_dob').innerHTML = driver_dob;
}
document.getElementById('show_driver_email').innerHTML = data.driver_email;
document.getElementById('show_driver_mobile_number').innerHTML = data.driver_mobile_number;
document.getElementById('show_driver_device').innerHTML = data.driver_device;
document.getElementById('show_driver_city').innerHTML = data.driver_city;
//document.getElementById('show_driver_vehicle_type').innerHTML = data.driver_vehicle_type;
document.getElementById('show_driver_vehicle_make').innerHTML = data.driver_vehicle_make;
document.getElementById('show_driver_vehicle_model').innerHTML = data.driver_vehicle_model;
document.getElementById('show_driver_vehicle_year').innerHTML = data.driver_vehicle_year;
if (data.driver_photo != '') {
$('#show_driver_photo').attr('src', webroot+'assets/uploaded_image/driver/thumbs/'+data.driver_photo);
}
else {
$('#show_driver_photo').attr('src', webroot+'assets/uploaded_image/driver/thumbs/default.png');
}
document.getElementById('show_driver_license_number').innerHTML = data.driver_license_number;
document.getElementById('show_driver_license_plate_number').innerHTML = data.driver_license_plate_number;
document.getElementById('show_driver_license_state').innerHTML = data.statename;
if (data.driver_license_expire_dob != null) {
var tempDate = data.driver_license_expire_dob;
tempDateParts = tempDate.split('-');
var driver_license_expire_dob = tempDateParts[1] + '/' + tempDateParts[2] + '/' + tempDateParts[0];
document.getElementById('show_license_doe').innerHTML = driver_license_expire_dob;
}
document.getElementById('show_driver_insurance_provider').innerHTML = data.driver_insurance_provider;
document.getElementById('show_driver_insurance_number').innerHTML = data.driver_insurance_number;
document.getElementById('show_driver_state').innerHTML = data.driver_state;
document.getElementById('show_driver_zipcode').innerHTML = data.driver_zipcode;
document.getElementById('show_driver_social_security_number').innerHTML = data.driver_social_security_number;
document.getElementById('show_driver_license_first_name').innerHTML = data.driver_license_first_name;
document.getElementById('show_driver_license_middle_name').innerHTML = data.driver_license_middle_name;
document.getElementById('show_driver_license_last_name').innerHTML = data.driver_license_last_name;
document.getElementById('show_driver_bank_name').innerHTML = data.driver_bank_name;
document.getElementById('show_payee_name').innerHTML = data.payee_name;
var account_type = '';
if (data.payee_name != '') {
if (data.is_savings_account == 1) {
account_type += 'Savings';
}
else if (data.is_savings_account == 0) {
account_type += 'Checking';
}
if (data.is_personal_account == 1) {
account_type += ', Personal';
}
else if (data.is_personal_account == 0) {
account_type += ', Business';
}
document.getElementById('show_account_type').innerHTML = account_type;
}
document.getElementById('show_driver_bank_ac_no').innerHTML = data.driver_bank_ac_no;
document.getElementById('show_driver_routine_no').innerHTML = data.driver_routine_no;
document.getElementById('show_driver_swift_code').innerHTML = data.driver_swift_code;
document.getElementById('ownveichle').innerHTML = data.own_vehicle;
document.getElementById('validage').innerHTML = data.age_confirm;
document.getElementById('haspermit').innerHTML = data.has_work_permit;
document.getElementById('hasabn').innerHTML = data.has_abn;
document.getElementById('workperweek').innerHTML = data.working_hour;
}
},
error: function(data) {
//alert('error');
console.log(data);
}
})
$('#myLoader').hide();
$('body').css('overflow', 'hidden');
$("#testPopupBottom").animate({'top': 0},1000);
}
function editDriver(driver_id) {
$("form").validator('update');
//console.log(data);
//alert($("input[name=ownVehicle][value=Yes]:checked").val());
$('#AddEditRename').html('Edit Driver');
document.getElementById('DriverEditId').value = driver_id;
url=webroot+'drivermanagement/getDriverDataOriginal';
$('#myLoader').show();
$.ajax({
url: url,
type: 'POST',
data: {driver_id: driver_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
if (data) {
console.log(data);
document.getElementById('driver_email').value = data.driver_email;
document.getElementById('driver_first_name').value = data.driver_first_name;
document.getElementById('driver_middle_name').value = data.driver_middle_name;
document.getElementById('driver_last_name').value = data.driver_last_name;
/*if (data.driver_dob != null) {
var tempDate = data.driver_dob;
tempDateParts = tempDate.split('-');
var driver_dob = tempDateParts[1] + '/' + tempDateParts[2] + '/' + tempDateParts[0];
document.getElementById('driver_dob').value = driver_dob;
}*/
// document.getElementById('driver_birth_month').value = data.driver_birth_month;
// document.getElementById('driver_birth_day').value = data.driver_birth_day;
// document.getElementById('driver_birth_year').value = data.driver_birth_year;
document.getElementById('driver_mobile_number').value = data.driver_mobile_number;
document.getElementById('driver_device').value = data.driver_device;
document.getElementById('driver_city').value = data.driver_city;
document.getElementById('driver_state').value = data.driver_state;
document.getElementById('driver_zipcode').value = data.driver_zipcode;
//document.getElementById('driver_vehicle_type').value = data.driver_vehicle_type;
document.getElementById('driver_vehicle_make').value = data.driver_vehicle_make;
document.getElementById('driver_vehicle_model').value = data.driver_vehicle_model;
document.getElementById('driver_vehicle_year').value = data.driver_vehicle_year;
document.getElementById('driver_license_first_name').value = data.driver_license_first_name;
document.getElementById('driver_license_last_name').value = data.driver_license_last_name;
document.getElementById('driver_license_middle_name').value = data.driver_license_middle_name;
if (data.driver_license_dob != null) {
var tempDate = data.driver_license_dob;
tempDateParts = tempDate.split('-');
var driver_license_dob = tempDateParts[1] + '/' + tempDateParts[2] + '/' + tempDateParts[0];
document.getElementById('driver_license_dob').value = driver_license_dob;
}
// document.getElementById('driver_license_birth_month').value = data.driver_license_birth_month;
// document.getElementById('driver_license_birth_day').value = data.driver_license_birth_day;
// document.getElementById('driver_license_birth_year').value = data.driver_license_birth_year;
document.getElementById('driver_license_number').value = data.driver_license_number;
document.getElementById('driver_license_plate_number').value = data.driver_license_plate_number;
document.getElementById('driver_license_state').value = data.driver_license_state;
if (data.driver_license_expire_dob != null) {
var tempDate = data.driver_license_expire_dob;
tempDateParts = tempDate.split('-');
var driver_license_expire_dob = tempDateParts[1] + '/' + tempDateParts[2] + '/' + tempDateParts[0];
document.getElementById('driver_license_expire_dob').value = driver_license_expire_dob;
}
// document.getElementById('driver_license_expire_month').value = data.driver_license_expire_month;
// document.getElementById('driver_license_expire_day').value = data.driver_license_expire_day;
// document.getElementById('driver_license_expire_year').value = data.driver_license_expire_year;
document.getElementById('driver_insurance_provider').value = data.driver_insurance_provider;
document.getElementById('driver_insurance_number').value = data.driver_insurance_number;
document.getElementById('driver_street_address').value = data.driver_street_address;
document.getElementById('driver_social_security_number').value = data.driver_social_security_number;
/*if (data.driver_license_photo != '') {
$('#uploaded_license_img').attr('src', webroot+'assets/uploaded_image/driver_license/thumbs/'+data.driver_license_photo).height(95);
$('#uploaded_license_img_wrap').show();
}
if (data.driver_insurance_photo != '') {
$('#uploaded_insurance_img').attr('src', webroot+'assets/uploaded_image/driver_insurance/thumbs/'+data.driver_insurance_photo).height(95);
$('#uploaded_insurance_img_wrap').show();
}*/
if (data.driver_license_photo != '') {
$('#uploaded_license_img').text(data.driver_license_photo);
}
if (data.driver_insurance_photo != '') {
$('#uploaded_insurance_img').text(data.driver_insurance_photo);
}
$('#payee_name').val(data.payee_name);
$('#driver_bank_ac_no').val(data.driver_bank_ac_no);
if (data.is_savings_account != '') {
$('#is_savings_account_'+data.is_savings_account).attr('checked', 'checked');
}
if (data.is_personal_account != '') {
$('#is_personal_account_'+data.is_personal_account).attr('checked', 'checked');
}
$('#driver_swift_code').val(data.driver_swift_code);
$('#driver_routine_no').val(data.driver_routine_no);
//alert(data.own_vehicle);
if(data.own_vehicle == "Yes")
{
$("input[name=ownVehicle][value=Yes]").attr('checked', 'checked');
}else {
$("input[name=ownVehicle][value=No]").attr('checked', 'checked');
}
if(data.age_confirm == "Yes")
{
$("input[name=ageConfirm][value=Yes]").attr('checked', 'checked');
}
else
{
$("input[name=ageConfirm][value=No]").attr('checked', 'checked');
}
if(data.has_work_permit == "Yes")
{
$("input[name=hasWorkPermit][value=Yes]").attr('checked', 'checked');
}else
{
$("input[name=hasWorkPermit][value=No]").attr('checked', 'checked');
}
if(data.has_abn == "Yes")
{
$("input[name=hasABN][value=Yes]").attr('checked', 'checked');
}else
{
$("input[name=hasABN][value=No]").attr('checked', 'checked');
}
if(data.working_hour == "1-12")
{
$("input[name=workingHour][value='1-12']").attr('checked', 'checked');
}
else if(data.working_hour == "13-20")
{
$("input[name=workingHour][value='13-20']").attr('checked', 'checked');
}
else if(data.working_hour == "21+")
{
$("input[name=workingHour][value='21+']").attr('checked', 'checked');
}
}
},
error: function(data) {
//alert('error occurred');
console.log(data);
}
})
$('#myLoader').hide();
$('body').css('overflow', 'hidden');
$("#testPopupBottom1").animate({'top': 0},1000);
$('#driver_password').attr('required', false);
}
function editDriverRestaurant(driver_id) {
$("form").validator('update');
//console.log(data);
//alert($("input[name=ownVehicle][value=Yes]:checked").val());
$('#AddEditRename').html('Edit Driver');
document.getElementById('DriverEditId').value = driver_id;
url=webroot+'drivermanagementrestaurant/getDriverDataOriginal';
$('#myLoader').show();
$.ajax({
url: url,
type: 'POST',
data: {driver_id: driver_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
if (data) {
console.log(data);
document.getElementById('driver_email').value = data.driver_email;
document.getElementById('driver_first_name').value = data.driver_first_name;
document.getElementById('driver_middle_name').value = data.driver_middle_name;
document.getElementById('driver_last_name').value = data.driver_last_name;
/*if (data.driver_dob != null) {
var tempDate = data.driver_dob;
tempDateParts = tempDate.split('-');
var driver_dob = tempDateParts[1] + '/' + tempDateParts[2] + '/' + tempDateParts[0];
document.getElementById('driver_dob').value = driver_dob;
}*/
// document.getElementById('driver_birth_month').value = data.driver_birth_month;
// document.getElementById('driver_birth_day').value = data.driver_birth_day;
// document.getElementById('driver_birth_year').value = data.driver_birth_year;
document.getElementById('driver_mobile_number').value = data.driver_mobile_number;
document.getElementById('driver_device').value = data.driver_device;
document.getElementById('driver_city').value = data.driver_city;
document.getElementById('driver_state').value = data.driver_state;
document.getElementById('driver_zipcode').value = data.driver_zipcode;
//document.getElementById('driver_vehicle_type').value = data.driver_vehicle_type;
document.getElementById('driver_vehicle_make').value = data.driver_vehicle_make;
document.getElementById('driver_vehicle_model').value = data.driver_vehicle_model;
document.getElementById('driver_vehicle_year').value = data.driver_vehicle_year;
document.getElementById('driver_license_first_name').value = data.driver_license_first_name;
document.getElementById('driver_license_last_name').value = data.driver_license_last_name;
document.getElementById('driver_license_middle_name').value = data.driver_license_middle_name;
if (data.driver_license_dob != null) {
var tempDate = data.driver_license_dob;
tempDateParts = tempDate.split('-');
var driver_license_dob = tempDateParts[1] + '/' + tempDateParts[2] + '/' + tempDateParts[0];
document.getElementById('driver_license_dob').value = driver_license_dob;
}
// document.getElementById('driver_license_birth_month').value = data.driver_license_birth_month;
// document.getElementById('driver_license_birth_day').value = data.driver_license_birth_day;
// document.getElementById('driver_license_birth_year').value = data.driver_license_birth_year;
document.getElementById('driver_license_number').value = data.driver_license_number;
document.getElementById('driver_license_plate_number').value = data.driver_license_plate_number;
document.getElementById('driver_license_state').value = data.driver_license_state;
if (data.driver_license_expire_dob != null) {
var tempDate = data.driver_license_expire_dob;
tempDateParts = tempDate.split('-');
var driver_license_expire_dob = tempDateParts[1] + '/' + tempDateParts[2] + '/' + tempDateParts[0];
document.getElementById('driver_license_expire_dob').value = driver_license_expire_dob;
}
// document.getElementById('driver_license_expire_month').value = data.driver_license_expire_month;
// document.getElementById('driver_license_expire_day').value = data.driver_license_expire_day;
// document.getElementById('driver_license_expire_year').value = data.driver_license_expire_year;
document.getElementById('driver_insurance_provider').value = data.driver_insurance_provider;
document.getElementById('driver_insurance_number').value = data.driver_insurance_number;
document.getElementById('driver_street_address').value = data.driver_street_address;
document.getElementById('driver_social_security_number').value = data.driver_social_security_number;
/*if (data.driver_license_photo != '') {
$('#uploaded_license_img').attr('src', webroot+'assets/uploaded_image/driver_license/thumbs/'+data.driver_license_photo).height(95);
$('#uploaded_license_img_wrap').show();
}
if (data.driver_insurance_photo != '') {
$('#uploaded_insurance_img').attr('src', webroot+'assets/uploaded_image/driver_insurance/thumbs/'+data.driver_insurance_photo).height(95);
$('#uploaded_insurance_img_wrap').show();
}*/
if (data.driver_license_photo != '') {
$('#uploaded_license_img').text(data.driver_license_photo);
}
if (data.driver_insurance_photo != '') {
$('#uploaded_insurance_img').text(data.driver_insurance_photo);
}
$('#payee_name').val(data.payee_name);
$('#driver_bank_ac_no').val(data.driver_bank_ac_no);
if (data.is_savings_account != '') {
$('#is_savings_account_'+data.is_savings_account).attr('checked', 'checked');
}
if (data.is_personal_account != '') {
$('#is_personal_account_'+data.is_personal_account).attr('checked', 'checked');
}
$('#driver_swift_code').val(data.driver_swift_code);
$('#driver_routine_no').val(data.driver_routine_no);
//alert(data.own_vehicle);
if(data.own_vehicle == "Yes")
{
$("input[name=ownVehicle][value=Yes]").prop('checked', true);
}else {
$("input[name=ownVehicle][value=No]").prop('checked', true);
}
if(data.age_confirm == "Yes")
{
$("input[name=ageConfirm][value=Yes]").prop('checked', true);
}
else
{
$("input[name=ageConfirm][value=No]").prop('checked', true);
}
if(data.has_work_permit == "Yes")
{
$("input[name=hasWorkPermit][value=Yes]").prop('checked', true);
}else
{
$("input[name=hasWorkPermit][value=No]").prop('checked', true);
}
if(data.has_abn == "Yes")
{
$("input[name=hasABN][value=Yes]").prop('checked', true);
}else
{
$("input[name=hasABN][value=No]").prop('checked', true);
}
console.log(data.working_hour);
if(data.working_hour == "1-12")
{
$("input[name=workingHour][value='1-12']").prop('checked', true);
}
else if(data.working_hour == "13-20")
{
$("input[name=workingHour][value='13-20']").prop('checked', true);
}
else if(data.working_hour == "21+")
{
$("input[name=workingHour][value='21+']").prop('checked', true);
}
}
},
error: function(data) {
//alert('error occurred');
console.log(data);
}
})
$('#myLoader').hide();
$('body').css('overflow', 'hidden');
$("#testPopupBottom1").animate({'top': 0},1000);
$('#driver_password').attr('required', false);
}
function editAddon(my_id, cont_nm) {
if (cont_nm === undefined) {
cont_nm = 'admin';
}
$('.EditSubAddonsRow').remove();
if(cont_nm=='restaurant')
{
url=webroot+'addonsmanagementrestaurant/showEditAddons';
}
if(cont_nm=='admin')
{
url=webroot+'addonsmanagement/showEditAddons';
}
//url=webroot+'addonsmanagement/showEditAddons';
//url=webroot+'addonsmanagementrestaurant/showEditAddons';
$.ajax({
url: url,
type: 'POST',
data: {id: my_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
//$('#testPopupBottom1').html(data);
//console.log(data.EditMainAddOns.restaurant_id);
$('#AddOnEditId').val(data.EditMainAddOns.id);
$('#edit_restaurant_name').val(data.EditMainAddOns.restaurant_id);
$('#edit_category_name').val(data.EditMainAddOns.category_id);
fetchCategoryByRest4(data.EditMainAddOns.restaurant_id,data.EditMainAddOns.category_id);
$('#edit_addons_name').val(data.EditMainAddOns.addonsname);
$('#edit_mainaddoncnt').val(data.EditMainAddOns.addonscount);
$('#EditootZ1').append(data.EditAddOnsHtml);
},
error: function(data) {
//alert('error');
console.log(data);
}
})
$('body').css('overflow', 'hidden');
$("#testPopupBottom1").animate({
'top': 0
}, 1000);
}
function removeRowMEdit(removeNum, cont_nm) {
if (cont_nm === undefined) {
cont_nm = 'admin';
}
jQuery('#adddonsX'+removeNum).remove();
var my_id = removeNum;
if(cont_nm=='restaurant')
{
url=webroot+'addonsmanagementrestaurant/deleteAddons';
}
if(cont_nm=='admin')
{
url=webroot+'addonsmanagement/deleteAddons';
}
$.ajax({
url: url,
type: 'POST',
data: {id: my_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
console.log(data);
},
error: function(data) {
//alert('error');
console.log(data);
}
})
}
function fetchCatAddons(catid,cont_nm) {
if (cont_nm === undefined) {
cont_nm = 'admin';
}
if(cont_nm=='restaurant')
{
url=webroot+'menumanagementrestaurant/fetchCatAddons';
}
if(cont_nm=='admin')
{
url = webroot+'menumanagement/fetchCatAddons';
}
$.ajax({
url: url,
type: 'POST',
data: {catid: catid, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
console.log(data);
$('#accordion').html(data.myHtml);
$(".panel-show").show();
},
error: function(data) {
//alert(data);
console.log(data);
}
})
}
function fetchCatAddonsRest(catid, menuid, cont_nm) {
if (cont_nm === undefined) {
cont_nm = 'admin';
}
if(cont_nm=='restaurant')
{
url=webroot+'menumanagementrestaurant/fetchCatAddons';
}
if(cont_nm=='admin')
{
url = webroot+'menumanagement/fetchCatAddons';
}
$.ajax({
url: url,
type: 'POST',
data: {catid: catid, menuid: menuid, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
//console.log(data);
$('#accordion').html(data.myHtml);
$(".panel-show").show();
},
error: function(data) {
//alert(data);
console.log(data);
}
})
}
function editMenu(menuid,cont_nm) {
/*var csrfToken = $('#myCsrf').val();*/
$('#menuFormHead').text('Edit Menu Item');
$('.EditMenuRow').remove();
if(cont_nm=='restaurant')
{
url=webroot+'menumanagementrestaurant/showEditMenu';
}
if(cont_nm=='admin')
{
url=webroot+'menumanagement/showEditMenu';
}
$('#ootZ1').removeClass('CheckSubAddon');
$.ajax({
url: url,
type: 'POST',
data: {menuid: menuid, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
$('#MenuEditId').val(data.menuDetails.id);
$('#restaurant_name').val(data.menuDetails.restaurant_id);
fetchCategoryByRest2(data.menuDetails.restaurant_id,data.menuDetails.menu_category);
$('#menu_name').val(data.menuDetails.menu_name);
fetchCatAddonsRest(data.menuDetails.menu_category,data.menuDetails.id,cont_nm);
$('#menu_type').val(data.menuDetails.menu_type);
$('#menu_cuisine').val(data.menuDetails.menu_cuisine);
$('#menu_price').val(data.menuDetails.menu_price);
$('#menu_addons').val(data.menuDetails.menu_addons);
$('#menu_spl_instruction').val(data.menuDetails.menu_spl_instruction);
$('#menu_description').val(data.menuDetails.menu_description);
//CKEDITOR.instances.menu_description.setData(data.menuDetails.menu_description);
$('#menu_popular_dish').val(data.menuDetails.menu_popular_dish);
$('#menu_spicy').val(data.menuDetails.menu_spicy);
$('#sizeoption').val(data.menuDetails.sizeoption);
$('#menu_nut').val(data.menuDetails.menu_nut);
$('#menu_hot').val(data.menuDetails.menu_hot);
if (data.menuDetails.menu_type == 'veg') {
$('#menu_type_veg').attr('checked', true);
}
else if (data.menuDetails.menu_type == 'nonveg') {
$('#menu_type_non_veg').attr('checked', true);
}
if (data.menuDetails.menu_popular_dish == 'Yes') {
$('#menu_populer_grp').attr('checked', true);
}
if (data.menuDetails.menu_nut == 'Yes') {
$('#menu_nut_grp').attr('checked', true);
}
if (data.menuDetails.menu_hot == 'medium') {
$('#hot_grp_medium').attr('checked', true);
}
else if (data.menuDetails.menu_hot == 'fair') {
$('#hot_grp_fair').attr('checked', true);
}
else if (data.menuDetails.menu_hot == 'very') {
$('#hot_grp_very').attr('checked', true);
}
else if (data.menuDetails.menu_hot == 'extreme') {
$('#hot_grp_extreme').attr('checked', true);
}
if (data.menuDetails.menu_gluten == 'yes') {
$('#gluten_grp_yes').attr('checked', true);
}
else if (data.menuDetails.menu_gluten == 'no') {
$('#gluten_grp_no').attr('checked', true);
}
if (data.menuDetails.sizeoption == 'size') {
$('#normalslice').attr('checked', true);
$('#show_menuoption2').hide();
$('#show_menuoption1').show();
}
if (data.menuDetails.menu_spl_instruction == 'Yes') {
$('.EditSplInsYes').removeClass('active');
$('.EditSplInsNo').removeClass('active');
$('.EditSplInsYes').addClass('active');
}
else if (data.menuDetails.menu_spl_instruction == 'No') {
$('.EditSplInsYes').removeClass('active');
$('.EditSplInsNo').removeClass('active');
$('.EditSplInsNo').addClass('active');
}
if (data.menuDetails.menu_addons == 'Yes') {
$('#advanceshow').removeClass('active');
$('#advancehide').removeClass('active');
$('#advanceshow').addClass('active');
$('#show_advance_menu').show();
}
else if (data.menuDetails.menu_addons == 'No') {
$('#advanceshow').removeClass('active');
$('#advancehide').removeClass('active');
$('#advancehide').addClass('active');
$('#show_advance_menu').hide();
$('#create_addon_button').hide();
$('#show_advance').find('input').attr('required', false);
}
$('input').iCheck('update');
if (data.menuDetails.menu_photo != '') {
$('#uploaded_img').attr('src', webroot+'assets/uploaded_image/menu/thumbs/'+data.menuDetails.menu_photo).height(95);
$('#uploaded_img_wrap').show();
}
if (data.menuDetails.sizeoption == 'size') {
$('#custom-table1').html(data.sizeHtml);
}
if (data.menuDetails.menu_addons == 'Yes') {
$('#show_advance').html(data.addonHtml);
}
$('button').removeClass('disabled');
$('#menu_category').val(data.menuDetails.menu_category);
if ($('#menu_addons').val() == 'Yes') {
var errCount = 1;
$(".CheckSubAddon").each(function(){
if($(this).find("div.mySubAddOnRow").length == 0)
{
errCount = 0;
}
})
if (errCount == 0) {
// alert('Sub add-on is not added for main add-on.');
console.log("error2");
// return false;
}
}
},
error: function(data) {
//alert('error');
console.log(data);
}
})
$('body').css('overflow', 'hidden');
$("#testPopupBottom").animate({
'top': 0
}, 1000);
}
function removeMainAddon(removeNum, menuaddons_id, request_from) {
if (request_from === undefined) {
request_from = 'admin';
}
jQuery('#ootZ' + removeNum + '_' + menuaddons_id).remove();
var my_id = menuaddons_id;
url=webroot+'menumanagement/deleteMenuAddons';
if (request_from == 9999) {
url=webroot+'menumanagementrestaurant/deleteMenuAddons';
}
$.ajax({
url: url,
type: 'POST',
data: {id: my_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
console.log(data);
},
error: function(data) {
//alert('error');
console.log(data);
}
})
}
function removeSubAddon(removeNum, menuaddons_id, request_from) {
if (request_from === undefined) {
request_from = 'admin';
}
jQuery('#adddonsX' + removeNum + '_' + menuaddons_id).remove();
var my_id = menuaddons_id;
url=webroot+'menumanagement/deleteMenuAddons';
if (request_from == 9999) {
url=webroot+'menumanagementrestaurant/deleteMenuAddons';
}
$.ajax({
url: url,
type: 'POST',
data: {id: my_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
console.log(data);
},
error: function(data) {
//alert('error');
console.log(data);
}
})
}
function removeMenuSize(removeNum, menu_slice_id) {
jQuery('#ootY' + removeNum).remove();
var my_id = menu_slice_id;
url=webroot+'menumanagement/deleteMenuSize';
$.ajax({
url: url,
type: 'POST',
data: {id: my_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
console.log(data);
},
error: function(data) {
//alert('error');
console.log(data);
}
})
}
function editFaq(my_id) {
url=webroot+'faqmanagement/showFaq';
$.ajax({
url: url,
type: 'POST',
data: {id: my_id, csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(data) {
$('#question').val(data.ShowPageFaq.question);
CKEDITOR.instances.answer.setData(data.ShowPageFaq.answer);
$('#FaqEditId').val(data.ShowPageFaq.faq_id);
},
error: function(data) {
//alert('error');
console.log(data);
}
})
$('body').css('overflow', 'hidden');
$("#testPopupBottom1").animate({
'top': 0
}, 1000);
}
function changeRestFeature(my_id, myThis) {
var old_status = $(myThis).attr('data-status');
var my_status = '';
if (old_status == 'Yes') {
my_status = 'No';
$(myThis).attr('class', 'fa fa-star-o');
}
else {
my_status = 'Yes';
$(myThis).attr('class', 'fa fa-star');
}
$(myThis).attr('data-status', my_status);
url=cntrlUrl+'changeRestFeature/';
$.ajax({
method: "POST",
url: url,
data: { restaurant_id: my_id,restaurant_feature_status: my_status, csrf_token_apm: myCsrfHash },
beforeSend: function(){
/*$('<?php echo $this->loading; ?>').show();*/
},
success: function(data){
/*$('<?php echo $this->loading; ?>').hide();
$('<?php echo $this->target; ?>').html(data);*/
}
});
}
function changeRestFooter(my_id, myThis) {
var old_status = $(myThis).attr('data-status');
var my_status = '';
if (old_status == 'Yes') {
my_status = 'No';
$(myThis).attr('class', 'fa fa-star-o');
}
else {
my_status = 'Yes';
$(myThis).attr('class', 'fa fa-star');
}
$(myThis).attr('data-status', my_status);
url=cntrlUrl+'changeRestFooter/';
$.ajax({
method: "POST",
url: url,
data: { restaurant_id: my_id,restaurant_footer_status: my_status, csrf_token_apm: myCsrfHash },
beforeSend: function(){
/*$('<?php echo $this->loading; ?>').show();*/
},
success: function(data){
/*$('<?php echo $this->loading; ?>').hide();
$('<?php echo $this->target; ?>').html(data);*/
}
});
}
function fetchCategoryByRest(restaurant_id) {
url=webroot+'superadmin/fetchCategoryByRest/';
$.ajax({
type: "post",
url: url,
cache: false,
data:{restaurant_id: restaurant_id, csrf_token_apm: myCsrfHash},
success: function(data){
document.getElementById("myCategory").innerHTML = data;
}
});
}
function fetchCategoryByRest2(restaurant_id,cat_id)
{
if (cat_id === undefined) {
cat_id = 0;
}
url=webroot+'superadmin/fetchCategoryByRest/';
$.ajax({
type: "post",
url: url,
cache: false,
data:{restaurant_id: restaurant_id, csrf_token_apm: myCsrfHash},
success: function(data){
document.getElementById("menu_category").innerHTML = data;
$('#menu_category').val(cat_id);
}
});
}
function fetchCategoryByRest3(restaurant_id,cat_id)
{
if (cat_id === undefined) {
cat_id = 0;
}
url=webroot+'superadmin/fetchCategoryByRest/';
$.ajax({
type: "post",
url: url,
cache: false,
data:{restaurant_id: restaurant_id, csrf_token_apm: myCsrfHash},
success: function(data){
document.getElementById("category_name").innerHTML = data;
$('#category_name').val(cat_id);
}
});
}
function fetchCategoryByRest4(restaurant_id,cat_id)
{
if (cat_id === undefined) {
cat_id = 0;
}
url=webroot+'superadmin/fetchCategoryByRest/';
$.ajax({
type: "post",
url: url,
cache: false,
data:{restaurant_id: restaurant_id, csrf_token_apm: myCsrfHash},
success: function(data){
document.getElementById("edit_category_name").innerHTML = data;
$('#edit_category_name').val(cat_id);
}
});
}
function readURL(input) {
/****************** Image Validation ***************************/
if (input.files && input.files[0]) {
if(input.files[0].type.indexOf("image") == -1) {
alert('Invalid file type!');
return false;
}
else if(input.files[0].size > 1024*1024*20) {
alert('Invalid file size!');
return false;
}
}
var reader = new FileReader();
reader.onload = function (e) {
///$('#siteLogoError').hide();
$('#imgview').attr('src', e.target.result).height(95);
reader.readAsDataURL(input.files[0]);
}
/****************** Image Validation ***************************/
// Upload Image
var fd = new FormData();
var file_data = input.files[0];
fd.append("admin_image", file_data);
fd.append("csrf_token_apm", myCsrfHash);
url=cntrlUrl+'upload_admin_image/';
$('#myLoader').show();
$.ajax({
url: url,
type: "POST",
mimeType: "multipart/form-data",
data: fd,
contentType: false, // The content type used when sending data to the server.
cache: false, // To unable request pages to be cached
processData:false,
success: function (file_name) {
console.log(file_name);
$('#show_admin_image').attr('src', webroot+'assets/uploaded_image/admin/thumbs/'+file_name);
$('#show_admin_image_header').attr('src', webroot+'assets/uploaded_image/admin/thumbs/'+file_name);
$('#myLoader').hide();
alert('Profile picture successfully changed!');
}
});
}
function readURL2(input) {
/****************** Image Validation ***************************/
if (input.files && input.files[0]) {
if(input.files[0].type.indexOf("image") == -1) {
alert('Invalid file type!');
return false;
}
else if(input.files[0].size > 1024*1024*20) {
alert('Invalid file size!');
return false;
}
}
var reader = new FileReader();
reader.onload = function (e) {
///$('#siteLogoError').hide();
$('#imgview').attr('src', e.target.result).height(95);
reader.readAsDataURL(input.files[0]);
}
/****************** Image Validation ***************************/
// Upload Image
var fd = new FormData();
var file_data = input.files[0];
fd.append("admin_image", file_data);
fd.append("csrf_token_apm", myCsrfHash);
url=webroot+'dashboardrestaurant/upload_admin_image/';
$('#myLoader').show();
$.ajax({
url: url,
type: "POST",
mimeType: "multipart/form-data",
data: fd,
contentType: false, // The content type used when sending data to the server.
cache: false, // To unable request pages to be cached
processData:false,
success: function (file_name) {
console.log(file_name);
$('#show_admin_image').attr('src', webroot+'assets/uploaded_image/admin/thumbs/'+file_name);
$('#show_admin_image_header').attr('src', webroot+'assets/uploaded_image/admin/thumbs/'+file_name);
$('#myLoader').hide();
alert('Profile picture successfully changed!');
}
});
}
function readURL3(input) {
/****************** Image Validation ***************************/
if (input.files && input.files[0]) {
if(input.files[0].type.indexOf("image") == -1) {
alert('Invalid file type!');
return false;
}
else if(input.files[0].size > 1024*1024*20) {
alert('Invalid file size!');
return false;
}
}
var reader = new FileReader();
reader.onload = function (e) {
///$('#siteLogoError').hide();
$('#imgview').attr('src', e.target.result).height(95);
reader.readAsDataURL(input.files[0]);
}
/****************** Image Validation ***************************/
// Upload Image
var fd = new FormData();
var file_data = input.files[0];
fd.append("admin_image", file_data);
fd.append("csrf_token_apm", myCsrfHash);
url=webroot+'dashboardcustomer/upload_customer_image/';
$('#myLoader').show();
$.ajax({
url: url,
type: "POST",
mimeType: "multipart/form-data",
data: fd,
contentType: false, // The content type used when sending data to the server.
cache: false, // To unable request pages to be cached
processData:false,
success: function (file_name) {
console.log(file_name);
$('#show_customer_image').attr('src', webroot+'assets/uploaded_image/customer/thumbs/'+file_name);
$('#show_customer_image_header').attr('src', webroot+'assets/uploaded_image/customer/thumbs/'+file_name);
$('#myLoader').hide();
alert('Profile picture successfully changed!');
}
});
}
///*********///*************///**************///****************///********************
function LiveFeedRestaurant()
{
url=webroot+'dashboardrestaurant/live_feed/';
//alert(url);
$.ajax({
type: "post",
url: url,
cache: false,
data: {csrf_token_apm: myCsrfHash},
dataType: 'json',
success: function(feeddata){
//************************************************************************************
//#Dashboard Order List
////document.getElementById("DashboardLastOrders").innerHTML = feeddata.DashboardLastOrders;
//document.getElementById("DashboardtopDiscountRestaurants").innerHTML = feeddata.DashboardtopDiscountRestaurants;
//Order Statistics - today
document.getElementById("OrdersToday").innerHTML = feeddata.OrdersToday;
document.getElementById("SalesToday").innerHTML = SITENAME_CURRENCY+""+feeddata.SalesToday;
document.getElementById("DeliveredOrderToday").innerHTML = feeddata.DeliveredOrderToday;
document.getElementById("PendingOrderToday").innerHTML = feeddata.PendingOrderToday;
//Order Statistics - week
document.getElementById("OrdersWeek").innerHTML = feeddata.OrdersWeek;
document.getElementById("SalesWeek").innerHTML = SITENAME_CURRENCY+""+feeddata.SalesWeek;
document.getElementById("DeliveredOrderWeek").innerHTML = feeddata.DeliveredOrderWeek;
document.getElementById("PendingOrderWeek").innerHTML = feeddata.PendingOrderWeek;
//Order Statistics - month
document.getElementById("OrdersMonth").innerHTML = feeddata.OrdersMonth;
document.getElementById("SalesMonth").innerHTML = SITENAME_CURRENCY+""+feeddata.SalesMonth;
document.getElementById("DeliveredOrderMonth").innerHTML = feeddata.DeliveredOrderMonth;
document.getElementById("PendingOrderMonth").innerHTML = feeddata.PendingOrderMonth;
//Order Statistics - year
document.getElementById("OrdersYear").innerHTML = feeddata.OrdersYear;
document.getElementById("SalesYear").innerHTML = SITENAME_CURRENCY+""+feeddata.SalesYear;
document.getElementById("DeliveredOrderYear").innerHTML = feeddata.DeliveredOrderYear;
document.getElementById("PendingOrderYear").innerHTML = feeddata.PendingOrderYear;
},error:function(jqXHR,exception){if (jqXHR.status === 0) {
msg = 'Not connected.\n Verify Network.';
} else if (jqXHR.status == 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
//alert(msg);
}
});
}
function setFavourite(restaurant_id, myThis) {
var set_fav = $(myThis).attr('data-status');
if (set_fav == 0) {
$(myThis).attr('data-status', 1);
$(myThis).attr('class', 'fa fa-heart-o');
swal('', 'Restaurant removed from favorite!', 'warning');
}
else if (set_fav == 1) {
$(myThis).attr('data-status', 0);
$(myThis).attr('class', 'fa fa-heart');
swal('', 'Restaurant added to favorite!', 'success');
}
url=webroot+'frontend/setFavourite/';
$.ajax({
type: "post",
url: url,
cache: false,
data:{restaurant_id: restaurant_id, set_fav: set_fav, csrf_token_apm: myCsrfHash},
success: function(data){}
});
}
function notLoggedInFav() {
swal('', 'Please login to mark restaurants as favourite!', 'warning');
}
function findAddressByZip(zip, otherCity, otherState) {
// console.log("findAddressByZip triggered");
if (otherCity === undefined && otherState === undefined) {
$('.generatedCity').val('');
$('.generatedState').val('');
}
else {
$('#'+otherCity).val('');
$('#'+otherState).val('');
}
if (zip.length == 9) {
// console.log("getJSON triggered");
$('#myLoader').show();
$.getJSON('https://maps.google.com/maps/api/geocode/json?components=country:BR|postal_code:'+zip+'&sensor=false&key='+MAP_API_KEY).success(function(response){
$('#myLoader').hide();
if (response.results[0] && response.results[0].address_components) {
var address_components = response.results[0].address_components;
var sublocality = '';
$.each(address_components, function(index, component){
var types = component.types;
$.each(types, function(index, type){
console.log(type);
if(type == 'sublocality') {
sublocality = component.long_name;
}
if(type == 'administrative_area_level_2') {
city = component.long_name;
}
if(type == 'administrative_area_level_1') {
state = component.long_name;
}
});
if (sublocality != '') {
city = sublocality;
}
});
if (otherCity === undefined && otherState === undefined) {
$('.generatedCity').val(city);
$('.generatedState').val(state);
}
else {
$('#'+otherCity).val(city);
$('#'+otherState).val(state);
}
}
else {
// alert('Please enter a valid US Zip Code');
}
});
}
}
function to24Hours(time) {
// var time = $('.delivery_time_to').val();
var hours = Number(time.match(/^(\d+)/)[1]);
var minutes = Number(time.match(/:(\d+)/)[1]);
var AMPM = time.match(/\s(.*)$/)[1];
if(AMPM == "PM" && hours<12) hours = hours+12;
if(AMPM == "AM" && hours==12) hours = hours-12;
var sHours = hours.toString();
var sMinutes = minutes.toString();
if(hours<10) sHours = "0" + sHours;
if(minutes<10) sMinutes = "0" + sMinutes;
var newTime = sHours + ":" + sMinutes;
return newTime;
}
function validateBookTime(E, F, G) {
var thisField = $('#' + G).val();
if ($('#' + E).val() != '' && $('#' + F).val() != '') {
var otherOpenTime = $('#' + E).val();
otherOpenTime = new Date("April 13, 1993 " + otherOpenTime + ':00');
var otherCloseTime = $('#' + F).val();
otherCloseTime = new Date("April 13, 1993 " + otherCloseTime + ':00');
if (otherCloseTime <= otherOpenTime) {
swal('', 'Please choose a valid time range!', 'warning');
$('#' + G).val('');
}
}
}
function validateOpenTime(A, B, C, D, E, F) {
// Pass current field pair ID in C & D
//A checking
if ($('#'+A).val() != '00:00') {
//A time
var mainOpenTime = $('#' + A).val();
mainOpenTime = to24Hours(mainOpenTime);
mainOpenTime = new Date("April 13, 1993 " + mainOpenTime + ':00');
//B time
var mainCloseTime = $('#' + B).val();
mainCloseTime = to24Hours(mainCloseTime);
mainCloseTime = new Date("April 13, 1993 " + mainCloseTime + ':00');
//C time
var currentPickedTime = $('#' + C).val();
currentPickedTime = new Date("April 13, 1993 " + currentPickedTime + ':00');
if (currentPickedTime >= mainOpenTime && currentPickedTime <= mainCloseTime) {
alert('Time already chosen.');
$('#' + C).val('');
}
else if ($('#' + E).val() != '' && $('#' + F).val() != '') {
// alert("E F");
//E time
var otherOpenTime = $('#' + E).val();
otherOpenTime = new Date("April 13, 1993 " + otherOpenTime + ':00');
//F time
var otherCloseTime = $('#' + F).val();
otherCloseTime = new Date("April 13, 1993 " + otherCloseTime + ':00');
if (currentPickedTime >= otherOpenTime && currentPickedTime <= otherCloseTime) {
alert('Time already chosen.');
$('#' + C).val('');
}
}
if ($('#' + D).val() != '') {
// alert("C D");
//D time
var currentCloseTime = $('#' + D).val();
currentCloseTime = new Date("April 13, 1993 " + currentCloseTime + ':00');
if (currentPickedTime >= currentCloseTime) {
alert('Open time cannot be greater than or equal to close time.');
$('#' + C).val('');
}
else if (currentPickedTime <= mainOpenTime && currentCloseTime >= mainCloseTime) {
alert('Time already chosen.');
$('#' + C).val('');
}
}
}
else {
alert('Please choose main opening times first.');
$('#' + C).val('');
}
}
function validateCloseTime(A, B, C, D, E, F) {
// Pass current field pair ID in C & D
//A checking
if ($('#' + A).val() != '00:00') {
//A time
var mainOpenTime = $('#' + A).val();
mainOpenTime = to24Hours(mainOpenTime);
mainOpenTime = new Date("April 13, 1993 " + mainOpenTime + ':00');
//B time
var mainCloseTime = $('#' + B).val();
mainCloseTime = to24Hours(mainCloseTime);
mainCloseTime = new Date("April 13, 1993 " + mainCloseTime + ':00');
//C time
var currentPickedTime = $('#' + D).val();
currentPickedTime = new Date("April 13, 1993 " + currentPickedTime + ':00');
if (currentPickedTime >= mainOpenTime && currentPickedTime <= mainCloseTime) {
alert('Time already chosen.');
$('#' + D).val('');
}
else if ($('#' + E).val() != '' && $('#' + F).val() != '') {
// alert("E F");
//E time
var otherOpenTime = $('#' + E).val();
otherOpenTime = new Date("April 13, 1993 " + otherOpenTime + ':00');
//F time
var otherCloseTime = $('#' + F).val();
otherCloseTime = new Date("April 13, 1993 " + otherCloseTime + ':00');
if (currentPickedTime >= otherOpenTime && currentPickedTime <= otherCloseTime) {
alert('Time already chosen.');
$('#' + D).val('');
}
}
if ($('#' + C).val() != '') {
// alert("C D");
//D time
var currentOpenTime = $('#' + C).val();
currentOpenTime = new Date("April 13, 1993 " + currentOpenTime + ':00');
if (currentPickedTime <= currentOpenTime) {
alert('Close time cannot be less than or equal to open time.');
$('#' + D).val('');
}
else if (currentOpenTime <= otherOpenTime && currentPickedTime >= otherCloseTime) {
alert('Time already chosen.');
$('#' + D).val('');
}
}
}
else {
alert('Please choose main opening times first.');
$('#' + D).val('');
}
}
function wip() {
swal({
title: "Sorry!",
text: "We are working on this section. Please try back later",
imageUrl: webroot+'assets/img/wip.png'
});
}
function openCustomerLogin() {
$('.modal').modal('hide');
$('#loginformModal').modal('show');
$('.commonTabClassLogin').removeClass('active');
$('#customerloginTab').addClass('active');
$('#customerlogin').addClass('active');
}
function openRestaurantLogin() {
$('.modal').modal('hide');
$('#loginformModal').modal('show');
$('.commonTabClassLogin').removeClass('active');
$('#restologinTab').addClass('active');
$('#restologin').addClass('active');
}
function openCustomerRegistration() {
$('.modal').modal('hide');
$('#registerformModal').modal('show');
$('.commonTabClassRegister').removeClass('active');
$('#customersignupTab').addClass('active');
$('#customersignup').addClass('active');
}
function openRestaurantRegistration() {
$('.modal').modal('hide');
$('#registerformModal').modal('show');
$('.commonTabClassRegister').removeClass('active');
$('#restosignupTab').addClass('active');
$('#restosignup').addClass('active');
}
function openCustomerForgotPass() {
$('.modal').modal('hide');
$('#customerForgotPassModal').modal('show');
}
function openRestaurantForgotPass() {
$('.modal').modal('hide');
$('#restaurantForgotPassModal').modal('show');
}