add new files

This commit is contained in:
Sunandar
2017-01-24 17:45:40 +06:30
parent 2f427ae5b9
commit 2893f33a23
138 changed files with 36367 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
app/.DS_Store vendored Normal file

Binary file not shown.

BIN
app/assets/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the api/auth controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the api/batch controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the api/batch_line_items controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the api/encoder controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the api/encoders controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,17 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/
@import "bootstrap.v4a2.min";
@import "bootstrap-multiselect";

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the batch_line_items controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the batches controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the encoders controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the home controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,89 @@
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
margin: 33px;
}
p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
margin: 33px;
}
pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}
a {
color: #000;
&:visited {
color: #666;
}
&:hover {
color: #fff;
background-color: #000;
}
}
th {
padding-bottom: 5px;
}
td {
padding-bottom: 7px;
padding-left: 5px;
padding-right: 5px;
}
div {
&.field, &.actions {
margin-bottom: 10px;
}
}
#notice {
color: green;
}
.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}
#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0;
background-color: #c00;
color: #fff;
}
ul li {
font-size: 12px;
list-style: square;
}
}
label {
display: block;
}

View File

@@ -0,0 +1,259 @@
#nav_bar {
z-index: 999;
}
hr
{
color: #999;
margin-top: -10px;
padding: 0px 30px;
}
.nav_space {
padding: 0px 10px;
}
.title {
font-size: 17px;
}
.more {
font-size: 12px;
}
.color_block {
background-color: #eee;
border-radius: 4px;
}
.text_block {
margin: 0px 10px;
}
.account_block {
float: left;
width:240px;
margin: 0 30px 30px 0;
}
.account_block a{
text-decoration: none;
color :#000;
}
.grad {
background: #eee; /* For browsers that do not support gradients */
background: -webkit-linear-gradient(#fff, #ddd); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(#fff, #ddd); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(#fff, #ddd); /* For Firefox 3.6 to 15 */
background: linear-gradient(#fff, #ddd); /* Standard syntax */
}
.logout a{
text-decoration: none;
color : #fff;
}
/*for mobile view*/
@media (max-device-width: 799px) {
.desktop {
display: none !important;
visibility: hidden !important;
}
.content_block_m {
display: block;
width: 100%;
height: 100%;
margin: 0 auto;
overflow: auto;
}
.left_block_m {
width: 100%;
padding-right: 20px;
text-align: center;
}
.left_block_m th{
text-align: right;
padding-left: 10px;
}
.left_block_m td{
padding-left: 10px;
text-align: left;
}
.left_block_m td hr{
color: #999;
margin-top: 5px;
padding: 0px 15px 0 0;
}
.right_block_m {
display: inline-block;
width: 100%;
padding-top: 30px;
border-top: 1px dotted #ccc;
}
.avalible_money_m {
width: 100%;
}
.right_block_m hr{
color: #999;
margin-top: 10px;
padding: 0px 30px;
}
}
/*end for mobile view*/
/*for desktop view*/
@media (min-device-width: 800px) {
.mobile{
display: none !important;
visibility: hidden !important;
}
.content_block {
display: block;
width: 100%;
height: 100%;
margin: 0 auto;
overflow: auto;
}
.left_block {
float: left;
padding-right: 20px;
border-right: 0.1em solid #eee;
text-align: center;
width: 35%;
}
.left_block th{
text-align: right;
padding-left: 10px;
width: 50%;
}
.left_block td{
padding-left: 10px;
text-align: left;
width: 50%;
}
.left_block td hr{
color: #999;
margin-top: 5px;
padding: 0px 15px 0 0;
}
.right_block {
margin-left: 20px;
display: inline-block;
width: 60%;
}
.avalible_money {
float: right;
width: 60%;
}
.right_block hr{
color: #999;
margin-top: 10px;
padding: 0px 30px;
}
}
/*end of desktop view*/
.notice {
padding-top: 7px;
font-size: 10px;
font-style: italic;
}
.gallery {
text-align: center;
margin: 0px;
overflow: auto;
}
.gallery ul {
list-style-type: none;
margin: 0px;
padding: 0px;
}
.gallery ul li {
float: left;
width: 100px;
height: 90px;
}
.img_container {
padding :5px;
}
.gallery ul li .img_text{
max-width: 80px !important;
height: 20px !important;
margin: 0 auto;
text-align:center;
line-height:8px;
font-weight: 200;
font-size: 10px;
}
.list_group {
display: inline-block;
margin-left: -20px;
overflow: auto;
}
.list_group ul li {
padding: 10px 5px;
float: left;
list-style: none;
font-size: 12px;
}
.circle{
-webkit-border-radius:5px;
-moz-border-radius:5px;
margin-top: 7px;
border-radius:5px;
border:1px solid #ccc;
width:5px;
height:5px;
}
.dl_horizontal {
display: block;
}
.dl_horizontal dl dt{
text-align: right;
}
.dl_horizontal dl dd{
text-align: left;
}
.txt_uppercase {
text-transform: uppercase; }
.top-content{
margin-top: 40px;
}
.content{
margin-top: 45px;
}
.btn-reset-filter{
margin-top: 35px;
}
.btn-list{
margin-top: 31px;
}
.content .show >.row{
margin-bottom: 8px;
}
.btn-show-action,.btn-action{
margin-top: 20px;
}
.btn-show-action{
padding-left: 5px;
}
.form-group{
margin-bottom: 23px;
}
.center{
text-align: center;
}
.right{
float:right;
}
.hide{
display: none;
}
.show{
display: block;
}
.spacer-30{
margin-top: 30px;
}
.container ul.nav>.nav-item{
padding-left: 30px;
}
.container ul.nav>.nav-item:first-child{
padding-left: 80px;
}

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,29 @@
class Api::AuthController < ApplicationController
skip_before_filter :verify_authenticity_token
def login
username = params[:username]
access = params[:access_code]
user = Member.find_by_email(username)
if user && user.valid_password?(access)
user.session_token = SecureRandom.hex
if user.save
@out=true,user.session_token
else
@out=false,"Error occurs in login process."
end
else
@out=false,"Sorry!Unauthorized user!"
end
end
def logout
login_token = params[:session_token]
@user = Member.find_by_session_token(login_token)
if !@user.nil?
@user.session_token = nil
if @user.save
return @user
end
end
end
end

View File

@@ -0,0 +1,57 @@
class Api::BatchLineItemsController < ApplicationController
skip_before_filter :verify_authenticity_token
def register
batch_id=params[:batch_id]
session_token=params[:session_token]
manufacture_uid = params[:manufacture_uid]
card_type = params[:card_type]
user_id=""
check_member= Member.authenticate_session_token(session_token)
if !check_member.nil?
encrypt_key=""
find_user=User.find_by_id(check_member.user_id)
if !find_user.nil?
encrypt_key=find_user.secrect_key
user_id=find_user.id
end
if !encrypt_key.nil?
str="manufacture_uid="+manufacture_uid.to_s+"&serial_no="+serial_no.to_s
digest_data= Digest::MD5.hexdigest(str)
hex_data=digest_data.hex
hex_str=hex_data.to_s
wristband_code=hex_str[0..15]
check_manufacture = BatchLineItem.find_by_manufacture_uid_and_wristband_code(manufacture_uid,wristband_code)
if check_manufacture.nil?
serial_no=BatchLineItem.generate_serial_no(user_id.to_s)
batchLineItem=BatchLineItem.new
batchLineItem.wristband_code=wristband_code
batchLineItem.serial_no=serial_no
batchLineItem.batch_id=batch_id
batchLineItem.manufacture_uid = manufacture_uid
batchLineItem.card_type = card_type
if batchLineItem.save
lookup=Lookup.find_by_name('generate_serial_no')
max_serail_no=lookup.max_value
lookup.max_value=max_serail_no.to_i+1
lookup.save
@out = true,batchLineItem.serial_no,batchLineItem.wristband_code
else
@out=false,'Error occurs in registration encoder!'
end
else
@out=false,'Wristband code is already exists!'
end
else
@out=false,'Invalid Encryption Key!'
end
else
@out=false,'Sorry!Unauthorized user!'
end
end
end

View File

@@ -0,0 +1,73 @@
class Api::BatchesController < ApplicationController
skip_before_filter :verify_authenticity_token
def create
session_token=params[:session_token]
check_member= Member.authenticate_session_token(session_token)
if !check_member.nil?
date = DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
created_by = params[:created_by]
order_ref = params[:order_ref]
card_qty = params[:card_qty]
user_id=check_member.user_id
batch = Batch.create_batch(created_by,date,order_ref,card_qty,user_id)
if !batch.nil?
@out=true,batch.id
else
@out=false,'Error occurs in creating batch!'
end
else
@out = false, "Sorry!Unauthorized user!"
end
end
def batch_end
session_token=params[:session_token]
batch_id=params[:batch_id]
is_authorize= Member.authenticate_session_token(session_token)
if is_authorize
batch=Batch.find_by_id(batch_id)
if !batch.nil?
batch.batch_end_time = DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
batch.batch_end = true
if batch.save
@out=true,"Batch end process is successfully finished."
else
@out=false,'Error occurs in batch end process!'
end
else
@out=false,'Invalid batch no!'
end
else
@out = false, "Sorry!Unauthorized user!"
end
end
def resume_batch
session_token=params[:session_token]
batch_id=params[:batch_id]
is_authorize= Member.authenticate_session_token(session_token)
if is_authorize
batch=Batch.find_by_id(batch_id)
tickets=batch.tickets.count
@out=true,tickets
else
@out = false, "Sorry!Unauthorized user!"
end
end
def batch_progress_list
created_by=params[:created_by]
if !created_by.nil?
batches = Batch.where('batch_end is null and created_by=?', created_by)
puts batches
if !batches.blank?
@out=true,batches
else
@out = false, "No Batch"
end
else
@out = false, "Sorry!Unauthorized user!"
end
end
end

View File

@@ -0,0 +1,36 @@
class BatchLineItemsController < ApplicationController
require "csv"
skip_before_filter :verify_authenticity_token
before_action :authenticate_member!
def index
@batches=Batch.all
@batchLineItems=BatchLineItem.joins('inner join batches on batches.id=batch_line_items.batch_id').select('batch_line_items.*,batches.order_ref as batch_name').page(params[:page]).per(2)
end
def create
batch_list=params[:batch]
if ! batch_list.nil?
batch_list.each do |batch|
find_batch=Batch.find_by_id(batch)
if !find_batch.nil?
export_count=find_batch.export_count
find_batch.export_count=export_count.to_i+1
find_batch.save
end
end
@batchLineItems = BatchLineItem.where('batch_id in (?) ',batch_list).select('*')
else
user_id=current_member.user_id
batches=Batch.all
batches.each do |batch|
export_count=batch.export_count
batch.export_count=export_count.to_i+1
batch.save
end
@batchLineItems = BatchLineItem.all.select('serial_no,wristband_code,batch_id,manufacture_uid,card_type')
end
respond_to do |format|
format.html
format.csv { send_data @batchLineItems.to_csv(user_id), filename: "encoder-#{Date.today}.csv" }
end
end
end

View File

@@ -0,0 +1,5 @@
class BatchesController < ApplicationController
def index
@batches=Batch.all.page(params[:page]).per(2)
end
end

View File

@@ -0,0 +1,10 @@
class HomeController < ApplicationController
skip_before_filter :verify_authenticity_token
def index
redirect_to new_member_session_path
end
def dashboard
@users=User.all
end
end

View File

@@ -0,0 +1,98 @@
class UsersController < ApplicationController
skip_before_filter :verify_authenticity_token
before_action :set_user, only: [:show, :edit, :update, :destroy]
# GET /users
# GET /users.json
def index
@users = User.all.page(params[:page])
end
# GET /users/1
# GET /users/1.json
def show
end
# GET /users/new
def new
@user = User.new
end
# GET /users/1/edit
def edit
end
# POST /users
# POST /users.json
def create
@user = User.new(user_params)
email=params[:registered_email]
@user.is_active=true
respond_to do |format|
if @user.save
member_id= current_member.id
member=Member.find_by_email(email)
if !member.nil?
member.user_id =@user.id
member.save
end
format.html { redirect_to @user, notice: 'User was successfully created.' }
format.json { render :show, status: :created, location: @user }
else
format.html { render :new }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /users/1
# PATCH/PUT /users/1.json
def update
respond_to do |format|
if @user.update(user_params)
format.html { redirect_to @user, notice: 'User was successfully updated.' }
format.json { render :show, status: :ok, location: @user }
else
format.html { render :edit }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
# DELETE /users/1
# DELETE /users/1.json
def destroy
@user.destroy
respond_to do |format|
format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }
format.json { head :no_content }
end
end
def check_registered_email
registered_email = params[:registered_email]
member =Member.find_by_email(registered_email)
if !member.nil?
if member.user_id.nil?
render json: {:status => 'true'}
else
user = User.find_by_id(member.user_id)
render json: {:status => 'false',:data => user}
end
else
render json: {:status => 'false',:data => nil}
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_user
@user = User.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def user_params
params.require(:user).permit(:name, :nrc, :email, :phone, :address,:is_active,:secrect_key)
end
end

View File

@@ -0,0 +1,2 @@
module Api::AuthHelper
end

View File

@@ -0,0 +1,2 @@
module Api::BatchHelper
end

View File

@@ -0,0 +1,2 @@
module Api::BatchLineItemsHelper
end

View File

@@ -0,0 +1,2 @@
module Api::EncoderHelper
end

View File

@@ -0,0 +1,2 @@
module Api::EncodersHelper
end

View File

@@ -0,0 +1,2 @@
module BatchLineItemsHelper
end

View File

@@ -0,0 +1,2 @@
module BatchesHelper
end

View File

@@ -0,0 +1,2 @@
module EncodersHelper
end

View File

@@ -0,0 +1,2 @@
module HomeHelper
end

View File

@@ -0,0 +1,2 @@
module UsersHelper
end

22
app/models/batch.rb Normal file
View File

@@ -0,0 +1,22 @@
class Batch < ApplicationRecord
has_many :batch_line_item
def self.create_batch(created_by,date,order_ref, card_qty,user_id)
batch = Batch.new
batch.created_by = created_by
batch.order_ref = order_ref
batch.date = date
batch.batch_start = true
batch.batch_start_time=DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
batch.qty_processing = card_qty.to_i
batch.qty_success = 0
batch.qty_fail = 0
batch.user_id=user_id
batch.export_count=0
if batch.save
return batch
else
return nil
end
end
end

View File

@@ -0,0 +1,89 @@
class BatchLineItem < ApplicationRecord
belongs_to :batch
attr_accessor :wristband_token
def self.generate_account_no
super_merchant = "101"
account_type='1'
location='101'
o = [('0'..'9')].map { |i| i.to_a }.flatten
random_account_no = (0...9).map { o[rand(o.length)] }.join
account_no = super_merchant+account_type+location+random_account_no
find_account_no = BatchLineItem.find_by_wristband_code(account_no)
if !find_account_no.nil?
o = [('0'..'9')].map { |i| i.to_a }.flatten
random_account_no = (0...9).map { o[rand(o.length)] }.join
account_no = super_merchant+account_type+location+random_account_no
end
return account_no
end
def self.generate_serial_no(user_id)
find_lookup=Lookup.find_by_name('generate_serial_no')
if !find_lookup.nil?
max_value=find_lookup.max_value
max_value=max_value +1
prefix=find_lookup.prefix
max_length=find_lookup.max_length
sufix_len=max_length-prefix.length
sufix_str="0" * sufix_len
value_len= max_value.to_s.length
start=0
ends=sufix_len-value_len-1
sufix_str= sufix_str[start..ends]
prefix=prefix[start..2]
prefix_str=prefix.to_s + user_id.to_s
serial_no=prefix_str.to_s+sufix_str+max_value.to_s
return serial_no
end
end
def self.to_csv(user_id)
encrypt_key=""
find_user=User.find_by_id(user_id)
if !find_user.nil?
encrypt_key=find_user.secrect_key
end
attributes = %w{serial_no wristband_code batch_id manufacture_uid card_type wristband_token}
CSV.generate(headers: true) do |csv|
csv << attributes
all.each do |encoder|
str="manufacture_uid="+encoder.manufacture_uid.to_s+"&serial_no="+encoder.serial_no.to_s
encryptd_data=BatchLineItem.encrypted(str,encrypt_key)
encoder.wristband_token=encryptd_data
csv << attributes.map{ |attr| encoder.send(attr)}
end
end
end
def self.encrypted(message,encrypt_key)
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
cipher.encrypt
key = Digest::SHA1.hexdigest(encrypt_key)
iv =encrypt_key
cipher.key = encrypt_key
cipher.iv = encrypt_key
encrypted = cipher.update(message)
encrypted << cipher.final
encrypted=Base64.encode64(encrypted)
return encrypted
end
# def self.encrypted(data,encrypt_key)
# crypt = ActiveSupport::MessageEncryptor.new(encrypt_key)
# encrypted_data = crypt.encrypt_and_sign(data)
# encrypted_data=Digest::MD5.hexdigest(encrypted_data)
# data=encrypted_data.hex
# data=data.to_s
# return data[0..15]
# end
end

2
app/models/lookup.rb Normal file
View File

@@ -0,0 +1,2 @@
class Lookup < ApplicationRecord
end

21
app/models/member.rb Normal file
View File

@@ -0,0 +1,21 @@
class Member < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
belongs_to :user,optional: true
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,:uid, :confirmable, :lockable
def self.authenticate_session_token(token)
if token.nil? || token.blank? || token.to_s == ' '
return false
else
mem = Member.find_by_session_token(token)
if mem.nil?
return false
else
return mem
end
end
end
end

4
app/models/user.rb Normal file
View File

@@ -0,0 +1,4 @@
class User < ApplicationRecord
has_many :members
validates :name, presence: { message: "Please enter name." }
end

BIN
app/views/.DS_Store vendored Normal file

Binary file not shown.

BIN
app/views/api/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,7 @@
if @out[0] == true
json.set! :status, @out[0]
json.set! :data, @out[1]
else
json.set! :status, @out[0]
json.set! :message,@out[1]
end

View File

@@ -0,0 +1,7 @@
if (@user)
json.status true
json.extract! @user, :id
else
json.status false
json.message "Logout Failed."
end

View File

@@ -0,0 +1,8 @@
if @out[0] == true
json.set! :status, @out[0]
json.set! :serial_no, @out[1]
json.set! :wristband_code, @out[2]
else
json.set! :status, @out[0]
json.set! :message,@out[1]
end

View File

@@ -0,0 +1,2 @@
json.set! :status, @out[0]
json.set! :message,@out[1]

View File

@@ -0,0 +1,7 @@
if @out[0] == true
json.set! :status, @out[0]
json.set! :data, @out[1]
else
json.set! :status, @out[0]
json.set! :message,@out[1]
end

View File

@@ -0,0 +1,7 @@
if @out[0] == true
json.set! :status, @out[0]
json.set! :data, @out[1]
else
json.set! :status, @out[0]
json.set! :message,@out[1]
end

View File

@@ -0,0 +1,7 @@
if @out[0] == true
json.set! :status, @out[0]
json.set! :data, @out[1]
else
json.set! :status, @out[0]
json.set! :message,@out[1]
end

View File

@@ -0,0 +1,66 @@
<div class="row ">
<nav class="breadcrumb">
<a class="breadcrumb-item active" href="<%= dashboard_path %>">Home</a>
<a class="breadcrumb-item active" href="#">Batch Line Item List</a>
</nav>
</div>
<div class="row top-content">
<%= form_tag export_path(:format => :csv),:method => :post do%>
<div class="col-lg-7">
</div>
<div class="col-lg-5">
<label><strong>Choose Batch:</strong></label>
<select class='selectpicker' id='batch' name='batch[]' multiple= "multiple" >
<% @batches.each do |batch| %>
<option value="<%= batch.id %>"><%= batch.order_ref %></option>
<% end %>
</select>
&nbsp; &nbsp;
<%= button_tag "Export CSV",:class =>'btn btn-primary btn-sm',:id =>"btnexport" %>
</div>
<% end %>
</div>
<div class="row content">
<div class="card">
<div class="card-header">
<strong>Batch Line Item List</strong>
</div>
<div class="card-block">
<table class="table" style="border-top:none">
<thead>
<tr>
<th>Serail No</th>
<th>Wristband Code</th>
<th>Manufacture UID</th>
<th>Batch No</th>
<th>Card Type</th>
<th>Created At </th>
<th>Update At </th>
</tr>
</thead>
<tbody>
<% @batchLineItems.each do |item| %>
<tr>
<td><%= item.serial_no rescue '' %></td>
<td><%= item.wristband_code rescue '' %></td>
<td><%= item.manufacture_uid rescue '' %></td>
<td><%= item.batch_name rescue '' %></td>
<td><%= item.card_type rescue '' %></td>
<td><%= item.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
<td><%= item.updated_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
</tr>
<% end %>
</tbody>
</table>
<%=paginate @batchLineItems %>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$('#batch').multiselect()
$("#batch").multiselect("refresh");
})
</script>

