update add order

This commit is contained in:
Aung Myo
2017-11-22 15:54:58 +06:30
parent 5b7ba0c144
commit d3ceba0a7a
2 changed files with 70 additions and 15 deletions

View File

@@ -95,7 +95,6 @@ $(function() {
var menu_items_list = $('.menu_items_list'); var menu_items_list = $('.menu_items_list');
menu_items_list.empty(); menu_items_list.empty();
menu_items = data.menu_items; menu_items = data.menu_items;
console.log(menu_items);
for(var field in menu_items) { for(var field in menu_items) {
if (menu_items[field].is_sub_item == false) { if (menu_items[field].is_sub_item == false) {
@@ -194,6 +193,7 @@ $(function() {
$(document).on('click', '.set_item_box', function(event){ $(document).on('click', '.set_item_box', function(event){
$(".instance-list").empty(); $(".instance-list").empty();
$(".options-list").empty(); $(".options-list").empty();
$('.set_change_qty').val(1);
change_qty_plus_minus("set_count","set_plus","set_minus"); change_qty_plus_minus("set_count","set_plus","set_minus");
data = $(this).parent().children().children('.add_icon'); data = $(this).parent().children().children('.add_icon');
@@ -373,6 +373,8 @@ $(function() {
$('.add_to_order').removeAttr('data-attributes'); $('.add_to_order').removeAttr('data-attributes');
$('.add_to_order').removeAttr('data-options'); $('.add_to_order').removeAttr('data-options');
$('.change_qty').val(1);
change_qty_plus_minus("count","plus","minus"); change_qty_plus_minus("count","plus","minus");
data = $(this).parent().children().children('.add_icon'); data = $(this).parent().children().children('.add_icon');
@@ -513,7 +515,6 @@ $(function() {
// click select option icon for add // click select option icon for add
$(document).on('click', '.option_btn', function(event){ $(document).on('click', '.option_btn', function(event){
active =$(this).hasClass('selected-option'); active =$(this).hasClass('selected-option');
console.log(active);
value = $(this).data('value'); value = $(this).data('value');
type = $(this).data('type'); type = $(this).data('type');
group = $(this).data('group'); group = $(this).data('group');
@@ -558,8 +559,24 @@ $(function() {
if (item_row.length>0) { if (item_row.length>0) {
var instances = jQuery.parseJSON(item_row.attr('data-instances')); var instances = jQuery.parseJSON(item_row.attr('data-instances'));
for(var field in instances) {
if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values)) {
for(var field in instances) {
attrbu = JSON.stringify(attribute_arr);
instan = JSON.stringify(instances[field].values);
var newarr = new Set(instan);
result = false;
for(var i in attrbu) {
if (newarr.has(attrbu[i])) {
result = true;
break;
}
}
if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values) || result) {
$('.add_to_order').attr('data-instance-code',instances[field].code); $('.add_to_order').attr('data-instance-code',instances[field].code);
$('.add_to_order').attr('data-instance',instances[field].name); $('.add_to_order').attr('data-instance',instances[field].name);
$('.add_to_order').attr('data-price',instances[field].price); $('.add_to_order').attr('data-price',instances[field].price);
@@ -872,7 +889,7 @@ $(function() {
id = $(this).attr('id'); id = $(this).attr('id');
value = $(this).val(); value = $(this).val();
$('#count').attr('value',value); $('.change_qty').attr('value',value);
if (id=="count") { if (id=="count") {
price = $("#unit_price").text(); price = $("#unit_price").text();
$("#total_price").text(value*price); $("#total_price").text(value*price);
@@ -880,7 +897,7 @@ $(function() {
var item_row = $('.selected-instance'); var item_row = $('.selected-instance');
price = $("#set_unit_price").text(); price = $("#set_unit_price").text();
set_total_price = $("#set_total_price").text(); set_total_price = $("#set_total_price").text();
$("#set_count").val(value); $(".set_change_qty").val(value);
if (item_row.length > 1) { if (item_row.length > 1) {
total = 0 ; total = 0 ;
$(item_row).each(function(i){ $(item_row).each(function(i){

View File

@@ -1,10 +1,48 @@
application_path = ENV.fetch("SX_PATH") {'/home/superuser/Application/production/sxrestaurant'} # Puma can serve each request in a thread from an internal thread pool.
directory application_path # The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" } environment ENV.fetch("RAILS_ENV") { "development" }
daemonize true
pidfile "#{application_path}/tmp/puma/pid" # Specifies the number of `workers` to boot in clustered mode.
state_path "#{application_path}/tmp/puma/state" # Workers are forked webserver processes. If using threads and workers together
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" # the concurrency of the application would be max `threads` * `workers`.
port ENV.fetch("PORT") { 62158 } # Workers do not work on JRuby or Windows (both of which do not support
workers 2 # processes).
preload_app! #
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
#
# preload_app!
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted this block will be run, if you are using `preload_app!`
# option you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, Ruby
# cannot share connections between processes.
#
# on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart