From 646492fbd6fc9fefdb677f2861f54c0d6a14cd11 Mon Sep 17 00:00:00 2001 From: yamin Date: Mon, 14 Aug 2017 10:18:59 +0630 Subject: [PATCH 1/8] updateability --- app/models/ability.rb | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index 1938fb45..ffd0dbaa 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -41,8 +41,8 @@ class Ability can :index, :void_sale can :get_customer, Customer - can :add_customer, Customer - can :update_sale_by_customer, Customer + can :add_customer, Customer + can :update_sale_by_customer, Customer can :index, :other_charge can :create, :other_charge @@ -57,7 +57,7 @@ class Ability can :reprint, :payment can :rounding_adj, :payment - can :move_dining, :movetable + can :move_dining, :movetable can :moving, :movetable can :move_dining, :moveroom @@ -71,14 +71,14 @@ class Ability can :overall_void, :void elsif user.role == "cashier" - + # can :overall_void, :void can :read, Order can :update, Order - - can :read, Sale - can :update, Sale + + can :read, Sale + can :update, Sale can :get_customer, Customer can :add_customer, Customer can :update_sale_by_customer, Customer @@ -97,7 +97,7 @@ class Ability can :reprint, :payment can :rounding_adj, :payment - can :move_dining, :movetable + can :move_dining, :movetable can :moving, :movetable can :move_dining, :moveroom @@ -108,7 +108,7 @@ class Ability can :reprint, :payment can :manage, DiningQueue - + elsif user.role == "account" can :index, :dailysale @@ -122,9 +122,18 @@ class Ability can :edit, :sale_edit can :item_void, :sale_edit + can :an :edit, :sale_edit + can :item_void, :sale_edit can :item_edit, :sale_edit can :item_void_cancel, :sale_edit - can :cancel_all_void, :sale_edit + can :cancel_all_void, :sale_edit + can :apply_void, :sale_edit + can :overall_void, :void + + can :first_bill, :payment + can :citem_edit, :sale_edit + can :item_void_cancel, :sale_edit + can :cancel_all_void, :sale_edit can :apply_void, :sale_edit can :overall_void, :void From 25ab7c9701eef0b883d9e46dc30a45dbbb026979 Mon Sep 17 00:00:00 2001 From: Phyo Date: Mon, 14 Aug 2017 13:41:18 +0630 Subject: [PATCH 2/8] Payment Voucher UI fix --- app/controllers/origami/voucher_controller.rb | 46 +++++++++++++++++-- app/views/origami/voucher/index.html.erb | 36 +++++++++------ config/routes.rb | 1 + 3 files changed, 67 insertions(+), 16 deletions(-) diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index a9bdcc2b..7eda6084 100644 --- a/app/controllers/origami/voucher_controller.rb +++ b/app/controllers/origami/voucher_controller.rb @@ -22,10 +22,50 @@ class Origami::VoucherController < BaseOrigamiController def create cash = params[:amount] sale_id = params[:sale_id] + sale_id = params[:refnumber] if(Sale.exists?(sale_id)) - saleObj = Sale.find(sale_id) - sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "voucher") + customer_data= Customer.find_by_customer_id(sale_data.customer_id) + if customer_data + membership_id = customer_data.membership_id + membership_setting = MembershipSetting.find_by_membership_type("paypar_url") + if membership_setting.gateway_url + member_actions =MembershipAction.find_by_membership_type("get_account_balance") #need to modify here + if member_actions.gateway_url + campaign_type_id = member_actions.additional_parameter["campaign_type_id"] + url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s + merchant_uid= member_actions.merchant_account_id + auth_token = member_actions.auth_token.to_s + # membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token) + # if membership_data["status"]==true + begin + response = HTTParty.get(url, + :body => { app_token: token,membership_id:membership_id, + campaign_type_id:campaign_type_id,merchant_uid:merchant_uid, + auth_token:auth_token + }.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + + rescue OpenURI::HTTPError + response = { status: false} + + rescue SocketError + response = { status: false} + end + # end + end + end + end + if( response["status"]==true ) + saleObj = Sale.find(sale_id) + sale_payment = SalePayment.new + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "voucher") + end end end diff --git a/app/views/origami/voucher/index.html.erb b/app/views/origami/voucher/index.html.erb index 809793ce..db4de245 100644 --- a/app/views/origami/voucher/index.html.erb +++ b/app/views/origami/voucher/index.html.erb @@ -28,14 +28,15 @@
- +