View File

@@ -0,0 +1,42 @@
<div class="row ">
<nav class="breadcrumb">
<a class="breadcrumb-item active" href="<%= dashboard_path %>">Home</a>
<a class="breadcrumb-item active" href="#">Batches</a>
</nav>
</div>
<div class="row content">
<div class="card">
<div class="card-header">
<strong>Batch List</strong>
</div>
<div class="card-block">
<table class="table" style="border-top:none">
<thead>
<tr>
<th>Order Ref</th>
<th>Created By</th>
<th>Qty Processing</th>
<th>Qty Success</th>
<th>Qty Fail</th>
<th>Export Count</th>
<th>Creatd At</th>
</tr>
</thead>
<tbody>
<% @batches.each do |batch| %>
<tr>
<td><%= batch.order_ref rescue '' %></td>
<td><%= batch.created_by rescue '' %></td>
<td><%= batch.qty_processing rescue '' %></td>
<td><%= batch.qty_success rescue '' %></td>
<td><%= batch.qty_fail rescue '' %></td>
<td><%= batch.export_count %></td>
<td><%= batch.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @batches %>
</div>
</div>
</div>

View File

@@ -0,0 +1,17 @@
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
<%= devise_error_messages! %>
<div class="col-md-3"></div>
<div class="col-md-6" >
<h4>Resend confirmation instructions</h4>
<div class="form-group">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email),:class =>"form-control" %>
</div>
<div class="actions">
<%= f.submit "Resend confirmation instructions" ,:class=> "btn btn-lg btn-primary btn-block"%>
</div>
<%= render "devise/shared/links" %>
</div>
<% end %>

