diff --git a/app/assets/stylesheets/orgiami.scss b/app/assets/stylesheets/orgiami.scss index 70e1fe8b..327c5897 100644 --- a/app/assets/stylesheets/orgiami.scss +++ b/app/assets/stylesheets/orgiami.scss @@ -25,3 +25,7 @@ .long{ width:100% } + +.purple { + background-color:#7a62d3; +} diff --git a/app/controllers/origami/card_payments_controller.rb b/app/controllers/origami/card_payments_controller.rb new file mode 100644 index 00000000..2df4b266 --- /dev/null +++ b/app/controllers/origami/card_payments_controller.rb @@ -0,0 +1,10 @@ +class Origami::CardPaymentsController < BaseOrigamiController + + + def index + end + + def create + end + +end diff --git a/app/controllers/origami/credit_payments_controller.rb b/app/controllers/origami/credit_payments_controller.rb new file mode 100644 index 00000000..a348951e --- /dev/null +++ b/app/controllers/origami/credit_payments_controller.rb @@ -0,0 +1,10 @@ +class Origami::CreditPaymentsController < BaseOrigamiController + + + def index + end + + def create + end + +end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index a09b81fe..f64e27e3 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -2,13 +2,16 @@ class Origami::PaymentsController < BaseOrigamiController def index - end def create + #payment type + #sale status + #point - get [ food amount ] end def show end + end diff --git a/app/models/sale.rb b/app/models/sale.rb index 0c8b3e43..db1eedcf 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -1,6 +1,6 @@ class Sale < ApplicationRecord self.primary_key = "sale_id" - + #primary key - need to be unique generated for multiple shops before_create :generate_custom_id @@ -17,6 +17,7 @@ class Sale < ApplicationRecord scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") } def generate_invoice_from_booking(booking_id, requested_by) + puts "get invoice from booking" booking = Booking.find(booking_id) status = false Rails.logger.debug "Booking -> " + booking.id.to_s @@ -32,6 +33,7 @@ class Sale < ApplicationRecord booking.sale_id = sale_id end order = booking.booking_orders.take.order + puts "add sale order" link_order_sale(order.id) return status, sale_id end @@ -68,8 +70,8 @@ class Sale < ApplicationRecord add_item(item) end - link_order_sale(order.id) - + link_order_sale(order.id) + end @@ -226,9 +228,14 @@ class Sale < ApplicationRecord def link_order_sale(order_id) #create if it doesn't exist - if (SaleOrder.where("sale_id = #{self.id} and order_id=#{order_id}").nil?) + saleOrder = SaleOrder.where("sale_id=? and order_id=?", self.id, order_id).take + + if saleOrder.nil? SaleOrder.create(:sale_id => self.id, :order_id => order_id) end + # if (SaleOrder.where("sale_id = #{self.id} and order_id=#{order_id}").nil?) + # SaleOrder.create(:sale_id => self.id, :order_id => order_id) + # end #dosomrting here #puts Time.now.format(":short") end diff --git a/app/views/origami/card_payments/index.html.erb b/app/views/origami/card_payments/index.html.erb new file mode 100644 index 00000000..86ef10b0 --- /dev/null +++ b/app/views/origami/card_payments/index.html.erb @@ -0,0 +1 @@ +Hello Card Payment diff --git a/app/views/origami/credit_payments/index.html.erb b/app/views/origami/credit_payments/index.html.erb new file mode 100644 index 00000000..e4f97119 --- /dev/null +++ b/app/views/origami/credit_payments/index.html.erb @@ -0,0 +1 @@ +hello Credit diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index a26322dd..ac8c7678 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -314,14 +314,15 @@ $( document ).ready(function() { window.location.href = '/origami/request_bills/'+ table_or_order_id return false; }); + + $('#pay').click(function() { + window.location.href = '/origami/sale/'+ pay_sale_id + "/payment" + return false; + }); + }); -$( document ).ready(function() { - $('#pay').click(function() { - window.location.href = '/origami/sale/'+ pay_sale_id + "/payment" - return false; - }); -}); +