Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into r-1804001-01

This commit is contained in:
Aung Myo
2018-04-19 16:56:30 +06:30
16 changed files with 140 additions and 41 deletions

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 id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div>
@@ -348,7 +354,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

@@ -432,20 +432,12 @@
<iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe>
</div>
</div>
<div class="modal-footer ">
<div class="row m-b-10 m-r-30">
<div class="col-md-5 m-r-20">
<% if ENV["SERVER_MODE"] != "cloud" %>
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
<% end %>
</div>
<div class="col-md-5 m-r-20">
<button type="button" class="btn btn-link bg-blue waves-effect btn_pdf_close" data-dismiss="modal">CLOSE</button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="mr-2 btn btn-link bg-red waves-effect print_receipt"> Print
</button>
<button type="button" class="btn btn-link bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
CLOSE
</button>
</div>
</div>
</div>
@@ -1049,7 +1041,6 @@ var customer_name = "<%= @customer.name %>";
url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print",
data: params,
success:function(result){
console.log(result);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);