View File

@@ -0,0 +1,5 @@
<p>Welcome <%= @email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>

View File

@@ -0,0 +1,3 @@
<p>Hello <%= @resource.email %>!</p>
<p>We're contacting you to notify you that your password has been changed.</p>

View File

@@ -0,0 +1,8 @@
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

View File

@@ -0,0 +1,7 @@
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>

View File

@@ -0,0 +1,25 @@
<h2>Change your password</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %>
<%= f.hidden_field :reset_password_token %>
<div class="field">
<%= f.label :password, "New password" %><br />
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
<% end %>
<%= f.password_field :password, autofocus: true, autocomplete: "off" %>
</div>
<div class="field">
<%= f.label :password_confirmation, "Confirm new password" %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>
<div class="actions">
<%= f.submit "Change my password" %>
</div>
<% end %>
<%= render "devise/shared/links" %>

View File

@@ -0,0 +1,18 @@
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= devise_error_messages! %>
<div class="col-md-3"></div>
<div class="col-md-6" >
<h4>Forgot your password?</h4>
<div class="form-group">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true,:class =>"form-control" %>
</div>
<div class="actions">
<%= f.submit "Send me reset password instructions" ,:class=> "btn btn-lg btn-primary btn-block"%>
</div>
<%= render "devise/shared/links" %>
</div>
<% end %>

View File

@@ -0,0 +1,43 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
</div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
<div class="field">
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password, autocomplete: "off" %>
<% if @minimum_password_length %>
<br />
<em><%= @minimum_password_length %> characters minimum</em>
<% end %>
</div>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>
<div class="field">
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
<%= f.password_field :current_password, autocomplete: "off" %>
</div>
<div class="actions">
<%= f.submit "Update" %>
</div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
<%= link_to "Back", :back %>

View File

@@ -0,0 +1,28 @@
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div class="col-md-3"></div>
<div class="col-md-6" >
<h4>Sign up</h4>
<div class="form-group">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true,:class =>"form-control" %>
</div>
<div class="form-group">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %><br />
<%= f.password_field :password, autocomplete: "off" ,:class =>"form-control" %>
</div>
<div class="form-group">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "off",:class =>"form-control" %>
</div>
<div class="actions">
<%= f.submit "Sign up" ,:class=> "btn btn-lg btn-primary btn-block"%>
</div>
<%= render "devise/shared/links" %>
</div>
<% end %>

View File

@@ -0,0 +1,28 @@
<div class="content">
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="col-md-3"></div>
<div class="col-md-6" >
<h4>Log in</h4>
<div class ="form-group" >
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true ,:class =>"form-control" %>
</div>
<div class ="form-group" >
<%= f.label :password %><br />
<%= f.password_field :password, autocomplete: "off" ,:class=>"form-control" %>
</div>
<% if devise_mapping.rememberable? -%>
<div class ="form-group" >
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<% end -%>
<div class="actions">
<%= f.submit "Log in" ,:class=> "btn btn-lg btn-primary btn-block"%>
</div>
<%= render "devise/shared/links" %>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,25 @@
<%- if controller_name != 'sessions' %>
<%= link_to "Log in", new_session_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
<% end -%>
<% end -%>

View File

