diff --git a/app/assets/javascripts/CRM.js b/app/assets/javascripts/CRM.js index 03450eb1..b616453c 100755 --- a/app/assets/javascripts/CRM.js +++ b/app/assets/javascripts/CRM.js @@ -23,6 +23,7 @@ //= require bootstrap-notify/bootstrap-notify.js //= require node-waves/waves.js //= require sweetalert/sweetalert.min.js +//= require fileinput.min //= require BSBMaterial/turbolink_admin.js //= require BSBMaterial/demo.js //= require custom.js @@ -34,4 +35,24 @@ $(document).on('turbolinks:load', function() { weekStart: 1, time: false }); -}); \ No newline at end of file + + $("#customer_image_path").fileinput({ + previewFileType: "image", + allowedFileExtensions: ["jpg", "gif", "png"], + browseClass: "btn btn-success", + browseLabel: "Pick Image", + browseIcon: " ", + removeClass: "btn btn-danger", + removeLabel: "Delete", + removeIcon: " ", + showUpload: false, + // uploadClass: "btn btn-info", + // uploadLabel: "Upload", + // uploadIcon: " ", + previewTemplates: { + image: '
\n' + + ' {caption}\n' + + '
\n', + } + }); +}); diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 76341958..e486c152 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -104,6 +104,86 @@ $(document).ready(function() { } }); + $("#shop_logo").fileinput({ + previewFileType: "image", + allowedFileExtensions: ["jpg", "gif", "png"], + browseClass: "btn btn-success", + browseLabel: "Pick Image", + browseIcon: " ", + removeClass: "btn btn-danger", + removeLabel: "Delete", + removeIcon: " ", + showUpload: false, + // uploadClass: "btn btn-info", + // uploadLabel: "Upload", + // uploadIcon: " ", + previewTemplates: { + image: '
\n' + + ' {caption}\n' + + '
\n', + } + }); + + $("#commissioner_image_path").fileinput({ + previewFileType: "image", + allowedFileExtensions: ["jpg", "gif", "png"], + browseClass: "btn btn-success", + browseLabel: "Pick Image", + browseIcon: " ", + removeClass: "btn btn-danger", + removeLabel: "Delete", + removeIcon: " ", + showUpload: false, + // uploadClass: "btn btn-info", + // uploadLabel: "Upload", + // uploadIcon: " ", + previewTemplates: { + image: '
\n' + + ' {caption}\n' + + '
\n', + } + }); + + $("#employee_image_path").fileinput({ + previewFileType: "image", + allowedFileExtensions: ["jpg", "gif", "png"], + browseClass: "btn btn-success", + browseLabel: "Pick Image", + browseIcon: " ", + removeClass: "btn btn-danger", + removeLabel: "Delete", + removeIcon: " ", + showUpload: false, + // uploadClass: "btn btn-info", + // uploadLabel: "Upload", + // uploadIcon: " ", + previewTemplates: { + image: '
\n' + + ' {caption}\n' + + '
\n', + } + }); + + $("#shop_image").fileinput({ + previewFileType: "image", + allowedFileExtensions: ["jpg", "gif", "png"], + browseClass: "btn btn-success", + browseLabel: "Pick Image", + browseIcon: " ", + removeClass: "btn btn-danger", + removeLabel: "Delete", + removeIcon: " ", + showUpload: false, + // uploadClass: "btn btn-info", + // uploadLabel: "Upload", + // uploadIcon: " ", + previewTemplates: { + image: '
\n' + + ' {caption}\n' + + '
\n', + } + }); + // first input focus for all form $('form:first *input[data-behaviour!=datepicker]:input[type!=hidden]:first').focus(); diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 842b236b..418b6ebe 100755 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -9,12 +9,37 @@ //= require bootstrap-notify/bootstrap-notify.js //= require node-waves/waves.js //= require sweetalert/sweetalert.min.js +//= require fileinput.min //= require cable //= require turbolinks //= require BSBMaterial/turbolink_admin.js //= require BSBMaterial/demo.js //= require custom.js + +$(document).on('turbolinks:load', function() { + + $("#customer_image_path").fileinput({ + previewFileType: "image", + allowedFileExtensions: ["jpg", "gif", "png"], + browseClass: "btn btn-success", + browseLabel: "Pick Image", + browseIcon: " ", + removeClass: "btn btn-danger", + removeLabel: "Delete", + removeIcon: " ", + showUpload: false, + // uploadClass: "btn btn-info", + // uploadLabel: "Upload", + // uploadIcon: " ", + previewTemplates: { + image: '
\n' + + ' {caption}\n' + + '
\n', + } + }); +}); + $(document).on('turbolinks:load', function() { $('.datetimepicker').bootstrapMaterialDatePicker({ format: 'DD-MM-YYYY - HH:mm', diff --git a/app/assets/stylesheets/CRM.scss b/app/assets/stylesheets/CRM.scss index 8b652eac..5bfab409 100755 --- a/app/assets/stylesheets/CRM.scss +++ b/app/assets/stylesheets/CRM.scss @@ -13,6 +13,7 @@ @import "BSBMaterial/style"; @import "BSBMaterial/themes/all-themes"; @import "reset"; +@import "fileinput.min"; .sx-margin-0 { margin: 0 !important; diff --git a/app/assets/stylesheets/login.scss b/app/assets/stylesheets/login.scss index 030b0fe1..b5f29da6 100755 --- a/app/assets/stylesheets/login.scss +++ b/app/assets/stylesheets/login.scss @@ -8,6 +8,11 @@ background-color: #2790a5; } +.active_tab{ + border-style: solid; + border-color: #2790a5; +} + .login-page { margin: 0% auto; background-color: #2790a5; @@ -75,3 +80,13 @@ background-color: #fff; border-top: none; } + +.p-card{ + margin: 20px 0; + text-align: center; +} + +.p-name{ + padding-bottom: 20px; + font-size: 14px; +} diff --git a/app/controllers/base_controller.rb b/app/controllers/base_controller.rb index 1bf5b4d4..aad5c676 100755 --- a/app/controllers/base_controller.rb +++ b/app/controllers/base_controller.rb @@ -1,5 +1,12 @@ class BaseController < ActionController::Base layout "installation" protect_from_forgery with: :exception + + helper_method :shop_detail + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/base_crm_controller.rb b/app/controllers/base_crm_controller.rb index d7c008f6..3b9e0176 100755 --- a/app/controllers/base_crm_controller.rb +++ b/app/controllers/base_crm_controller.rb @@ -5,8 +5,29 @@ class BaseCrmController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception + helper_method :shop_detail + rescue_from CanCan::AccessDenied do |exception| flash[:warning] = exception.message redirect_to root_path end + + #change locallization + def set_locale + I18n.locale = params[:locale] || I18n.default_locale + end + + # RESTful url for localize + def default_url_options + { locale: I18n.locale } + end + + def current_user + @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + end + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/base_inventory_controller.rb b/app/controllers/base_inventory_controller.rb index fc9c0c47..a88a3abb 100755 --- a/app/controllers/base_inventory_controller.rb +++ b/app/controllers/base_inventory_controller.rb @@ -5,8 +5,19 @@ class BaseInventoryController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception + helper_method :shop_detail + rescue_from CanCan::AccessDenied do |exception| flash[:warning] = exception.message redirect_to root_path end + + def current_user + @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + end + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/base_oqs_controller.rb b/app/controllers/base_oqs_controller.rb index 19b01ea3..0f093913 100755 --- a/app/controllers/base_oqs_controller.rb +++ b/app/controllers/base_oqs_controller.rb @@ -4,9 +4,30 @@ class BaseOqsController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception + + helper_method :shop_detail rescue_from CanCan::AccessDenied do |exception| flash[:warning] = exception.message redirect_to root_path end + + #change locallization + def set_locale + I18n.locale = params[:locale] || I18n.default_locale + end + + # RESTful url for localize + def default_url_options + { locale: I18n.locale } + end + + def current_user + @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + end + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index 4b20f9e5..8c4f3aaa 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -7,6 +7,7 @@ class BaseOrigamiController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception + helper_method :shop_detail rescue_from CanCan::AccessDenied do |exception| flash[:warning] = exception.message # redirect_to origami_root_path @@ -25,4 +26,10 @@ class BaseOrigamiController < ActionController::Base def get_cashier @cashier = Employee.where("role = 'cashier' AND token_session <> ''") end + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end + end diff --git a/app/controllers/base_report_controller.rb b/app/controllers/base_report_controller.rb index 7689ed54..e96e97c8 100755 --- a/app/controllers/base_report_controller.rb +++ b/app/controllers/base_report_controller.rb @@ -5,7 +5,9 @@ class BaseReportController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception - rescue_from CanCan::AccessDenied do |exception| + helper_method :shop_detail + + rescue_from CanCan::AccessDenied do |exception| flash[:warning] = exception.message redirect_to root_path end @@ -80,4 +82,9 @@ class BaseReportController < ActionController::Base return from, to end + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/base_waiter_controller.rb b/app/controllers/base_waiter_controller.rb index ca4622db..71303213 100755 --- a/app/controllers/base_waiter_controller.rb +++ b/app/controllers/base_waiter_controller.rb @@ -4,4 +4,11 @@ class BaseWaiterController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception + + helper_method :shop_detail + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/crm/bookings_controller.rb b/app/controllers/crm/bookings_controller.rb index 30a9eb92..7e6c3c83 100755 --- a/app/controllers/crm/bookings_controller.rb +++ b/app/controllers/crm/bookings_controller.rb @@ -15,9 +15,4 @@ class Crm::BookingsController < BaseCrmController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 55eed487..3082687b 100755 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -396,12 +396,7 @@ end def customer_params params.require(:customer).permit(:id, :name, :company, :contact_no, :email, - :date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type) + :date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path) end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index 4b1eddcc..e52abeea 100755 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -142,10 +142,5 @@ class Crm::DiningQueuesController < BaseCrmController def dining_queue_params params.require(:dining_queue).permit(:customer_id, :name, :contact_no, :queue_no,:status,:seater,:remark) end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index b5acf59a..398fc96a 100755 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -56,10 +56,5 @@ class Crm::HomeController < BaseCrmController # end # end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 3ebafa99..147b2ee4 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,6 +1,8 @@ class HomeController < ApplicationController # layout "application", except: [:index, :show] - # skip_before_action only: [:index, :show, :create, :update, :destroy] + # skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy] + + helper_method :shop_detail def index # @employees = Employee.all_emp_except_waiter.order("name asc") @@ -135,12 +137,6 @@ class HomeController < ApplicationController render :json => {:status=> "Success", :url => root_path }.to_json end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end - private # Never trust parameters from the scary internet, only allow the white list through. @@ -194,4 +190,9 @@ class HomeController < ApplicationController return from, to end + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/install_controller.rb b/app/controllers/install_controller.rb index 1ff003db..ccc1bf3e 100755 --- a/app/controllers/install_controller.rb +++ b/app/controllers/install_controller.rb @@ -3,6 +3,8 @@ class InstallController < BaseController skip_before_action :verify_authenticity_token # before_action :check_license + helper_method :shop_detail + def index end @@ -75,4 +77,9 @@ class InstallController < BaseController # return nil # end # end + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/oqs/backhome_controller.rb b/app/controllers/oqs/backhome_controller.rb index 990fa459..4ac5f0a2 100755 --- a/app/controllers/oqs/backhome_controller.rb +++ b/app/controllers/oqs/backhome_controller.rb @@ -30,12 +30,6 @@ class Oqs::HomeController < BaseOqsController @queue_stations_items end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end - # Get Order items def get_order_items items = [] @@ -129,9 +123,4 @@ class Oqs::HomeController < BaseOqsController # completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true'); end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index ea2e6662..e8d9615d 100755 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -60,9 +60,4 @@ class Oqs::EditController < BaseOqsController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index 95c4d833..19d4c17f 100755 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -244,10 +244,4 @@ class Oqs::HomeController < BaseOqsController .group("order_queue_stations.id") end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end - end diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index 5f973c7a..baa4af40 100755 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -102,9 +102,4 @@ class Oqs::PrintController < ApplicationController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end \ No newline at end of file diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index 35f672ef..7dd2b3f0 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -226,9 +226,4 @@ class Origami::AddordersController < BaseOrigamiController # @dining = DiningFacility.find(params[:id]) # end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/bank_integration_controller.rb b/app/controllers/origami/bank_integration_controller.rb index 6dde10da..cb735873 100644 --- a/app/controllers/origami/bank_integration_controller.rb +++ b/app/controllers/origami/bank_integration_controller.rb @@ -96,9 +96,4 @@ class Origami::BankIntegrationController < ApplicationController #BaseOrigamiCon render json: response end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/card_payments_controller.rb b/app/controllers/origami/card_payments_controller.rb index cd08c16a..e0c56971 100755 --- a/app/controllers/origami/card_payments_controller.rb +++ b/app/controllers/origami/card_payments_controller.rb @@ -24,9 +24,4 @@ class Origami::CardPaymentsController < BaseOrigamiController def create end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/cash_ins_controller.rb b/app/controllers/origami/cash_ins_controller.rb index 4d7c2b64..441cd94e 100755 --- a/app/controllers/origami/cash_ins_controller.rb +++ b/app/controllers/origami/cash_ins_controller.rb @@ -14,10 +14,5 @@ class Origami::CashInsController < BaseOrigamiController shift.cash_in = shift.cash_in + amount.to_i shift.save end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/origami/cash_mgmt_controller.rb b/app/controllers/origami/cash_mgmt_controller.rb index 1f48370e..916f5d8b 100755 --- a/app/controllers/origami/cash_mgmt_controller.rb +++ b/app/controllers/origami/cash_mgmt_controller.rb @@ -8,9 +8,4 @@ class Origami::CashMgmtController < ApplicationController def create end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/cash_outs_controller.rb b/app/controllers/origami/cash_outs_controller.rb index cc22516c..8c81b5cb 100755 --- a/app/controllers/origami/cash_outs_controller.rb +++ b/app/controllers/origami/cash_outs_controller.rb @@ -13,9 +13,4 @@ class Origami::CashOutsController < BaseOrigamiController shift.save end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/check_in_process_controller.rb b/app/controllers/origami/check_in_process_controller.rb index 48d55c9a..ad3efee0 100644 --- a/app/controllers/origami/check_in_process_controller.rb +++ b/app/controllers/origami/check_in_process_controller.rb @@ -36,9 +36,4 @@ class Origami::CheckInProcessController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/credit_payments_controller.rb b/app/controllers/origami/credit_payments_controller.rb index 4fd9ba71..d70ef870 100755 --- a/app/controllers/origami/credit_payments_controller.rb +++ b/app/controllers/origami/credit_payments_controller.rb @@ -47,10 +47,4 @@ class Origami::CreditPaymentsController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end - end diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 25dc9748..234a1dc5 100755 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -141,10 +141,5 @@ class Origami::CustomersController < BaseOrigamiController render json: JSON.generate({:status => false, :error_message => "Record not found"}) end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/origami/dashboard_controller.rb b/app/controllers/origami/dashboard_controller.rb index a3d08132..f888ac57 100644 --- a/app/controllers/origami/dashboard_controller.rb +++ b/app/controllers/origami/dashboard_controller.rb @@ -58,8 +58,4 @@ class Origami::DashboardController < BaseOrigamiController @current_user = current_user end - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index 0c2fbef5..8e390015 100755 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -355,9 +355,5 @@ class Origami::DiscountsController < BaseOrigamiController # redirect_to origami_path(sale_id) # end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index c89b83eb..6a6c0c90 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -136,12 +136,6 @@ class Origami::HomeController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end - private def set_dining diff --git a/app/controllers/origami/home_controller_bk.rb b/app/controllers/origami/home_controller_bk.rb index 3e414665..4839f15c 100755 --- a/app/controllers/origami/home_controller_bk.rb +++ b/app/controllers/origami/home_controller_bk.rb @@ -81,9 +81,4 @@ class Origami::HomeController < ApplicationController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/in_duties_controller.rb b/app/controllers/origami/in_duties_controller.rb index 945f3bd9..9846516e 100755 --- a/app/controllers/origami/in_duties_controller.rb +++ b/app/controllers/origami/in_duties_controller.rb @@ -169,9 +169,4 @@ class Origami::InDutiesController < BaseOrigamiController params.require(:in_duty).permit(:id, :dinning_id, :commissioner_ids, :in_time, :out_time) end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/jcb_controller.rb b/app/controllers/origami/jcb_controller.rb index 0604535e..06ee6087 100755 --- a/app/controllers/origami/jcb_controller.rb +++ b/app/controllers/origami/jcb_controller.rb @@ -9,6 +9,7 @@ class Origami::JcbController < BaseOrigamiController @jcbcount = 0 others = 0 + @payment_method_setting_nav = PaymentMethodSetting.all @shop = Shop::ShopDetail if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) @@ -58,9 +59,4 @@ class Origami::JcbController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/master_controller.rb b/app/controllers/origami/master_controller.rb index 25bebf55..77ae99d2 100755 --- a/app/controllers/origami/master_controller.rb +++ b/app/controllers/origami/master_controller.rb @@ -9,6 +9,7 @@ class Origami::MasterController < BaseOrigamiController @mastercount = 0 others = 0 + @payment_method_setting_nav = PaymentMethodSetting.all @shop = Shop::ShopDetail if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) @@ -57,9 +58,4 @@ class Origami::MasterController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/moveroom_controller.rb b/app/controllers/origami/moveroom_controller.rb index 5b53f68c..316ab894 100755 --- a/app/controllers/origami/moveroom_controller.rb +++ b/app/controllers/origami/moveroom_controller.rb @@ -35,11 +35,5 @@ class Origami::MoveroomController < BaseOrigamiController end end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb index 8da417ac..dfdfcabf 100755 --- a/app/controllers/origami/movetable_controller.rb +++ b/app/controllers/origami/movetable_controller.rb @@ -70,10 +70,5 @@ class Origami::MovetableController < BaseOrigamiController @get_type = Booking.update_dining_facility(booking_array,change_to,change_from) end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/origami/mpu_controller.rb b/app/controllers/origami/mpu_controller.rb index ce0dccce..c3f74133 100755 --- a/app/controllers/origami/mpu_controller.rb +++ b/app/controllers/origami/mpu_controller.rb @@ -7,7 +7,8 @@ class Origami::MpuController < BaseOrigamiController total = sale_data.grand_total @mpucount = 0 others = 0 - + + @payment_method_setting_nav = PaymentMethodSetting.all @shop = Shop::ShopDetail if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) @@ -57,9 +58,4 @@ class Origami::MpuController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/orders_controller.rb b/app/controllers/origami/orders_controller.rb index 13f5b684..3181d470 100755 --- a/app/controllers/origami/orders_controller.rb +++ b/app/controllers/origami/orders_controller.rb @@ -80,10 +80,5 @@ class Origami::OrdersController < BaseOrigamiController end end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb index 93afc99a..8bba3800 100755 --- a/app/controllers/origami/other_charges_controller.rb +++ b/app/controllers/origami/other_charges_controller.rb @@ -76,10 +76,5 @@ class Origami::OtherChargesController < BaseOrigamiController end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end \ No newline at end of file diff --git a/app/controllers/origami/others_payments_controller.rb b/app/controllers/origami/others_payments_controller.rb index ab755ea1..e4a39662 100755 --- a/app/controllers/origami/others_payments_controller.rb +++ b/app/controllers/origami/others_payments_controller.rb @@ -37,9 +37,4 @@ class Origami::OthersPaymentsController < BaseOrigamiController def create end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 4508c582..c764b92f 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -511,10 +511,4 @@ class Origami::PaymentsController < BaseOrigamiController render :json => {status: true} end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end \ No newline at end of file diff --git a/app/controllers/origami/paypar_payments_controller.rb b/app/controllers/origami/paypar_payments_controller.rb index 04a52f0f..faaeca8e 100755 --- a/app/controllers/origami/paypar_payments_controller.rb +++ b/app/controllers/origami/paypar_payments_controller.rb @@ -29,9 +29,4 @@ class Origami::PayparPaymentsController < BaseOrigamiController end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/pending_order_controller.rb b/app/controllers/origami/pending_order_controller.rb index d738a0a5..9a413316 100644 --- a/app/controllers/origami/pending_order_controller.rb +++ b/app/controllers/origami/pending_order_controller.rb @@ -41,9 +41,4 @@ class Origami::PendingOrderController < BaseOrigamiController end end - - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/product_commissions_controller.rb b/app/controllers/origami/product_commissions_controller.rb index 2ab9a618..2f209a7a 100755 --- a/app/controllers/origami/product_commissions_controller.rb +++ b/app/controllers/origami/product_commissions_controller.rb @@ -137,9 +137,4 @@ class Origami::ProductCommissionsController < BaseOrigamiController params.fetch(:product_commission, {}) end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/redeem_payments_controller.rb b/app/controllers/origami/redeem_payments_controller.rb index 76517e8a..bcb8f9ae 100755 --- a/app/controllers/origami/redeem_payments_controller.rb +++ b/app/controllers/origami/redeem_payments_controller.rb @@ -6,6 +6,7 @@ class Origami::RedeemPaymentsController < BaseOrigamiController @membership_rebate_balance=0 sale_data = Sale.find_by_sale_id(@sale_id) + @payment_method_setting_nav = PaymentMethodSetting.all @shop = Shop::ShopDetail # if @shop.is_rounding_adj # new_total = Sale.get_rounding_adjustment(sale_data.grand_total) @@ -68,10 +69,5 @@ class Origami::RedeemPaymentsController < BaseOrigamiController end @out = false, 0 end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index f6dd4e14..aa145b4f 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -58,10 +58,5 @@ class Origami::RequestBillsController < ApplicationController # printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details) end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/origami/room_invoices_controller.rb b/app/controllers/origami/room_invoices_controller.rb index 9c3b16a6..8d805771 100755 --- a/app/controllers/origami/room_invoices_controller.rb +++ b/app/controllers/origami/room_invoices_controller.rb @@ -37,9 +37,4 @@ class Origami::RoomInvoicesController < BaseOrigamiController @customer = @sale.customer end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb index 6117d01d..3aa98282 100755 --- a/app/controllers/origami/rooms_controller.rb +++ b/app/controllers/origami/rooms_controller.rb @@ -136,9 +136,4 @@ class Origami::RoomsController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb index 44ec6442..72df82ac 100755 --- a/app/controllers/origami/sale_edit_controller.rb +++ b/app/controllers/origami/sale_edit_controller.rb @@ -196,10 +196,5 @@ class Origami::SaleEditController < BaseOrigamiController ProductCommission.remove_product_commission(item) end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/origami/sales_controller.rb b/app/controllers/origami/sales_controller.rb index 513bdb2c..eee75e37 100755 --- a/app/controllers/origami/sales_controller.rb +++ b/app/controllers/origami/sales_controller.rb @@ -56,9 +56,4 @@ class Origami::SalesController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index 29a6e76a..19def9b6 100755 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -125,9 +125,4 @@ class Origami::ShiftsController < BaseOrigamiController end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 9f8afd0d..1790624a 100644 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -366,11 +366,4 @@ class Origami::SplitBillController < BaseOrigamiController render :json => { status: true } end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end - end diff --git a/app/controllers/origami/surveys_controller.rb b/app/controllers/origami/surveys_controller.rb index 47b7e8fd..654f8a1a 100644 --- a/app/controllers/origami/surveys_controller.rb +++ b/app/controllers/origami/surveys_controller.rb @@ -90,10 +90,5 @@ class Origami::SurveysController < BaseOrigamiController def survey_params params.require(:survey).permit(:child, :adult,:male,:female,:local,:foreigner, :dining_name,:receipt_no,:shift_id,:created_by,:total_customer,:total_amount,:survey_id) end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb index 9aff7202..a84f6ca7 100755 --- a/app/controllers/origami/table_invoices_controller.rb +++ b/app/controllers/origami/table_invoices_controller.rb @@ -70,9 +70,4 @@ class Origami::TableInvoicesController < BaseOrigamiController @print_settings = PrintSetting.get_precision_delimiter() end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/unionpay_controller.rb b/app/controllers/origami/unionpay_controller.rb index 89adfd3e..707a1022 100644 --- a/app/controllers/origami/unionpay_controller.rb +++ b/app/controllers/origami/unionpay_controller.rb @@ -8,6 +8,7 @@ class Origami::UnionpayController < BaseOrigamiController @unionpaycount = 0 others = 0 + @payment_method_setting_nav = PaymentMethodSetting.all @shop = Shop::ShopDetail if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) @@ -57,9 +58,4 @@ class Origami::UnionpayController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/visa_controller.rb b/app/controllers/origami/visa_controller.rb index 5404789c..788704eb 100755 --- a/app/controllers/origami/visa_controller.rb +++ b/app/controllers/origami/visa_controller.rb @@ -8,6 +8,7 @@ class Origami::VisaController < BaseOrigamiController @visacount = 0 others = 0 + @payment_method_setting_nav = PaymentMethodSetting.all @shop = Shop::ShopDetail if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) @@ -57,9 +58,4 @@ class Origami::VisaController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index 5bbc9ac3..33ff0d76 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -134,10 +134,5 @@ class Origami::VoidController < BaseOrigamiController end end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end \ No newline at end of file diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index c0a9e96d..25352597 100755 --- a/app/controllers/origami/voucher_controller.rb +++ b/app/controllers/origami/voucher_controller.rb @@ -78,9 +78,4 @@ class Origami::VoucherController < BaseOrigamiController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/print_settings_controller.rb b/app/controllers/print_settings_controller.rb index a72319b3..710e6ea4 100755 --- a/app/controllers/print_settings_controller.rb +++ b/app/controllers/print_settings_controller.rb @@ -2,6 +2,8 @@ class PrintSettingsController < ApplicationController load_and_authorize_resource except: [:create] before_action :set_print_setting, only: [:show, :edit, :update, :destroy] + helper_method :shop_detail + # GET /print_settings # GET /print_settings.json def index @@ -72,4 +74,9 @@ class PrintSettingsController < ApplicationController def print_setting_params params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space) end + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/reports/bksaleitem_controller.rb b/app/controllers/reports/bksaleitem_controller.rb index 118269bb..0f91681d 100755 --- a/app/controllers/reports/bksaleitem_controller.rb +++ b/app/controllers/reports/bksaleitem_controller.rb @@ -16,10 +16,4 @@ class Reports::SaleitemController < BaseReportController end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end - end diff --git a/app/controllers/reports/commission_controller.rb b/app/controllers/reports/commission_controller.rb index 9e13bd75..9a7f4ca1 100755 --- a/app/controllers/reports/commission_controller.rb +++ b/app/controllers/reports/commission_controller.rb @@ -49,11 +49,6 @@ class Reports::CommissionController < BaseReportController format.json { render json: out } end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/reports/credit_payment_controller.rb b/app/controllers/reports/credit_payment_controller.rb index abf7a6af..f46b008f 100755 --- a/app/controllers/reports/credit_payment_controller.rb +++ b/app/controllers/reports/credit_payment_controller.rb @@ -60,9 +60,4 @@ authorize_resource :class => false end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end \ No newline at end of file diff --git a/app/controllers/reports/dailysale_controller.rb b/app/controllers/reports/dailysale_controller.rb index d43355fa..4f6d8e68 100755 --- a/app/controllers/reports/dailysale_controller.rb +++ b/app/controllers/reports/dailysale_controller.rb @@ -19,10 +19,5 @@ class Reports::DailysaleController < BaseReportController def show end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/reports/payment_method_controller.rb b/app/controllers/reports/payment_method_controller.rb index 0262594f..928f17d6 100644 --- a/app/controllers/reports/payment_method_controller.rb +++ b/app/controllers/reports/payment_method_controller.rb @@ -62,9 +62,4 @@ class Reports::PaymentMethodController < BaseReportController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end \ No newline at end of file diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index ead85d72..cff7887c 100755 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -61,10 +61,5 @@ authorize_resource :class => false format.json { render json: out } end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end \ No newline at end of file diff --git a/app/controllers/reports/saleitem_controller.rb b/app/controllers/reports/saleitem_controller.rb index b9712722..796b02ad 100755 --- a/app/controllers/reports/saleitem_controller.rb +++ b/app/controllers/reports/saleitem_controller.rb @@ -76,10 +76,5 @@ class Reports::SaleitemController < BaseReportController format.json { render json: out } end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/reports/shiftsale_controller.rb b/app/controllers/reports/shiftsale_controller.rb index cf722495..21ca498b 100755 --- a/app/controllers/reports/shiftsale_controller.rb +++ b/app/controllers/reports/shiftsale_controller.rb @@ -48,10 +48,5 @@ class Reports::ShiftsaleController < BaseReportController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end diff --git a/app/controllers/reports/stock_check_controller.rb b/app/controllers/reports/stock_check_controller.rb index 7dee598e..c2f2cf0d 100755 --- a/app/controllers/reports/stock_check_controller.rb +++ b/app/controllers/reports/stock_check_controller.rb @@ -46,11 +46,6 @@ class Reports::StockCheckController < BaseReportController format.json { render json: out } end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end + end diff --git a/app/controllers/reports/void_sale_controller.rb b/app/controllers/reports/void_sale_controller.rb index 50a7c57d..32926d63 100755 --- a/app/controllers/reports/void_sale_controller.rb +++ b/app/controllers/reports/void_sale_controller.rb @@ -59,9 +59,4 @@ authorize_resource :class => false end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.first - end end \ No newline at end of file diff --git a/app/controllers/settings/commissioners_controller.rb b/app/controllers/settings/commissioners_controller.rb index 4f195f43..f8314bcb 100755 --- a/app/controllers/settings/commissioners_controller.rb +++ b/app/controllers/settings/commissioners_controller.rb @@ -91,6 +91,6 @@ class Settings::CommissionersController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def commissioner_params - params.require(:commissioner).permit(:name, :emp_id, :created_by, :commission_id, :joined_date, :resigned_date, :is_active) + params.require(:commissioner).permit(:name, :emp_id, :created_by, :commission_id, :joined_date, :resigned_date, :is_active, :image_path) end end diff --git a/app/controllers/settings/display_images_controller.rb b/app/controllers/settings/display_images_controller.rb new file mode 100644 index 00000000..48406f48 --- /dev/null +++ b/app/controllers/settings/display_images_controller.rb @@ -0,0 +1,11 @@ +class Settings::DisplayImagesController < ApplicationController + def destroy + #byebug + @item_photo = DisplayImage.find(params[:shop_id]) + item = @item_photo.id + @item_photo.destroy + respond_to do |format| + format.html {redirect_to settings_shops_url+'/1/edit', notice: 'Image was successfully destroyed.'} + end + end +end diff --git a/app/controllers/settings/employees_controller.rb b/app/controllers/settings/employees_controller.rb index 2bc81c51..cefb7b9c 100755 --- a/app/controllers/settings/employees_controller.rb +++ b/app/controllers/settings/employees_controller.rb @@ -68,6 +68,6 @@ class Settings::EmployeesController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def employee_params - params.require(:employee).permit(:name, :role, :emp_id, :password) + params.require(:employee).permit(:name, :role, :emp_id, :password, :image_path) end end diff --git a/app/controllers/settings/shops_controller.rb b/app/controllers/settings/shops_controller.rb index a48bcb9a..365be7e2 100644 --- a/app/controllers/settings/shops_controller.rb +++ b/app/controllers/settings/shops_controller.rb @@ -1,6 +1,6 @@ class Settings::ShopsController < ApplicationController load_and_authorize_resource except: [:create] - before_action :set_shop, only: [:show, :edit, :update] + before_action :set_shop, only: [:show, :edit, :update, :destroy] # GET /settings/shops # GET /settings/shops.json @@ -11,11 +11,13 @@ class Settings::ShopsController < ApplicationController # GET /settings/shops/1 # GET /settings/shops/1.json def show + @display_images = @settings_shop.display_images.all end # GET /settings/shops/new def new @settings_shop = Shop.new + @display_image = @settings_shop.display_images.build end # GET /settings/shops/1/edit @@ -28,6 +30,11 @@ class Settings::ShopsController < ApplicationController @settings_shop = Shop.new(shop_params) respond_to do |format| if @settings_shop.save + if params[:display_images].present? + params[:display_images]['image'].each do |a| + @display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :image => a) + end + end format.html { redirect_to settings_shops_url, notice: 'Shop was successfully created.' } format.json { render :index, status: :created, location: @settings_shop } else @@ -42,6 +49,11 @@ class Settings::ShopsController < ApplicationController def update respond_to do |format| if @settings_shop.update(shop_params) + if params[:display_images].present? + params[:display_images]['image'].each do |a| + @display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :image => a) + end + end format.html { redirect_to settings_shops_url, notice: 'Shop was successfully updated.' } format.json { render :index, status: :ok, location: @settings_shop } else @@ -71,6 +83,6 @@ class Settings::ShopsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def shop_params - params.require(:shop).permit(:name,:address,:city,:township,:state,:country,:phone_no,:reservation_no,:license,:activated_at,:license_data,:base_currency,:cloud_token,:cloud_url,:owner_token,:id_prefix,:is_rounding_adj,:quick_sale_summary,:calc_tax_order,:show_account_info) + params.require(:shop).permit(:logo, :name,:address,:city,:township,:state,:country,:phone_no,:reservation_no,:license,:activated_at,:license_data,:base_currency,:cloud_token,:cloud_url,:owner_token,:id_prefix,:is_rounding_adj,:quick_sale_summary,:calc_tax_order,:show_account_info, display_images_attributes: [:id, :shop_id, :image]) end end diff --git a/app/controllers/sym_control_controller.rb b/app/controllers/sym_control_controller.rb index 8ef6fd78..d2923bf2 100644 --- a/app/controllers/sym_control_controller.rb +++ b/app/controllers/sym_control_controller.rb @@ -2,6 +2,8 @@ class SymControlController < BaseController skip_before_action :verify_authenticity_token http_basic_authenticate_with name: "vip", password: "!abcABC01" + helper_method :shop_detail + def run sym_path = File.expand_path("~/symmetric/") check_sym_proc_str = `#{"sudo service SymmetricDS status"}` @@ -43,4 +45,9 @@ class SymControlController < BaseController end end + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end + end \ No newline at end of file diff --git a/app/models/commissioner.rb b/app/models/commissioner.rb index 2b262afc..68573460 100755 --- a/app/models/commissioner.rb +++ b/app/models/commissioner.rb @@ -7,4 +7,7 @@ class Commissioner < ApplicationRecord # validations validates_presence_of :name + + # Commissioner Image Uploader + mount_uploader :image_path, CommissionerImageUploader end diff --git a/app/models/customer.rb b/app/models/customer.rb index 59ab8841..934d371f 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -2,6 +2,9 @@ class Customer < ApplicationRecord #self.primary_key = :customer_id + # Customer Image Uploader + mount_uploader :image_path, CustomerImageUploader + before_create :generate_custom_id has_many :orders has_many :sales diff --git a/app/models/display_image.rb b/app/models/display_image.rb new file mode 100644 index 00000000..63405b26 --- /dev/null +++ b/app/models/display_image.rb @@ -0,0 +1,5 @@ +class DisplayImage < ApplicationRecord + mount_uploader :image, DisplayImageUploader + belongs_to :shop + +end diff --git a/app/models/employee.rb b/app/models/employee.rb index a12521cb..c1f985ea 100755 --- a/app/models/employee.rb +++ b/app/models/employee.rb @@ -8,6 +8,9 @@ class Employee < ApplicationRecord validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true validates :password, numericality: true, length: {in: 3..9}, allow_blank: true + # Employee Image Uploader + mount_uploader :image_path, EmployeeImageUploader + def self.all_emp_except_waiter Employee.where('role!=?','waiter') end diff --git a/app/models/shop.rb b/app/models/shop.rb index c722adc2..b0e84912 100755 --- a/app/models/shop.rb +++ b/app/models/shop.rb @@ -1,3 +1,9 @@ class Shop < ApplicationRecord ShopDetail = Shop.find_by_id(1) + + # Shop Image Uploader + mount_uploader :logo, ShopImageUploader + + has_many :display_images + accepts_nested_attributes_for :display_images end diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb index 11ad8100..206c7a0a 100644 --- a/app/pdf/receipt_bill_a5_pdf.rb +++ b/app/pdf/receipt_bill_a5_pdf.rb @@ -1,6 +1,7 @@ class ReceiptBillA5Pdf < 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 + + 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, :line_move 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,current_balance,card_data) self.page_width = printer_settings.page_width self.page_height = printer_settings.page_height @@ -15,6 +16,7 @@ class ReceiptBillA5Pdf < Prawn::Document self.description_width = 500 self.price_num_width = 100 + self.line_move = 10 # @item_width = self.page_width.to_i / 2 # @qty_width = @item_width.to_i / 3 # @double = @qty_width * 1.3 @@ -91,27 +93,33 @@ class ReceiptBillA5Pdf < Prawn::Document end def header (shop_details) - move_down 10 + move_down line_move text "#{shop_details.name}", :size => self.header_font_size,:align => :center - move_down 10 + move_down line_move text "#{shop_details.address}", :size => self.item_font_size,:align => :center # move_down self.item_height - move_down 10 + move_down line_move text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center - move_down 10 + move_down line_move stroke_horizontal_rule end def cashier_info(sale_data, customer_name) - move_down 12 + move_down line_move # move_down 2 y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left end - - move_down 10 + + if sale_data.bookings[0].dining_facility_id.to_i > 0 + bounding_box([self.item_description_width, y_position], :width => self.item_description_width, :height => self.item_height) do + text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right + end + end + + move_down line_move y_position = cursor if sale_data.bookings[0].dining_facility_id.to_i > 0 @@ -126,7 +134,7 @@ class ReceiptBillA5Pdf < Prawn::Document bounding_box([self.item_description_width - 2,y_position], :width =>self.item_description_width, :height => self.item_height) do text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right end - move_down 10 + move_down line_move y_position = cursor if sale_data.bookings[0].dining_facility_id.to_i > 0 @@ -145,7 +153,7 @@ class ReceiptBillA5Pdf < Prawn::Document # :size => self.item_font_size,:align => :right # end - move_down 10 + move_down line_move stroke_horizontal_rule end @@ -162,9 +170,9 @@ class ReceiptBillA5Pdf < Prawn::Document item_label_total_front_width = (self.item_width+self.price_width) + 5 item_label_total_end_width = self.total_width + 4 end - move_down 10 + move_down line_move y_position = cursor - move_down 10 + move_down line_move pad_top(15) { # @item_width.to_i + @half_qty.to_i text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix @@ -172,7 +180,7 @@ class ReceiptBillA5Pdf < Prawn::Document text_box "Qty", :at =>[item_label_qty_front_width,y_position], :width => item_label_qty_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix text_box "Total", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix } - move_down -5 + move_down line_move stroke_horizontal_rule add_line_item_row(sale_items,precision,delimiter) end @@ -192,7 +200,7 @@ class ReceiptBillA5Pdf < Prawn::Document item_total_end_width = self.total_width + 4 end y_position = cursor - move_down 10 + move_down line_move sub_total = 0.0 sale_items.each do |item| # check for item not to show @@ -223,25 +231,25 @@ class ReceiptBillA5Pdf < Prawn::Document end end end + move_down line_move } - move_down 10 end end stroke_horizontal_rule - move_down 10 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do text "Sub Total", :size => self.item_font_size,:align => :left end bounding_box([self.description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right - end - move_down 10 + end end def all_total(sale_data,precision,delimiter) + move_down line_move item_name_width = self.item_width y_position = cursor if sale_data.discount_type == 'member_discount' @@ -259,7 +267,7 @@ class ReceiptBillA5Pdf < Prawn::Document if sale_data.sale_taxes.length > 0 sale_data.sale_taxes.each do |st| - move_down 10 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do @@ -284,7 +292,7 @@ class ReceiptBillA5Pdf < Prawn::Document # end if sale_data.rounding_adjustment != 0.0 - move_down 10 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do @@ -295,16 +303,16 @@ class ReceiptBillA5Pdf < Prawn::Document end end - move_down 10 + move_down line_move y_position = cursor - move_down 10 + move_down line_move bounding_box([0,y_position], :width =>self.description_width) do text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left end bounding_box([self.description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right end - move_down 10 + move_down line_move sale_payment(sale_data,precision,delimiter) @@ -312,7 +320,7 @@ class ReceiptBillA5Pdf < Prawn::Document def sale_payment(sale_data,precision,delimiter) stroke_horizontal_rule - move_down 10 + # move_down 10 sale_payments = SalePayment.select("SUM(sale_payments.payment_amount) as payment_amount,sale_payments.payment_method").where('sale_id = ?', sale_data.sale_id).group("payment_method") sale_payments.each do |payment| y_position = cursor @@ -329,18 +337,18 @@ class ReceiptBillA5Pdf < Prawn::Document bounding_box([self.description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right end - move_down 10 + move_down line_move end if sale_data.amount_received > 0 y_position = cursor - move_down 10 + move_down line_move bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do text "Change Amount", :size => self.item_font_size,:align => :left end bounding_box([self.description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right end - move_down 10 + #move_down line_move end end @@ -367,7 +375,7 @@ class ReceiptBillA5Pdf < Prawn::Document rebate_balance = rebate_balance + res["deposit"] - move_down 10 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do text "Rebate Earn", :size => self.item_font_size,:align => :left @@ -380,7 +388,7 @@ class ReceiptBillA5Pdf < Prawn::Document # Total Rebate Amount if birthday if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate" rebate_balance = rebate_balance + res["deposit"] - move_down 10 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left @@ -392,7 +400,7 @@ class ReceiptBillA5Pdf < Prawn::Document #end Total rebate if birthday end - move_down 10 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do text "Redeem Amount", :size => self.item_font_size,:align => :left @@ -402,7 +410,7 @@ class ReceiptBillA5Pdf < Prawn::Document end if current_balance != nil - move_down 10 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do text "Old Balance", :size => self.item_font_size,:align => :left @@ -424,7 +432,7 @@ class ReceiptBillA5Pdf < Prawn::Document end end - move_down 10 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do text "Total Balance", :size => self.item_font_size,:align => :left @@ -437,21 +445,22 @@ class ReceiptBillA5Pdf < Prawn::Document end def customer(customer_name) - move_down 10 + move_down line_move y_position = cursor + move_down line_move bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do text "Customer Name", :size => self.item_font_size,:align => :left end bounding_box([self.description_width,y_position], :width =>self.label_width) do text "#{ customer_name }" , :size => self.item_font_size,:align => :right end + move_down line_move end def discount_account(discount_price_by_accounts,precision,delimiter) - move_down 10 stroke_horizontal_rule - move_down 10 + move_down line_move y_position = cursor discount_price_by_accounts.each do |ipa| y_position = cursor @@ -461,13 +470,13 @@ class ReceiptBillA5Pdf < Prawn::Document bounding_box([self.description_width,y_position], :width =>self.label_width) do text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right end + move_down line_move end end def items_account(item_price_by_accounts,precision,delimiter) - move_down 10 stroke_horizontal_rule - move_down 10 + move_down line_move y_position = cursor item_price_by_accounts.each do |ipa| y_position = cursor @@ -477,15 +486,15 @@ class ReceiptBillA5Pdf < Prawn::Document bounding_box([self.label_width,y_position], :width =>self.description_width) do text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right end + move_down line_move end end #individual payment per person - def individual_payment(sale_data, precision, delimiter) - per_person = sale_data.grand_total.to_f / sale_data.equal_persons.to_i - move_down 5 + def individual_payment(sale_data, survey, precision, delimiter) + per_person = sale_data.grand_total.to_f / survey.total_customer.to_i stroke_horizontal_rule - move_down 5 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.label_width+50) do text "Split Bill for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left @@ -541,9 +550,9 @@ class ReceiptBillA5Pdf < Prawn::Document end def footer(printed_status) - move_down 10 + move_down line_move stroke_horizontal_rule - move_down 10 + move_down line_move y_position = cursor bounding_box([0, y_position], :width =>self.item_description_width) do @@ -553,15 +562,15 @@ class ReceiptBillA5Pdf < Prawn::Document text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :right end - move_down 10 + move_down line_move end #start card sale trans data def card_sale_data(card_data) if card_data != nil && !card_data.empty? - move_down 5 + move_down line_move stroke_horizontal_rule - move_down 5 + move_down line_move y_position = cursor card_data.each do |data| diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index c34ce3e4..efc85c7f 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -1,6 +1,7 @@ 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 + + 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, :line_move 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,current_balance,card_data) self.page_width = printer_settings.page_width self.page_height = printer_settings.page_height @@ -15,6 +16,7 @@ class ReceiptBillPdf < Prawn::Document self.description_width = 150 self.price_num_width = 50 + self.line_move = 2 # @item_width = self.page_width.to_i / 2 # @qty_width = @item_width.to_i / 3 # @double = @qty_width * 1.3 @@ -91,27 +93,32 @@ class ReceiptBillPdf < Prawn::Document end def header (shop_details) - move_down 5 text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center - move_down 5 + move_down line_move text "#{shop_details.address}", :size => self.item_font_size,:align => :center # move_down self.item_height - move_down 5 + move_down line_move text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center - move_down 5 + move_down line_move stroke_horizontal_rule end def cashier_info(sale_data, customer_name) - move_down 7 + move_down line_move # move_down 2 y_position = cursor bounding_box([0,y_position], :width =>self.description_width + self.price_num_width, :height => self.item_height) do text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left end - move_down 5 + if sale_data.bookings[0].dining_facility_id.to_i > 0 + bounding_box([self.description_width - 2,y_position], :width => self.price_num_width, :height => self.item_height) do + text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right + end + end + + move_down line_move y_position = cursor if sale_data.bookings[0].dining_facility_id.to_i > 0 @@ -126,7 +133,7 @@ class ReceiptBillPdf < Prawn::Document bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right end - move_down 5 + move_down line_move y_position = cursor if sale_data.bookings[0].dining_facility_id.to_i > 0 @@ -146,7 +153,7 @@ class ReceiptBillPdf < Prawn::Document # :size => self.item_font_size,:align => :right # end - move_down 5 + move_down line_move stroke_horizontal_rule end @@ -163,9 +170,9 @@ class ReceiptBillPdf < Prawn::Document item_label_total_front_width = (self.item_width+self.price_width) + 5 item_label_total_end_width = self.total_width + 4 end - move_down 5 + move_down line_move y_position = cursor - move_down 5 + move_down line_move pad_top(15) { # @item_width.to_i + @half_qty.to_i text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix @@ -173,7 +180,7 @@ class ReceiptBillPdf < Prawn::Document text_box "Qty", :at =>[item_label_qty_front_width,y_position], :width => item_label_qty_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix text_box "Total", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix } - move_down -5 + # move_down line_move stroke_horizontal_rule add_line_item_row(sale_items,precision,delimiter) end @@ -193,7 +200,7 @@ class ReceiptBillPdf < Prawn::Document item_total_end_width = self.total_width + 4 end y_position = cursor - move_down 5 + move_down line_move sub_total = 0.0 sale_items.each do |item| # check for item not to show @@ -224,25 +231,27 @@ class ReceiptBillPdf < Prawn::Document end end end + move_down line_move } - move_down 5 + end end stroke_horizontal_rule - move_down 5 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Sub Total", :size => self.item_font_size,:align => :left end bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right - end - move_down 5 + end end def all_total(sale_data,precision,delimiter) + + move_down line_move item_name_width = self.item_width y_position = cursor if sale_data.discount_type == 'member_discount' @@ -260,7 +269,7 @@ class ReceiptBillPdf < Prawn::Document if sale_data.sale_taxes.length > 0 sale_data.sale_taxes.each do |st| - move_down 5 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do @@ -285,7 +294,7 @@ class ReceiptBillPdf < Prawn::Document # end if sale_data.rounding_adjustment != 0.0 - move_down 5 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do @@ -296,16 +305,16 @@ class ReceiptBillPdf < Prawn::Document end end - move_down 5 + move_down line_move y_position = cursor - move_down 5 + move_down line_move bounding_box([0,y_position], :width =>self.item_description_width) do text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left end bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right end - move_down 5 + move_down line_move sale_payment(sale_data,precision,delimiter) @@ -313,7 +322,7 @@ class ReceiptBillPdf < Prawn::Document def sale_payment(sale_data,precision,delimiter) stroke_horizontal_rule - move_down 5 + #move_down line_move sale_payments = SalePayment.select("SUM(sale_payments.payment_amount) as payment_amount,sale_payments.payment_method").where('sale_id = ?', sale_data.sale_id).group("payment_method") sale_payments.each do |payment| y_position = cursor @@ -330,18 +339,18 @@ class ReceiptBillPdf < Prawn::Document bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right end - move_down 5 + move_down line_move end if sale_data.amount_received > 0 y_position = cursor - move_down 5 + move_down line_move bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Change Amount", :size => self.item_font_size,:align => :left end bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right end - move_down 5 + # move_down line_move end end @@ -368,7 +377,7 @@ class ReceiptBillPdf < Prawn::Document rebate_balance = rebate_balance + res["deposit"] - move_down 5 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Rebate Earn", :size => self.item_font_size,:align => :left @@ -381,7 +390,7 @@ class ReceiptBillPdf < Prawn::Document # Total Rebate Amount if birthday if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate" rebate_balance = rebate_balance + res["deposit"] - move_down 5 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left @@ -393,7 +402,7 @@ class ReceiptBillPdf < Prawn::Document #end Total rebate if birthday end - move_down 5 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Redeem Amount", :size => self.item_font_size,:align => :left @@ -403,7 +412,7 @@ class ReceiptBillPdf < Prawn::Document end if current_balance != nil - move_down 5 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Old Balance", :size => self.item_font_size,:align => :left @@ -425,7 +434,7 @@ class ReceiptBillPdf < Prawn::Document end end - move_down 5 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Total Balance", :size => self.item_font_size,:align => :left @@ -438,21 +447,23 @@ class ReceiptBillPdf < Prawn::Document end def customer(customer_name) - move_down 5 + # move_down line_move y_position = cursor + #move_down line_move bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Customer Name", :size => self.item_font_size,:align => :left end bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "#{ customer_name }" , :size => self.item_font_size,:align => :right end + move_down line_move end def discount_account(discount_price_by_accounts,precision,delimiter) - move_down 5 + stroke_horizontal_rule - move_down 5 + move_down line_move y_position = cursor discount_price_by_accounts.each do |ipa| y_position = cursor @@ -462,13 +473,13 @@ class ReceiptBillPdf < Prawn::Document bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right end + move_down line_move end end def items_account(item_price_by_accounts,precision,delimiter) - move_down 5 stroke_horizontal_rule - move_down 5 + move_down line_move y_position = cursor item_price_by_accounts.each do |ipa| y_position = cursor @@ -477,16 +488,16 @@ class ReceiptBillPdf < Prawn::Document end bounding_box([self.label_width,y_position], :width =>self.item_description_width) do text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right - end + end + move_down line_move end end #individual payment per person - def individual_payment(sale_data, precision, delimiter) - per_person = sale_data.grand_total.to_f / sale_data.equal_persons.to_i - move_down 5 + def individual_payment(sale_data, survey, precision, delimiter) + per_person = sale_data.grand_total.to_f / survey.total_customer.to_i stroke_horizontal_rule - move_down 5 + move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.label_width+50) do text "Split Bill for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left @@ -542,10 +553,11 @@ class ReceiptBillPdf < Prawn::Document end def footer(printed_status) - move_down 5 + move_down line_move stroke_horizontal_rule - move_down 5 + move_down line_move + move_down line_move y_position = cursor bounding_box([0, y_position], :width =>self.label_width) do text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left @@ -554,15 +566,15 @@ class ReceiptBillPdf < Prawn::Document text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :left end - move_down 5 + move_down line_move end #start card sale trans data def card_sale_data(card_data) if card_data != nil && !card_data.empty? - move_down 5 + move_down line_move stroke_horizontal_rule - move_down 5 + move_down line_move y_position = cursor card_data.each do |data| diff --git a/app/uploaders/commissioner_image_uploader.rb b/app/uploaders/commissioner_image_uploader.rb new file mode 100644 index 00000000..639ce7d7 --- /dev/null +++ b/app/uploaders/commissioner_image_uploader.rb @@ -0,0 +1,59 @@ +class CommissionerImageUploader < CarrierWave::Uploader::Base + + # Include RMagick or MiniMagick support: + # include CarrierWave::RMagick + include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + storage :file + # storage :fog + + def root + Rails.root.join 'public/' + end + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "image/commissioner_images" + # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # def cache_dir + # '/tmp/images' + # end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url(*args) + # # For Rails 3.1+ asset pipeline compatibility: + # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) + # + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process scale: [200, 300] + process :resize_to_fit => [200, 150] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process resize_to_fit: [50, 50] + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + def extension_whitelist + %w(jpg jpeg gif png) + end + + # Override the filename of the uploaded files: + # Avoid using model.id or version_name here, see uploader/store.rb for details. + # def filename + # "something.jpg" if original_filename + # end + +end \ No newline at end of file diff --git a/app/uploaders/customer_image_uploader.rb b/app/uploaders/customer_image_uploader.rb new file mode 100644 index 00000000..1de0f3ad --- /dev/null +++ b/app/uploaders/customer_image_uploader.rb @@ -0,0 +1,59 @@ +class CustomerImageUploader < CarrierWave::Uploader::Base + + # Include RMagick or MiniMagick support: + # include CarrierWave::RMagick + include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + storage :file + # storage :fog + + def root + Rails.root.join 'public/' + end + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "image/customer_images" + # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # def cache_dir + # '/tmp/images' + # end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url(*args) + # # For Rails 3.1+ asset pipeline compatibility: + # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) + # + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process scale: [200, 300] + process :resize_to_fit => [200, 150] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process resize_to_fit: [50, 50] + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + def extension_whitelist + %w(jpg jpeg gif png) + end + + # Override the filename of the uploaded files: + # Avoid using model.id or version_name here, see uploader/store.rb for details. + # def filename + # "something.jpg" if original_filename + # end + +end \ No newline at end of file diff --git a/app/uploaders/display_image_uploader.rb b/app/uploaders/display_image_uploader.rb new file mode 100644 index 00000000..33e28997 --- /dev/null +++ b/app/uploaders/display_image_uploader.rb @@ -0,0 +1,59 @@ +class DisplayImageUploader < CarrierWave::Uploader::Base + + # Include RMagick or MiniMagick support: + # include CarrierWave::RMagick + include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + storage :file + # storage :fog + + # def root + # Rails.root.join 'public/' + # end + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + #"image/image" + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # def cache_dir + # '/tmp/images' + # end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url(*args) + # # For Rails 3.1+ asset pipeline compatibility: + # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) + # + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process scale: [200, 300] + process :resize_to_fit => [200, 150] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process resize_to_fit: [50, 50] + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + def extension_whitelist + %w(jpg jpeg gif png) + end + + # Override the filename of the uploaded files: + # Avoid using model.id or version_name here, see uploader/store.rb for details. + # def filename + # "something.jpg" if original_filename + # end + +end \ No newline at end of file diff --git a/app/uploaders/employee_image_uploader.rb b/app/uploaders/employee_image_uploader.rb new file mode 100644 index 00000000..fd64db42 --- /dev/null +++ b/app/uploaders/employee_image_uploader.rb @@ -0,0 +1,59 @@ +class EmployeeImageUploader < CarrierWave::Uploader::Base + + # Include RMagick or MiniMagick support: + # include CarrierWave::RMagick + include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + storage :file + # storage :fog + + def root + Rails.root.join 'public/' + end + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "image/employee_images" + # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # def cache_dir + # '/tmp/images' + # end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url(*args) + # # For Rails 3.1+ asset pipeline compatibility: + # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) + # + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process scale: [200, 300] + process :resize_to_fit => [200, 150] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process resize_to_fit: [50, 50] + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + def extension_whitelist + %w(jpg jpeg gif png) + end + + # Override the filename of the uploaded files: + # Avoid using model.id or version_name here, see uploader/store.rb for details. + # def filename + # "something.jpg" if original_filename + # end + +end \ No newline at end of file diff --git a/app/uploaders/shop_image_uploader.rb b/app/uploaders/shop_image_uploader.rb new file mode 100644 index 00000000..63a01c21 --- /dev/null +++ b/app/uploaders/shop_image_uploader.rb @@ -0,0 +1,59 @@ +class ShopImageUploader < CarrierWave::Uploader::Base + + # Include RMagick or MiniMagick support: + # include CarrierWave::RMagick + include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + storage :file + # storage :fog + + def root + Rails.root.join 'public/' + end + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "image/shop_images" + # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # def cache_dir + # '/tmp/images' + # end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url(*args) + # # For Rails 3.1+ asset pipeline compatibility: + # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) + # + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process scale: [200, 300] + process :resize_to_fit => [200, 150] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process resize_to_fit: [50, 50] + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + def extension_whitelist + %w(jpg jpeg gif png) + end + + # Override the filename of the uploaded files: + # Avoid using model.id or version_name here, see uploader/store.rb for details. + # def filename + # "something.jpg" if original_filename + # end + +end \ No newline at end of file diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb index 2359ad57..3a953e81 100755 --- a/app/views/crm/customers/_new_form.html.erb +++ b/app/views/crm/customers/_new_form.html.erb @@ -90,6 +90,21 @@ <%= f.text_field :date_of_birth, :value=>"01-01-1990",:class=>"datepicker form-control col-md-12"%> + +
+ +
+ + <%= f.file_field :image_path, :class => "img-thumbnail" %> +
+
@@ -164,6 +179,7 @@
diff --git a/app/views/origami/master/index.html.erb b/app/views/origami/master/index.html.erb index fa90de18..49d95e80 100755 --- a/app/views/origami/master/index.html.erb +++ b/app/views/origami/master/index.html.erb @@ -12,7 +12,6 @@ --> -
Master Payment
@@ -52,7 +51,8 @@
- + +

