update addor for set instance api for addorder and paymal paymant

This commit is contained in:
Aung Myo
2018-04-19 16:55:49 +06:30
parent f8a247c61a
commit ed025800c4
7 changed files with 63 additions and 8 deletions

View File

@@ -268,21 +268,24 @@ $(function() {
value = item_sets[field]["instances"];
$(value).each(function(i){
if (type != -1 && modify_order != -1) {
url = '../../../../api/restaurant/menu_item_instances/'+value[i]["id"];
url = '../../../addorders/get_item_instance/'+value[i]["id"];
console.log("ssssssss")
}
if(modify_order == -1 && type != -1){
url = '../../api/restaurant/menu_item_instances/'+value[i]["id"] ;
url = 'addorders/get_item_instance/'+value[i]["id"] ;
console.log("aaaaaa")
}
if (type ==-1 && modify_order == -1){
url = '../../api/restaurant/menu_item_instances/'+value[i]["id"];
url = '../addorders/get_item_instance/'+value[i]["id"];
console.log("cccccccccc")
}
$.ajax({
type: "GET",
url: url,
data: {id:value[i]},
// data: {id:value[i]},
success:function(result){
row = '<div class="col-md-4 " >'

View File

@@ -13,8 +13,8 @@ module TokenVerification
authenticate_token || render_unauthorized
end
def authenticate_token
authenticate_with_http_token do |token, options|
def authenticate_token
authenticate_with_http_token do |token, options|
# Rails.logger.debug "token - " + token.to_s
if(options.length !=0 && options["from"] == "DOEMAL")
if(ENV["SERVER_MODE"] === "cloud")

View File

@@ -58,6 +58,10 @@ class Origami::AddordersController < BaseOrigamiController
end
end
def get_item_instance
@id = MenuItemInstance.find(params[:id])
end
def get_menu()
if (params[:id])
#Pull this menu

View File

@@ -0,0 +1,39 @@
if(@id)
menu_item = MenuItem.find(@id.menu_item_id)
# Format for option json
opt_format = []
# Format for attributes json
menu_item.item_options.each do|opt|
menu_opt = MenuItemOption.find(opt)
if opt_format.count == 0
opt_format.push({ type: menu_opt.option_type, values: [menu_opt.name] })
next
end
opt_format.each do |of|
if menu_opt.option_type.in? opt_format.map {|k| k[:type]}
if menu_opt.option_type == of[:type]
of[:values].push(menu_opt.name)
end
else
new_opt = {type: menu_opt.option_type, values: [ menu_opt.name ] }
opt_format.push(new_opt)
break
end
end
end
json.success true
json.id @id.id
json.name @id.item_instance_name
json.code @id.item_instance_code
json.item_id @id.menu_item_id
json.attributes @id.item_attributes
json.price @id.price
json.is_default @id.is_default
json.options opt_format
else
json.success false
end

View File

@@ -106,6 +106,12 @@
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
</div>
<div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div>
<div class="m-r-20" align="right">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
</div>
</div>
</div>
</div>
@@ -341,7 +347,7 @@
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
url: "<%=origami_payment_dinga_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code},
success: function(result){

View File

@@ -237,6 +237,9 @@ scope "(:locale)", locale: /en|mm/ do
get '/:addorders/:id' => "addorders#detail"
post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' }
get '/addorders/get_item_instance/:id' => "addorders#get_item_instance",:as => "get_item_instance", :defaults => { :format => 'json' }
resources :commissions
resources :commissioners

View File

@@ -13,7 +13,7 @@
development:
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
sx_provision_url: https://connect.pos-myanmar.com/bensai/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
server_mode: cloud
server_mode: application
cipher_type: AES-256-CBC
sx_key: Wh@t1$C2L