@@ -0,0 +1,16 @@
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
<%= devise_error_messages! %>
<div class="col-md-3"></div>
<div class="col-md-6">
<h4>Resend unlock instructions</h4>
<div class="form-group">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true ,:class =>"form-control"%>
</div>
<div class="actions">
<%= f.submit "Resend unlock instructions",:class=> "btn btn-lg btn-primary btn-block" %>
</div>
<%= render "devise/shared/links" %>
</div>
<% end %>

View File

@@ -0,0 +1,34 @@
<div class="row content">
<div class="card">
<div class="card-header">
<strong>User List</strong>
</div>
<div class="card-block">
<table class="table" style="border-top:none">
<thead>
<tr>
<th>Name</th>
<th>Nrc</th>
<th>Email</th>
<th>Phone</th>
<th>Address</th>
<th>Status</th>
<th>Created At </th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.name rescue '' %></td>
<td><%= user.nrc rescue '' %></td>
<td><%= user.email rescue '' %></td>
<td><%= user.phone rescue '' %></td>
<td><%= user.address rescue '' %></td>
<td><%= user.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,35 @@
<nav class="navbar navbar-dark navbar-fixed-top" style="background:#1E90FF">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="/">Nemo Encoder</a>
</div>
<% if member_signed_in? %>
<ul class="nav navbar-nav">
<li class="nav-item">
<%= link_to "Home", dashboard_path, :class => "nav-link" %>
</li>
<li class="nav-item">
<%= link_to "Batches",batches_path, :class => "nav-link" %>
</li>
<li class="nav-item">
<%= link_to "Issued Batch Item",batch_line_items_path, :class => "nav-link" %>
</li>
<li class="nav-item">
<%= link_to "User",users_path, :class => "nav-link" %>
</li>
</ul>
<div class="float-xs-right">
<ul class="nav navbar-nav right">
<li class="nav-item"><%= link_to "Logout", destroy_member_session_path, :tabindex =>"-1", :class => "nav-link", :method => :delete %></li>
</ul>
</div>
<% else %>
<div class="float-xs-right">
<ul class="nav navbar-nav right">
<li class="nav-item"><%= link_to "Login", new_member_session_path, :tabindex =>"-1", :class => "nav-link" %>
</li>
</ul>
</div>
<% end %>
</div>
</nav>

View File

@@ -0,0 +1,130 @@
<%= simple_form_for(@user) do |f| %>
<nav class="breadcrumb">
<a class="breadcrumb-item" href="<%= dashboard_path %>">Home</a>
<a class="breadcrumb-item active" href="<%= users_path %>">User</a>
<a class="breadcrumb-item active" href="#">
<% if !@user.id.nil? %>
Edit
<% else %>
New
<% end %>
</a>
</nav>
<div class="content">
<% if @user.id.nil? %>
<div class="row">
<div class="col-md-5" >
<div class="form-group">
<label for="email" class="string optional control-label">Registered Email:</label>
<input type="text" id="registered_email" name="registered_email" class="form-control" placeholder="Please enter member mail">
</div>
</div>
<div class="col-md-1">
<label for="email" class="string optional control-label"> &nbsp;&nbsp;&nbsp;</label>
<button type="button" class="btn btn-primary" style="float:right;" id="check_email" >Check</button>
</div>
</div>
<% end %>
<div class="row">
<div class="col-md-6" id="textbox_group">
<div class ="form-group" >
<label for="name" class="string optional control-label">Name:</label>
<%= f.input :name ,:label =>false,:error => false,:placeholder =>'Please enter user name',input_html: { class: "form-control" } %>
<%= f.error :name ,style: 'color: red' %>
</div>
<div class ="form-group" >
<label for="nrc" class="string optional control-label">NRC:</label>
<%= f.input :nrc ,:error=>false,:label =>false,:placeholder =>'Please enter user NRC',input_html: { class: "form-control" } %>
</div>
<div class ="form-group" >
<label for="email" class="string optional control-label">Email:</label>
<%= f.input :email ,:error=>false,:label =>false ,:placeholder =>'Please enter user email',input_html: { class: "form-control" } %>
</div>
<div class ="form-group" >
<label for="phone" class="string optional control-label">Phone:</label>
<%= f.input :phone,:error=>false,:label =>false,:placeholder =>'Please enter user phone',input_html: { class: "form-control" } %>
</div>
<div class ="form-group" >
<label for="address" class="string optional control-label">Address:</label>
<%= f.input :address,:error=>false,:label =>false,:placeholder =>'Please enter user address',input_html: { class: "form-control" } %>
</div>
<div class ="form-group" >
<label for="secret_key" class="string optional control-label">Secrect Key:</label>
<%= f.input :secrect_key,:error=>false,:label =>false,:placeholder =>'Please enter user secret key',input_html: { class: "form-control" } %>
</div>
<% if !@user.id.nil? %>
<div class ="form-group" >
<label for="is_active" class="string optional control-label">Active:</label>
<%= f.check_box :is_active %>
</div>
<% end %>
<div class ="form-group" >
<label></label>
<div class="actions">
<%= f.button :submit, :class => 'btn btn-primary',:id =>'btn_submit' %>
<%= link_to 'Cancel', users_path ,:class => 'btn btn-primary',:id => 'btnback' %>
</div>
</div>
</div>
</div>
</div>
<% end %>
<script >
$(document).ready(function() {
status='disabled'
name=$("#user_name").val()
if (name.trim() !=""){
status=''
}
enable_control(status)
$("#check_email").click(function(){
registered_email = $("#registered_email").val();
$.ajax({
type:'get',
url: '<%= check_registered_email_path %>',
data:'registered_email='+ registered_email ,
success:function(result){
// $("#show-data").html('')
if (result.status == 'true'){
enable_control(false)
}
else
{
if (result.data === null){
enable_control(true)
}
else
{
$(result.data).each(function(i){
name = result.data.name
nrc =result.data.nrc
phone =result.data.phone
address =result.data.address
email = result.data.email
$("#user_name").val(name)
$("#user_email").val(email)
$("#user_nrc").val(nrc)
$("#user_phone").val(email)
$("#user_address").val(address)
$("#btn_submit").hide()
});
}
}
}
});
});
function enable_control(status){
$("#user_name").prop('disabled',status);
$("#user_email").prop('disabled',status);
$("#user_nrc").prop('disabled',status);
$("#user_phone").prop('disabled',status);
$("#user_address").prop('disabled',status);
$("#btn_submit").prop('disabled',status)
}
})
</script>

View File

@@ -0,0 +1,2 @@
json.extract! user, :id, :created_at, :updated_at
json.url user_url(user, format: :json)

View File

@@ -0,0 +1 @@
<%= render 'form' %>

View File

@@ -0,0 +1,54 @@
<div class="row ">
<nav class="breadcrumb">
<a class="breadcrumb-item active" href="<%= dashboard_path %>">Home</a>
<a class="breadcrumb-item active" href="#">Users</a>
</nav>
</div>
<div class="row top-content">
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_user_path,:class => 'btn btn-primary' %>
</span>
</div>
<div class="row content">
<div class="card">
<div class="card-header">
<strong>User List</strong>
</div>
<div class="card-block">
<table class="table" style="border-top:none">
<thead>
<tr>
<th>Name</th>
<th>Nrc</th>
<th>Email</th>
<th>Phone</th>
<th>Address</th>
<th>Status</th>
<th>Created At </th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.name rescue '' %></td>
<td><%= user.nrc rescue '' %></td>
<td><%= user.email rescue '' %></td>
<td><%= user.phone rescue '' %></td>
<td><%= user.address rescue '' %></td>
<td><%= user.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
<td>
<%= link_to 'Detail',
user_path(user), :class => 'btn btn-primary btn-sm' %>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_user_path(user), :class => 'btn btn-primary btn-sm' %>
<%= link_to 'Delete', user_path(user), method: :delete, data: { confirm: 'Are you sure?' },:class => 'btn btn-primary btn-sm' %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%=paginate @users %>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.array! @users, partial: 'users/user', as: :user

View File

@@ -0,0 +1 @@
<%= render 'form' %>

View File