@@ -192,10 +192,14 @@ }); $('#master_pay').on('click',function(){ var amount = $('#amount').text(); + var reference_no = $('#reference_no').val(); var sale_id = "<%= @sale_id %>"; var receipt_no = "<%= @receipt_no %>"; var bank_integration = "<%= @bank_integration %>"; - if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ + $("#reference_no_Err").html(""); + if(reference_no.length > 0){ + if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ + $(this).off("click"); //start member discount 5% by pay card // var sub_total = $('#sub-total').text(); @@ -214,31 +218,34 @@ if(bank_integration == '1'){ pay_withBank("SALE", "master", amount, sale_id, receipt_no,cashier_type); }else{ - $.ajax({type: "POST", - url: "<%= origami_payment_master_path %>", - data: "amount="+ amount + "&sale_id="+ sale_id, - success:function(result){ - if(result){ - swal({ - title: "Information!", - text: "Payment Successfully", - html: true, - closeOnConfirm: false, - closeOnCancel: false, - allowOutsideClick: false - }, function () { - window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"; - }); + $.ajax({type: "POST", + url: "<%= origami_payment_master_path %>", + data: "amount="+ amount + "&sale_id="+ sale_id, + success:function(result){ + if(result){ + swal({ + title: "Information!", + text: "Payment Successfully", + html: true, + closeOnConfirm: false, + closeOnCancel: false, + allowOutsideClick: false + }, function () { + window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"; + }); + } } - } - }); + }); + } + }else{ + if (amount>0) { + swal ( "Oops" , "Paid Amount is over!" , "error" ); + }else{ + swal ( "Oops" , "Enter Amount!" , "error" ); + } } }else{ - if (amount>0) { - swal ( "Oops" , "Paid Amount is over!" , "error" ); - }else{ - swal ( "Oops" , "Enter Amount!" , "error" ); - } + $("#reference_no_Err").html("can't be blank"); } }) diff --git a/app/views/origami/mpu/index.html.erb b/app/views/origami/mpu/index.html.erb index 79e7bbe5..51a6bdc4 100755 --- a/app/views/origami/mpu/index.html.erb +++ b/app/views/origami/mpu/index.html.erb @@ -12,7 +12,6 @@
--> -
MPU Payment
@@ -52,7 +51,8 @@
- + +

@@ -197,26 +197,29 @@ $('#mpu_pay').on('click',function(){ var amount = $('#amount').text(); + var reference_no = $('#reference_no').val(); var sale_id = "<%= @sale_id %>"; var receipt_no = "<%= @receipt_no %>"; var bank_integration = "<%= @bank_integration %>"; var cashier_type = "<%= @cashier_type %>"; - if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ - $(this).off("click"); - //start member discount 5% by pay card - // var sub_total = $('#sub-total').text(); - // var member_id = $('#membership_id').text(); - // var member_discount = $('#member_discount').text(); - // if (member_id && member_discount) { - // $.ajax({ - // type: "POST", - // url: "/origami/" + sale_id + "/member_discount", - // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true }, - // success:function(result){ - // } - // }); - // } - //end member discount + $("#reference_no_Err").html(""); + if(reference_no.length > 0){ + if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ + $(this).off("click"); + //start member discount 5% by pay card + // var sub_total = $('#sub-total').text(); + // var member_id = $('#membership_id').text(); + // var member_discount = $('#member_discount').text(); + // if (member_id && member_discount) { + // $.ajax({ + // type: "POST", + // url: "/origami/" + sale_id + "/member_discount", + // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true }, + // success:function(result){ + // } + // }); + // } + //end member discount if(bank_integration == '1'){ pay_withBank("SALE", "mpu", amount, sale_id, receipt_no,cashier_type); }else{ @@ -241,12 +244,15 @@ } }else{ - if (amount>0) { - swal ( "Oops" , "Paid Amount is over!" , "error" ); - }else{ - swal ( "Oops" , "Enter Amount!" , "error" ); - } - } - }) + if (amount>0) { + swal ( "Oops" , "Paid Amount is over!" , "error" ); + }else{ + swal ( "Oops" , "Enter Amount!" , "error" ); + } + } + }else{ + $("#reference_no_Err").html("can't be blank"); + } + }) diff --git a/app/views/origami/redeem_payments/index.html.erb b/app/views/origami/redeem_payments/index.html.erb index 1d29e563..169eb026 100755 --- a/app/views/origami/redeem_payments/index.html.erb +++ b/app/views/origami/redeem_payments/index.html.erb @@ -9,7 +9,6 @@
--> -
Reedem Payment
diff --git a/app/views/origami/unionpay/index.html.erb b/app/views/origami/unionpay/index.html.erb index e407cc46..c48e4a80 100755 --- a/app/views/origami/unionpay/index.html.erb +++ b/app/views/origami/unionpay/index.html.erb @@ -12,7 +12,6 @@
--> -
UNIONPAY Payment
@@ -52,7 +51,8 @@
- + +

@@ -196,10 +196,14 @@ }); $('#unionpay_pay').on('click',function(){ var amount = $('#amount').text(); + var reference_no = $('#reference_no').val(); var sale_id = "<%= @sale_id %>"; var receipt_no = "<%= @receipt_no %>"; - if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ - $(this).off("click"); + + $("#reference_no_Err").html(""); + if(reference_no.length > 0){ + if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ + $(this).off("click"); //start member discount 5% by pay card // var sub_total = $('#sub-total').text(); // var member_id = $('#membership_id').text(); @@ -219,31 +223,34 @@ pay_withBank("SALE", "unionpay", amount, sale_id, receipt_no, cashier_type); } else{ - $.ajax({type: "POST", - url: "<%= origami_payment_unionpay_path %>", - data: "amount="+ amount + "&sale_id="+ sale_id, - success:function(result){ - if(result){ - swal({ - title: "Information!", - text: "Payment Successfully", - html: true, - closeOnConfirm: false, - closeOnCancel: false, - allowOutsideClick: false - }, function () { - window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"; - }); + $.ajax({type: "POST", + url: "<%= origami_payment_unionpay_path %>", + data: "amount="+ amount + "&sale_id="+ sale_id, + success:function(result){ + if(result){ + swal({ + title: "Information!", + text: "Payment Successfully", + html: true, + closeOnConfirm: false, + closeOnCancel: false, + allowOutsideClick: false + }, function () { + window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"; + }); + } } - } - }); + }); + } + }else{ + if (amount>0) { + swal ( "Oops" , "Paid Amount is over!" , "error" ); + }else{ + swal ( "Oops" , "Enter Amount!" , "error" ); + } } }else{ - if (amount>0) { - swal ( "Oops" , "Paid Amount is over!" , "error" ); - }else{ - swal ( "Oops" , "Enter Amount!" , "error" ); - } + $("#reference_no_Err").html("can't be blank"); } }) diff --git a/app/views/origami/visa/index.html.erb b/app/views/origami/visa/index.html.erb index 2824ef15..2b81db65 100755 --- a/app/views/origami/visa/index.html.erb +++ b/app/views/origami/visa/index.html.erb @@ -12,7 +12,6 @@
--> -
VISA Payment
@@ -52,7 +51,8 @@
- + +

@@ -195,11 +195,14 @@ }); $('#visa_pay').on('click',function(){ var amount = $('#amount').text(); + var reference_no = $('#reference_no').val(); var sale_id = "<%= @sale_id %>"; var receipt_no = "<%= @receipt_no %>"; console.log(amount); console.log($("#validamount").attr("value")); - if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ + $("#reference_no_Err").html(""); + if(reference_no.length > 0){ + if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ $(this).off("click"); //start member discount 5% by pay card // var sub_total = $('#sub-total').text(); @@ -236,15 +239,18 @@ window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"; }); } - } - }); + } + }); } }else{ - if (amount>0) { - swal ( "Oops" , "Paid Amount is over!" , "error" ); - }else{ - swal ( "Oops" , "Enter Amount!" , "error" ); + if (amount>0) { + swal ( "Oops" , "Paid Amount is over!" , "error" ); + }else{ + swal ( "Oops" , "Enter Amount!" , "error" ); + } } + }else{ + $("#reference_no_Err").html("can't be blank"); } - }) + }); diff --git a/app/views/settings/commissioners/_form.html.erb b/app/views/settings/commissioners/_form.html.erb index a337e47b..1d0823a5 100755 --- a/app/views/settings/commissioners/_form.html.erb +++ b/app/views/settings/commissioners/_form.html.erb @@ -1,11 +1,27 @@
-
+
<%= simple_form_for([:settings, @commissioner]) do |f| %> <%= f.error_notification %> -
+
<%= f.input :name %> + + +
+
+ + <%= f.file_field :image_path, :class => "img-thumbnail" %> +
+
+ <%= f.label :emp_id, 'Employee' %> <%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %> @@ -29,7 +45,7 @@
-
+
view_headline <%= t("views.right_panel.header.page_detail") %>
diff --git a/app/views/settings/commissioners/show.html.erb b/app/views/settings/commissioners/show.html.erb index 49c7f2de..b9df0967 100755 --- a/app/views/settings/commissioners/show.html.erb +++ b/app/views/settings/commissioners/show.html.erb @@ -33,6 +33,10 @@ <%= t("views.right_panel.detail.name") %> <%= @commissioner.name %> + + <%= t("views.right_panel.detail.commissioner_photo") %> + <%= image_tag @commissioner.image_path, :size => '200x200'%> + <%= t("views.right_panel.detail.employee") %> <%= t("views.right_panel.detail.name") %> <%= @commissioner.employee.name rescue '-' %> diff --git a/app/views/settings/employees/_form.html.erb b/app/views/settings/employees/_form.html.erb index 5d5fcb04..0b973416 100755 --- a/app/views/settings/employees/_form.html.erb +++ b/app/views/settings/employees/_form.html.erb @@ -12,6 +12,22 @@ <%= f.input :password %>
+
+ +
+
+ + <%= f.file_field :image_path, :class => "img-thumbnail" %> +
+
+
<%= f.submit t('views.btn.submit'),:class => 'btn btn-primary btn-lg waves-effect' %> diff --git a/app/views/settings/employees/show.html.erb b/app/views/settings/employees/show.html.erb index 0b26b1bf..0e57b032 100755 --- a/app/views/settings/employees/show.html.erb +++ b/app/views/settings/employees/show.html.erb @@ -44,6 +44,10 @@ <%= t("views.right_panel.detail.updated_at") %> <%= @employee.updated_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %> + + <%= t("views.right_panel.detail.employee_photo") %> + <%= image_tag @employee.image_path, :size => '200x200'%> + diff --git a/app/views/settings/products/_form.html.erb b/app/views/settings/products/_form.html.erb index f9ad882b..bea0f004 100755 --- a/app/views/settings/products/_form.html.erb +++ b/app/views/settings/products/_form.html.erb @@ -12,7 +12,7 @@ <%= f.input :unit_price %> <%= f.input :description %> <%= f.input :information %> - <%= f.input:taxable %> + <%= f.input :taxable %>
diff --git a/app/views/settings/shops/_form.html.erb b/app/views/settings/shops/_form.html.erb index 5a353b9b..0be7b052 100755 --- a/app/views/settings/shops/_form.html.erb +++ b/app/views/settings/shops/_form.html.erb @@ -1,68 +1,111 @@
- <%= simple_form_for([:settings,@settings_shop]) do |f| %> - <%= f.error_notification %> -
- <%= f.input :name ,:input_html=>{:class=>"col-md-10"},:required=>true%> - - <%= f.input :address %> - <%= f.input :city %> - <%= f.input :township %> - <%= f.input :state %> - <%= f.input :phone_no %> - <%= f.input :reservation_no %> - <%= f.input :license %> - <%= f.input :license_data %> - <%= f.input :base_currency %> - <%= f.input :cloud_token %> - <%= f.input :cloud_url %> - <%= f.input :owner_token %> - <%= f.input :id_prefix %> - <%= f.input :is_rounding_adj %> - <%= f.input :quick_sale_summary %> - <%= f.input :calc_tax_order %> - <%= f.input :show_account_info %> +
+
+ <%= simple_form_for([:settings,@settings_shop], :html => { :multipart => true }) do |f| %> + <%= f.error_notification %> +
+ <%= f.input :name ,:input_html=>{:class=>"col-md-10"},:required=>true%> + <%= f.input :address %> + <%= f.input :city %> + <%= f.input :township %> + <%= f.input :state %> + <%= f.input :phone_no %> + <%= f.input :reservation_no %> + <%= f.input :license %> + <%= f.input :license_data %> + <%= f.input :base_currency %> + <%= f.input :cloud_token %> + <%= f.input :cloud_url %> + <%= f.input :owner_token %> + <%= f.input :id_prefix %> + <%= f.input :is_rounding_adj %> + <%= f.input :quick_sale_summary %> + <%= f.input :calc_tax_order %> + <%= f.input :show_account_info %> +
- -
-
- <%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %> -
- <% end %> -
-
-
-
-
view_headline <%= t("views.right_panel.header.page_detail") %>
-

- 1) address - to write shop's address
- 2) city - to write city
- 3) township - to write township
- 4) state - to write state
- 5) phone_no - to write shop's phone_no
- 6) reservation_no - to write shop's reservation_no
- 7) license - to write license
- 8) license_data - to write license data
- 9) base_currency - to write base currency
- 10)cloud_token - to write cloud token
- 11)cloud_url - to write cloud url
- 12)owner_token - to write shop's owner token
- 13)id_prefix - to write id prefix
- 14)is_rounding_adj - to check for calculate rounding adj of shop
- 15)quick_sale_summary - to check for view Quick Sale Summary
- 16)calc_tax_order - to check for tax calculation of shop
- -

