shops
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
class Api::VerificationsController < ActionController::API
|
||||||
|
|
||||||
|
def request_code
|
||||||
|
|
||||||
|
phone_number = params[:phone_number]
|
||||||
|
|
||||||
|
#TODO - user generate
|
||||||
|
|
||||||
|
if @user.pin.nil?
|
||||||
|
@user.pin = rand(1000..9999)
|
||||||
|
@user.contact_no = phone_number
|
||||||
|
@user.pin_send_at = Time.now
|
||||||
|
@user.save
|
||||||
|
VerifyNumber.send_message(@user.contact_no, @user.pin)
|
||||||
|
#sent message
|
||||||
|
else
|
||||||
|
@user.contact_no = phone_number
|
||||||
|
@user.save
|
||||||
|
VerifyNumber.send_message(@user.contact_no, @user.pin)
|
||||||
|
#sent message
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def verify_code
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
class Api::ShopsController < Api::ApiController
|
class Api::ShopsController < Api::ApiController
|
||||||
|
|
||||||
|
skip_before_action :authenticate
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@shops = Shop.select('id,logo,name,shop_code,address,phone_no,cloud_url,cloud_token').all
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
class HomeController < ApplicationController
|
class HomeController < ApplicationController
|
||||||
# layout "application", except: [:index, :show]
|
# layout "application", except: [:index, :show]
|
||||||
# skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
# skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||||
|
include PrecisionHelper
|
||||||
before_action :check_user, only: :dashboard
|
before_action :check_user, only: :dashboard
|
||||||
|
|
||||||
# Special check for only dashboard
|
# Special check for only dashboard
|
||||||
def check_user
|
def check_user
|
||||||
if current_user.nil?
|
if current_user.nil?
|
||||||
@@ -90,9 +90,7 @@ class HomeController < ApplicationController
|
|||||||
|
|
||||||
def dashboard
|
def dashboard
|
||||||
@from, @to, @from_time, @to_time = get_date_range_from_params
|
@from, @to, @from_time, @to_time = get_date_range_from_params
|
||||||
|
|
||||||
@shop = Shop.first
|
@shop = Shop.first
|
||||||
|
|
||||||
today = DateTime.now.strftime('%Y-%m-%d')
|
today = DateTime.now.strftime('%Y-%m-%d')
|
||||||
if !@from.nil? && !@to.nil?
|
if !@from.nil? && !@to.nil?
|
||||||
if !@from_time.nil? && @to_time.nil?
|
if !@from_time.nil? && @to_time.nil?
|
||||||
@@ -115,12 +113,7 @@ class HomeController < ApplicationController
|
|||||||
@top_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"top").sum('i.qty')
|
@top_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"top").sum('i.qty')
|
||||||
@bottom_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"bottom").sum('i.qty')
|
@bottom_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"bottom").sum('i.qty')
|
||||||
@hourly_sales = Sale.hourly_sales(today,current_user,@from,@to,@from_time,@to_time).sum(:grand_total)
|
@hourly_sales = Sale.hourly_sales(today,current_user,@from,@to,@from_time,@to_time).sum(:grand_total)
|
||||||
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
|
||||||
# .sum(:grand_total)
|
|
||||||
logger.debug 'hourly_sales<>><><><<<<<<>><<<><><><><><><><><><<>><'
|
|
||||||
logger.debug @hourly_sales.to_json
|
|
||||||
employee_sales = Sale.employee_sales(today,current_user,@from,@to,@from_time,@to_time)
|
employee_sales = Sale.employee_sales(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
# .sum("(CASE WHEN sp.payment_method='cash' THEN ((sp.payment_amount) - (sales.amount_changed)) ELSE (sp.payment_amount) END)")
|
|
||||||
@employee_sales = []
|
@employee_sales = []
|
||||||
if !employee_sales.nil?
|
if !employee_sales.nil?
|
||||||
employee_sales.each do |emp|
|
employee_sales.each do |emp|
|
||||||
@@ -154,7 +147,6 @@ class HomeController < ApplicationController
|
|||||||
end
|
end
|
||||||
@summ_sale = Sale.summary_sale_receipt(today,current_user,@from,@to,@from_time,@to_time)
|
@summ_sale = Sale.summary_sale_receipt(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_customer, @total_dinein, @total_takeaway, @total_membership = Sale.total_customer(today,current_user,@from,@to,@from_time,@to_time)
|
@total_customer, @total_dinein, @total_takeaway, @total_membership = Sale.total_customer(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
# @total_other_customer = Sale.total_other_customer(today,current_user)
|
|
||||||
|
|
||||||
@total_order = Sale.total_order(today,current_user,@from,@to,@from_time,@to_time)
|
@total_order = Sale.total_order(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_accounts = Sale.total_account(today,current_user,@from,@to,@from_time,@to_time)
|
@total_accounts = Sale.total_account(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@@ -172,7 +164,7 @@ class HomeController < ApplicationController
|
|||||||
@total_foc_items = Sale.total_foc_items(today,current_user,@from,@to,@from_time,@to_time)
|
@total_foc_items = Sale.total_foc_items(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
|
|
||||||
# get printer info
|
# get printer info
|
||||||
@print_settings = PrintSetting.get_precision_delimiter()
|
# @print_settings = get_precision_delimiter
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ class Origami::DashboardController < BaseOrigamiController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@shop = Shop.first
|
@shop = Shop.first
|
||||||
|
|
||||||
today = DateTime.now.strftime('%Y-%m-%d')
|
today = DateTime.now.strftime('%Y-%m-%d')
|
||||||
|
|
||||||
@display_type = Lookup.find_by_lookup_type("display_type")
|
@display_type = Lookup.find_by_lookup_type("display_type")
|
||||||
|
|||||||
27
app/helpers/precision_helper.rb
Normal file
27
app/helpers/precision_helper.rb
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#PrecisionHelper
|
||||||
|
module PrecisionHelper
|
||||||
|
|
||||||
|
def get_precision_delimiter
|
||||||
|
value_set = nil
|
||||||
|
|
||||||
|
setting = PrintSetting.find_by_unique_code("CloseCashierPdf")
|
||||||
|
if setting.nil?
|
||||||
|
star_setting = PrintSetting.find_by_unique_code("CloseCashierStarPdf")
|
||||||
|
if star_setting.nil?
|
||||||
|
value_set = PrintSetting.find_by_unique_code("CloseCashierCustomisePdf")
|
||||||
|
else
|
||||||
|
value_set = star_setting
|
||||||
|
end
|
||||||
|
else
|
||||||
|
value_set = setting
|
||||||
|
end
|
||||||
|
|
||||||
|
if !value_set.nil?
|
||||||
|
@precision_value = value_set.precision.to_i > 0 ? value_set.precision : 0
|
||||||
|
@delimiter_value = value_set.delimiter ? "," : ""
|
||||||
|
end
|
||||||
|
|
||||||
|
return @precision_value, @delimiter_value
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1589,9 +1589,10 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.nil?
|
if current_user.nil?
|
||||||
|
puts "Run employee "
|
||||||
total = query.where('DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',today,today)
|
total = query.where('DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',today,today)
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
@@ -1602,7 +1603,7 @@ end
|
|||||||
total = query.where('DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and shift_sale_id=?',today,today,shift.id)
|
total = query.where('DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and shift_sale_id=?',today,today,shift.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
7
app/views/api/shops/index.json.jbuilder
Normal file
7
app/views/api/shops/index.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
if @shops
|
||||||
|
json.status true
|
||||||
|
json.data @shops
|
||||||
|
else
|
||||||
|
json.status false
|
||||||
|
json.message "Record Not Found"
|
||||||
|
end
|
||||||
@@ -3,18 +3,6 @@
|
|||||||
<!-- <h2><%= t :dashboard %></h2> -->
|
<!-- <h2><%= t :dashboard %></h2> -->
|
||||||
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
|
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
|
||||||
</div>
|
</div>
|
||||||
<% if @print_settings.precision.to_i > 0
|
|
||||||
precision = @print_settings.precision
|
|
||||||
else
|
|
||||||
precision = 0
|
|
||||||
end
|
|
||||||
#check delimiter
|
|
||||||
if @print_settings.delimiter
|
|
||||||
delimiter = ","
|
|
||||||
else
|
|
||||||
delimiter = ""
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
<!-- Widgets -->
|
<!-- Widgets -->
|
||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 col-mbl-view">
|
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 col-mbl-view">
|
||||||
@@ -211,19 +199,19 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<% revenue = @summ_sale.total_amount - @summ_sale.total_discount%>
|
<% revenue = @summ_sale.total_amount - @summ_sale.total_discount%>
|
||||||
<td><%= t("views.right_panel.detail.sale") %> <%= t :revenue %> : </td>
|
<td><%= t("views.right_panel.detail.sale") %> <%= t :revenue %> : </td>
|
||||||
<td align="right"><%= number_with_precision( revenue, precision: precision.to_i ,delimiter: delimiter) %></td>
|
<td align="right"><%= number_with_precision( revenue, precision: @precision.to_i ,delimiter: @delimiter) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
|
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
|
||||||
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: @precision.to_i ,delimiter: @delimiter) rescue number_with_precision(0, precision: @precision.to_i ,delimiter: @delimiter) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
|
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
|
||||||
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: @precision.to_i ,delimiter: @delimiter) rescue number_with_precision(0, precision: @precision.to_i ,delimiter: @delimiter) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= t("views.right_panel.detail.total_sale") %> : </td>
|
<td><%= t("views.right_panel.detail.total_sale") %> : </td>
|
||||||
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
|
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: @precision.to_i ,delimiter: @delimiter)%></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
@@ -240,7 +228,7 @@
|
|||||||
<td align="right">
|
<td align="right">
|
||||||
<% @sale_data.each do |data| %>
|
<% @sale_data.each do |data| %>
|
||||||
<% pay_mth = payment.payment_method %>
|
<% pay_mth = payment.payment_method %>
|
||||||
<%= number_with_precision(data[""+pay_mth+""], precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
|
<%= number_with_precision(data[""+pay_mth+""], precision: @precision.to_i ,delimiter: @delimiter) rescue number_with_precision(0, precision: @precision.to_i ,delimiter: @delimiter) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -253,7 +241,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= t("views.right_panel.detail.other_payment") %> : </td>
|
<td><%= t("views.right_panel.detail.other_payment") %> : </td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<%= number_with_precision(total_card["card"], precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
|
<%= number_with_precision(total_card["card"], precision: @precision.to_i ,delimiter: @delimiter) rescue number_with_precision(0, precision: @precision.to_i ,delimiter: @delimiter) %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ class ActionController::Base
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
# check for license file
|
# check for license file
|
||||||
if check_license
|
# if check_license
|
||||||
current_license(ENV["SX_PROVISION_URL"])
|
# current_license(ENV["SX_PROVISION_URL"])
|
||||||
else
|
# else
|
||||||
redirect_to activate_path
|
# redirect_to activate_path
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
application_path="#{File.expand_path("../..", __FILE__)}"
|
# application_path="#{File.expand_path("../..", __FILE__)}"
|
||||||
directory application_path
|
# directory application_path
|
||||||
#environment ENV.fetch("RAILS_ENV") { "production" }
|
# #environment ENV.fetch("RAILS_ENV") { "production" }
|
||||||
environment "production"
|
# environment "production"
|
||||||
pidfile "#{application_path}/tmp/puma/pid"
|
# pidfile "#{application_path}/tmp/puma/pid"
|
||||||
state_path "#{application_path}/tmp/puma/state"
|
# state_path "#{application_path}/tmp/puma/state"
|
||||||
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||||
port ENV.fetch("PORT") { 62158 }
|
# port ENV.fetch("PORT") { 62158 }
|
||||||
workers 2
|
# workers 2
|
||||||
preload_app!
|
# preload_app!
|
||||||
threads 1,1
|
# threads 1,1
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
post 'authenticate' => "authenticate#create"
|
post 'authenticate' => "authenticate#create"
|
||||||
delete 'authenticate' => "authenticate#destroy"
|
delete 'authenticate' => "authenticate#destroy"
|
||||||
|
|
||||||
|
get 'get_shops' => "shops#index"
|
||||||
namespace :restaurant do
|
namespace :restaurant do
|
||||||
get 'zones' => "zones#index"
|
get 'zones' => "zones#index"
|
||||||
resources :menu, only: [:index, :show]
|
resources :menu, only: [:index, :show]
|
||||||
|
|||||||
Reference in New Issue
Block a user