@@ -0,0 +1,51 @@
<div class="row">
<nav class="breadcrumb">
<a class="breadcrumb-item" href="<%= dashboard_path %>">Home</a>
<a class="breadcrumb-item active" href="<%= users_path %>">Users</a>
<a class="breadcrumb-item active" href="#">Show</a>
</nav>
</div>
<div class="row content">
<div class="col-lg-6 show">
<div class="row">
<div class="col-lg-4"><strong>Name:</strong></div>
<div class="col-lg-8 uppercase"><%= @user.name %></div>
</div>
<div class="row">
<div class="col-lg-4"><strong>NRC:</strong></div>
<div class="col-lg-8"><%= @user.nrc %></div>
</div>
<div class="row">
<div class="col-lg-4"><strong>Email:</strong></div>
<div class="col-lg-8"><%= @user.email %></div>
</div>
<div class="row">
<div class="col-lg-4"><strong>Phone:</strong></div>
<div class="col-lg-8"><%= @user.phone %></div>
</div>
<div class="row">
<div class="col-lg-4"><strong>Address:</strong></div>
<div class="col-lg-8"><%= @user.address %></div>
</div>
<div class="row">
<div class="col-lg-4"><strong>Active:</strong></div>
<div class="col-lg-8">
<% if @user.is_active %>
<input type="checkbox" checked disabled="true" />
<% else %>
<input type="checkbox" disabled="true"/>
<% end %>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div class="col-lg-3"></div>
<div class="col-lg-4 btn-show-action">
<%= link_to 'Edit', edit_user_path(@user),:class => 'btn btn-primary' %>
<%= link_to 'Back', users_path ,:class => 'btn btn-primary'%>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "users/user", user: @user

15
config/config.yml Normal file
View File

