diff --git a/Gemfile b/Gemfile index 7295ffab..e6e99241 100644 --- a/Gemfile +++ b/Gemfile @@ -95,6 +95,6 @@ gem 'httparty', '~> 0.15.5' # gem 'momentjs-rails', '>= 2.9.0' # gem 'bootstrap-datepicker-rails' -# gem 'momentjs-rails', '>= 2.9.0' -# gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47' +# # gem 'momentjs-rails', '>= 2.9.0' +# gem 'bootstrap3-datetimepicker-rails'z gem 'bootstrap-datepicker-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 6a7c6340..7b18943d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -80,8 +80,8 @@ GEM httparty (0.15.5) multi_xml (>= 0.5.2) i18n (0.8.4) - jbuilder (2.6.4) - activesupport (>= 3.0.0) + jbuilder (2.7.0) + activesupport (>= 4.2.0) multi_json (>= 1.2) jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) @@ -95,20 +95,20 @@ GEM rb-inotify (~> 0.9, >= 0.9.7) loofah (2.0.3) nokogiri (>= 1.5.9) - mail (2.6.5) + mail (2.6.6) mime-types (>= 1.16, < 4) method_source (0.8.2) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_portile2 (2.1.0) + mini_portile2 (2.2.0) minitest (5.10.2) multi_json (1.12.1) multi_xml (0.6.0) mysql2 (0.4.6) nio4r (2.1.0) - nokogiri (1.7.2) - mini_portile2 (~> 2.1.0) + nokogiri (1.8.0) + mini_portile2 (~> 2.2.0) pdf-core (0.7.0) prawn (2.2.2) pdf-core (~> 0.7.0) @@ -179,7 +179,7 @@ GEM activesupport (>= 3.2.1) shoulda-matchers (3.1.1) activesupport (>= 4.0.0) - sidekiq (5.0.0) + sidekiq (5.0.2) concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 59e4a386..f4ee96ab 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -17,11 +17,7 @@ //= require turbolinks //= require cable //= require settings/processing_items -//= require bootstrap-datepicker/core -//= require bootstrap-datepicker/locales/bootstrap-datepicker.es +//= require bootstrap-datepicker + -$(document).on("focus", "[data-behaviour~='datepicker']", function(e){ - $(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true}); - $('.dropdown-toggle').dropdown(); -}); diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js index ce5ac871..43efe3f2 100644 --- a/app/assets/javascripts/cable.js +++ b/app/assets/javascripts/cable.js @@ -6,9 +6,9 @@ //= require_tree ./channels // Temp Disable -// (function() { -// this.App || (this.App = {}); +(function() { + this.App || (this.App = {}); -// App.cable = ActionCable.createConsumer(); + App.cable = ActionCable.createConsumer(); -// }).call(this); +}).call(this); diff --git a/app/assets/javascripts/report.js b/app/assets/javascripts/report.js new file mode 100644 index 00000000..09f74075 --- /dev/null +++ b/app/assets/javascripts/report.js @@ -0,0 +1,4 @@ +$(document).on("focus", "[data-behaviour~='datepicker']", function(e){ + $(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true}); + $('.dropdown-toggle').dropdown(); +}); \ No newline at end of file diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 00000000..e69de29b diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 468ac33d..c3030dfb 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -2,7 +2,7 @@ @import "bootstrap"; @import "font-awesome"; @import "theme"; -@import 'bootstrap-datepicker'; +@import "bootstrap-datepicker"; /* Show it is fixed to the top */ // body { diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 525302c8..2933cda8 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -10,13 +10,13 @@ class Crm::CustomersController < BaseCrmController @crm_customers = Customer.order("customer_id").page(params[:page]) #@products = Product.order("name").page(params[:page]).per(5) else - @crm_customers = Customer.where("name LIKE ?", "%#{filter}%").order("name").page(params[:page]) - end + @crm_customers = Customer.where("name LIKE ?", "%#{filter}%").order("name").page(params[:page]) end #@crm_customers = Customer.all @crm_customer = Customer.new - if @crm_customer.valid? - @crm_customer.errors.messages - end + + + # puts @crm_customer.valid? + # @membership = Customer.get_member_group # if @membership["status"] == true # @member_group = @membership["data"] @@ -57,8 +57,9 @@ class Crm::CustomersController < BaseCrmController def create @crm_customers = Customer.new(customer_params) - + respond_to do |format| + puts @crm_customers.errors.to_json if @crm_customers.save name = customer_params[:name] phone = customer_params[:contact_no] @@ -105,6 +106,7 @@ class Crm::CustomersController < BaseCrmController if params[:sale_id] format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer'} else + format.html { redirect_to crm_customers_path} format.json { render json: @crm_customers.errors, status: :unprocessable_entity } end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 290a2911..1e08f8a8 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -20,6 +20,31 @@ class Origami::PaymentsController < BaseOrigamiController @cash = 0.0 @other = 0.0 @sale_data = Sale.find_by_sale_id(sale_id) + + #get customer amount + @customer = Customer.find(@sale_data.customer_id) + + membership = MembershipSetting.find_by_membership_type("paypar_url") + + memberaction = MembershipAction.find_by_membership_type("get_all_member_account") + merchant_uid = memberaction.merchant_account_id.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + + response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + } + ) + + @balance = 0.00 + response["data"].each do |res| + if res["accountable_type"] == "RebateAccount" + @balance = res["balance"] + end + end + #end customer amount + @sale_data.sale_payments.each do |spay| if spay.payment_method == "cash" @cash = spay.payment_amount diff --git a/app/models/order.rb b/app/models/order.rb index 5a4d6e2d..ac51c115 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -244,21 +244,9 @@ class Order < ApplicationRecord .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") .where("sales.sale_status='completed'") -<<<<<<< HEAD .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status") end - #Origami: Cashier : to view booking order Table - def self.get_booking_order_table - booking_orders = Booking.select("sales.receipt_no,orders.status as order_status, - bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") - .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") - .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") - .joins("left join orders on orders.order_id = booking_orders.order_id") - .joins("left join sales on sales.sale_id = bookings.sale_id") - .where("sales.sale_status<>'completed' and booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true) - .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.customer_id,sales.customer_id,orders.order_id") - end #Origami: Cashier : to view order type Room def self.get_booking_order_rooms diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 9f62b55b..034f06b7 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -66,37 +66,32 @@ -