-
0.0
+ +

@@ -103,12 +104,17 @@ $(document).ready(function() { } }); // number key pad +var float_value = "" +var total = 0 + +$(document).on('focusout', '.float-value', function(event){ + float_value = $(this).attr("data-value"); $(document).on('click', '.cashier_number', function(event){ event.stopPropagation(); event.preventDefault(); if(event.handled !== true) { var original_value; - original_value = $('#amount').text(); + original_value = $('#'+float_value).val(); var input_value = $(this).attr("data-value"); @@ -116,28 +122,28 @@ $(document).on('click', '.cashier_number', function(event){ switch (input_type) { case 'num': if (original_value == "0.0"){ - $('#amount').text(input_value); + $('#'+float_value).val(input_value); }else{ - $('#amount').append(input_value); + $('#'+float_value).val(original_value+input_value); } break; case 'add': var input_value = $(this).attr("data-value"); amount = parseInt(input_value) + parseInt(original_value); - $('#amount').html(amount); + $('#'+float_value).val(amount); break; case 'clr': - $('#amount').html("0.0"); + $('#'+float_value).val("0.0"); break; case 'del' : - var cash=$('#amount').text(); - $('#amount').text(cash.substr(0,cash.length-1)); + var cash=$('#'+float_value).val(); + $('#'+float_value).val(cash.substr(0,cash.length-1)); break; case 'nett': var remain_amount = $('#validamount').val(); - $('#amount').text(remain_amount); + $('#'+float_value).val(remain_amount); break; } @@ -146,15 +152,19 @@ $(document).on('click', '.cashier_number', function(event){ return false; } }); +}) $('#voucher_pay').on('click',function(){ - var amount = $('#amount').text(); + var amount = $('#amount').val(); + var refnumber = $("#<%=@sale_id %>").val(); var sale_id = "<%= @sale_id %>"; if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){ + // alert(amount); + // alert(refnumber); $.ajax({type: "POST", - url: "<%= origami_payment_jcb_path %>", - data: "amount="+ amount + "&sale_id="+ sale_id, + url: "<%= origami_payment_voucher_path %>", + data: "amount="+ amount + "&sale_id="+ sale_id+ "&refnumber="+ refnumber, success:function(result){ if(result){ alert("Payment success") diff --git a/config/routes.rb b/config/routes.rb index b6af8698..9e62023c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -137,6 +137,7 @@ Rails.application.routes.draw do post 'payment/visa' => "visa#create" post 'payment/paypar' => 'paypar_payments#create' post 'payment/credit' => 'credit_payments#create' + post 'payment/voucher' => 'voucher_payments#create' get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index" get 'sale/:sale_id/payment/others_payment' => "others_payments#index" From 497a1b60f713fa1dd5022b85f31dc68d74bad657 Mon Sep 17 00:00:00 2001 From: Phyo Date: Mon, 14 Aug 2017 14:04:39 +0630 Subject: [PATCH 3/8] add Updated_at to Employee Listing --- app/views/settings/employees/index.html.erb | 2 ++ app/views/settings/employees/show.html.erb | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/settings/employees/index.html.erb b/app/views/settings/employees/index.html.erb index b44a2dcd..7c1f2eb7 100644 --- a/app/views/settings/employees/index.html.erb +++ b/app/views/settings/employees/index.html.erb @@ -16,6 +16,7 @@ Name Role Created At + Updated At Action @@ -26,6 +27,7 @@ <%= link_to employee.name,settings_employee_path(employee) %> <%= employee.role %> <%= employee.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %> + <%= employee.updated_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %> <%= link_to 'Edit', edit_settings_employee_path(employee) %> <%if employee.role != "administrator"%> diff --git a/app/views/settings/employees/show.html.erb b/app/views/settings/employees/show.html.erb index cad7a6ad..1869fcde 100644 --- a/app/views/settings/employees/show.html.erb +++ b/app/views/settings/employees/show.html.erb @@ -2,7 +2,7 @@ @@ -15,7 +15,8 @@ Name Role - + Created At + Updated At Action @@ -24,6 +25,8 @@ <%= @employee.name %> <%= @employee.role %> + <%= @employee.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %> + <%= @employee.updated_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %> <%= link_to 'Edit', edit_settings_employee_path(@employee) %> @@ -34,4 +37,3 @@ - From fa68bcff69e0226a5695ca30b34e846e5d409afc Mon Sep 17 00:00:00 2001 From: yamin Date: Mon, 14 Aug 2017 14:26:16 +0630 Subject: [PATCH 4/8] removeDBcolsanddbparams --- app/controllers/print_settings_controller.rb | 2 +- app/models/ability.rb | 4 +--- app/views/print_settings/_form.html.erb | 4 ---- app/views/print_settings/index.html.erb | 12 ++---------- app/views/print_settings/show.html.erb | 16 ---------------- ...4041543_remove_d_bcols_from_print_settings.rb | 8 ++++++++ 6 files changed, 12 insertions(+), 34 deletions(-) create mode 100644 db/migrate/20170814041543_remove_d_bcols_from_print_settings.rb diff --git a/app/controllers/print_settings_controller.rb b/app/controllers/print_settings_controller.rb index 8efb9dd5..5bf654ef 100644 --- a/app/controllers/print_settings_controller.rb +++ b/app/controllers/print_settings_controller.rb @@ -70,6 +70,6 @@ class PrintSettingsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def print_setting_params - params.require(:print_setting).permit(:name, :unique_code, :template, :db_name, :db_type, :db_username, :db_password, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space) + params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space) end end diff --git a/app/models/ability.rb b/app/models/ability.rb index ffd0dbaa..444795dd 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -122,11 +122,9 @@ class Ability can :edit, :sale_edit can :item_void, :sale_edit - can :an :edit, :sale_edit - can :item_void, :sale_edit can :item_edit, :sale_edit can :item_void_cancel, :sale_edit - can :cancel_all_void, :sale_edit + can :cancel_all_void, :sale_edit can :apply_void, :sale_edit can :overall_void, :void diff --git a/app/views/print_settings/_form.html.erb b/app/views/print_settings/_form.html.erb index ba703aae..f9079f99 100644 --- a/app/views/print_settings/_form.html.erb +++ b/app/views/print_settings/_form.html.erb @@ -5,10 +5,6 @@ <%= f.input :name %> <%= f.input :unique_code %> <%= f.input :template %> - <%= f.input :db_name %> - <%= f.input :db_type %> - <%= f.input :db_username %> - <%= f.input :db_password %> <%= f.input :printer_name %> <%= f.input :api_settings %> <%= f.input :page_width %> diff --git a/app/views/print_settings/index.html.erb b/app/views/print_settings/index.html.erb index 9c8ce0b0..c16a28c2 100644 --- a/app/views/print_settings/index.html.erb +++ b/app/views/print_settings/index.html.erb @@ -16,11 +16,7 @@ Name Unique code - + Template Printer name Api settings Page width @@ -38,11 +34,7 @@ <%= print_setting.name %> <%= print_setting.unique_code %> - + <%= print_setting.template %> <%= print_setting.printer_name %> <%= print_setting.api_settings %> <%= print_setting.page_width %> diff --git a/app/views/print_settings/show.html.erb b/app/views/print_settings/show.html.erb index 71d74950..46126c4b 100644 --- a/app/views/print_settings/show.html.erb +++ b/app/views/print_settings/show.html.erb @@ -29,22 +29,6 @@ Template <%= @print_setting.template %> - - Db name - <%= @print_setting.db_name %> - - - Db type - <%= @print_setting.db_type %> - - - Db username - <%= @print_setting.db_username %> - - - Db password - <%= @print_setting.db_password %> - Printer name <%= @print_setting.printer_name %> diff --git a/db/migrate/20170814041543_remove_d_bcols_from_print_settings.rb b/db/migrate/20170814041543_remove_d_bcols_from_print_settings.rb new file mode 100644 index 00000000..48a7de5d --- /dev/null +++ b/db/migrate/20170814041543_remove_d_bcols_from_print_settings.rb @@ -0,0 +1,8 @@ +class RemoveDBcolsFromPrintSettings < ActiveRecord::Migration[5.1] + def change + remove_column :print_settings, :db_name, :string + remove_column :print_settings, :db_type, :string + remove_column :print_settings, :db_username, :string + remove_column :print_settings, :db_password, :string + end +end From 3c54f4da89a1346ee853ec587ca2dba5f1a54a70 Mon Sep 17 00:00:00 2001 From: yamin Date: Mon, 14 Aug 2017 14:29:03 +0630 Subject: [PATCH 5/8] addQueryforwidthandheight --- app/pdf/close_cashier_pdf.rb | 4 ++-- app/pdf/crm_order_pdf.rb | 4 ++-- app/pdf/order_item_pdf.rb | 4 ++-- app/pdf/order_summary_pdf.rb | 4 ++-- app/pdf/queue_no_pdf.rb | 4 ++-- app/pdf/receipt_bill_pdf.rb | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb index 4eadf007..133d9c48 100644 --- a/app/pdf/close_cashier_pdf.rb +++ b/app/pdf/close_cashier_pdf.rb @@ -1,8 +1,8 @@ class CloseCashierPdf < Prawn::Document attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width def initialize(printer_settings, shift_sale,shop_details,sale_taxes) - self.page_width = 210 - self.page_height = 7000 + self.page_width = PrintSetting.where("name = ?","Close Cashier").first.page_width + self.page_height = PrintSetting.where("name = ?","Close Cashier").first.page_height self.margin = 5 self.price_width = 40 self.qty_width = 20 diff --git a/app/pdf/crm_order_pdf.rb b/app/pdf/crm_order_pdf.rb index 55d08ecc..a7f85098 100644 --- a/app/pdf/crm_order_pdf.rb +++ b/app/pdf/crm_order_pdf.rb @@ -1,8 +1,8 @@ class CrmOrderPdf < Prawn::Document attr_accessor :receipt_width,:price_column_width,:p_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_column_width,:item_description_width def initialize(booking,order_items,printer_settings) - self.p_width = 200 - self.page_height = 1450 + self.page_width = PrintSetting.where("name = ?","CRM Order").first.page_width + self.page_height = PrintSetting.where("name = ?","CRM Order").first.page_height self.margin = 10 # self.price_width = self.p_width / 2 self.price_width=80 diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index 20a4537c..7b2e350b 100644 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -2,8 +2,8 @@ class OrderItemPdf < Prawn::Document include ActionView::Helpers::NumberHelper attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(print_settings,order_item, print_status, options, alt_name) - self.page_width = 185 - self.page_height = 1450 + self.page_width = PrintSetting.where("name = ?","OrderItemPdf").first.page_width + self.page_height = PrintSetting.where("name = ?","OrderItemPdf").first.page_height self.margin = 0 self.price_width = 40 # No Need for item self.qty_width = 40 diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 244fbdfa..902c68ad 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -2,8 +2,8 @@ class OrderSummaryPdf < Prawn::Document include ActionView::Helpers::NumberHelper attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(print_settings,order, print_status, order_items = nil,alt_name) - self.page_width = 190 - self.page_height = 1450 + self.page_width = PrintSetting.where("name = ?","Order Summary").first.page_width + self.page_height = PrintSetting.where("name = ?","Order Summary").first.page_height self.margin = 0 self.price_width = 40 # No Need for item self.qty_width = 40 diff --git a/app/pdf/queue_no_pdf.rb b/app/pdf/queue_no_pdf.rb index 0963f55e..cda410ca 100644 --- a/app/pdf/queue_no_pdf.rb +++ b/app/pdf/queue_no_pdf.rb @@ -1,8 +1,8 @@ class QueueNoPdf < Prawn::Document attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(printer_settings, queue) - self.page_width = 210 - self.page_height = 1450 + self.page_width = PrintSetting.where("name = ?","Queue No").first.page_width + self.page_height = PrintSetting.where("name = ?","Queue No").first.page_height self.margin = 5 self.price_width = 35 self.qty_width = 20 diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 2dca6d16..3027fb60 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -2,8 +2,8 @@ class ReceiptBillPdf < Prawn::Document include ActionView::Helpers::NumberHelper attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status) - self.page_width = 210 - self.page_height = 1450 + self.page_width = PrintSetting.where("name = ?","Receipt Bill").first.page_width + self.page_height = PrintSetting.where("name = ?","Receipt Bill").first.page_height self.margin = 5 self.price_width = 40 self.qty_width = 20 From af3a7c1d88571d6e2560c372499acd15b5dcc58b Mon Sep 17 00:00:00 2001 From: Phyo Date: Mon, 14 Aug 2017 15:33:13 +0630 Subject: [PATCH 6/8] Room Charges Bug Fix --- .../settings/dining_charges_controller.rb | 12 ++++++++-- app/views/settings/rooms/_form.html.erb | 22 +++++++++++++++++++ app/views/settings/tables/_form.html.erb | 12 +++++----- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/app/controllers/settings/dining_charges_controller.rb b/app/controllers/settings/dining_charges_controller.rb index 6de504bf..2c8e3b7e 100644 --- a/app/controllers/settings/dining_charges_controller.rb +++ b/app/controllers/settings/dining_charges_controller.rb @@ -29,7 +29,11 @@ class Settings::DiningChargesController < ApplicationController @dining_charge.dining_facility_id = @settings_dining_facility.id respond_to do |format| if @dining_charge.save - format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' } + if @table + format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' } + else + format.html { redirect_to edit_settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' } + end format.json { render :show, status: :created, location: @dining_charge } else format.html { render :new } @@ -44,7 +48,11 @@ class Settings::DiningChargesController < ApplicationController respond_to do |format| @dining_charge.dining_facility_id = @settings_dining_facility.id if @dining_charge.update(dining_charge_params) - format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' } + if @table + format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' } + else + format.html { redirect_to edit_settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' } + end format.json { render :show, status: :ok, location: @dining_charge } else format.html { render :edit } diff --git a/app/views/settings/rooms/_form.html.erb b/app/views/settings/rooms/_form.html.erb index 25af618c..a0118e61 100644 --- a/app/views/settings/rooms/_form.html.erb +++ b/app/views/settings/rooms/_form.html.erb @@ -7,6 +7,28 @@ <%= f.input :seater %> <%= f.input :order_by %> <%= f.input :is_active %> + <% if @settings_room.dining_charges.length == 0 %> + <% if @settings_room.id != nil %> +
+
+ <%= link_to 'Add For Extra Charges', new_settings_zone_room_dining_charge_path(@zone,@settings_room),:class => 'btn btn-primary' %> +
+
+ <% end %> + <% else %> + <% @settings_room.dining_charges.each do |dc| %> +
+
Dining Charge
+
item code : <%= dc.item_code %>
+
Unit price : <%= dc.unit_price %>
+
Charge type : <%= dc.charge_type %>
+
+ <%= link_to 'Edit Charges', edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc),:class => 'btn btn-primary' %> + +
+
+ <% end %> + <% end %>
diff --git a/app/views/settings/tables/_form.html.erb b/app/views/settings/tables/_form.html.erb index 3d641592..9736f523 100644 --- a/app/views/settings/tables/_form.html.erb +++ b/app/views/settings/tables/_form.html.erb @@ -8,11 +8,13 @@ <%= f.input :order_by %> <%= f.input :is_active %> <% if @settings_table.dining_charges.length == 0 %> -
-
- <%= link_to 'Add For Extra Charges', new_settings_zone_table_dining_charge_path(@zone,@settings_table),:class => 'btn btn-primary' %> -
-
+ <% if @settings_table.id != nil %> +
+
+ <%= link_to 'Add For Extra Charges', new_settings_zone_table_dining_charge_path(@zone,@settings_table),:class => 'btn btn-primary' %> +
+
+ <% end %> <% else %> <% @settings_table.dining_charges.each do |dc| %>
From 7dae1c2c27f1d44c80fad0876c5513f3c3cf2740 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Mon, 14 Aug 2017 16:43:35 +0630 Subject: [PATCH 7/8] dashboard link --- .gitignore | 3 + .idea/.generators | 2 +- .idea/.rakeTasks | 2 +- .idea/sxrestaurant.iml | 28 +- .idea/workspace.xml | 910 +++++++++++------------------- app/models/ability.rb | 208 +++---- app/views/home/dashboard.html.erb | 304 +++++++++- app/views/home/show.html.erb | 131 ++--- 8 files changed, 811 insertions(+), 777 deletions(-) diff --git a/.gitignore b/.gitignore index 5dafee53..3d6c48d5 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,6 @@ dump.rdb # Fonts public/fonts/* + +# Ruby-Mine IDE folder +.idea diff --git a/.idea/.generators b/.idea/.generators index 16189766..d2c02fb2 100644 --- a/.idea/.generators +++ b/.idea/.generators @@ -5,4 +5,4 @@ You are allowed to: 2. Remove generators 3. Add installed generators To add new installed generators automatically delete this file and reload the project. ---> +--> diff --git a/.idea/.rakeTasks b/.idea/.rakeTasks index 3577d8ad..bc783dc5 100644 --- a/.idea/.rakeTasks +++ b/.idea/.rakeTasks @@ -4,4 +4,4 @@ You are allowed to: 1. Remove rake task 2. Add existing rake tasks To add existing rake tasks automatically delete this file and reload the project. ---> +--> diff --git a/.idea/sxrestaurant.iml b/.idea/sxrestaurant.iml index 586fd380..169f839c 100644 --- a/.idea/sxrestaurant.iml +++ b/.idea/sxrestaurant.iml @@ -124,14 +124,14 @@ - - - - - - - - + + + + + + + + @@ -142,6 +142,7 @@ + @@ -150,7 +151,7 @@ - + @@ -160,7 +161,7 @@ - + @@ -175,7 +176,7 @@ - + @@ -190,10 +191,10 @@ - + - + @@ -228,6 +229,7 @@ + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 34b4f3b1..958de2f8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,14 @@ - + + + + + + + + @@ -18,141 +25,65 @@ - - + + - - + + - - + + - - - + + + + + + + - + - - + + + + + + + + + + + + - + - - - - - - - - - - - - - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -165,6 +96,7 @@ origami table_invoice sale_id + oqs @@ -184,6 +116,11 @@ @@ -194,15 +131,16 @@ DEFINITION_ORDER + - + @@ -217,355 +155,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -578,6 +167,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -585,6 +301,7 @@ + - - + - + - - + + + @@ -948,11 +667,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -960,7 +727,6 @@ - @@ -968,7 +734,6 @@ - @@ -976,7 +741,6 @@ - @@ -984,7 +748,6 @@ - @@ -992,7 +755,6 @@ - @@ -1000,15 +762,6 @@ - - - - - - - - - @@ -1030,7 +783,6 @@ - @@ -1038,7 +790,6 @@ - @@ -1046,7 +797,6 @@ - @@ -1054,7 +804,6 @@ - @@ -1062,7 +811,6 @@ - @@ -1070,7 +818,6 @@ - @@ -1078,7 +825,6 @@ - @@ -1086,7 +832,6 @@ - @@ -1094,7 +839,6 @@ - @@ -1102,7 +846,6 @@ - @@ -1110,15 +853,6 @@ - - - - - - - - - @@ -1126,7 +860,6 @@ - @@ -1134,7 +867,6 @@ - @@ -1142,7 +874,6 @@ - @@ -1150,113 +881,162 @@ - - - - + + - - - + + - - - - - + + - - - + + - + - - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/models/ability.rb b/app/models/ability.rb index 1938fb45..6965ab05 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -4,135 +4,135 @@ class Ability def initialize(user) user ||= Employee.new - if user.role == "administrator" + if user.role == 'administrator' - can :manage, :all + can :manage, :all - elsif user.role == "manager" + elsif user.role == 'manager' - can :manage, Menu - can :manage, MenuCategory - can :manage, MenuItemAttribute - can :manage, MenuItemInstance - can :manage, MenuItemOption - can :manage, SetMenuItem - can :manage, OrderQueueStation - can :manage, Zone - can :manage, CashierTerminal - can :manage, Employee - # can :manage, MembershipSetting - # can :manage, MembershipAction - # can :manage, PaymentMethodSetting - can :manage, TaxProfile - can :manage, PrintSetting - can :manage, Account + can :manage, Menu + can :manage, MenuCategory + can :manage, MenuItemAttribute + can :manage, MenuItemInstance + can :manage, MenuItemOption + can :manage, SetMenuItem + can :manage, OrderQueueStation + can :manage, Zone + can :manage, CashierTerminal + can :manage, Employee + # can :manage, MembershipSetting + # can :manage, MembershipAction + # can :manage, PaymentMethodSetting + can :manage, TaxProfile + can :manage, PrintSetting + can :manage, Account - can :manage, Order - can :manage, Sale + can :manage, Order + can :manage, Sale - can :manage, Customer - can :manage, DiningQueue + can :manage, Customer + can :manage, DiningQueue - can :index, :dailysale - can :index, :saleitem - can :index, :receipt_no - can :index, :shiftsale - can :index, :credit_payment - can :index, :void_sale + can :index, :dailysale + can :index, :saleitem + can :index, :receipt_no + can :index, :shiftsale + can :index, :credit_payment + can :index, :void_sale - can :get_customer, Customer - can :add_customer, Customer - can :update_sale_by_customer, Customer + can :get_customer, Customer + can :add_customer, Customer + can :update_sale_by_customer, Customer - can :index, :other_charge - can :create, :other_charge - can :index, :discount - can :create, :discount - can :remove_discount_items, :discount - can :remove_all_discount, :discount + can :index, :other_charge + can :create, :other_charge + can :index, :discount + can :create, :discount + can :remove_discount_items, :discount + can :remove_all_discount, :discount - can :first_bill, :payment - can :show, :payment - can :create, :payment - can :reprint, :payment - can :rounding_adj, :payment + can :first_bill, :payment + can :show, :payment + can :create, :payment + can :reprint, :payment + can :rounding_adj, :payment - can :move_dining, :movetable - can :moving, :movetable + can :move_dining, :movetable + can :moving, :movetable - can :move_dining, :moveroom + can :move_dining, :moveroom - can :edit, :sale_edit - can :item_void, :sale_edit - can :item_void_cancel, :sale_edit - can :cancel_all_void, :sale_edit - can :apply_void, :sale_edit + can :edit, :sale_edit + can :item_void, :sale_edit + can :item_void_cancel, :sale_edit + can :cancel_all_void, :sale_edit + can :apply_void, :sale_edit - can :overall_void, :void + can :overall_void, :void - elsif user.role == "cashier" - - # can :overall_void, :void + elsif user.role == 'cashier' - can :read, Order - can :update, Order - - can :read, Sale - can :update, Sale - can :get_customer, Customer - can :add_customer, Customer - can :update_sale_by_customer, Customer + # can :overall_void, :void - can :index, :other_charge - can :create, :other_charge - can :index, :discount - can :create, :discount - can :remove_discount_items, :discount - can :remove_all_discount, :discount - can :member_discount, :discount + can :read, Order + can :update, Order - can :first_bill, :payment - can :show, :payment - can :create, :payment - can :reprint, :payment - can :rounding_adj, :payment + can :read, Sale + can :update, Sale + can :get_customer, Customer + can :add_customer, Customer + can :update_sale_by_customer, Customer - can :move_dining, :movetable - can :moving, :movetable + can :index, :other_charge + can :create, :other_charge + can :index, :discount + can :create, :discount + can :remove_discount_items, :discount + can :remove_all_discount, :discount + can :member_discount, :discount - can :move_dining, :moveroom + can :first_bill, :payment + can :show, :payment + can :create, :payment + can :reprint, :payment + can :rounding_adj, :payment - can :first_bill, :payment - can :show, :payment - can :create, :payment - can :reprint, :payment + can :move_dining, :movetable + can :moving, :movetable - can :manage, DiningQueue - - elsif user.role == "account" + can :move_dining, :moveroom - can :index, :dailysale - can :index, :saleitem - can :index, :receipt_no - can :index, :shiftsale - can :index, :credit_payment - can :index, :void_sale + can :first_bill, :payment + can :show, :payment + can :create, :payment + can :reprint, :payment - elsif user.role == "supervisour" + can :manage, DiningQueue - can :edit, :sale_edit - can :item_void, :sale_edit - can :item_edit, :sale_edit - can :item_void_cancel, :sale_edit - can :cancel_all_void, :sale_edit - can :apply_void, :sale_edit - can :overall_void, :void + elsif user.role == 'account' - can :first_bill, :payment - can :create, :payment - can :show, :payment - can :reprint, :payment - can :rounding_adj, :payment + can :index, :dailysale + can :index, :saleitem + can :index, :receipt_no + can :index, :shiftsale + can :index, :credit_payment + can :index, :void_sale + + elsif user.role == 'supervisour' + + can :edit, :sale_edit + can :item_void, :sale_edit + can :item_edit, :sale_edit + can :item_void_cancel, :sale_edit + can :cancel_all_void, :sale_edit + can :apply_void, :sale_edit + can :overall_void, :void + + can :first_bill, :payment + can :create, :payment + can :show, :payment + can :reprint, :payment + can :rounding_adj, :payment end end diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index c2074720..571360c3 100644 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -1,47 +1,291 @@ -
-
+
+
- <% if current_login_employee.role = "admin" %> + <% if current_login_employee.role = "admin" %> - <% elsif current_login_employee.role = "cashier" %> - <%= link_to "Cashier Station", origami_path %> + <% elsif current_login_employee.role = "cashier" %> + <%= link_to "Cashier Station", origami_path %> - <% elsif current_login_employee = "account" %> - <%= link_to "Cashier Station", oishi_path %> + <% elsif current_login_employee = "account" %> + <%= link_to "Cashier Station", oishi_path %> - <% else %> - <%= link_to "Cashier Station", oishi_path %> + <% else %> + <%= link_to "Cashier Station", oishi_path %> - <% end %> - <% shop = Shop.first %> + <% end %> + <% shop = Shop.first %> - - - - -
+
-