From 521b4d897b82ff19f352bc3da1296f3f72c40ddd Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 19 Feb 2018 15:43:27 +0630 Subject: [PATCH] change migration file --- app/controllers/application_controller.rb | 10 +++++----- app/controllers/home_controller.rb | 19 +++++++++++++++++++ app/views/home/dashboard.html.erb | 16 +++++++++++++--- db/migrate/20170403155230_create_employees.rb | 1 + db/migrate/20170622050926_create_customers.rb | 1 + .../20170825090115_create_commissioners.rb | 1 + ...80213050551_add_image_path_to_employees.rb | 9 --------- ...80213050631_add_image_path_to_customers.rb | 9 --------- ...3052206_add_image_path_to_commissioners.rb | 9 --------- 9 files changed, 40 insertions(+), 35 deletions(-) delete mode 100644 db/migrate/20180213050551_add_image_path_to_employees.rb delete mode 100644 db/migrate/20180213050631_add_image_path_to_customers.rb delete mode 100644 db/migrate/20180213052206_add_image_path_to_commissioners.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 67f6cb46..eaf89c34 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -38,11 +38,11 @@ class ApplicationController < ActionController::Base end else # check for license file - if check_license - current_license(ENV["SX_PROVISION_URL"]) - else - redirect_to activate_path - end + # if check_license + # current_license(ENV["SX_PROVISION_URL"]) + # else + # redirect_to activate_path + # end end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index db843aca..99c6d5f6 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -62,6 +62,9 @@ class HomeController < ApplicationController end def dashboard + # puts "date range =>" + # puts get_date_range_from_params + @shop = Shop.first today = DateTime.now.strftime('%Y-%m-%d') @@ -162,4 +165,20 @@ class HomeController < ApplicationController redirect_to reports_dailysale_index_path end end + + def get_date_range_from_params + from = params[:from] + to = params[:to] + + if from.present? && to.present? + f_date = DateTime.parse(from) + t_date = DateTime.parse(to) + f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec) + t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec) + from = f_time.beginning_of_day.utc.getlocal + to = t_time.end_of_day.utc.getlocal + end + + return from, to + end end diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index f935522b..d1a13775 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -67,11 +67,21 @@ -
-
- +
diff --git a/db/migrate/20170403155230_create_employees.rb b/db/migrate/20170403155230_create_employees.rb index c4bf65ac..4270b265 100755 --- a/db/migrate/20170403155230_create_employees.rb +++ b/db/migrate/20170403155230_create_employees.rb @@ -9,6 +9,7 @@ class CreateEmployees < ActiveRecord::Migration[5.1] t.datetime :session_expiry t.datetime :session_last_login t.string :created_by + t.string :image_path t.timestamps end end diff --git a/db/migrate/20170622050926_create_customers.rb b/db/migrate/20170622050926_create_customers.rb index cb370bc1..b01362fe 100755 --- a/db/migrate/20170622050926_create_customers.rb +++ b/db/migrate/20170622050926_create_customers.rb @@ -18,6 +18,7 @@ class CreateCustomers < ActiveRecord::Migration[5.1] t.string :membership_authentication_code t.string :customer_type, :default => "Dinein" t.json :tax_profiles + t.string :image_path end end end diff --git a/db/migrate/20170825090115_create_commissioners.rb b/db/migrate/20170825090115_create_commissioners.rb index 1794b5c7..a89920d5 100755 --- a/db/migrate/20170825090115_create_commissioners.rb +++ b/db/migrate/20170825090115_create_commissioners.rb @@ -9,6 +9,7 @@ class CreateCommissioners < ActiveRecord::Migration[5.1] t.datetime :joined_date t.datetime :resigned_date t.boolean :is_active, default: true + t.string :image_path t.timestamps end end diff --git a/db/migrate/20180213050551_add_image_path_to_employees.rb b/db/migrate/20180213050551_add_image_path_to_employees.rb deleted file mode 100644 index bb26e888..00000000 --- a/db/migrate/20180213050551_add_image_path_to_employees.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddImagePathToEmployees < ActiveRecord::Migration[5.1] - def change - add_column :employees, :image_path, :string - end - - def down - remove_column :image_path - end -end diff --git a/db/migrate/20180213050631_add_image_path_to_customers.rb b/db/migrate/20180213050631_add_image_path_to_customers.rb deleted file mode 100644 index 11eecdc0..00000000 --- a/db/migrate/20180213050631_add_image_path_to_customers.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddImagePathToCustomers < ActiveRecord::Migration[5.1] - def change - add_column :customers, :image_path, :string - end - - def down - remove_column :image_path - end -end diff --git a/db/migrate/20180213052206_add_image_path_to_commissioners.rb b/db/migrate/20180213052206_add_image_path_to_commissioners.rb deleted file mode 100644 index f61dce61..00000000 --- a/db/migrate/20180213052206_add_image_path_to_commissioners.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddImagePathToCommissioners < ActiveRecord::Migration[5.1] - def change - add_column :commissioners, :image_path, :string - end - - def down - remove_column :image_path - end -end