From 69dccb6770f966cb9f5f88200132f3515e97b7ab Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 23 Nov 2017 11:50:19 +0630 Subject: [PATCH] update addorder and mem_action for additional para --- app/assets/javascripts/addorder.js | 42 +++++++++++-------- .../settings/membership_actions_controller.rb | 2 +- app/controllers/settings/shops_controller.rb | 2 +- app/views/origami/addorders/detail.html.erb | 4 +- .../membership_actions/_form.html.erb | 1 - 5 files changed, 28 insertions(+), 23 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index b65561e9..10e80ad8 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -886,27 +886,33 @@ $(function() { $('.keypress_qty').keyup(function(e){ - id = $(this).attr('id'); + id = $(this).attr('id'); value = $(this).val(); - $('.change_qty').attr('value',value); - if (id=="count") { - price = $("#unit_price").text(); - $("#total_price").text(value*price); - }else{ - var item_row = $('.selected-instance'); - price = $("#set_unit_price").text(); - set_total_price = $("#set_total_price").text(); - $(".set_change_qty").val(value); - if (item_row.length > 1) { - total = 0 ; - $(item_row).each(function(i){ - total += value * $(item_row[i]).attr('data-price'); - total_price = total; - }); + + if ($.isNumeric(value)) { + $('.change_qty').attr('value',value); + if (id=="count") { + price = $("#unit_price").text(); + $("#total_price").text(value*price); }else{ - total_price = value*price; + var item_row = $('.selected-instance'); + price = $("#set_unit_price").text(); + set_total_price = $("#set_total_price").text(); + $(".set_change_qty").val(value); + if (item_row.length > 1) { + total = 0 ; + $(item_row).each(function(i){ + total += value * $(item_row[i]).attr('data-price'); + total_price = total; + }); + }else{ + total_price = value*price; + } + $("#set_total_price").text(total_price); } - $("#set_total_price").text(total_price); + }else{ + $('#'+id).val(1); + swal("Opps","Please enter number for qty","warning"); } }); diff --git a/app/controllers/settings/membership_actions_controller.rb b/app/controllers/settings/membership_actions_controller.rb index 4f22a285..a41f7ad2 100755 --- a/app/controllers/settings/membership_actions_controller.rb +++ b/app/controllers/settings/membership_actions_controller.rb @@ -72,6 +72,6 @@ class Settings::MembershipActionsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def settings_membership_action_params - params.require(:membership_action).permit(:membership_type, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :created_by, :additional_parameter) + params.require(:membership_action).permit(:membership_type, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :created_by) end end diff --git a/app/controllers/settings/shops_controller.rb b/app/controllers/settings/shops_controller.rb index 25c8456d..a48bcb9a 100644 --- a/app/controllers/settings/shops_controller.rb +++ b/app/controllers/settings/shops_controller.rb @@ -71,6 +71,6 @@ class Settings::ShopsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def shop_params - params.require(:shop).permit(:name,:address,:city,:township,:state,:country,:phone_no,:reservation_no,:license,:activated_at,:license_data,:base_currency,:cloud_token,:cloud_url,:owner_token,:id_prefix,:is_rounding_adj,:quick_sale_summary,:calc_tax_order) + params.require(:shop).permit(:name,:address,:city,:township,:state,:country,:phone_no,:reservation_no,:license,:activated_at,:license_data,:base_currency,:cloud_token,:cloud_url,:owner_token,:id_prefix,:is_rounding_adj,:quick_sale_summary,:calc_tax_order,:show_account_info) end end diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 150ea55d..59e782b4 100755 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -140,7 +140,7 @@ - + - +