add dashboard settings and customer create
This commit is contained in:
@@ -244,6 +244,13 @@ Menu Image (Import guideline)
|
||||
For Edit Order Open & Close
|
||||
1) settings/lookups => {type:edit_order, name:EditOrderOrigami, value: {1 or 0}}
|
||||
|
||||
For Dashboard Settings for supervisor and cashier
|
||||
1) settings/lookups => {type:dashboard_settings, name:supervisor, value: {1 or 0}}
|
||||
2) settings/lookups => {type:dashboard_settings, name:cashier, value: {1 or 0}}
|
||||
|
||||
For Customer Settings On/Off
|
||||
1) settings/lookups => {type:customer_settings, name:create, value: {1 or 0}}
|
||||
|
||||
* ToDo list
|
||||
|
||||
1. Migration
|
||||
|
||||
@@ -504,7 +504,7 @@ function showNewOrderAlert(order_reservation,shop_code){
|
||||
if((order_reservation!=undefined) && (order_reservation!=null) && (order_reservation!="")){
|
||||
var date = new Date(order_reservation.requested_time);
|
||||
var time = timeFormat(date);
|
||||
var requested_date = date.getFullYear() + '-' + (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >= 10? date.getDate() : '0' + date.getDate()) +' '+time;
|
||||
var requested_date = date.getFullYear() + '-' + (date.getMonth() >= 10? (date.getMonth()+1) : '0' + (date.getMonth()+1)) +'-'+ (date.getDate() >= 10? date.getDate() : '0' + date.getDate()) +' '+time;
|
||||
$('.first-1').click();
|
||||
|
||||
swal({
|
||||
|
||||
@@ -569,7 +569,7 @@ function getCreditSales(filter, customer, cashier_type){
|
||||
$(".credit_items").show();
|
||||
for (var i = 0; i < credit_sales.length ; i++) {
|
||||
var sale_date = new Date(credit_sales[i].sale_date);
|
||||
var receipt_date = sale_date.getFullYear() +'-'+ (sale_date.getMonth() > 10 ? sale_date.getMonth() : '0' + sale_date.getMonth()) +'-'+ (sale_date.getDate() > 10 ? sale_date.getDate() : '0' + sale_date.getDate());
|
||||
var receipt_date = sale_date.getFullYear() +'-'+ (sale_date.getMonth() > 10 ? (sale_date.getMonth()+1) : '0' + (sale_date.getMonth()+1)) +'-'+ (sale_date.getDate() > 10 ? sale_date.getDate() : '0' + sale_date.getDate());
|
||||
$('.tbd_credit_lists').append(html_credit_items.formatUnicorn({
|
||||
'key':i,
|
||||
'sale_id':credit_sales[i].sale_id,
|
||||
|
||||
@@ -43,6 +43,19 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
@filter = filter
|
||||
|
||||
#for create customer on/off
|
||||
@create_flag = true
|
||||
lookup_customer = Lookup.collection_of('customer_settings')
|
||||
if !lookup_customer.empty?
|
||||
lookup_customer.each do |create_setting|
|
||||
if create_setting[0].downcase == "create"
|
||||
if create_setting[1] == '0' && current_login_employee.role == 'cashier'
|
||||
@create_flag = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
# end
|
||||
@@ -197,7 +210,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created.' + response["message"]}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' + response["message"] }
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' }
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
@@ -67,7 +67,8 @@ class HomeController < ApplicationController
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "supervisor"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_root_path
|
||||
route_by_role(@employee)
|
||||
# redirect_to origami_root_path
|
||||
elsif @employee.role == "waiter"
|
||||
session[:session_token] = @employee.token_session
|
||||
route_by_role(@employee)
|
||||
@@ -202,9 +203,9 @@ class HomeController < ApplicationController
|
||||
redirect_to origami_dashboard_path
|
||||
elsif employee.role == "crm"
|
||||
redirect_to crm_root_path
|
||||
elsif @employee.role == "supervisor"
|
||||
redirect_to origami_root_path
|
||||
elsif @employee.role == "account"
|
||||
elsif employee.role == "supervisor"
|
||||
redirect_to origami_dashboard_path
|
||||
elsif employee.role == "account"
|
||||
redirect_to reports_dailysale_index_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -74,8 +74,7 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
end
|
||||
|
||||
filter = params[:filter]
|
||||
puts "filter"
|
||||
puts filter
|
||||
|
||||
if filter.nil?
|
||||
puts params[:page]
|
||||
@crm_customers = Customer.order("customer_id") #.page(params[:page])
|
||||
@@ -94,6 +93,19 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
# end
|
||||
@membership_types = Lookup.collection_of("member_group_type")
|
||||
|
||||
#for create customer on/off
|
||||
@create_flag = true
|
||||
lookup_customer = Lookup.collection_of('customer_settings')
|
||||
if !lookup_customer.empty?
|
||||
lookup_customer.each do |create_setting|
|
||||
if create_setting[0].downcase == "create"
|
||||
if create_setting[1] == '0' && current_login_employee.role == 'cashier'
|
||||
@create_flag = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
# format.html { render :template => "crm/customers/index" }
|
||||
format.html { render action: "index"}
|
||||
|
||||
@@ -69,6 +69,17 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#dashboard settings on/off for supervisor and cashier
|
||||
dashboard_settings = Lookup.collection_of('dashboard_settings')
|
||||
@setting_flag = true
|
||||
if !dashboard_settings.empty?
|
||||
dashboard_settings.each do |setting|
|
||||
if setting[0].to_s.downcase == current_user.role.downcase && setting[1] == '0'
|
||||
@setting_flag = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_all_menu
|
||||
|
||||
@@ -116,7 +116,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@split_bill = lookup_spit_bill[0][1]
|
||||
end
|
||||
|
||||
#for edit order open & close
|
||||
#for edit order on/off
|
||||
@edit_order_origami = true
|
||||
lookup_edit_order = Lookup.collection_of('edit_order')
|
||||
if !lookup_edit_order.empty?
|
||||
|
||||
@@ -6,7 +6,11 @@ class Settings::EmployeesController < ApplicationController
|
||||
# GET /employees
|
||||
# GET /employees.json
|
||||
def index
|
||||
@employees = Employee.all
|
||||
if current_user.role == "supervisor"
|
||||
@employees = Employee.where("role in ('cashier', 'waiter')")
|
||||
else
|
||||
@employees = Employee.all
|
||||
end
|
||||
end
|
||||
|
||||
# GET /employees/1
|
||||
|
||||
@@ -223,7 +223,8 @@ class Ability
|
||||
can :show, :product_sale
|
||||
|
||||
elsif user.role == "supervisor"
|
||||
|
||||
can :manage, Employee
|
||||
|
||||
can :edit, :sale_edit
|
||||
can :item_void, :sale_edit
|
||||
can :item_foc, :sale_edit
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
<div class="<%= @create_flag ? 'col-lg-8 col-md-8 col-sm-8' : 'col-lg-12 col-md-12 col-sm-12' %>">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<div class="row p-l-20 p-t-20">
|
||||
@@ -104,20 +104,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<div class="card">
|
||||
<div class="body" id="custom-slimscroll">
|
||||
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
||||
<% if @create_flag %>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<div class="card">
|
||||
<div class="body" id="custom-slimscroll">
|
||||
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-lg-1 col-md-1 col-sm-1 ">
|
||||
<br>
|
||||
<a href="<%= dashboard_path%>" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-lg-1 col-md-1 col-sm-1 ">
|
||||
<br>
|
||||
<a href="<%= dashboard_path%>" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</div> -->
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
<!-- CPU Usage -->
|
||||
|
||||
<!-- Date range for dashboard -->
|
||||
<% if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' %>
|
||||
<div class="row clearfix">
|
||||
<%
|
||||
if !@from.nil?
|
||||
@@ -124,6 +125,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<% end %>
|
||||
<!-- Date range for dashboard -->
|
||||
|
||||
<div class="row">
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> -->
|
||||
<%if current_login_employee.role !="waiter" %>
|
||||
<a href="javascript:void(0);" class="bars"></a>
|
||||
<% if current_login_employee.role != "cashier" %>
|
||||
<% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "account" %>
|
||||
<a class="navbar-brand" href="<%=dashboard_path%>" style="margin-left: 20px;">
|
||||
<% else %>
|
||||
<a class="navbar-brand" href="<%=origami_dashboard_path%>" style="margin-left: 20px;">
|
||||
|
||||
@@ -30,7 +30,11 @@
|
||||
<ul class="list">
|
||||
<li class="header"><%= t :main_navigation %></li>
|
||||
<li class="active">
|
||||
<a href="<%= dashboard_path %>">
|
||||
<% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "account" %>
|
||||
<a href="<%= dashboard_path %>">
|
||||
<% elsif current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %>
|
||||
<a href="<%= origami_dashboard_path %>">
|
||||
<%end%>
|
||||
<i class="material-icons">home</i>
|
||||
<span><%= t :dashboard %></span>
|
||||
</a>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
<div class="<%= @create_flag ? 'col-lg-8 col-md-8 col-sm-8' : 'col-lg-11 col-md-11 col-sm-11' %>">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<div class="row p-t-20 p-l-20">
|
||||
@@ -109,28 +109,29 @@
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-lg-4 col-md-4 col-sm-4" style="min-height:600px; max-height:600px; overflow-x:scroll"> -->
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
|
||||
<input type="hidden" id="page" name="page" value="<%= @page %>" />
|
||||
<%if !@dining_facility.nil?%>
|
||||
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
|
||||
<input type="hidden" id="table_type" name="table_type" value="<%= @dining_facility.type %>" />
|
||||
<% elsif @cashier_type == 'quick_service' %>
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
|
||||
<input type="hidden" id="page" name="page" value="<%= @page %>" />
|
||||
<%else%>
|
||||
<input type="hidden" id="table_id" name="table_id" value="" />
|
||||
<input type="hidden" id="type" name="type" value="" />
|
||||
<input type="hidden" id="table_type" name="table_type" value="" />
|
||||
<%end%>
|
||||
<% if @create_flag %>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3" >
|
||||
<div class="card">
|
||||
<div class="body" id="custom-slimscroll">
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
|
||||
<span class="patch_method"></span>
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
|
||||
<input type="hidden" id="page" name="page" value="<%= @page %>" />
|
||||
<%if !@dining_facility.nil?%>
|
||||
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
|
||||
<input type="hidden" id="table_type" name="table_type" value="<%= @dining_facility.type %>" />
|
||||
<% elsif @cashier_type == 'quick_service' %>
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
|
||||
<input type="hidden" id="page" name="page" value="<%= @page %>" />
|
||||
<%else%>
|
||||
<input type="hidden" id="table_id" name="table_id" value="" />
|
||||
<input type="hidden" id="type" name="type" value="" />
|
||||
<input type="hidden" id="table_type" name="table_type" value="" />
|
||||
<%end%>
|
||||
<%= f.error_notification %>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
<div class="form-group">
|
||||
@@ -276,6 +277,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- #END# Widgets -->
|
||||
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
|
||||
<% if !@current_user.nil? && @current_user.role != 'waiter' && @setting_flag %>
|
||||
<!-- CPU Usage -->
|
||||
<div class="row clearfix">
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
<%= f.input :is_active,:input_html=>{:class=>"col-md-9"} %>
|
||||
<% if current_user.role == "administrator" %>
|
||||
<%= f.input :role, :collection => Lookup.collection_of("employee_roles"),:class=>'form-group' %>
|
||||
<% elsif current_user.role == "supervisor" %>
|
||||
<%= f.input :role, :collection => Lookup.collection_of("employee_roles").select{|r| r[1] == "cashier" || r[1] == "waiter"},:class=>'form-group' %>
|
||||
<% else %>
|
||||
<%= f.input :role, :collection => Lookup.collection_of("employee_roles").select{|r| r[1] != "administrator"},:class=>'form-group' %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user