add out of stock

This commit is contained in:
NyanLinHtut
2019-12-13 10:07:20 +06:30
parent 7a9e270627
commit c6c605bb01
20 changed files with 1041 additions and 44 deletions

View File

@@ -1483,7 +1483,8 @@ $(function() {
instances = menu_items[field].instances;
$(instances).each(function(i){
if (instances[i].is_default == true) {
price = parseFloat(instances[i].price).toFixed(2);
price = parseFloat(instances[i].price).toFixed(2);
out_of_stock = instances[i].out_of_stock;
}else{
price = 0;
}
@@ -1510,18 +1511,28 @@ $(function() {
item_attributes = instances[i].values;
promotion_price = instances[i].promotion_price;
code = instances[i].code;
out_of_stock = instances[i].out_of_stock;
}
});
}
if (menu_items[field].image) {
if (modify_order) {
image_path = "../../"+menu_items[field].image;
}else{
image_path = menu_items[field].image;
}
if (out_of_stock === true) {
// oos_item = out_of_stock_item
oos_item = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;pointer-events: none;opacity: 0.4;">'
oos_header = '<div style="position: absolute;z-index: 5;top: 0;left: 0;right: 0;text-align: center;background: #fb483a;margin: auto;color: #fff;padding: 8px;font-weight: bolder;">OUT OF STOCK</div>'
}else{
oos_item = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
oos_header = ''
}
row = '<div class="col-md-6 col-sm-6 col-lg-3">'
+'<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
+ oos_item + oos_header
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" >'
+'<div class="col-md-10 " style="padding:0px !important;">'+ menu_items[field].name +'</div>'
@@ -1564,8 +1575,16 @@ $(function() {
+'</div>'
+'</div>'; ;
}else{
if (out_of_stock === true) {
// oos_item = out_of_stock_item
oos_item = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%; pointer-events: none;opacity: 0.4;">'
oos_header = '<div style="position: absolute;z-index: 5;top: 0;left: 0;right: 0;text-align: center;background: #fb483a;margin: auto;color: #fff;padding: 8px;font-weight: bolder;">OUT OF STOCK</div>'
}else{
oos_item = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;">'
oos_header = ''
}
row = '<div class="col-md-6 col-sm-6 col-lg-3 mt-1">'
+'<div class="card custom-card testimonial-card fadeInRight" style="height:100%;">'
+ oos_item + oos_header
+'<div class="custom-card-no-img-head card-head '+add_icon+' " style="margin:0px;display:flex;!important "'
+" data-item-code='"+ menu_items[field].code +"' "
+" data-name='" + menu_items[field].name +"' "
@@ -1621,6 +1640,7 @@ $(function() {
+'</div>'
+'</div>';
}
$('.menu_items_list').append(row);

View File

@@ -63,7 +63,7 @@ $(document).on('turbolinks:load', function() {
' <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',
@@ -128,11 +128,11 @@ $(document).on('turbolinks:load', function() {
type: "POST",
url: "/origami/" + unique_id,
data: { 'booking_id' : unique_id },
success:function(result){
success:function(result){
for (i = 0; i < result.length; i++) {
var data = JSON.stringify(result[i]);
var parse_data = JSON.parse(data);
var show_date = "";
var show_date = "";
// Receipt Header
receipt_no = result[i].receipt_no;
@@ -140,14 +140,14 @@ $(document).on('turbolinks:load', function() {
if(result[i].receipt_date != null){
receipt_date = new Date(result[i].receipt_date);
show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
}
}
//Receipt Charges
sub_total += parseFloat(parse_data.price);
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
tax_amount = parse_data.tax_amount;
grand_total_amount = parse_data.grand_total_amount;
grand_total_amount = parse_data.grand_total_amount;
// Ordered Items
var order_items_rows = "<tr>" +
@@ -234,7 +234,7 @@ $(document).on('turbolinks:load', function() {
window.location.href = "/origami/cashier/credit_sales/"+sale_id;
}else{
window.location.href = "/origami/quick_service/credit_sales/"+sale_id;
}
}
});
});
@@ -385,7 +385,7 @@ function resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amo
}else{
payment_type = "Master";
}
$("#loading_wrapper").hide();
swal({
title: 'Oops',
@@ -512,7 +512,7 @@ if (!String.prototype.formatUnicorn) {
}
var t=typeof arguments[0],n="string"==t||"number"==t?Array.prototype.slice.call(arguments):arguments[0];
for(var i in n){
e=e.replace(new RegExp("\\{"+i+"\\}","gi"),n[i]==null?'':n[i]);
e=e.replace(new RegExp("\\{"+i+"\\}","gi"),n[i]==null?'':n[i]);
}
return e;
};
@@ -523,7 +523,7 @@ if (!String.prototype.formatUnicorn) {
function timeFormat(date){
var isPM = date.getHours() >= 12;
var isMidday = date.getHours() == 12;
var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0),
var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0),
(date.getMinutes()>10? date.getMinutes() : '0'+date.getMinutes()) || '00'].join(':') +
(isPM ? ' PM' : ' AM');
return time;
@@ -589,4 +589,4 @@ function getCreditSales(filter, customer, cashier_type){
}
});
}
//End of credit sales function
//End of credit sales function