change migration file

This commit is contained in:
phyusin
2018-02-19 15:43:27 +06:30
parent 9f2bab7187
commit 521b4d897b
9 changed files with 40 additions and 35 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -67,11 +67,21 @@
<!-- CPU Usage -->
<!-- Date range for dashboard -->
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<!-- <div class="row clearfix">
<div class="col-lg-4 col-md-4 col-sm-4">
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 35px;">
</div>
<div class="col-lg-4 col-md-4 col-sm-4">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 35px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<label></label><br>
<input type="button" value="Generate" class='btn btn-primary btn_generate'>
</div>
</div>
<br> -->
<!-- Date range for dashboard -->
<div class="row">

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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