diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js
index c4035ead..64ebc678 100644
--- a/app/assets/javascripts/OQS.js
+++ b/app/assets/javascripts/OQS.js
@@ -18,8 +18,6 @@
//= require cable
$(document).ready(function(){
-
-
$(".nav-completed").on("click", function(){
$("#completed").removeClass('hide')
@@ -36,9 +34,7 @@ $(document).ready(function(){
var oqs_id = $(this).find(".oqs-id").text();
var url = 'oqs/get_items/'+oqs_id;
- show_details(url);
-
-
+ show_details(url);
}); //End Click
diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js
index a394e468..6d79ca2a 100644
--- a/app/assets/javascripts/addorder.js
+++ b/app/assets/javascripts/addorder.js
@@ -8,12 +8,6 @@ $(function(){
});
//End menu category Click
- $("#set_change_qty").change(function(){
- qty = $(this).val();
- price = $("#set_total_price").text();
- $("#set_total_price").text(qty*price);
- });
-
//show menu item list when click menu category
function show_menu_item_list(url_item){
var menu_list = $('.menu_items_list');
@@ -104,10 +98,10 @@ $(function(){
}
//end show list function
//click item row for item set
- $(document).on('click', '.set_item_box', function(event){
- $(".instance-list").empty();
- $(".options-list").empty();
-
+ $(document).on('click', '.set_item_box', function(event){
+ $(".instance-list").empty();
+ $(".options-list").empty();
+ change_qty_plus_minus("set_count","set_plus","set_minus");
data = $(this).parent().children().children('.add_icon');
instances = $(this).data('instance');
@@ -152,8 +146,10 @@ $(function(){
$('#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_total_price').text(data.attr('data-price'));
+ $('#set_total_price').text(0);
$('#set_unit_price').text(data.attr('data-price'));
+ // $('#set_unit_price').text(0);
});
// click instance for add item set
$(document).on('click', '.instance_box', function(event){
@@ -179,7 +175,8 @@ $(function(){
sub_total = $('#set_total_price').text();
name = $(this).data('name');
price = $(this).data('price');
- qty = $('#set_change_qty').val();
+ // qty = $('#set_change_qty').val();
+ qty = document.getElementById("set_count").value;
total = qty*price;
var total_price = +sub_total - +total;
$(this).removeClass('selected-instance');
@@ -187,21 +184,24 @@ $(function(){
$(this).removeAttr('data-options');
$('#instance_option').text('')
}else {
+
sub_total = $('#set_total_price').text();
name = $(this).data('name');
price = $(this).data('price');
- qty = $('#set_change_qty').val();
+ // qty = $('#set_change_qty').val();
+ qty = document.getElementById("set_count").value;
total = qty*price;
var total_price = +sub_total + +total;
$(this).addClass('selected-instance');
}
+ $('#set_unit_price').text(price);
$('#set_total_price').text(total_price);
}); //End selecct attribute buttom
// click add order
$(document).on('click', '.set_order', function(event){
total_price = $('#set_total_price').text();
- qty = parseInt($('#set_change_qty').val());
+ qty = parseInt($('#set_count').val());
item_code = $('#set_item_code').text();
item_name = $('#set_name').text();
@@ -253,6 +253,8 @@ $(function(){
$('.add_to_order').removeAttr('data-attributes');
$('.add_to_order').removeAttr('data-options');
+ change_qty_plus_minus("count","plus","minus");
+
data = $(this).parent().children().children('.add_icon');
$('#total_price').text(data.attr('data-price'));
@@ -273,21 +275,44 @@ $(function(){
for(var field in instances) {
value = instances[field].values;
$(value).each(function(i){
- options = value[i];
- instance_attributes.push(options);
+ options = value[i];
+ instance_attributes.push(options);
+ // $.ajax({
+ // type: "GET",
+ // url: '../../api/restaurant/menu_item_attributes/'+value[i],
+ // data: {id:value[i]},
+ // success:function(result){
+
+ // options = result["name"];
+ // instance_attributes.push(options);
+ // }
+ // });
});
}
+ // selected_arr = []
+ // $(selected_item).each(function(i){
+ // $.ajax({
+ // type: "GET",
+ // url: '../../api/restaurant/menu_item_attributes/'+selected_item[i],
+ // data: {id:selected_item[i]},
+ // success:function(result){
+ // name = result["name"];
+ // selected_arr.push(name);
+ // }
+ // });
+ // });
+
+
for(var field in attributes) {
value = attributes[field]["values"];
type = attributes[field]["type"]
- row = "
"+attributes[field]["type"]+"
"
+ row = ""+attributes[field]["type"]+"
";
+
$(value).each(function(i){
disabled = ""
status ="";
-
-
- if(parseInt(jQuery.inArray(value[i], selected_item))!== -1){
+ if(parseInt(jQuery.inArray(value[i], selected_item)) !== -1){
status = "selected-attribute";
}
if(parseInt(jQuery.inArray(value[i], instance_attributes)) == -1){
@@ -326,6 +351,8 @@ $(function(){
// click select option icon for add
$(document).on('click', '.attribute_btn', function(event){
+
+ $('.change_qty').val(1);
value = $(this).data('value');
type = $(this).data('type');
instances = $(this).data('instances');
@@ -345,7 +372,7 @@ $(function(){
var selected_attr = get_selected_attributes('selected-attribute');
- qty = $('#change_qty').val();
+ qty = $('.change_qty').val();
for(var field in instances) {
item_attr = instances[field].values;
@@ -652,24 +679,72 @@ $(function(){
}
});
- var count = 1;
- var countEl = document.getElementById("count");
- $("#plus").on("click", function(){
- count++;
- countEl.value = count;
+ // Get Selected Class
+ function change_qty_plus_minus(id,plus,minus) {
- price = $("#unit_price").text();
- $("#total_price").text(count*price);
- });
- $("#minus").on("click", function(){
- if (count > 1) {
- count--;
+ var count = 1;
+ var countEl = document.getElementById(id);
+
+ $('#'+plus).on("click", function(){
+
+ count++;
countEl.value = count;
- price = $("#unit_price").text();
- $("#total_price").text(count*price);
- }
- })
+
+ if (id == "count") {
+ price = $("#unit_price").text();
+ $("#total_price").text(count*price);
+ }else{
+ var item_row = $('.selected-instance');
+ price = $("#set_unit_price").text();
+ set_total_price = $("#set_total_price").text();
+
+ if (item_row.length > 1) {
+ total = 0 ;
+ $(item_row).each(function(i){
+ total += count * $(item_row[i]).attr('data-price');
+ total_price = total;
+ });
+ }else{
+ total_price = count*price;
+ }
+
+ $("#set_total_price").text(total_price);
+ }
+ });
+
+ $('#'+minus).on("click", function(){
+ if (count > 1) {
+ count--;
+ countEl.value = count;
+
+ if (id=="count") {
+ price = $("#unit_price").text();
+ $("#total_price").text(count*price);
+ }else{
+ var item_row = $('.selected-instance');
+ price = $("#set_unit_price").text();
+ set_total_price = $("#set_total_price").text();
+
+ if (item_row.length > 1) {
+ total = 0 ;
+ $(item_row).each(function(i){
+ total += count * $(item_row[i]).attr('data-price');
+ total_price = total;
+ });
+ }else{
+ total_price = count*price;
+ }
+ $("#set_total_price").text(total_price);
+ }
+ }
+ })
+ }
+ // $("#set_change_qty").change(function(){
+ // qty = $(this).val();
+ // price = $("#set_total_price").text();
+ // $("#set_total_price").text(qty*price);
+ // });
// $(".change_qty").change(function(){
// qty = $(this).val();
diff --git a/app/assets/stylesheets/CRM.scss b/app/assets/stylesheets/CRM.scss
index 82b84afd..df008329 100644
--- a/app/assets/stylesheets/CRM.scss
+++ b/app/assets/stylesheets/CRM.scss
@@ -81,4 +81,16 @@
padding-top: 5%;
border-radius: 100px;
z-index: 1101;
+}
+
+#container {
+ margin: 0px auto;
+ width: 480px;
+ height: 375px;
+
+}
+#videoElement {
+ width: 480px;
+ height: 375px;
+
}
\ No newline at end of file
diff --git a/app/controllers/api/restaurant/menu_item_attributes_controller.rb b/app/controllers/api/restaurant/menu_item_attributes_controller.rb
index 1b6a48d4..37719c37 100644
--- a/app/controllers/api/restaurant/menu_item_attributes_controller.rb
+++ b/app/controllers/api/restaurant/menu_item_attributes_controller.rb
@@ -1,9 +1,12 @@
class Api::Restaurant::MenuItemAttributesController < Api::ApiController
-
+ skip_before_action :authenticate
#Description
# Pull the default menu details and also other available (active) menus
# Input Params - order_id
def index
@menu_attributes = MenuItemAttribute.all
end
+ def show
+ @attribute = MenuItemAttribute.find(params[:id])
+ end
end
diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb
index 1f9d70f3..6c9127ae 100644
--- a/app/controllers/origami/addorders_controller.rb
+++ b/app/controllers/origami/addorders_controller.rb
@@ -30,10 +30,19 @@ class Origami::AddordersController < BaseOrigamiController
else
@booking = nil
end
-
-
end
+ def get_menu_category ()
+ if (params[:id])
+ #Pull this menu
+ @menu = MenuCategory.find_by_id(params[:id])
+ return @menu
+ else
+ MenuCategory.current_menu
+ end
+ end
+
+
def create
Rails.logger.debug "Order Source - " + params[:order_source].to_s
Rails.logger.debug "Table ID - " + params[:table_id].to_s
diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb
index 1e14fbc5..8fddfa0f 100644
--- a/app/controllers/origami/discounts_controller.rb
+++ b/app/controllers/origami/discounts_controller.rb
@@ -127,88 +127,91 @@ class Origami::DiscountsController < BaseOrigamiController
# Member Discount
def member_discount
- sale_id = params[:sale_id]
- # account_types = JSON.parse(params[:account_types])
- account_types = Account.where("discount=?",true)
- sub_total = params[:sub_total]
- sale = Sale.find(sale_id)
- price = SaleItem.calculate_price_by_accounts(sale.sale_items)
-
- arr = Array.new;
-
- account_types.each do |at|
- price.each do |pc|
- if pc[:name] == at.title && pc[:price]>0
- str={type:pc[:name],amount:pc[:price]}
- arr.push(str)
- end
- end
- end
-
- generic_customer_id = sale.customer.membership_id
-
- receipt_no = sale.receipt_no
- membership = MembershipSetting.find_by_membership_type("paypar_url")
- memberaction = MembershipAction.find_by_membership_type("member_discount")
- merchant_uid = memberaction.merchant_account_id.to_s
- campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
- auth_token = memberaction.auth_token.to_s
- url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
-
- # Check for items for Paypar Cloud
- if arr.length > 0
- begin
- response = HTTParty.post(url,
- :body => { account_no: nil,
- generic_customer_id:generic_customer_id ,
- campaign_type_id: campaign_type_id,
- receipt_no: receipt_no,
- merchant_uid:merchant_uid,
- campaign_method:arr.to_json,
- total_sale_transaction_amount: sale.grand_total,
- auth_token:auth_token}.to_json,
- :headers => {
- 'Content-Type' => 'application/json',
- 'Accept' => 'application/json'
- }, :timeout => 10)
- rescue HTTParty::Error
- response = {:status=> false, :message => "Can't open membership server " }
-
- rescue Net::OpenTimeout
- response = {:status=> false, :message => "Can't open membership server " }
- rescue OpenURI::HTTPError
- response = {:status=> false, :message => "Can't open membership server " }
-
- rescue SocketError
- response = {:status=> false, :message => "Can't open membership server " }
- end
- else
- response = {:status=> false, :message => "You have no selected discount item" }
- end
-
- table_id = sale.bookings[0].dining_facility_id
- table_type = DiningFacility.find(table_id).type
-
- # Re-calc All Amount in Sale
- if response["status"] == true
- discount_amount = response["discount_earned"]
- if response["discount_bonus_earned"]
- discount_amount = discount_amount + response["discount_bonus_earned"]
- end
- sale.compute_by_sale_items(sale_id, sale.sale_items, discount_amount, 'member_discount')
- result = {:status=> "Success",:title=>"Member Discount", :table_id => table_id,:table_type => table_type }
- end
-
- if response["status"] == "500"
- result = {:status=> response["error"],:title=>"Alert", :table_id => table_id,:table_type => table_type }
- end
- if !response.nil?
- if response[:status] == false
- result = {:status=> response[:message],:title=>"Alert", :table_id => table_id,:table_type => table_type }
- end
- end
- render :json => result.to_json
+ sale_id = params[:sale_id]
+ is_card = params[:is_card]
+ sub_total = params[:sub_total]
+ sale = Sale.find(sale_id)
+
+ # Check for Card Payment
+ is_card_payment = SaleItem.get_sale_payments_by_card(sale.sale_payments)
+
+ if is_card_payment != true
+ account_types = Account.where("discount=?",true)
+ table_id = sale.bookings[0].dining_facility_id
+ table_type = DiningFacility.find(table_id).type
+
+ # Get Prices for each accounts (eg: food, beverage)
+ account_price = SaleItem.calculate_price_by_accounts(sale.sale_items)
+ acc_prices = Array.new;
+
+ account_types.each do |at|
+ account_price.each do |pc|
+ if pc[:name] == at.title && pc[:price]>0
+ str={type:pc[:name],amount:pc[:price]}
+ acc_prices.push(str)
+ end
+ end
+ end
+
+ generic_customer_id = sale.customer.membership_id
+ receipt_no = sale.receipt_no
+ membership = MembershipSetting.find_by_membership_type("paypar_url")
+ memberaction = MembershipAction.find_by_membership_type("member_discount")
+ merchant_uid = memberaction.merchant_account_id.to_s
+ campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
+ auth_token = memberaction.auth_token.to_s
+ url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
+
+ # Check for items for Paypar Cloud
+ if acc_prices.length > 0
+ begin
+ response = HTTParty.post(url,
+ :body => { account_no: nil,
+ generic_customer_id:generic_customer_id ,
+ campaign_type_id: campaign_type_id,
+ receipt_no: receipt_no,
+ merchant_uid:merchant_uid,
+ campaign_method:acc_prices.to_json,
+ total_sale_transaction_amount: sale.grand_total,
+ is_card: is_card,
+ auth_token:auth_token}.to_json,
+ :headers => {
+ 'Content-Type' => 'application/json',
+ 'Accept' => 'application/json'
+ }, :timeout => 10)
+ rescue HTTParty::Error
+ response = {"status": false, "message": "Can't open membership server " }
+
+ rescue Net::OpenTimeout
+ response = {"status": false, "message": "Can't open membership server " }
+ rescue OpenURI::HTTPError
+ response = {"status": false, "message": "Can't open membership server " }
+
+ rescue SocketError
+ response = {"status": false, "message": "Can't open membership server " }
+ end
+ else
+ response = {"status": false, "message": "You have no selected discount item" }
+ end
+
+ # Re-calc All Amount in Sale
+ if response["status"] == true
+ discount_amount = response["discount_earned"]
+ if response["discount_bonus_earned"]
+ discount_amount = discount_amount + response["discount_bonus_earned"]
+ end
+ sale.compute_by_sale_items(sale_id, sale.sale_items, discount_amount, 'member_discount')
+ result = {:status=> "Success",:title=>"Member Discount", :table_id => table_id,:table_type => table_type }
+ elsif response["status"] == "500"
+ result = {:status=> response["error"],:title=>"Alert", :table_id => table_id,:table_type => table_type }
+ else
+ result = {:status=> response["message"],:title=>"Alert", :table_id => table_id,:table_type => table_type }
+ end
+
+ render :json => result.to_json
+
+ end #end Is Card Payment
end
#discount for selected order
diff --git a/app/controllers/origami/jcb_controller.rb b/app/controllers/origami/jcb_controller.rb
index 5bed3470..a8b77861 100644
--- a/app/controllers/origami/jcb_controller.rb
+++ b/app/controllers/origami/jcb_controller.rb
@@ -17,6 +17,9 @@ class Origami::JcbController < BaseOrigamiController
end
@can_jcb = total - @jcbcount - others
+ @member_discount = MembershipSetting.find_by_discount(1)
+ @sub_total = sale_data.total_amount
+ @membership_id = sale_data.customer.membership_id
end
def create
diff --git a/app/controllers/origami/master_controller.rb b/app/controllers/origami/master_controller.rb
index 67107167..ba97cad9 100644
--- a/app/controllers/origami/master_controller.rb
+++ b/app/controllers/origami/master_controller.rb
@@ -16,6 +16,9 @@ class Origami::MasterController < BaseOrigamiController
end
end
@can_master = total - @mastercount - others
+ @member_discount = MembershipSetting.find_by_discount(1)
+ @sub_total = sale_data.total_amount
+ @membership_id = sale_data.customer.membership_id
end
def create
diff --git a/app/controllers/origami/mpu_controller.rb b/app/controllers/origami/mpu_controller.rb
index 3707d1f4..c9f707e3 100644
--- a/app/controllers/origami/mpu_controller.rb
+++ b/app/controllers/origami/mpu_controller.rb
@@ -5,9 +5,10 @@ class Origami::MpuController < BaseOrigamiController
# limit mpu_amount
sale_data = Sale.find_by_sale_id(@sale_id)
- total = sale_data.grand_total
+ total = sale_data.grand_total
@mpucount = 0
- others = 0
+ others = 0
+
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "mpu"
@mpucount = @mpucount + sale_payment.payment_amount
@@ -17,6 +18,9 @@ class Origami::MpuController < BaseOrigamiController
end
@can_mpu = total - @mpucount - others
+ @member_discount = MembershipSetting.find_by_discount(1)
+ @sub_total = sale_data.total_amount
+ @membership_id = sale_data.customer.membership_id
end
def create
diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb
index 109138a5..2a9fe5d9 100644
--- a/app/controllers/origami/payments_controller.rb
+++ b/app/controllers/origami/payments_controller.rb
@@ -75,6 +75,8 @@ class Origami::PaymentsController < BaseOrigamiController
def show
sale_id = params[:sale_id]
+
+ @member_discount = MembershipSetting.find_by_discount(1)
if Sale.exists?(sale_id)
@cash = 0.0
diff --git a/app/controllers/origami/visa_controller.rb b/app/controllers/origami/visa_controller.rb
index 3cb8cabb..552d960b 100644
--- a/app/controllers/origami/visa_controller.rb
+++ b/app/controllers/origami/visa_controller.rb
@@ -16,6 +16,9 @@ class Origami::VisaController < BaseOrigamiController
end
end
@can_visa = total - @visacount - others
+ @member_discount = MembershipSetting.find_by_discount(1)
+ @sub_total = sale_data.total_amount
+ @membership_id = sale_data.customer.membership_id
end
def create
diff --git a/app/controllers/settings/menu_item_instances_controller.rb b/app/controllers/settings/menu_item_instances_controller.rb
index 6b5f8652..ac2acc7f 100644
--- a/app/controllers/settings/menu_item_instances_controller.rb
+++ b/app/controllers/settings/menu_item_instances_controller.rb
@@ -92,12 +92,14 @@ class Settings::MenuItemInstancesController < ApplicationController
category = MenuCategory.find(id)
# Bind for Item Sets
- if params[:menu_item_instance][:item_sets].count > 1
+ if params[:menu_item_instance][:item_sets].count > 0
params[:menu_item_instance][:item_sets].delete_at(0)
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
- if sets.count > 0
+ if sets.count >= 0
+ # destroy all item sets for edit
+ @settings_menu_item_instances.item_sets.destroy
@settings_menu_item_instances.item_sets = sets
end
end
diff --git a/app/controllers/settings/set_menu_items_controller.rb b/app/controllers/settings/set_menu_items_controller.rb
index a9e91a94..d37a59c9 100644
--- a/app/controllers/settings/set_menu_items_controller.rb
+++ b/app/controllers/settings/set_menu_items_controller.rb
@@ -75,12 +75,14 @@ class Settings::SetMenuItemsController < ApplicationController
params[:set_menu_item][:item_options].delete_at(0)
# Bind for Item Sets
- if params[:set_menu_item][:item_sets].count > 1
+ if params[:set_menu_item][:item_sets].count > 0
params[:set_menu_item][:item_sets].delete_at(0)
sets = ItemSet.find(params[:set_menu_item][:item_sets])
- if sets.count > 0
+ if sets.count >= 0
+ # destroy all item sets for edit
+ @settings_menu_item.item_sets.destroy
@settings_menu_item.item_sets = sets
end
end
diff --git a/app/controllers/settings/simple_menu_items_controller.rb b/app/controllers/settings/simple_menu_items_controller.rb
index e3010e30..319934ca 100644
--- a/app/controllers/settings/simple_menu_items_controller.rb
+++ b/app/controllers/settings/simple_menu_items_controller.rb
@@ -98,12 +98,14 @@ class Settings::SimpleMenuItemsController < ApplicationController
params[:simple_menu_item][:item_options].delete_at(0)
# Bind for Item Sets
- if params[:simple_menu_item][:item_sets].count > 1
+ if params[:simple_menu_item][:item_sets].count > 0
params[:simple_menu_item][:item_sets].delete_at(0)
sets = ItemSet.find(params[:simple_menu_item][:item_sets])
- if sets.count > 0
+ if sets.count >= 0
+ # destroy all item sets for edit
+ @settings_menu_item.item_sets.destroy
@settings_menu_item.item_sets = sets
end
end
diff --git a/app/models/promotion.rb b/app/models/promotion.rb
index 021fda65..d17a39b0 100644
--- a/app/models/promotion.rb
+++ b/app/models/promotion.rb
@@ -23,7 +23,7 @@ class Promotion < ApplicationRecord
end
def self.is_between_promo_datetime(current_day,current_time) #database is not local time
- promoList = Promotion.where("(Date_Format(promo_start_date, 'YYYY-MM-DD') <=? AND Date_Format(promo_end_date, 'YYYY-MM-DD') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
+ promoList = Promotion.where("(Date_Format(promo_start_date, '%Y-%m-%d') <=? AND Date_Format(promo_end_date, '%Y-%m-%d') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
return promoList
end
diff --git a/app/models/sale_item.rb b/app/models/sale_item.rb
index b8ae456d..c4aae1fa 100644
--- a/app/models/sale_item.rb
+++ b/app/models/sale_item.rb
@@ -107,7 +107,17 @@ class SaleItem < ApplicationRecord
return price,type
end
+ # Check for Card Payment
+ def self.get_sale_payments_by_card(sale_payments)
+ # Check for Card Payment
+ sale_payments.each do |sp|
+ if sp.payment_method == "jcb" || sp.payment_method == "mpu" || sp.payment_method == "visa" || sp.payment_method == "master"
+ return true;
+ end
+ end
+
+ end
# def self.get_overall_discount(sale_id)
# price = 0.0
# item=SaleItem.where("product_code=?", sale_id)
diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb
index 4719e546..5f97bcfc 100644
--- a/app/models/sale_payment.rb
+++ b/app/models/sale_payment.rb
@@ -263,6 +263,8 @@ class SalePayment < ApplicationRecord
end
def sale_update_payment_status(paid_amount)
+ puts paid_amount
+ puts "parid Masssssssssssssssssssssssssssssssssssssssss"
#update amount_outstanding
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
self.sale.save!
diff --git a/app/views/api/restaurant/menu/_menu_item.json.jbuilder b/app/views/api/restaurant/menu/_menu_item.json.jbuilder
index e692ccdb..fe7c1979 100644
--- a/app/views/api/restaurant/menu/_menu_item.json.jbuilder
+++ b/app/views/api/restaurant/menu/_menu_item.json.jbuilder
@@ -92,6 +92,7 @@ json.options opt_format
json.instances item.menu_item_instances do |is|
# Convert id to name for attributes
instance_attr = []
+
is.item_attributes.each do |ia|
# mItemAttr = MenuItemAttribute.find(is)
# instance_attr.push(ia)
diff --git a/app/views/api/restaurant/menu_item_attributes/show.json.jbuilder b/app/views/api/restaurant/menu_item_attributes/show.json.jbuilder
new file mode 100644
index 00000000..e158f807
--- /dev/null
+++ b/app/views/api/restaurant/menu_item_attributes/show.json.jbuilder
@@ -0,0 +1,8 @@
+if(@attribute)
+ json.id @attribute.id
+ json.type @attribute.attribute_type
+ json.name @attribute.name
+ json.value @attribute.value
+else
+ json.success false
+end
\ No newline at end of file
diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb
index c39f065f..260bdbcd 100644
--- a/app/views/crm/customers/_new_form.html.erb
+++ b/app/views/crm/customers/_new_form.html.erb
@@ -138,7 +138,29 @@
+
+
diff --git a/app/views/origami/master/index.html.erb b/app/views/origami/master/index.html.erb
index 6afc1081..ab396252 100644
--- a/app/views/origami/master/index.html.erb
+++ b/app/views/origami/master/index.html.erb
@@ -7,160 +7,194 @@
Master
-
-
-
-
-
-
-
-
+
<%= @membership_id%>
+
<%= @member_discount%>
+
<%= @sub_total%>
+
+
-
-
-
+
+
+
+
+
diff --git a/app/views/origami/mpu/index.html.erb b/app/views/origami/mpu/index.html.erb
index e8e25b2f..30d12d35 100644
--- a/app/views/origami/mpu/index.html.erb
+++ b/app/views/origami/mpu/index.html.erb
@@ -7,160 +7,195 @@
MPU
-
-
+
<%= @membership_id%>
+
<%= @member_discount%>
+
<%= @sub_total%>
+
-
+ });
+ $('#mpu_pay').on('click',function(){
+ var amount = $('#amount').text();
+ var sale_id = "<%= @sale_id %>";
+ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
+ //start member discount 5% by pay card
+ var sub_total = $('#sub-total').text();
+ var member_id = $('#membership_id').text();
+ var member_discount = $('#member_discount').text();
+ if (member_id && member_discount) {
+ $.ajax({
+ type: "POST",
+ url: "/origami/" + sale_id + "/member_discount",
+ data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
+ // success:function(result){
+ // }
+ });
+ }
+ //end member discount
+ //Mpu Payment
+ $.ajax({type: "POST",
+ url: "<%= origami_payment_mpu_path %>",
+ data: "amount="+ amount + "&sale_id="+ sale_id,
+ success:function(result){
+ if(result){
+ $.confirm({
+ title: 'Infomation!',
+ content: 'Payment Successfully',
+ buttons: {
+ confirm: {
+ text: 'Ok',
+ btnClass: 'btn-green',
+ action: function(){
+ window.location.href = '/origami/sale/'+ sale_id + "/payment";
+ }
+ }
+ }
+ });
+ }
+ }
+ });
+ }else{
+ $.alert({
+ title: 'Alert!',
+ content: "Paid Amount is over!",
+ type: 'red',
+ typeAnimated: true,
+ btnClass: 'btn-danger',
+ });
+ }
+ })
+
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb
index 36c4cc0e..f0298e73 100644
--- a/app/views/origami/payments/show.html.erb
+++ b/app/views/origami/payments/show.html.erb
@@ -1,8 +1,8 @@
+
+
-
+
@@ -123,159 +125,159 @@
<%= @credit %>
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0%>
-
-
Other Payments
-
<%= @other %>
-
+
+
Other Payments
+
<%= @other %>
+
<% else %>
-
+
<% end %>
-
- <% if @other != 0.0 %>
-
-
-
MPU
-
<%= @other %>
-
- <% else %>
-
- <% end %>
-
- <% if @ppamount != 0.0 %>
-
-
-
Redeem
-
<%= @ppamount %>
-
- <% else %>
-
- <% end %>
-
- <% if @visacount != 0.0 %>
-
-
-
Visa
-
<%= @visacount %>
-
- <% else %>
-
- <% end %>
-
- <% if @jcbcount != 0.0 %>
-
-
-
JCB
-
<%= @jcbcount %>
-
- <% else %>
-
- <% end %>
-
- <% if @mastercount != 0.0 %>
-
-
-
Master
-
<%= @mastercount %>
-
- <% else %>
-
- <% end %>
-
+
+ <% if @other != 0.0 %>
+
+
+
MPU
+
<%= @other %>
+
+ <% else %>
+
+ <% end %>
+
+ <% if @ppamount != 0.0 %>
+
+
+
Redeem
+
<%= @ppamount %>
+
+ <% else %>
+
+ <% end %>
+
+ <% if @visacount != 0.0 %>
+
+
+
Visa
+
<%= @visacount %>
+
+ <% else %>
+
+ <% end %>
+
+ <% if @jcbcount != 0.0 %>
+
+
+
JCB
+
<%= @jcbcount %>
+
+ <% else %>
+
+ <% end %>
+
+ <% if @mastercount != 0.0 %>
+
+
+
Master
+
<%= @mastercount %>
+
+ <% else %>
+
+ <% end %>
+
Balance
<%= @sale_data.grand_total %>
-
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
+
\ No newline at end of file
diff --git a/app/views/origami/redeem_payments/index.html.erb b/app/views/origami/redeem_payments/index.html.erb
index a4783010..df4e7cf9 100644
--- a/app/views/origami/redeem_payments/index.html.erb
+++ b/app/views/origami/redeem_payments/index.html.erb
@@ -147,6 +147,7 @@ $(document).on('click', '.cashier_number', function(event){
return false;
}
});
+
$("#redeem").click(function(){
valid_amount = $("#valid_amount").val();
sale_id = $("#valid_amount").attr('data-value');
diff --git a/app/views/origami/visa/index.html.erb b/app/views/origami/visa/index.html.erb
index 1589ca1b..073b7e60 100644
--- a/app/views/origami/visa/index.html.erb
+++ b/app/views/origami/visa/index.html.erb
@@ -7,160 +7,194 @@
VISA
-
-
-
-
-
-
-
-
+
<%= @membership_id%>
+
<%= @member_discount%>
+
<%= @sub_total%>
+
+
-
-
-
+
+
+
+
+
diff --git a/app/views/settings/menu_item_instances/edit.html.erb b/app/views/settings/menu_item_instances/edit.html.erb
index d5884474..d82b8486 100644
--- a/app/views/settings/menu_item_instances/edit.html.erb
+++ b/app/views/settings/menu_item_instances/edit.html.erb
@@ -12,5 +12,26 @@
<%= render 'form', settings_menu_item_menu_item_instances: @settings_menu_item_instances, item_sets: @item_sets %>
-
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 6ac723aa..70accbb2 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -33,7 +33,7 @@ Rails.application.routes.draw do
resources :menu, only: [:index, :show]
resources :menu_categories, only: [:index, :show]
resources :menu_items, only: [:index, :show]
- resources :menu_item_attributes, only: [:index]
+ resources :menu_item_attributes, only: [:index, :show]
resources :menu_item_options, only: [:index]
resources :menu_sold_out, only: [:index]
resources :menu_item_instances, only: [:show]
@@ -178,8 +178,9 @@ Rails.application.routes.draw do
post '/:sale_id/get_customer' => "customers#get_customer"
- get '/:addorders/:id' => "addorders#detail"
- post '/:addorders/create' => "addorders#create", :defaults => { :format => 'json' }
+ get '/:addorders/:id' => "addorders#detail"
+ post '/:addorders/create' => "addorders#create", :defaults => { :format => 'json' }
+ get '/addorders/get_menu_category/:id' => "addorders#get_menu_category",:as => "get_menu_category", :defaults => { :format => 'json' }
resources :commissions
resources :commissioners