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 2670dcc4..ae4a3181 100644 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -128,6 +128,11 @@ text-align: right; } +.item-attr-edit{ + width: 10%; + text-align: left; +} + .display-none{ display: none; } @@ -186,4 +191,4 @@ tr.discount-item-row:hover { .jconfirm-box-container{ margin-left:-40px !important -} \ No newline at end of file +} diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 38225fae..c063d935 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 d0b53858..0974e7da 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -260,17 +260,19 @@ <% if @dining.bookings.length >= 1 %> - + <% if @status_order == 'order' && @status_sale != 'sale' %> - + + <% else %> - + + @@ -382,4 +384,10 @@ $('#add_invoice').on('click',function(){ } }); }) + +$('#edit').on('click',function(){ + var dining_id = "<%= @dining.id %>" + var sale_id = "<%= @obj_sale.sale_id rescue "" %>" + window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit"; +}) diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb new file mode 100644 index 00000000..f04561e0 --- /dev/null +++ b/app/views/origami/sale_edit/edit.html.erb @@ -0,0 +1,120 @@ +
+ +
+
+
+
INVOICE DETAILS
+
+
+
+
+

Receipt No: + <%= @saleobj.receipt_no rescue '' %> +

+
+
+

Date: <%= @saleobj.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+
+
+
+
+

Customer :

+
+ +
+
+ + + + + + + + + + <% + count = 0 + sub_total = 0 + @saleobj.sale_items.each do |sale_item| + count += 1 + sub_total = sub_total + sale_item.price + %> + + <% + # Can't check for discount + unless sale_item.price == 0 + %> + + + + + + + + <% + end + end + %> + +
#ItemsQTY + Price + Action
<%= count %><%= sale_item.product_name %> +
+
+ +
+
+
+ + +
+ + +
+
+ diff --git a/config/routes.rb b/config/routes.rb index 0bf24ce7..20b87fd1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -76,7 +76,7 @@ Rails.application.routes.draw do resources :customers #add customer type end post 'moving' => "movetable#moving" - + get "/table/:table_id/sale/:sale_id/edit" => "sale_edit#edit" get 'table/:dining_id/movetable' => "movetable#move_dining" get 'table/:dining_id/moveroom' => "moveroom#move_dining" get 'sale/:sale_id' => 'sales#show'