-
list <%= t("views.right_panel.header.button_lists") %>
-

- 1) <%= t("views.right_panel.button.submit") %> - <%= t("views.right_panel.detail.submit_btn_txt") %> <%= t("views.right_panel.detail.shop_txt") %>
-

-
list <%= t("views.right_panel.header.link_lists") %>
-

- 1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %>
- 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.shop_txt") %>
-

+ +
+
+ + <%= f.file_field :logo, :class => "img-thumbnail" %> +
+
+ + +
+
+ +
+
+ + + +
+ <%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %> +
+ <% end %> +
-
-
+
+ +
+
+
+
view_headline <%= t("views.right_panel.header.page_detail") %>
+

+ 1) address - to write shop's address
+ 2) city - to write city
+ 3) township - to write township
+ 4) state - to write state
+ 5) phone_no - to write shop's phone_no
+ 6) reservation_no - to write shop's reservation_no
+ 7) license - to write license
+ 8) license_data - to write license data
+ 9) base_currency - to write base currency
+ 10)cloud_token - to write cloud token
+ 11)cloud_url - to write cloud url
+ 12)owner_token - to write shop's owner token
+ 13)id_prefix - to write id prefix
+ 14)is_rounding_adj - to check for calculate rounding adj of shop
+ 15)quick_sale_summary - to check for view Quick Sale Summary
+ 16)calc_tax_order - to check for tax calculation of shop
+ +

