update add order
This commit is contained in:
@@ -123,8 +123,10 @@ $(function() {
|
||||
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
|
||||
fa_plus = '';
|
||||
add = '';
|
||||
menu_item_box = 'set_item_box';
|
||||
menu_item_box = 'add_icon';
|
||||
data_target = 'sx_item_set_detailModal';
|
||||
data_modal = 'modal'
|
||||
add_icon = "set_item_box"
|
||||
code = menu_items[field].code;
|
||||
name = menu_items[field].name;
|
||||
instances = menu_items[field].instances;
|
||||
@@ -144,6 +146,8 @@ $(function() {
|
||||
add = 'add'
|
||||
menu_item_box = 'menu_item_box';
|
||||
data_target = 'sx_item_detailModal';
|
||||
data_modal = ''
|
||||
add_icon = "add_icon"
|
||||
|
||||
$(instances).each(function(i){
|
||||
if (instances[i].is_default === true) {
|
||||
@@ -164,11 +168,11 @@ $(function() {
|
||||
}else{
|
||||
image_path = "/image/logo.png";
|
||||
}
|
||||
if (menu_item_box == "set_item_box") {
|
||||
add_icon = "set_item_box"
|
||||
}else{
|
||||
add_icon = "add_icon"
|
||||
}
|
||||
// if (menu_item_box == "set_item_box") {
|
||||
|
||||
// }else{
|
||||
|
||||
// }
|
||||
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="">'
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">'
|
||||
@@ -190,7 +194,10 @@ $(function() {
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ options +"' data-image='"+image_path+"' >"
|
||||
+ options +"' data-image='"+image_path+"' data-toggle='"
|
||||
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"'>"
|
||||
|
||||
+"<div class='card-block custom-card-block'>"
|
||||
+"<img id='logo' height='125px' src='"+image_path+"'>"
|
||||
@@ -218,10 +225,12 @@ $(function() {
|
||||
$('.set_change_qty').val(1);
|
||||
change_qty_plus_minus("set_count","set_plus","set_minus");
|
||||
data = $(this).parent().children().children('.add_icon');
|
||||
|
||||
instances = $(this).data('instance');
|
||||
// data = $(this).parent().siblings('.add_icon');
|
||||
//instances = $(this).data('instance');
|
||||
item_sets = $(this).data('item-sets');
|
||||
|
||||
instances = $(this).data('instances');
|
||||
// item_sets = $(data).attr('data-item-sets');
|
||||
console.log(instances)
|
||||
for(var field in item_sets) {
|
||||
|
||||
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
|
||||
@@ -274,11 +283,11 @@ $(function() {
|
||||
|
||||
$('#set_change_qty').val(1);
|
||||
$('#set_item_instances').text(instances);
|
||||
$('#set_name').text(data.attr('data-name'));
|
||||
$('#set_item_code').text(data.attr('data-item-code'));
|
||||
$('#set_total_price').text(data.attr('data-price'));
|
||||
$('#set_name').text($(this).attr('data-name'));
|
||||
$('#set_item_code').text($(this).attr('data-item-code'));
|
||||
$('#set_total_price').text($(this).attr('data-price'));
|
||||
// $('#set_total_price').text(0);
|
||||
$('#set_unit_price').text(data.attr('data-price'));
|
||||
$('#set_unit_price').text($(this).attr('data-price'));
|
||||
// $('#set_unit_price').text(0);
|
||||
});
|
||||
// click instance for add item set
|
||||
@@ -735,7 +744,7 @@ $(function() {
|
||||
if (type == 'true') {
|
||||
type = 'cashier'
|
||||
|
||||
var table_type = $('#table_id').find("option:selected").data('type');
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').val();
|
||||
var customer_id = $('#customer_id').val();
|
||||
var booking_id = $('#booking_id').text();
|
||||
@@ -762,21 +771,28 @@ $(function() {
|
||||
'customer_id': customer_id, 'guest_info': "",
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
if (table_id.length>0) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$(this).removeAttr('disabled', '');
|
||||
$("#oqs_loading_wrapper").hide();
|
||||
|
||||
swal("Opps","Please Select Table or Room","warning");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
|
||||
def index
|
||||
@menu = MenuCategory.all.active
|
||||
@dining = DiningFacility.all.active
|
||||
@zone = Zone.all
|
||||
@customer = Customer.all
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
|
||||
@@ -78,10 +78,11 @@
|
||||
<!-- <i class="material-icons">reply</i> -->
|
||||
Back
|
||||
</button>
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style=" padding: .5rem 0.15rem !important;">Pending Order
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
|
||||
</button>
|
||||
<a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a>
|
||||
<input type="hidden" name="table_id" value="" id="table_id">
|
||||
|
||||
<%else%>
|
||||
<button type="button" class="btn btn-lg btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>Back
|
||||
@@ -110,7 +111,7 @@
|
||||
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
|
||||
<p class="hidden" id="sale_id"><%=@sale_id%></p>
|
||||
<% else%>
|
||||
|
||||
<p class="hidden" id="table_type"></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
@@ -361,92 +362,46 @@
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="margin-top: -0.75rem;padding-top:5px">
|
||||
<h5>Table</h5>
|
||||
<%@zone.each do |zone| %>
|
||||
<h5>Zone : <%=zone.name%></h5>
|
||||
<div class="card-columns" style="column-count: 7;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
|
||||
<% else %>
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
<!-- <span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
|
||||
<div style="font-size:12px;"></div> -->
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
|
||||
<% else %>
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<hr style="margin: 5px 20px">
|
||||
<h5>Room</h5>
|
||||
<div class="card-columns" style="column-count: 7;">
|
||||
<% @rooms.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
|
||||
<% else %>
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
<!-- <span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
|
||||
<div style="font-size:12px;"></div> -->
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
|
||||
<% else %>
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%zone.tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
@@ -455,18 +410,24 @@
|
||||
$('.tables').removeClass('purple')
|
||||
var dining_id = $(this).attr("data-id");
|
||||
var name = $(this).attr("data-name");
|
||||
var type = $(this).attr("data-type");
|
||||
$(this).css('background-color','purple');
|
||||
$(this).addClass('purple')
|
||||
$('.confirm_table').attr("data-id",dining_id)
|
||||
$('.confirm_table').attr("data-name",name)
|
||||
$('.confirm_table').attr("data-type",type)
|
||||
|
||||
});
|
||||
$(".confirm_table").on('click', function () {
|
||||
var dining_id = $(this).attr("data-id");
|
||||
var name = $(this).attr("data-name");
|
||||
var type = $(this).attr("data-type");
|
||||
$('#table_id').val(dining_id)
|
||||
$('#table_type').text(type)
|
||||
$('.select_table').text(name)
|
||||
|
||||
console.log(type)
|
||||
|
||||
});
|
||||
$('#pending_order').on('click', function () {
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
|
||||
Reference in New Issue
Block a user