187 lines
6.1 KiB
JavaScript
187 lines
6.1 KiB
JavaScript
//= require jquery
|
|
//= require tether
|
|
//= require jquery_ujs
|
|
//= require bootstrap/js/popper.min
|
|
//= require bootstrap/js/bootstrap-material-design.min
|
|
//= require momentjs/moment
|
|
//= require bootstrap-material-datetimepicker/js/bootstrap-material-datetimepicker
|
|
//= require jquery-slimscroll/jquery.slimscroll.js
|
|
//= require bootstrap-notify/bootstrap-notify.js
|
|
//= require node-waves/waves.js
|
|
//= require sweetalert/sweetalert.min.js
|
|
//= require fileinput.min
|
|
//= require cable
|
|
//= require turbolinks
|
|
//= require BSBMaterial/turbolink_admin.js
|
|
//= require BSBMaterial/demo.js
|
|
|
|
/* Constant Varaibles */
|
|
_CREDIT_PAYMENTS_ = "/ CREDIT PAYMENTS";
|
|
_CUSTOMERS_ = "/ CUSTOMERS";
|
|
_DISCOUNTS_ = "/ DISCOUNTS";
|
|
_IN_DUTIES_ = "/ IN DUTIES";
|
|
_JCB_ = "/ JCB PAYMENT";
|
|
_MASTER_ = "/ MASTER PAYMENT";
|
|
_MPU_ = "/ MPU PAYMENT";
|
|
_ALIPAY_ = "/ Alipay";
|
|
_JUNCTIONPAY_ = "/ JunctionPay";
|
|
_PAYMAL_ = "/ PAYMAL";
|
|
_DINGA_ = "/ DINGA PAYMENT";
|
|
_GIFT_VOUCHER_ = "/ GIFT VOUCHER";
|
|
_OTHER_CHARGES_ = "/ CHARGES";
|
|
_OTHER_PAYMENTS_ = "/ OTHER PAYMENT";
|
|
_PAYMENTS_ = "/ PAYMENT";
|
|
_PAYPAR_PAYMENT_ = "/ PAYPAR PAYMENT";
|
|
_COMMISSIONS_ = "/ COMMISSIONS";
|
|
_REDEEM_PAYMENT_ = "/ REDEEM PAYMENT";
|
|
_SALE_EDIT_ = "/ SALE EDIT";
|
|
_SPLIT_BILL_ = "/ SPLIT BILL";
|
|
_UNION_ = "/ UNION PAYMENT";
|
|
_VISA_ = "/ VISA PAYMENT";
|
|
_VOUCHER_ = "/ VOUCHER";
|
|
_SURVEY_ = "/ SURVEY";
|
|
/* Constant Varaibles */
|
|
|
|
$(document).on('turbolinks:load', function() {
|
|
|
|
$("#customer_image_path").fileinput({
|
|
previewFileType: "image",
|
|
allowedFileExtensions: ["jpg", "gif", "png"],
|
|
browseClass: "btn btn-success",
|
|
browseLabel: "Pick Image",
|
|
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
|
removeClass: "btn btn-danger",
|
|
removeLabel: "Delete",
|
|
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
|
showUpload: false,
|
|
// uploadClass: "btn btn-info",
|
|
// uploadLabel: "Upload",
|
|
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
|
previewTemplates: {
|
|
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
|
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
|
'</div>\n',
|
|
}
|
|
});
|
|
|
|
$('.datetimepicker').bootstrapMaterialDatePicker({
|
|
format: 'DD-MM-YYYY - HH:mm',
|
|
clearButton: true,
|
|
weekStart: 1
|
|
});
|
|
|
|
$('.datepicker').bootstrapMaterialDatePicker({
|
|
format: 'DD-MM-YYYY',
|
|
clearButton: true,
|
|
weekStart: 1,
|
|
time: false
|
|
});
|
|
|
|
$('.timepicker').bootstrapMaterialDatePicker({
|
|
format: 'HH:mm',
|
|
clearButton: true,
|
|
date: false
|
|
});
|
|
|
|
// For selected order return
|
|
var order_status = "";
|
|
order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim();
|
|
|
|
|
|
$(document).on('click', '.access_modal', function(event){
|
|
type = $(this).data("type");
|
|
$(".ok").attr("data-action",type);
|
|
$('#AccessCodeModal').modal('show');
|
|
});
|
|
|
|
$(document).on('click', '.access_number', function(event){
|
|
if(event.handled !== true) {
|
|
var original_value = $('#access_code').val();
|
|
var input_type = $(this).attr("data-type");
|
|
|
|
switch (input_type) {
|
|
case 'num':
|
|
var input_value = $(this).attr("data-value");
|
|
if (original_value){
|
|
$('#access_code').val(original_value + input_value);
|
|
}else{
|
|
$('#access_code').val(original_value + input_value);
|
|
}
|
|
break;
|
|
case 'ok':
|
|
var type = $(this).attr("data-action");
|
|
code = $('#access_code').val();
|
|
check_emp_access_code(code,type)
|
|
break;
|
|
case 'clr':
|
|
$('#access_code').val("");
|
|
break;
|
|
}
|
|
event.handled = true;
|
|
} else {
|
|
return false;
|
|
}
|
|
});
|
|
});
|
|
|
|
function setHeaderBreadCrumb(params){
|
|
$("#others_payment").html(params);
|
|
}
|
|
|
|
//show hide nav bar for webview
|
|
function showHideNavbar(webview,page){
|
|
if(webview){
|
|
$("nav.navbar").addClass("hidden");
|
|
$("section").addClass("section-margin");
|
|
$(".page-loader-wrapper").addClass("hidden");
|
|
if(page!=undefined){
|
|
$("#back").hide();
|
|
}
|
|
}else{
|
|
$("nav.navbar").removeClass("hidden");
|
|
$("section").removeClass("section-margin");
|
|
$(".page-loader-wrapper").removeClass("hidden");
|
|
if(page!=undefined){
|
|
$("#back").show();
|
|
}
|
|
}
|
|
}
|
|
|
|
function createAccessCode(code) {
|
|
localStorage.setItem("access_code",code);
|
|
}
|
|
function check_emp_access_code(access_code,type) {
|
|
var url = "/foodcourt/check_emp_access_code/" + access_code ;
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: url,
|
|
data: {},
|
|
success: function (result) {
|
|
if (result.status == true) {
|
|
createAccessCode(code);
|
|
if (type == "edit") {
|
|
var dining_id = $('#dining').text();
|
|
var sale_id = $('#sale_id').text();
|
|
if (dining_id) {
|
|
window.location.href = '/foodcourt/table/' + dining_id + "/sale/" + sale_id + "/food_court/edit";
|
|
}else{
|
|
window.location.href = "/foodcourt/table/sale/" + sale_id + "/food_court/edit";
|
|
}
|
|
}else if(type == "void"){
|
|
$('#AccessCodeModal').modal('hide');
|
|
$('#voidModal').modal('show');
|
|
}else if(type == "waste") {
|
|
waste_and_spoilage("waste")
|
|
}else if(type == "spoile") {
|
|
waste_and_spoilage("spoile")
|
|
}else if(type == "foc"){
|
|
$('#AccessCodeModal').modal('hide');
|
|
$('#focModal').modal('show');
|
|
}
|
|
}else{
|
|
swal("Oops",result.message,"warning");
|
|
}
|
|
}
|
|
});
|
|
}
|