@@ -0,0 +1,15 @@
defaults: &DEFAULTS
private_key:"-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAulhJXaxNsJdwoRWuKqAunpIHs7NxjgMlWoNAqc2pnmXGrn2Z\n050CCOt+YkCCvvPE2Wle6T0xFF1keV+QkhlvBwXNYfnFdSZnJd61S4U4q1jqnEO3\ncYalZNU/jZF/+pFSPKiYJQaiew1kC/MjDdmn2M83KNJAcrr6WDKvHeYBlesm/xcS\nflm0eKQWzJrtpFluHkzoJw/xsVXdjiNOpS/tAj6pmVqfVQHDVSuLlStJRGeXgU+A\nDftTQDCwD+YJO+HCzWm8tWd0p0Fx+AZvkMjLKT3E85z0pp6C6sH9cRlnt1Lq9W1Q\nyd8xflNKNkHA5aQGxJG44qXPDjr5vPl2poh1aQIDAQABAoIBAFrG44akh3w9afqv\nCxdszQkmbmYWRn09/xZm1jtiGv0062LZgPRbikA6KGlIr+jB6+VVtYy96IjZLjcK\nXO0vQq0TIIhYGt8FBD6ojXzquz6NpEzXmCfPxgam87zNYqD35i3ym5t97e0wCsrf\nePYoT+IIoABc3FSHzajll/VitOcIv8XurxfvvBpfqMf9Uoh13QEkkK0GgixIJMXq\nA1ZDjgRUasiWFe3HoXSkk1O23+mJvz76DOVbPCnEmbWwyrgDaMCRcjQ8+VOKE8Zx\nHZm9mODLqP0d0taK67aswPHRLkMxLN5yfkBTTx8IGiTPk8xt40TjoepYorywx5Rn\nofMBebkCgYEA6T5GljCINemBrgSxlYgiO9Hig9wa088qrVvXbQbLVtSj/QXmhkC/\n0dSKINObnIoUhsNQqigZXoxVXMVzunhJt4/6WlVQiD65befMQXQvuO3wLiMEBDWu\nLxSomG0Rmq0tp0xG99LUCNRx76qSoCUAJgY7Gn9OI+Qfos7d4KZaVScCgYEAzIag\n0KuMaAKWWSGrlMe+vwgqSwFvGep9Sij4+cCXxlajvgAQ0wOhc0nU4VkYErhrNgGt\nduIMeVpxoQ1jqZuQd+AZAJmKfX3hpxOB+lIzR2Q1mXBN4tKfYuHh+TW6eC82Nwrm\npIJYYcC9RuB5cmnNRaSC7DdZKttux0KpXfIrGu8CgYEApDIrDt/rg8h2ekLjoRjM\nwL/oblssp59Xs+LLrPzzeJUJPL5CopBCeTzeYG2XRoQOHzCwQJkqAt1X2o9GASdc\n/dRlseINZ1yAvVZI/GsGjXEze8c6tJv1mz830NY3ZmQzl2qjKyNIEU89RjMWNZbW\nm+4W/XhRUgLuInbuy49QWFECgYBL0BeqYfygzVy322BDvSr6muc6eGSbga1BoSBx\nS6+26IS3uESEQ5NELfkIM0NWJSAwm7yWFcKz9Q+ruE/aHf0WQm5iJ4gLbm8HxJZo\nmLHDY+TuZI+qZZKJT9u4ye6+ABojmxnVny9txMkkja7W91sM1qdlMjsORNqyaAZp\n+Yt65wKBgGoFSIzcqMJIbbsW5y92q02HTNzgVR0oCAdblmhymo1tIFYzyke39G1z\na+/ZE0JvJs0pKXD3ibvPnsfxP3mdO8eQJEGw80W9RyjBKfAM/S6KpYGvdPd8Tizo\nS+Chzm3vd4TuBoPwAxCfa95qvmYh9hTsnEVRM7tYnBhaQSx3q9UJ\n-----END RSA PRIVATE KEY-----\n"
development:
smartpay_provision_url: http://192.168.1.146:3000
private_key: "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAulhJXaxNsJdwoRWuKqAunpIHs7NxjgMlWoNAqc2pnmXGrn2Z\n050CCOt+YkCCvvPE2Wle6T0xFF1keV+QkhlvBwXNYfnFdSZnJd61S4U4q1jqnEO3\ncYalZNU/jZF/+pFSPKiYJQaiew1kC/MjDdmn2M83KNJAcrr6WDKvHeYBlesm/xcS\nflm0eKQWzJrtpFluHkzoJw/xsVXdjiNOpS/tAj6pmVqfVQHDVSuLlStJRGeXgU+A\nDftTQDCwD+YJO+HCzWm8tWd0p0Fx+AZvkMjLKT3E85z0pp6C6sH9cRlnt1Lq9W1Q\nyd8xflNKNkHA5aQGxJG44qXPDjr5vPl2poh1aQIDAQABAoIBAFrG44akh3w9afqv\nCxdszQkmbmYWRn09/xZm1jtiGv0062LZgPRbikA6KGlIr+jB6+VVtYy96IjZLjcK\nXO0vQq0TIIhYGt8FBD6ojXzquz6NpEzXmCfPxgam87zNYqD35i3ym5t97e0wCsrf\nePYoT+IIoABc3FSHzajll/VitOcIv8XurxfvvBpfqMf9Uoh13QEkkK0GgixIJMXq\nA1ZDjgRUasiWFe3HoXSkk1O23+mJvz76DOVbPCnEmbWwyrgDaMCRcjQ8+VOKE8Zx\nHZm9mODLqP0d0taK67aswPHRLkMxLN5yfkBTTx8IGiTPk8xt40TjoepYorywx5Rn\nofMBebkCgYEA6T5GljCINemBrgSxlYgiO9Hig9wa088qrVvXbQbLVtSj/QXmhkC/\n0dSKINObnIoUhsNQqigZXoxVXMVzunhJt4/6WlVQiD65befMQXQvuO3wLiMEBDWu\nLxSomG0Rmq0tp0xG99LUCNRx76qSoCUAJgY7Gn9OI+Qfos7d4KZaVScCgYEAzIag\n0KuMaAKWWSGrlMe+vwgqSwFvGep9Sij4+cCXxlajvgAQ0wOhc0nU4VkYErhrNgGt\nduIMeVpxoQ1jqZuQd+AZAJmKfX3hpxOB+lIzR2Q1mXBN4tKfYuHh+TW6eC82Nwrm\npIJYYcC9RuB5cmnNRaSC7DdZKttux0KpXfIrGu8CgYEApDIrDt/rg8h2ekLjoRjM\nwL/oblssp59Xs+LLrPzzeJUJPL5CopBCeTzeYG2XRoQOHzCwQJkqAt1X2o9GASdc\n/dRlseINZ1yAvVZI/GsGjXEze8c6tJv1mz830NY3ZmQzl2qjKyNIEU89RjMWNZbW\nm+4W/XhRUgLuInbuy49QWFECgYBL0BeqYfygzVy322BDvSr6muc6eGSbga1BoSBx\nS6+26IS3uESEQ5NELfkIM0NWJSAwm7yWFcKz9Q+ruE/aHf0WQm5iJ4gLbm8HxJZo\nmLHDY+TuZI+qZZKJT9u4ye6+ABojmxnVny9txMkkja7W91sM1qdlMjsORNqyaAZp\n+Yt65wKBgGoFSIzcqMJIbbsW5y92q02HTNzgVR0oCAdblmhymo1tIFYzyke39G1z\na+/ZE0JvJs0pKXD3ibvPnsfxP3mdO8eQJEGw80W9RyjBKfAM/S6KpYGvdPd8Tizo\nS+Chzm3vd4TuBoPwAxCfa95qvmYh9hTsnEVRM7tYnBhaQSx3q9UJ\n-----END RSA PRIVATE KEY-----\n"
test:
private_key: "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAulhJXaxNsJdwoRWuKqAunpIHs7NxjgMlWoNAqc2pnmXGrn2Z\n050CCOt+YkCCvvPE2Wle6T0xFF1keV+QkhlvBwXNYfnFdSZnJd61S4U4q1jqnEO3\ncYalZNU/jZF/+pFSPKiYJQaiew1kC/MjDdmn2M83KNJAcrr6WDKvHeYBlesm/xcS\nflm0eKQWzJrtpFluHkzoJw/xsVXdjiNOpS/tAj6pmVqfVQHDVSuLlStJRGeXgU+A\nDftTQDCwD+YJO+HCzWm8tWd0p0Fx+AZvkMjLKT3E85z0pp6C6sH9cRlnt1Lq9W1Q\nyd8xflNKNkHA5aQGxJG44qXPDjr5vPl2poh1aQIDAQABAoIBAFrG44akh3w9afqv\nCxdszQkmbmYWRn09/xZm1jtiGv0062LZgPRbikA6KGlIr+jB6+VVtYy96IjZLjcK\nXO0vQq0TIIhYGt8FBD6ojXzquz6NpEzXmCfPxgam87zNYqD35i3ym5t97e0wCsrf\nePYoT+IIoABc3FSHzajll/VitOcIv8XurxfvvBpfqMf9Uoh13QEkkK0GgixIJMXq\nA1ZDjgRUasiWFe3HoXSkk1O23+mJvz76DOVbPCnEmbWwyrgDaMCRcjQ8+VOKE8Zx\nHZm9mODLqP0d0taK67aswPHRLkMxLN5yfkBTTx8IGiTPk8xt40TjoepYorywx5Rn\nofMBebkCgYEA6T5GljCINemBrgSxlYgiO9Hig9wa088qrVvXbQbLVtSj/QXmhkC/\n0dSKINObnIoUhsNQqigZXoxVXMVzunhJt4/6WlVQiD65befMQXQvuO3wLiMEBDWu\nLxSomG0Rmq0tp0xG99LUCNRx76qSoCUAJgY7Gn9OI+Qfos7d4KZaVScCgYEAzIag\n0KuMaAKWWSGrlMe+vwgqSwFvGep9Sij4+cCXxlajvgAQ0wOhc0nU4VkYErhrNgGt\nduIMeVpxoQ1jqZuQd+AZAJmKfX3hpxOB+lIzR2Q1mXBN4tKfYuHh+TW6eC82Nwrm\npIJYYcC9RuB5cmnNRaSC7DdZKttux0KpXfIrGu8CgYEApDIrDt/rg8h2ekLjoRjM\nwL/oblssp59Xs+LLrPzzeJUJPL5CopBCeTzeYG2XRoQOHzCwQJkqAt1X2o9GASdc\n/dRlseINZ1yAvVZI/GsGjXEze8c6tJv1mz830NY3ZmQzl2qjKyNIEU89RjMWNZbW\nm+4W/XhRUgLuInbuy49QWFECgYBL0BeqYfygzVy322BDvSr6muc6eGSbga1BoSBx\nS6+26IS3uESEQ5NELfkIM0NWJSAwm7yWFcKz9Q+ruE/aHf0WQm5iJ4gLbm8HxJZo\nmLHDY+TuZI+qZZKJT9u4ye6+ABojmxnVny9txMkkja7W91sM1qdlMjsORNqyaAZp\n+Yt65wKBgGoFSIzcqMJIbbsW5y92q02HTNzgVR0oCAdblmhymo1tIFYzyke39G1z\na+/ZE0JvJs0pKXD3ibvPnsfxP3mdO8eQJEGw80W9RyjBKfAM/S6KpYGvdPd8Tizo\nS+Chzm3vd4TuBoPwAxCfa95qvmYh9hTsnEVRM7tYnBhaQSx3q9UJ\n-----END RSA PRIVATE KEY-----\n"
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
private_key: "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAulhJXaxNsJdwoRWuKqAunpIHs7NxjgMlWoNAqc2pnmXGrn2Z\n050CCOt+YkCCvvPE2Wle6T0xFF1keV+QkhlvBwXNYfnFdSZnJd61S4U4q1jqnEO3\ncYalZNU/jZF/+pFSPKiYJQaiew1kC/MjDdmn2M83KNJAcrr6WDKvHeYBlesm/xcS\nflm0eKQWzJrtpFluHkzoJw/xsVXdjiNOpS/tAj6pmVqfVQHDVSuLlStJRGeXgU+A\nDftTQDCwD+YJO+HCzWm8tWd0p0Fx+AZvkMjLKT3E85z0pp6C6sH9cRlnt1Lq9W1Q\nyd8xflNKNkHA5aQGxJG44qXPDjr5vPl2poh1aQIDAQABAoIBAFrG44akh3w9afqv\nCxdszQkmbmYWRn09/xZm1jtiGv0062LZgPRbikA6KGlIr+jB6+VVtYy96IjZLjcK\nXO0vQq0TIIhYGt8FBD6ojXzquz6NpEzXmCfPxgam87zNYqD35i3ym5t97e0wCsrf\nePYoT+IIoABc3FSHzajll/VitOcIv8XurxfvvBpfqMf9Uoh13QEkkK0GgixIJMXq\nA1ZDjgRUasiWFe3HoXSkk1O23+mJvz76DOVbPCnEmbWwyrgDaMCRcjQ8+VOKE8Zx\nHZm9mODLqP0d0taK67aswPHRLkMxLN5yfkBTTx8IGiTPk8xt40TjoepYorywx5Rn\nofMBebkCgYEA6T5GljCINemBrgSxlYgiO9Hig9wa088qrVvXbQbLVtSj/QXmhkC/\n0dSKINObnIoUhsNQqigZXoxVXMVzunhJt4/6WlVQiD65befMQXQvuO3wLiMEBDWu\nLxSomG0Rmq0tp0xG99LUCNRx76qSoCUAJgY7Gn9OI+Qfos7d4KZaVScCgYEAzIag\n0KuMaAKWWSGrlMe+vwgqSwFvGep9Sij4+cCXxlajvgAQ0wOhc0nU4VkYErhrNgGt\nduIMeVpxoQ1jqZuQd+AZAJmKfX3hpxOB+lIzR2Q1mXBN4tKfYuHh+TW6eC82Nwrm\npIJYYcC9RuB5cmnNRaSC7DdZKttux0KpXfIrGu8CgYEApDIrDt/rg8h2ekLjoRjM\nwL/oblssp59Xs+LLrPzzeJUJPL5CopBCeTzeYG2XRoQOHzCwQJkqAt1X2o9GASdc\n/dRlseINZ1yAvVZI/GsGjXEze8c6tJv1mz830NY3ZmQzl2qjKyNIEU89RjMWNZbW\nm+4W/XhRUgLuInbuy49QWFECgYBL0BeqYfygzVy322BDvSr6muc6eGSbga1BoSBx\nS6+26IS3uESEQ5NELfkIM0NWJSAwm7yWFcKz9Q+ruE/aHf0WQm5iJ4gLbm8HxJZo\nmLHDY+TuZI+qZZKJT9u4ye6+ABojmxnVny9txMkkja7W91sM1qdlMjsORNqyaAZp\n+Yt65wKBgGoFSIzcqMJIbbsW5y92q02HTNzgVR0oCAdblmhymo1tIFYzyke39G1z\na+/ZE0JvJs0pKXD3ibvPnsfxP3mdO8eQJEGw80W9RyjBKfAM/S6KpYGvdPd8Tizo\nS+Chzm3vd4TuBoPwAxCfa95qvmYh9hTsnEVRM7tYnBhaQSx3q9UJ\n-----END RSA PRIVATE KEY-----\n"
# e3db7e59ca27d8d0119a - hledan
# 394e11b1b04037611fe3 - hagl

View File

