change order reservation

This commit is contained in:
phyusin
2018-04-30 09:45:37 +06:30
19 changed files with 189 additions and 108 deletions

View File

@@ -101,6 +101,14 @@ $(function() {
var menu_id = $(this).attr("data-id");
var url = "get_menu_category/"+menu_id;
show_menu_item_list(url);
var sub_id = $(this).attr("data-sub-id");
if (sub_id == "true") {
console.log("hhhhhhhhhhhhhhhhh")
var sub_url = "get_menu_sub_category/"+menu_id;
sub_category = $(this).find('.sub_category_list');
show_sub_category_list(sub_url,sub_category);
}
});
//End menu category Click
@@ -457,9 +465,10 @@ $(function() {
var items = $('.selected-set');
if (items.length >= min_qty) {
if ($('#server_mode').val() != "cloud") {
item = get_set_item(items);
customer_display_view(item,"set_add");
}
var option = []
attribute_arr = []
@@ -786,8 +795,10 @@ $(function() {
$('.add_to_order').attr('data-options',JSON.stringify(option_arr));
$('.add_to_order').attr('data-opt',JSON.stringify(option_arr));
var item_data = $(this);
item = get_item(item_data,"add_to_order");
customer_display_view(item,"add");
if ($('#server_mode').val() != "cloud") {
item = get_item(item_data,"add_to_order");
customer_display_view(item,"add");
}
show_item_detail(item_data,"add_to_order");
calculate_sub_total();
@@ -796,8 +807,10 @@ $(function() {
// click plus icon for add
$(document).on('click', '.add_icon', function(event){
var item_data = $(this);
item = get_item(item_data,"add_icon");
customer_display_view(item,"add");
if ($('#server_mode').val() != "cloud") {
item = get_item(item_data,"add_icon");
customer_display_view(item,"add");
}
show_item_detail(item_data,"add_icon");
calculate_sub_total();
}); //End Add Icon Click
@@ -922,7 +935,9 @@ console.log(d_option)
window.location.href = "/origami/room/" + table_id
}
}
customer_display_view(null,"reload");
if ($('#server_mode').val() != "cloud") {
customer_display_view(null,"reload");
}
}
});
// }else{
@@ -1225,7 +1240,7 @@ console.log(d_option)
//click menu sidebar menu category
$(document).on('click', '.sub_click', function(event){
$(document).on('click', '.sub_clickssss', function(event){
event.preventDefault();
var menu_id = $(this).attr("data-id");
var url = "get_menu_sub_category/"+menu_id;
@@ -1260,11 +1275,11 @@ console.log(d_option)
data = data.sub_category;
if (data.length>0) {
if ((sub_category.hasClass('hidden'))) {
// if ((sub_category.hasClass('hidden'))) {
$(sub_category).removeClass('hidden');
}else{
$(sub_category).addClass('hidden');
}
// }else{
// $(sub_category).addClass('hidden');
// }
for(var i in data) {

View File

@@ -7,41 +7,37 @@ App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
received: function(data) {
var order = data.data;
var rowCount = $('.order_reserve_cable tbody tr').length+1;
if(order.length > 0){
$('.order_reserve_cable tbody').html("");
$.each(order, function(key,value){
var rowCount = key+1;
var date = new Date(value.created_at);
var isPM = date.getHours() >= 12;
var isMidday = date.getHours() == 12;
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
date.getMinutes() || '00'].join(':') +
(isPM ? ' PM' : 'AM');
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ date.getDate();
var date = new Date(order.requested_time);
var requested_time = date.getHours()+ ':' + date.getMinutes()+ '-' + date.getMinutes();
var isPM = date.getHours() >= 12;
var isMidday = date.getHours() == 12;
var result = document.querySelector('#result');
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
date.getMinutes() || '00'].join(':') +
(isPM ? ' PM' : 'AM');
var month = 0;
if(parseInt(newDate.getMonth()) > 10){
month = parseInt(newDate.getMonth()) + 1;
row = '<tr class="custom-tr first-'+rowCount+'" style="" data-id="'+value.order_reservation_id+'" data-sr-no="'+rowCount+'">'
+'<td width ="5%" class="align-left">'+rowCount
+'</td>'
+'<td width ="20%" class="align-center">'+created_at
+'</td>'
+'<td width ="20%" class="align-center">'+time
+'</td>'
+'<td width ="20%" class="align-center">'+value.grand_total
+'</td>'
+'<td width ="30%" class="align-center">'
+'<span class="font-10 col-blue">'+ value.status +'</span>'
+'</td>'
+' </tr>'
$('.order_reserve_cable tbody').append(row);
});
}
else{
month = '0' + (parseInt(newDate.getMonth()) + 1);
}
var requested_date = date.getFullYear() +'-'+ month +'-'+ date.getDate();
row = '<tr class="custom-tr first-'+rowCount+'" style="" data-id="'+order.order_reservation_id+'" data-sr-no="'+rowCount+'">'
+'<td width ="5%" class="align-left">'+rowCount
+'</td>'
+'<td width ="20%" class="align-center">'+requested_date
+'</td>'
+'<td width ="20%" class="align-center">'+time
+'</td>'
+'<td width ="20%" class="align-center">'+order.grand_total
+'</td>'
+'<td width ="30%" class="align-center">'
+'<span class="font-10 col-blue">'+ order.status +'</span>'
+'</td>'
+' </tr>'
$('.order_reserve_cable tbody').append(row);
}
});

View File

@@ -38,6 +38,7 @@ $(function() {
});
function refreshDetailData(){
$('#requested_date_time').text("");
$("#sr_number").text("");
$("#delivery_info").text("");
$("#contact_info").text("");
@@ -45,6 +46,7 @@ $(function() {
$('#sub_total').text("0.00");
$('#delivery_fee').text("0.00");
$('#total_charges').text("0.00");
$('#discount_amount').text("0.00");
$('#total_tax').text("0.00");
$('#grand_total').text("0.00");
}
@@ -72,15 +74,7 @@ $(function() {
var time = [newDate.getHours() - (isPM && !isMidday ? 12 : 0),
newDate.getMinutes() || '00'].join(':') +
(isPM ? ' PM' : 'AM');
var month = 0;
if(parseInt(newDate.getMonth()) > 10){
month = parseInt(newDate.getMonth()) + 1;
}
else{
month = '0' + (parseInt(newDate.getMonth()) + 1);
}
var requested_date = newDate.getFullYear() + '-' + month +'-'+ newDate.getDate() +' '+time;
var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() > 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ newDate.getDate() +' '+time;
item_list.empty();
@@ -103,14 +97,25 @@ $(function() {
$('.summary-items').append(row);
}
if(data.discount_amount > 0){
$("#discount").show();
}
$('#requested_date_time').text(requested_date);
$('#sub_total').text(data.total_amount);
$('#delivery_fee').text(delivery.delivery_fee? delivery.delivery_fee : '0.0');
$('#total_charges').text(data.convenience_charge?data.convenience_charge : '0.0');
$('#delivery_fee').text((parseFloat(delivery.delivery_fee) > 0)? delivery.delivery_fee : '0.0');
$('#total_charges').text((parseFloat(data.convenience_charge) > 0)? data.convenience_charge : '0.0');
$('#discount_amount').text((parseFloat(data.discount_amount) > 0)? data.discount_amount : '0.0');
$('#total_tax').text(data.total_tax);
$('#grand_total').text(data.grand_total);
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
var address = delivery.address;
if(delivery.township != null && delivery.township!=""){
address += ', ' +delivery.township;
}else if(delivery.direction_address!=null && delivery.direction_address!=""){
address += ", (" +delivery.direction_address+")";
}
$('#requested_time').text(requested_date);
$('#customer_name').text(data.customer_name);
$('#phone').text(data.phone);
$('#address').text(address);
@@ -122,8 +127,10 @@ $(function() {
if(delivery.delivery_type == "service"){
$("#delivery_info").text("(DELIVERY)");
}else if(delivery.delivery_type == "self_pick_up"){
}else if(delivery.delivery_type == "pick_up"){
$("#delivery_info").text("(PICK-UP)");
}else{
$("#delivery_info").text("(DIRECT DELIVERY)");
}
if(data.order_remark!=null && data.order_remark!=""){
@@ -131,7 +138,7 @@ $(function() {
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
$("#order_remark").text(data.reservation_remark);
}
$("#sr_number").text("No."+sr_no);
$("#sr_number").text("NO."+sr_no);
if (data["receipt_no"]) {
$("#contact_info").text(data["receipt_no"]);
}else{

View File

@@ -88,4 +88,7 @@
}
.div_order_margin {
margin: 0px 0px 0px -5px !important
}
.div_card_order {
margin: 0px -5px !important
}