+
list <%= t("views.right_panel.header.button_lists") %>
+

+ 1) <%= t("views.right_panel.button.submit") %> - <%= t("views.right_panel.detail.submit_btn_txt") %> <%= t("views.right_panel.detail.shop_txt") %>
+

+
list <%= t("views.right_panel.header.link_lists") %>
+

+ 1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %>
+ 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.shop_txt") %>
+

+
+
+
diff --git a/app/views/settings/shops/show.html.erb b/app/views/settings/shops/show.html.erb index 8fd9c5f0..d30ca274 100755 --- a/app/views/settings/shops/show.html.erb +++ b/app/views/settings/shops/show.html.erb @@ -96,8 +96,18 @@ <%= @settings_shop.calc_tax_order %> - - + Shop Image + <%= image_tag @settings_shop.logo, :size => '200x200'%> + + + Shop Images + + <% @display_images.each do |p| %> + <%= image_tag p.image , :size => '200x200'%>
+ <% end %> + + + <%= link_to t("views.btn.edit"), edit_settings_shop_path(@settings_shop),:class => 'btn btn-primary btn-sm waves-effect' %> diff --git a/config/routes.rb b/config/routes.rb index 092b82d6..6983cfbe 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -289,7 +289,10 @@ scope "(:locale)", locale: /en|mm/ do #--------- System Settings ------------# namespace :settings do - resources :shops + resources :shops do + resources :display_images + end + #employees resources :employees #menu diff --git a/db/seeds.rb b/db/seeds.rb index 1de300a1..df707508 100755 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -193,9 +193,9 @@ activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_pr #Create Adminstrator employee admin_employee = Employee.create({name: "Administrator", role: "administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"}) -admin_employee = Employee.create({name: "Waiter", role: "waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"}) -admin_employee = Employee.create({name: "Waiter 2", role: "waiter", password: "22222", emp_id:"222", created_by: "SYSTEM DEFAULT"}) -admin_employee = Employee.create({name: "Cashier", role: "cashier", password: "33333", emp_id:"333", created_by: "SYSTEM DEFAULT"}) +# admin_employee = Employee.create({name: "Waiter", role: "waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"}) +# admin_employee = Employee.create({name: "Waiter 2", role: "waiter", password: "22222", emp_id:"222", created_by: "SYSTEM DEFAULT"}) +# admin_employee = Employee.create({name: "Cashier", role: "cashier", password: "33333", emp_id:"333", created_by: "SYSTEM DEFAULT"}) order_item_printer=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "Cashier", precision: "0", delimiter: 0, heading_space: 5, page_width: 210, page_height: 1450}) order_summary_printer=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "Cashier", precision: "0", delimiter: 0, heading_space: 5, page_width: 210, page_height: 1450})