diff --git a/Gemfile b/Gemfile index 22275707..227cfa72 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'rails', '~> 5.1.0' gem 'mysql2', '>= 0.3.18', '< 0.5' #Use PosgreSQL -# gem 'pg' +gem 'pg' # redis server for cable # gem 'redis', '~> 3.0' diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index d6588a94..3606dadc 100644 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -130,6 +130,11 @@ text-align: right; } +.item-attr-edit{ + width: 10%; + text-align: left; +} + .display-none{ display: none; } diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 00abc9aa..0119953f 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -11,7 +11,7 @@ class Origami::PaymentsController < BaseOrigamiController saleObj = Sale.find(sale_id) sale_payment = SalePayment.new sale_payment.process_payment(saleObj, @user, cash, "cash") - + rebate_amount = nil unique_code = "ReceiptBillPdf" @@ -53,7 +53,8 @@ class Origami::PaymentsController < BaseOrigamiController response["data"].each do |res| if res["accountable_type"] == "RebateAccount" @balance = res["balance"] - @accountable_type = res["accountable_type"] + # @accountable_type = res["accountable_type"] + @accountable_type = "Rebate Balance" end end end diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb new file mode 100644 index 00000000..93e98d03 --- /dev/null +++ b/app/controllers/origami/sale_edit_controller.rb @@ -0,0 +1,8 @@ +class Origami::SaleEditController < BaseOrigamiController + + def edit + sale_id = params[:sale_id] + @table_id = params[:table_id] + @saleobj = Sale.find(sale_id) + end +end diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index f8cb639c..0e10307b 100644 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -20,8 +20,6 @@ class DiningFacility < ApplicationRecord def get_booking booking = self.get_current_booking - puts "is bookig?" - puts booking if booking if booking.dining_facility_id.to_i == self.id if booking.booking_status == 'assign' diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index f118506c..73f298ec 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -272,17 +272,19 @@ <% if @dining.bookings.length >= 1 %> - + <% if @status_order == 'order' && @status_sale != 'sale' %> - + + <% else %> - + + @@ -416,35 +418,41 @@ $('#add_invoice').on('click',function(){ //show cusotmer rebate amount function show_customer_details(customer_id){ var url = '<%= @show_customer_details_path %>' + //Start Ajax + $.ajax({ + type: "GET", + url: url, + data: {}, + dataType: "json", + success: function(data) { + $("#customer_name").text(data["customer"].name); + if (data["response_data"]["data"].length) { + $.each(data["response_data"]["data"], function (i) { + if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){ + var balance = data["response_data"]["data"][i]["balance"]; + if (data["response_data"]["status"]==true) { + $('.rebate_amount').removeClass('hide'); + row = + '
Receipt No: + <%= @saleobj.receipt_no rescue '' %> +
+Date: <%= @saleobj.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
+| # | +Items | +QTY + | Price + | Action | +
|---|---|---|---|---|
| <%= count %> | +<%= sale_item.product_name %> | ++ | + | + | +