@@ -0,0 +1,274 @@
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` as its `secret_key`
# by default. You can change it below and use your own secret key.
# config.secret_key = '46dbd53ef9c48f17f50e9bfb517d1df18a71598fd5f69247a6a7e6a74b3255bdf55f92eccf247b1848fa7734033ae939757d341ea5dd159c7f688459ceefea64'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
# Configure the parent class responsible to send e-mails.
# config.parent_mailer = 'ActionMailer::Base'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require 'devise/orm/active_record'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
# config.authentication_keys = [:email]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
# find_for_authentication method and considered in your model lookup. For instance,
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
# The same considerations mentioned for authentication_keys also apply to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [:email]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [:email]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
# given strategies, for example, `config.params_authenticatable = [:database]` will
# enable it only for database (email + password) authentication.
# config.params_authenticatable = true
# Tell if authentication through HTTP Auth is enabled. False by default.
# It can be set to an array that will enable http authentication only for the
# given strategies, for example, `config.http_authenticatable = [:database]` will
# enable it only for database authentication. The supported strategies are:
# :database = Support basic authentication with authentication key + password
# config.http_authenticatable = false
# If 401 status code should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication. 'Application' by default.
# config.http_authentication_realm = 'Application'
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# config.paranoid = true
# By default Devise will store the user in session. You can skip storage for
# particular strategies by setting this option.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing skip: :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
# By default, Devise cleans up the CSRF token on authentication to
# avoid CSRF token fixation attacks. This means that, when using AJAX
# requests for sign in and sign up, you need to get a new CSRF token
# from the server. You can disable this option at your own risk.
# config.clean_up_csrf_token_on_authentication = true
# When false, Devise will not attempt to reload routes on eager load.
# This can reduce the time taken to boot the app but if your application
# requires the Devise mappings to be loaded during boot time the application
# won't boot properly.
# config.reload_routes = true
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
# using other algorithms, it sets how many times you want the password to be hashed.
#
# Limiting the stretches to just one in testing will increase the performance of
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
# a value less than 10 in other environments. Note that, for bcrypt (the default
# algorithm), the cost increases exponentially with the number of stretches (e.g.
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
config.stretches = Rails.env.test? ? 1 : 11
# Set up a pepper to generate the hashed password.
# config.pepper = '5fcdf20603ba0a69698497b8eed045ff1875f4ebf2efb4ed1b7388f4e12331db4233483782bce8c0aa8b36110a3bee372ca54aa3d4d688db5e2ffbf3277dbd78'
# Send a notification email when the user's password is changed
# config.send_password_change_notification = false
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming their account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming their account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming their account.
# config.allow_unconfirmed_access_for = 2.days
# A period that the user is allowed to confirm their account before their
# token becomes invalid. For example, if set to 3.days, the user can confirm
# their account within 3 days after the mail was sent, but on the fourth day
# their account can't be confirmed with the token any more.
# Default is nil, meaning there is no restriction on how long a user can take
# before confirming their account.
# config.confirm_within = 3.days
# If true, requires any email changes to be confirmed (exactly the same way as
# initial account confirmation) to be applied. Requires additional unconfirmed_email
# db field (see migrations). Until confirmed, new email is stored in
# unconfirmed_email column, and copied to email column on successful confirmation.
config.reconfirmable = true
# Defines which key will be used when confirming an account
# config.confirmation_keys = [:email]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# Invalidates all the remember me tokens when the user signs out.
config.expire_all_remember_me_on_sign_out = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
# secure: true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
# Range for password length.
config.password_length = 6..128
# Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
# config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account
# config.unlock_keys = [:email]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
# config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
# config.maximum_attempts = 20
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
# Warn on the last attempt before the account is locked.
# config.last_attempt_warning = true
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
# config.reset_password_keys = [:email]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
config.reset_password_within = 6.hours
# When set to false, does not sign a user in automatically after their password is
# reset. Defaults to true, so a user is signed in automatically after a reset.
# config.sign_in_after_reset_password = true
# ==> Configuration for :encryptable
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
# You can use :sha1, :sha512 or algorithms from others authentication tools as
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
# for default behavior) and :restful_authentication_sha1 (then you should set
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
#
# Require the `devise-encryptable` gem when using anything other than bcrypt
# config.encryptor = :sha512
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user).
# config.default_scope = :user
# Set this configuration to false if you want /users/sign_out to sign out
# only the current scope. By default, Devise signs out all scopes.
# config.sign_out_all_scopes = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
#
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists.
#
# The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ['*/*', :html]
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
# is mountable, there are some extra configurations to be taken into account.
# The following options are available, assuming the engine is mounted as:
#
# mount MyEngine, at: '/my_engine'
#
# The router that invoked `devise_for`, in the example above, would be:
# config.router_name = :my_engine
#
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
end

View File

@@ -0,0 +1,169 @@
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
# wrapper, change the order or even add your own to the
# stack. The options given below are used to wrap the
# whole input.
config.wrappers :default, class: :input,
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
# You can make any of these extensions optional by
# renaming `b.use` to `b.optional`.
# Determines whether to use HTML5 (:email, :url, ...)
# and required attributes
b.use :html5
# Calculates placeholders automatically from I18n
# You can also pass a string as f.input placeholder: "Placeholder"
b.use :placeholder
## Optional extensions
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
# to the input. If so, they will retrieve the values from the model
# if any exists. If you want to enable any of those
# extensions by default, you can change `b.optional` to `b.use`.
# Calculates maxlength from length validations for string inputs
# and/or database column lengths
b.optional :maxlength
# Calculate minlength from length validations for string inputs
b.optional :minlength
# Calculates pattern from format validations for string inputs
b.optional :pattern
# Calculates min and max from length validations for numeric inputs
b.optional :min_max
# Calculates readonly automatically from readonly attributes
b.optional :readonly
## Inputs
b.use :label_input
b.use :hint, wrap_with: { tag: :span, class: :hint }
b.use :error, wrap_with: { tag: :span, class: :error }
## full_messages_for
# If you want to display the full error message for the attribute, you can
# use the component :full_error, like:
#
# b.use :full_error, wrap_with: { tag: :span, class: :error }
end
# The default wrapper to be used by the FormBuilder.
config.default_wrapper = :default
# Define the way to render check boxes / radio buttons with labels.
# Defaults to :nested for bootstrap config.
# inline: input + label
# nested: label > input
config.boolean_style = :nested
# Default class for buttons
config.button_class = 'btn'
# Method used to tidy up errors. Specify any Rails Array method.
# :first lists the first message for each field.
# Use :to_sentence to list all errors for each field.
# config.error_method = :first
# Default tag used for error notification helper.
config.error_notification_tag = :div
# CSS class to add for error notification helper.
config.error_notification_class = 'error_notification'
# ID to add for error notification helper.
# config.error_notification_id = nil
# Series of attempts to detect a default label method for collection.
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
# Series of attempts to detect a default value method for collection.
# config.collection_value_methods = [ :id, :to_s ]
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
# config.collection_wrapper_tag = nil
# You can define the class to use on all collection wrappers. Defaulting to none.
# config.collection_wrapper_class = nil
# You can wrap each item in a collection of radio/check boxes with a tag,
# defaulting to :span.
# config.item_wrapper_tag = :span
# You can define a class to use in all item wrappers. Defaulting to none.
# config.item_wrapper_class = nil
# How the label text should be generated altogether with the required text.
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
# You can define the class to use on all labels. Default is nil.
# config.label_class = nil
# You can define the default class to be used on forms. Can be overriden
# with `html: { :class }`. Defaulting to none.
# config.default_form_class = nil
# You can define which elements should obtain additional classes
# config.generate_additional_classes_for = [:wrapper, :label, :input]
# Whether attributes are required by default (or not). Default is true.
# config.required_by_default = true
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
# These validations are enabled in SimpleForm's internal config but disabled by default
# in this configuration, which is recommended due to some quirks from different browsers.
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
# change this configuration to true.
config.browser_validations = false
# Collection of methods to detect if a file type was given.
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
# Custom mappings for input types. This should be a hash containing a regexp
# to match as key, and the input type that will be used when the field name
# matches the regexp as value.
# config.input_mappings = { /count/ => :integer }
# Custom wrappers for input types. This should be a hash containing an input
# type as key and the wrapper that will be used for all inputs with specified type.
# config.wrapper_mappings = { string: :prepend }
# Namespaces where SimpleForm should look for custom input classes that
# override default inputs.
# config.custom_inputs_namespaces << "CustomInputs"
# Default priority for time_zone inputs.
# config.time_zone_priority = nil
# Default priority for country inputs.
# config.country_priority = nil
# When false, do not use translations for labels.
# config.translate_labels = true
# Automatically discover new inputs in Rails' autoload path.
# config.inputs_discovery = true
# Cache SimpleForm inputs discovery
# config.cache_discovery = !Rails.env.development?
# Default class for inputs
# config.input_class = nil
# Define the default class of the input wrapper of the boolean input.
config.boolean_label_class = 'checkbox'
# Defines if the default input wrapper class should be included in radio
# collection wrappers.
# config.include_default_input_wrapper_class = true
# Defines which i18n scope will be used in Simple Form.
# config.i18n_scope = 'simple_form'
end

View File

@@ -0,0 +1,62 @@
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
en:
devise:
confirmations:
confirmed: "Your email address has been successfully confirmed."
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
failure:
already_authenticated: "You are already signed in."
inactive: "Your account is not activated yet."
invalid: "Invalid %{authentication_keys} or password."
locked: "Your account is locked."
last_attempt: "You have one more attempt before your account is locked."
not_found_in_database: "Invalid %{authentication_keys} or password."
timeout: "Your session expired. Please sign in again to continue."
unauthenticated: "You need to sign in or sign up before continuing."
unconfirmed: "You have to confirm your email address before continuing."
mailer:
confirmation_instructions:
subject: "Confirmation instructions"
reset_password_instructions:
subject: "Reset password instructions"
unlock_instructions:
subject: "Unlock instructions"
password_change:
subject: "Password Changed"
omniauth_callbacks:
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
success: "Successfully authenticated from %{kind} account."
passwords:
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
updated: "Your password has been changed successfully. You are now signed in."
updated_not_active: "Your password has been changed successfully."
registrations:
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
signed_up: "Welcome! You have signed up successfully."
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
updated: "Your account has been updated successfully."
sessions:
signed_in: "Signed in successfully."
signed_out: "Signed out successfully."
already_signed_out: "Signed out successfully."
unlocks:
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
errors:
messages:
already_confirmed: "was already confirmed, please try signing in"
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
expired: "has expired, please request a new one"
not_found: "not found"
not_locked: "was not locked"
not_saved:
one: "1 error prohibited this %{resource} from being saved:"
other: "%{count} errors prohibited this %{resource} from being saved:"

View File

@@ -0,0 +1,31 @@
en:
simple_form:
"yes": 'Yes'
"no": 'No'
required:
text: 'required'
mark: '*'
# You can uncomment the line below if you need to overwrite the whole required html.
# When using html, text and mark won't be used.
# html: '<abbr title="required">*</abbr>'
error_notification:
default_message: "Please review the problems below:"
# Examples
# labels:
# defaults:
# password: 'Password'
# user:
# new:
# email: 'E-mail to sign in.'
# edit:
# email: 'E-mail.'
# hints:
# defaults:
# username: 'User name to sign in.'
# password: 'No special characters, please.'
# include_blanks:
# defaults:
# age: 'Rather not say'
# prompts:
# defaults:
# age: 'Select your age'

View File

@@ -0,0 +1,20 @@
class CreateBatches < ActiveRecord::Migration[5.0]
def change
create_table :batches do |t|
t.datetime :date,:null => false
t.references :user
t.string :order_ref,:null => false
t.boolean :batch_start
t.boolean :batch_end
t.string :created_by,:null => false
t.integer :qty_processing,:null => false
t.integer :qty_success, :null => false
t.integer :qty_fail,:null => false
t.datetime :batch_start_time
t.datetime :batch_end_time
t.integer :export_count
t.string :remark
t.timestamps
end
end
end

View File

@@ -0,0 +1,47 @@
class DeviseCreateMembers < ActiveRecord::Migration[5.0]
def change
create_table :members do |t|
## Database authenticatable
t.references :user
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
## Confirmable
t.string :confirmation_token
t.datetime :confirmed_at
t.datetime :confirmation_sent_at
t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
t.string :unlock_token # Only if unlock strategy is :email or :both
t.datetime :locked_at
t.timestamps null: false
## UID
t.string :uid
t.string :session_token
end
add_index :members, :email, unique: true
add_index :members, :reset_password_token, unique: true
add_index :members, :confirmation_token, unique: true
add_index :members, :unlock_token, unique: true
add_index :members, :uid, :unique => true
end
end

View File

@@ -0,0 +1,12 @@
class CreateBatchLineItems < ActiveRecord::Migration[5.0]
def change
create_table :batch_line_items do |t|
t.references :batch
t.string :serial_no , null: false
t.string :wristband_code , null: false
t.string :manufacture_uid ,null:false
t.string :card_type,:default => "child"
t.timestamps null: false
end
end
end

View File

@@ -0,0 +1,14 @@
class CreateUser < ActiveRecord::Migration[5.0]
def change
create_table :users do |t|
t.string :name,:null => false
t.string :nrc
t.string :email
t.boolean :is_active,:default =>false
t.string :phone
t.string :address
t.string :secrect_key
t.timestamps null: false
end
end
end

View File

@@ -0,0 +1,11 @@
class CreateLookups < ActiveRecord::Migration[5.0]
def change
create_table :lookups do |t|
t.string :name,:null => false
t.integer :max_value
t.string :prefix
t.integer :max_length
t.timestamps null: false
end
end
end

100
db/schema.rb Normal file
View File

@@ -0,0 +1,100 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170121092515) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "batch_line_items", force: :cascade do |t|
t.integer "batch_id"
t.string "serial_no", null: false
t.string "wristband_code", null: false
t.string "manufacture_uid", null: false
t.string "card_type", default: "child"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["batch_id"], name: "index_batch_line_items_on_batch_id", using: :btree
end
create_table "batches", force: :cascade do |t|
t.datetime "date", null: false
t.integer "user_id"
t.string "order_ref", null: false
t.boolean "batch_start"
t.boolean "batch_end"
t.string "created_by", null: false
t.integer "qty_processing", null: false
t.integer "qty_success", null: false
t.integer "qty_fail", null: false
t.datetime "batch_start_time"
t.datetime "batch_end_time"
t.integer "export_count"
t.string "remark"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_batches_on_user_id", using: :btree
end
create_table "lookups", force: :cascade do |t|
t.string "name", null: false
t.integer "max_value"
t.string "prefix"
t.integer "max_length"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "members", force: :cascade do |t|
t.integer "user_id"
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.integer "failed_attempts", default: 0, null: false
t.string "unlock_token"
t.datetime "locked_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "uid"
t.string "session_token"
t.index ["confirmation_token"], name: "index_members_on_confirmation_token", unique: true, using: :btree
t.index ["email"], name: "index_members_on_email", unique: true, using: :btree
t.index ["reset_password_token"], name: "index_members_on_reset_password_token", unique: true, using: :btree
t.index ["uid"], name: "index_members_on_uid", unique: true, using: :btree
t.index ["unlock_token"], name: "index_members_on_unlock_token", unique: true, using: :btree
t.index ["user_id"], name: "index_members_on_user_id", using: :btree
end
create_table "users", force: :cascade do |t|
t.string "name", null: false
t.string "nrc"
t.string "email"
t.boolean "is_active", default: false
t.string "phone"
t.string "address"
t.string "secrect_key"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end

0
false Normal file
View File

BIN
lib/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,13 @@
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
<%%= f.error_notification %>
<div class="form-inputs">
<%- attributes.each do |attribute| -%>
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
<%- end -%>
</div>
<div class="form-actions">
<%%= f.button :submit %>
</div>
<%% end %>

BIN
public/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1 @@
{"files":{"application-55570bc046304f178e10e45bec721268c8bf8e0a3bc8f2c1f69ff39df39dee3e.js":{"logical_path":"application.js","mtime":"2017-01-19T15:25:44+06:30","size":416216,"digest":"55570bc046304f178e10e45bec721268c8bf8e0a3bc8f2c1f69ff39df39dee3e","integrity":"sha256-VVcLwEYwTxeOEORb7HISaMi/jgo7yPLB9p/znfOd7j4="},"application-13eed745f8cdce49cda636dbb6e1d13489cce811adff36b761521f71e31214e9.css":{"logical_path":"application.css","mtime":"2017-01-19T15:25:44+06:30","size":735,"digest":"13eed745f8cdce49cda636dbb6e1d13489cce811adff36b761521f71e31214e9","integrity":"sha256-E+7XRfjNzknNpjbbtuHRNInM6BGt/za3YVIfceMSFOk="},"application-dd37038c1f0879ef01c745fd8ef7928f3e45a56984deeabd50392be0a3162d6f.js":{"logical_path":"application.js","mtime":"2017-01-21T16:54:30+06:30","size":459409,"digest":"dd37038c1f0879ef01c745fd8ef7928f3e45a56984deeabd50392be0a3162d6f","integrity":"sha256-3TcDjB8Iee8Bx0X9jveSjz5FpWmE3uq9UDkr4KMWLW8="},"application-9db673cb6d4bf3821c5d6ed2f654d4ecb84adecf44609892b94d84b104a4ba68.css":{"logical_path":"application.css","mtime":"2017-01-21T16:54:27+06:30","size":261683,"digest":"9db673cb6d4bf3821c5d6ed2f654d4ecb84adecf44609892b94d84b104a4ba68","integrity":"sha256-nbZzy21L84IcXW7S9lTU7LhK3s9EYJiSuU2EsQSkumg="}},"assets":{"application.js":"application-dd37038c1f0879ef01c745fd8ef7928f3e45a56984deeabd50392be0a3162d6f.js","application.css":"application-9db673cb6d4bf3821c5d6ed2f654d4ecb84adecf44609892b94d84b104a4ba68.css"}}

View File

@@ -0,0 +1,17 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*/
@import "bootstrap.v4a2.min";

Some files were not shown because too many files have changed in this diff Show More