barcode update

This commit is contained in:
nandar
2018-07-26 09:33:05 +06:30
parent 8dc9ab0fbe
commit 004f801f71
15 changed files with 284 additions and 158 deletions

View File

@@ -20,9 +20,10 @@ gem 'unicorn'
gem 'execjs' gem 'execjs'
gem 'rack', '~> 2.0.1' gem 'rack', '~> 2.0.1'
gem 'therubyracer' gem 'therubyracer'
platform :ruby do gem 'pg', '~> 0.20'
gem 'pg' # platform :ruby do
end # gem 'pg'
# end
# Use jquery as the JavaScript library # Use jquery as the JavaScript library
gem 'jquery-rails' gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks

View File

@@ -1,78 +1,77 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.0.1) actioncable (5.0.7)
actionpack (= 5.0.1) actionpack (= 5.0.7)
nio4r (~> 1.2) nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1) websocket-driver (~> 0.6.1)
actionmailer (5.0.1) actionmailer (5.0.7)
actionpack (= 5.0.1) actionpack (= 5.0.7)
actionview (= 5.0.1) actionview (= 5.0.7)
activejob (= 5.0.1) activejob (= 5.0.7)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.0.1) actionpack (5.0.7)
actionview (= 5.0.1) actionview (= 5.0.7)
activesupport (= 5.0.1) activesupport (= 5.0.7)
rack (~> 2.0) rack (~> 2.0)
rack-test (~> 0.6.3) rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.1) actionview (5.0.7)
activesupport (= 5.0.1) activesupport (= 5.0.7)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.1) activejob (5.0.7)
activesupport (= 5.0.1) activesupport (= 5.0.7)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.0.1) activemodel (5.0.7)
activesupport (= 5.0.1) activesupport (= 5.0.7)
activerecord (5.0.1) activerecord (5.0.7)
activemodel (= 5.0.1) activemodel (= 5.0.7)
activesupport (= 5.0.1) activesupport (= 5.0.7)
arel (~> 7.0) arel (~> 7.0)
activesupport (5.0.1) activesupport (5.0.7)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
airbrussh (1.1.2) airbrussh (1.3.0)
sshkit (>= 1.6.1, != 1.7.0) sshkit (>= 1.6.1, != 1.7.0)
arel (7.1.4) arel (7.1.4)
bcrypt (3.1.11) bcrypt (3.1.12)
bindex (0.5.0)
builder (3.2.3) builder (3.2.3)
byebug (9.0.6) byebug (10.0.2)
capistrano (3.7.2) capistrano (3.11.0)
airbrussh (>= 1.0.0) airbrussh (>= 1.0.0)
capistrano-harrow
i18n i18n
rake (>= 10.0.0) rake (>= 10.0.0)
sshkit (>= 1.9.0) sshkit (>= 1.9.0)
capistrano-bundler (1.2.0) capistrano-bundler (1.3.0)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.2) sshkit (~> 1.2)
capistrano-harrow (0.5.3) capistrano-rails (1.4.0)
capistrano-rails (1.2.2)
capistrano (~> 3.1) capistrano (~> 3.1)
capistrano-bundler (~> 1.1) capistrano-bundler (~> 1.1)
capistrano-rbenv (2.1.0) capistrano-rbenv (2.1.3)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.3) sshkit (~> 1.3)
coffee-rails (4.2.1) coffee-rails (4.2.2)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.2.x) railties (>= 4.0.0)
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
concurrent-ruby (1.0.4) concurrent-ruby (1.0.5)
debug_inspector (0.0.2) crass (1.0.4)
devise (4.2.0) devise (4.4.3)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.1) railties (>= 4.1.0, < 6.0)
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
devise_uid (0.1.1) devise_uid (0.1.1)
@@ -80,140 +79,145 @@ GEM
railties (>= 3.0) railties (>= 3.0)
erubis (2.7.0) erubis (2.7.0)
execjs (2.7.0) execjs (2.7.0)
ffi (1.9.17) ffi (1.9.25)
globalid (0.3.7) globalid (0.4.1)
activesupport (>= 4.1.0) activesupport (>= 4.2.0)
i18n (0.8.1) i18n (1.0.1)
jbuilder (2.6.2) concurrent-ruby (~> 1.0)
activesupport (>= 3.0.0, < 5.1) jbuilder (2.7.0)
multi_json (~> 1.2) activesupport (>= 4.2.0)
jquery-rails (4.2.2) multi_json (>= 1.2)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
kaminari (1.0.1) kaminari (1.1.1)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
kaminari-actionview (= 1.0.1) kaminari-actionview (= 1.1.1)
kaminari-activerecord (= 1.0.1) kaminari-activerecord (= 1.1.1)
kaminari-core (= 1.0.1) kaminari-core (= 1.1.1)
kaminari-actionview (1.0.1) kaminari-actionview (1.1.1)
actionview actionview
kaminari-core (= 1.0.1) kaminari-core (= 1.1.1)
kaminari-activerecord (1.0.1) kaminari-activerecord (1.1.1)
activerecord activerecord
kaminari-core (= 1.0.1) kaminari-core (= 1.1.1)
kaminari-core (1.0.1) kaminari-core (1.1.1)
kgio (2.11.0) kgio (2.11.2)
libv8 (3.16.14.17) libv8 (3.16.14.19)
listen (3.0.8) listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.0.3) loofah (2.2.2)
crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.4) mail (2.7.0)
mime-types (>= 1.16, < 4) mini_mime (>= 0.1.1)
method_source (0.8.2) method_source (0.9.0)
mime-types (3.1) mini_mime (1.0.0)
mime-types-data (~> 3.2015) mini_portile2 (2.3.0)
mime-types-data (3.2016.0521) minitest (5.11.3)
mini_portile2 (2.1.0) multi_json (1.13.1)
minitest (5.10.1)
multi_json (1.12.1)
net-scp (1.2.1) net-scp (1.2.1)
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
net-ssh (4.1.0) net-ssh (5.0.2)
nio4r (1.2.1) nio4r (2.3.1)
nokogiri (1.7.0.1) nokogiri (1.8.4)
mini_portile2 (~> 2.1.0) mini_portile2 (~> 2.3.0)
orm_adapter (0.5.0) orm_adapter (0.5.0)
pg (0.19.0) pg (0.21.0)
puma (3.7.1) puma (3.12.0)
rack (2.0.1) rack (2.0.5)
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (5.0.1) rails (5.0.7)
actioncable (= 5.0.1) actioncable (= 5.0.7)
actionmailer (= 5.0.1) actionmailer (= 5.0.7)
actionpack (= 5.0.1) actionpack (= 5.0.7)
actionview (= 5.0.1) actionview (= 5.0.7)
activejob (= 5.0.1) activejob (= 5.0.7)
activemodel (= 5.0.1) activemodel (= 5.0.7)
activerecord (= 5.0.1) activerecord (= 5.0.7)
activesupport (= 5.0.1) activesupport (= 5.0.7)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0)
railties (= 5.0.1) railties (= 5.0.7)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.2) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0, < 6.0) activesupport (>= 4.2.0)
nokogiri (~> 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3) rails-html-sanitizer (1.0.4)
loofah (~> 2.0) loofah (~> 2.2, >= 2.2.2)
railties (5.0.1) railties (5.0.7)
actionpack (= 5.0.1) actionpack (= 5.0.7)
activesupport (= 5.0.1) activesupport (= 5.0.7)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
raindrops (0.17.0) raindrops (0.19.0)
rake (12.0.0) rake (12.3.1)
rb-fsevent (0.9.8) rb-fsevent (0.10.3)
rb-inotify (0.9.8) rb-inotify (0.9.10)
ffi (>= 0.5.0) ffi (>= 0.5.0, < 2)
ref (2.0.0) ref (2.0.0)
responders (2.3.0) responders (2.4.0)
railties (>= 4.2.0, < 5.1) actionpack (>= 4.2.0, < 5.3)
sass (3.4.23) railties (>= 4.2.0, < 5.3)
sass-rails (5.0.6) sass (3.5.7)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6) railties (>= 4.0.0, < 6)
sass (~> 3.1) sass (~> 3.1)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
simple_form (3.4.0) simple_form (4.0.1)
actionpack (> 4, < 5.1) actionpack (>= 5.0)
activemodel (> 4, < 5.1) activemodel (>= 5.0)
spring (2.0.1) spring (2.0.2)
activesupport (>= 4.2) activesupport (>= 4.2)
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0) spring (>= 1.2, < 3.0)
sprockets (3.7.1) sprockets (3.7.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.0) sprockets-rails (3.2.1)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sshkit (1.12.0) sshkit (1.17.0)
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
therubyracer (0.12.3) therubyracer (0.12.3)
libv8 (~> 3.16.14.15) libv8 (~> 3.16.14.15)
ref ref
thor (0.19.4) thor (0.20.0)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.6) tilt (2.0.8)
to_csv-rails (0.1.5) to_csv-rails (0.1.5)
turbolinks (5.0.1) turbolinks (5.1.1)
turbolinks-source (~> 5) turbolinks-source (~> 5.1)
turbolinks-source (5.0.0) turbolinks-source (5.1.0)
tzinfo (1.2.2) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (3.0.4) uglifier (4.1.15)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unicorn (5.2.0) unicorn (5.4.0)
kgio (~> 2.6) kgio (~> 2.6)
raindrops (~> 0.7) raindrops (~> 0.7)
warden (1.2.7) warden (1.2.7)
rack (>= 1.0) rack (>= 1.0)
web-console (3.4.0) web-console (3.6.2)
actionview (>= 5.0) actionview (>= 5.0)
activemodel (>= 5.0) activemodel (>= 5.0)
debug_inspector bindex (>= 0.4.0)
railties (>= 5.0) railties (>= 5.0)
websocket-driver (0.6.5) websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2) websocket-extensions (0.1.3)
PLATFORMS PLATFORMS
ruby ruby
@@ -233,7 +237,7 @@ DEPENDENCIES
jquery-rails jquery-rails
kaminari kaminari
listen (~> 3.0.5) listen (~> 3.0.5)
pg pg (~> 0.20)
puma (~> 3.0) puma (~> 3.0)
rack (~> 2.0.1) rack (~> 2.0.1)
rails (~> 5.0.0, >= 5.0.0.1) rails (~> 5.0.0, >= 5.0.0.1)
@@ -250,4 +254,4 @@ DEPENDENCIES
web-console web-console
BUNDLED WITH BUNDLED WITH
1.14.3 1.16.1

View File

@@ -29,7 +29,7 @@ a {
&:hover { &:hover {
color: #fff; color: #fff;
// background-color: #000; background-color: #000;
} }
} }

View File

@@ -140,14 +140,17 @@ class Api::BatchLineItemsController < ApplicationController
# end # end
# Generate Code # Generate Code
end end
def update_manufacture_uid def update_manufacture_uid
account_no = params[:account_no] account_no = params[:account_no]
barcode = params[:barcode]
manufacture_uid = params[:manufacture_uid] manufacture_uid = params[:manufacture_uid]
batch_line_item = BatchLineItem.find_by_asset_identity(account_no) batch_line_item = BatchLineItem.find_by_asset_identity(account_no)
if !batch_line_item.nil? if !batch_line_item.nil?
batch_line_item.manufacture_uid = manufacture_uid batch_line_item.manufacture_uid = manufacture_uid
batch_line_item.barcode = barcode
batch_line_item.save batch_line_item.save
# update batch # update batch
batch = Batch.find_by_id(batch_line_item.batch_id) batch = Batch.find_by_id(batch_line_item.batch_id)
card_qty=batch.qty_processing.to_i card_qty=batch.qty_processing.to_i
@@ -172,6 +175,94 @@ class Api::BatchLineItemsController < ApplicationController
else else
@out = false,"no batch" @out = false,"no batch"
end end
end
def code_activate
session_token = params[:session_token]
barcode =params[:barcode]
find_seller = Member.find_by_session_token(session_token)
if !find_seller.nil?
seller_id = find_seller.user_id
find_barcode = BatchLineItem.find_by_barcode(barcode)
if !find_barcode.nil?
find_batch = Batch.find_by_id(find_barcode.batch_id)
if find_batch.export_to_seller_id == seller_id
if find_barcode.is_activated == false
find_barcode.is_activated = true
find_barcode.activated_date = DateTime.now
find_barcode.save
@out = true,"Success"
else
@out = false,"This is already activated!"
end
else
@out = false,"Not Authorized Seller"
end
else
@out = false,"Fail"
end
else
@out = false, "Not Authorized"
end
end
# def check_ticket
# session_token = params[:session_token]
# barcode =params[:barcode]
# find_seller = Member.find_by_session_token(session_token)
# if !find_seller.nil?
# seller_id = find_seller.user_id
# find_barcode = BatchLineItem.find_by_barcode(barcode)
# if !find_barcode.nil?
# @out = true,"valid"
# end
# else
# @out = false, "Not Authorized"
# end
# end
def activated_list
session_token = params[:session_token]
find_seller = Member.find_by_session_token(session_token)
if !find_seller.nil?
total_page_count= 0
page_no = params[:page]
if !page_no.nil? && page_no != ""
offset = (page_no.to_i - 1 ) * 10
else
offset = 0
end
seller_id = find_seller.user_id
get_list = BatchLineItem.select("batch_line_items.id,batch_line_items.barcode,batch_line_items.activated_date").joins("join batches on batches.id=batch_line_items.batch_id").where("batch_line_items.is_activated=? and batches.export_to_seller_id=?",true,seller_id).limit(10).offset(offset)
if get_list.count%10 > 0
total_page_count = get_list.count/10 + 1
else
total_page_count = get_list.count/10
end
if !get_list.nil?
@out = true, get_list, total_page_count
else
@out = false, "No data"
end
else
@out = false, "Not Authorized"
end
end end
def seller_info
session_token = params[:session_token]
find_seller = Member.find_by_session_token(session_token)
if !find_seller.nil?
seller_id = find_seller.user_id
total_export_qty = BatchLineItem.select("count(batch_line_items.id)as count").joins("join batches on batches.id=batch_line_items.batch_id").where("batches.export_to_seller_id=?",seller_id)
total_activated_qty = BatchLineItem.select("count(batch_line_items.id)as count").joins("join batches on batches.id=batch_line_items.batch_id").where("batches.export_to_seller_id=? and batch_line_items.is_activated=?",seller_id,true)
@out = true,total_export_qty[0]["count"],total_activated_qty[0]["count"]
else
@out = false,"Not Authorized"
end
end
end end

View File

@@ -9,16 +9,19 @@ class BatchLineItemsController < ApplicationController
@product_category_id="" @product_category_id=""
@clients=Client.all.order('id desc') @clients=Client.all.order('id desc')
@product_categories=ProductCategory.all.order('id desc') @product_categories=ProductCategory.all.order('id desc')
@sellers=User.where("user_type=?","Seller")
find_client=Client.select(:id).order('id desc').last find_client=Client.select(:id).order('id desc').last
if !find_client.nil? if !find_client.nil?
client_id=find_client.id client_id=find_client.id
find_batch=Batch.where('client_id=?',client_id).order('id desc').first find_batch=Batch.where('client_id=?',client_id).order('id desc').first
if !find_batch.nil? if !find_batch.nil?
@product_category_id=find_batch.product_category_id @product_category_id=find_batch.product_category_id
end end
sub_query="(select * from batches where client_id="+client_id.to_s+" and product_category_id ="+@product_category_id.to_s+" )" sub_query="(select * from batches where client_id="+client_id.to_s+" and product_category_id ="+@product_category_id.to_s+" )"
@batchLineItems=BatchLineItem.joins('inner join '+sub_query+' as batches on batches.id=batch_line_items.batch_id') @batchLineItems=BatchLineItem.joins('inner join '+sub_query+' as batches on batches.id=batch_line_items.batch_id')
.select('batch_line_items.*,batches.order_ref as batch_name').order('batch_line_items.id desc').page(params[:page]).per(10) .select('batch_line_items.*,batches.order_ref as batch_name').order('batch_line_items.id desc').page(params[:page]).per(10)
@result_count= @batchLineItems.total_count @result_count= @batchLineItems.total_count
@@ -76,6 +79,7 @@ class BatchLineItemsController < ApplicationController
@batches=Batch.where('user_id=?',user_id) @batches=Batch.where('user_id=?',user_id)
client_id=params[:client] client_id=params[:client]
product_category_id=params[:product_category] product_category_id=params[:product_category]
seller_id = params[:seller]
find_client=Client.find_by_id(client_id) find_client=Client.find_by_id(client_id)
location_code=find_client.location_code location_code=find_client.location_code
client_name=find_client.name.downcase client_name=find_client.name.downcase
@@ -91,7 +95,7 @@ class BatchLineItemsController < ApplicationController
end end
if !batch_list.empty? if !batch_list.empty?
res=Batch.where("client_id=? and product_category_id=? and id in (?)",client_id,product_category_id,batch_list).update_all("export_count = export_count + 1,exported_by='"+exported_by+"'") res=Batch.where("client_id=? and product_category_id=? and id in (?)",client_id,product_category_id,batch_list).update_all("export_count = export_count + 1,exported_by='"+exported_by+"',export_to_seller_id='"+seller_id+"'")
sub_query= "(select * from batches where client_id="+client_id.to_s+" and product_category_id="+ product_category_id.to_s+")" sub_query= "(select * from batches where client_id="+client_id.to_s+" and product_category_id="+ product_category_id.to_s+")"
@@ -101,7 +105,7 @@ class BatchLineItemsController < ApplicationController
.where('batch_id in (?)',batch_list) .where('batch_id in (?)',batch_list)
.select("*,product.product_type_id ,product.name,'' as secret_token,'' as location_name") .select("*,product.product_type_id ,product.name,'' as secret_token,'' as location_name")
else else
Batch.where("client_id=? ",client_id).update_all("export_count = export_count + 1,exported_by='"+exported_by+"'") Batch.where("client_id=? ",client_id).update_all("export_count = export_count + 1,exported_by='"+exported_by+"',export_to_seller_id='"+seller_id+"'")
sub_query="(select * from batches where client_id ="+client_id+" and product_category_id="+ product_category_id+")" sub_query="(select * from batches where client_id ="+client_id+" and product_category_id="+ product_category_id+")"
@batchLineItems = BatchLineItem.joins('inner join '+sub_query+' as batches on batches.id=batch_line_items.batch_id') @batchLineItems = BatchLineItem.joins('inner join '+sub_query+' as batches on batches.id=batch_line_items.batch_id')
.joins('inner join product_categories as product on product.id=batches.product_category_id') .joins('inner join product_categories as product on product.id=batches.product_category_id')

View File

@@ -100,6 +100,6 @@ class UsersController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
def user_params def user_params
params.require(:user).permit(:name, :nrc, :email, :phone, :address,:is_active) params.require(:user).permit(:name, :nrc, :email, :phone, :address,:is_active,:user_type)
end end
end end

View File

@@ -72,20 +72,21 @@ class BatchLineItem < ApplicationRecord
if !find_client.nil? if !find_client.nil?
encrypt_key=find_client.secrect_key encrypt_key=find_client.secrect_key
end end
attributes = %w{serial_no asset_identity batch_id manufacture_uid asset_type secret_token location security_code} attributes = %w{serial_no asset_identity batch_id manufacture_uid asset_type secret_token location}
CSV.generate(headers: true) do |csv| CSV.generate(headers: true) do |csv|
csv << attributes csv << attributes
all.each do |encoder| all.each do |encoder|
if encoder.product_type_id ==1 if encoder.product_type_id ==1
str="account_no="+encoder.asset_identity.to_s+"&manufacture_uid="+encoder.manufacture_uid.to_s+"&serial_no="+encoder.serial_no.to_s str="account_no="+encoder.asset_identity.to_s+"&manufacture_uid="+encoder.manufacture_uid.to_s+"&serial_no="+encoder.serial_no.to_s
elsif encoder.product_type_id == 3 elsif encoder.product_type_id == 3
attributes = attributes+ %w{security_code}
str="account_no="+encoder.asset_identity.to_s+"&manufacture_uid="+encoder.manufacture_uid.to_s+"&serial_no="+encoder.serial_no.to_s+"&security_code="+encoder.security_code.to_s str="account_no="+encoder.asset_identity.to_s+"&manufacture_uid="+encoder.manufacture_uid.to_s+"&serial_no="+encoder.serial_no.to_s+"&security_code="+encoder.security_code.to_s
else else
str="manufacture_uid="+encoder.manufacture_uid.to_s+"&serial_no="+encoder.serial_no.to_s str="manufacture_uid="+encoder.manufacture_uid.to_s+"&serial_no="+encoder.serial_no.to_s
end end
# security_code = encoder.security_code
# digest = Digest::MD5.hexdigest(security_code)
encryptd_data=BatchLineItem.encrypted(str,encrypt_key) encryptd_data=BatchLineItem.encrypted(str,encrypt_key)
encoder.secret_token=encryptd_data encoder.secret_token=encryptd_data

View File

@@ -6,6 +6,7 @@ class Member < ApplicationRecord
devise :database_authenticatable, :registerable, devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,:uid, :confirmable, :lockable :recoverable, :rememberable, :trackable, :validatable,:uid, :confirmable, :lockable
def self.authenticate_session_token(token) def self.authenticate_session_token(token)
if token.nil? || token.blank? || token.to_s == ' ' if token.nil? || token.blank? || token.to_s == ' '
return false return false

View File

@@ -14,11 +14,20 @@
<label><strong>Select Product:</strong></label> <label><strong>Select Product:</strong></label>
<%= select_tag "product_category", options_from_collection_for_select(@product_categories, "id", "name"), :class => 'form-control'%> <%= select_tag "product_category", options_from_collection_for_select(@product_categories, "id", "name"), :class => 'form-control'%>
</div> </div>
<div class="col-lg-4"> <div class="col-lg-4">
<label><strong>Select Batch:</strong></label><br> <label><strong>Select Batch:</strong></label><br>
<select class='selectpicker' id='batch' name='batch[]' multiple= "multiple"></select> &nbsp; &nbsp; <select class='selectpicker' id='batch' name='batch[]' multiple= "multiple"></select>
<%= button_tag "Export csv?",:class =>'btn btn-primary btn-sm',:id =>"btnexport" %> <%= button_tag "Export csv?",:class =>'btn btn-primary btn-sm',:id =>"btnexport" %>
</div> </div>
<br/>
<div class="col-lg-3">
<label><strong>Export to Seller:</strong></label>
<%= select_tag "seller", options_from_collection_for_select(@sellers, "id", "name"), :class => 'form-control'%>
</div>
<% end %> <% end %>
</div> </div>
<div class="row show_image"> <div class="row show_image">
@@ -50,7 +59,7 @@
<th>Asset Identity</th> <th>Asset Identity</th>
<th>Manufacture UID</th> <th>Manufacture UID</th>
<th>Batch No</th> <th>Batch No</th>
<th>Asset Type</th> <th>Barcode</th>
<th>Created At </th> <th>Created At </th>
<th>Updated At </th> <th>Updated At </th>
</tr> </tr>
@@ -62,7 +71,7 @@
<td><%= item.asset_identity rescue '' %></td> <td><%= item.asset_identity rescue '' %></td>
<td><%= item.manufacture_uid rescue '' %></td> <td><%= item.manufacture_uid rescue '' %></td>
<td><%= item.batch_name rescue '' %></td> <td><%= item.batch_name rescue '' %></td>
<td><%= item.asset_type rescue '' %></td> <td><%= item.barcode rescue '' %></td>
<td><%= item.created_at.strftime("%e,%b %Y %I:%M %p") 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> <td><%= item.updated_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
</tr> </tr>

View File

@@ -19,7 +19,7 @@
</li> </li>
<li class="nav-item"> <li class="nav-item">
<%= link_to "Client",clients_path, :class => "nav-link" %> <%= link_to "Client",clients_path, :class => "nav-link" %>
</li> </li>
</ul> </ul>
<div class="float-xs-right"> <div class="float-xs-right">
<ul class="nav navbar-nav right"> <ul class="nav navbar-nav right">

View File

@@ -28,6 +28,11 @@
<% end %> <% end %>
<div class="row"> <div class="row">
<div class="col-md-6" id="textbox_group"> <div class="col-md-6" id="textbox_group">
<div class="form-group">
<label for="user_type" class="string optional control-label">User Type:</label>
<%= f.select(:user_type, ['User', "Seller"], {}, { :class => 'form-control' }) %>
</div>
<div class ="form-group" > <div class ="form-group" >
<label for="name" class="string optional control-label">Name:</label> <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.input :name ,:label =>false,:error => false,:placeholder =>'Please enter user name',input_html: { class: "form-control" } %>

View File

@@ -18,26 +18,25 @@
<table class="table" style="border-top:none"> <table class="table" style="border-top:none">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>User Type</th>
<th>Nrc</th> <th>Nrc</th>
<th>Email</th> <th>Email</th>
<th>Phone</th> <th>Phone</th>
<th>Address</th>
<th>Status</th> <th>Status</th>
<th>Created At </th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @users.each do |user| %> <% @users.each do |user| %>
<tr> <tr>
<td><%= user.name rescue '' %></td> <td><%= user.name rescue '' %></td>
<td><%= user.user_type rescue '' %></td>
<td><%= user.nrc rescue '' %></td> <td><%= user.nrc rescue '' %></td>
<td><%= user.email rescue '' %></td> <td><%= user.email rescue '' %></td>
<td><%= user.phone rescue '' %></td> <td><%= user.phone rescue '' %></td>
<td><%= user.address rescue '' %></td> <td><%= user.address rescue '' %></td>
<td></td> <td></td>
<td><%= user.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
<td> <td>
<%= link_to 'Detail', <%= link_to 'Detail',
user_path(user), :class => 'btn btn-primary btn-sm' %> user_path(user), :class => 'btn btn-primary btn-sm' %>

View File

@@ -1,6 +1,7 @@
Rails.application.routes.draw do Rails.application.routes.draw do
resources :sellers
resources :clients resources :clients
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root :to => 'home#index' root :to => 'home#index'
@@ -50,5 +51,9 @@ Rails.application.routes.draw do
#batch_line_items #batch_line_items
post "generate_card_account_items" =>"batch_line_items#generate_card_account_items" post "generate_card_account_items" =>"batch_line_items#generate_card_account_items"
post "update_manufacture_uid" => "batch_line_items#update_manufacture_uid" post "update_manufacture_uid" => "batch_line_items#update_manufacture_uid"
post "code_activate" => "batch_line_items#code_activate"
get "activated_list" => "batch_line_items#activated_list"
get "seller_info" => "batch_line_items#seller_info"
end end
end end

View File

@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180627041112) do ActiveRecord::Schema.define(version: 20180724072431) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@@ -27,29 +27,34 @@ ActiveRecord::Schema.define(version: 20180627041112) do
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "security_code" t.string "security_code"
t.string "barcode"
t.boolean "is_activated", default: false
t.datetime "activated_date"
t.index ["batch_id"], name: "index_batch_line_items_on_batch_id", using: :btree t.index ["batch_id"], name: "index_batch_line_items_on_batch_id", using: :btree
end end
create_table "batches", force: :cascade do |t| create_table "batches", force: :cascade do |t|
t.datetime "date", null: false t.datetime "date", null: false
t.integer "user_id" t.integer "user_id"
t.integer "client_id" t.integer "client_id"
t.string "order_ref", null: false t.string "order_ref", null: false
t.boolean "batch_start" t.boolean "batch_start"
t.boolean "batch_end" t.boolean "batch_end"
t.string "exported_by", null: false t.string "exported_by", null: false
t.integer "qty_processing", null: false t.integer "qty_processing", null: false
t.integer "qty_success", null: false t.integer "qty_success", null: false
t.integer "qty_fail", null: false t.integer "qty_fail", null: false
t.datetime "batch_start_time" t.datetime "batch_start_time"
t.datetime "batch_end_time" t.datetime "batch_end_time"
t.integer "export_count" t.integer "export_count"
t.string "remark" t.string "remark"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "adult_or_child", default: "CHILD" t.string "adult_or_child", default: "CHILD"
t.integer "product_category_id" t.integer "product_category_id"
t.integer "generated_qty" t.integer "generated_qty"
t.integer "export_to_seller_id"
t.datetime "export_to_seller_date"
t.index ["client_id"], name: "index_batches_on_client_id", using: :btree t.index ["client_id"], name: "index_batches_on_client_id", using: :btree
t.index ["product_category_id"], name: "index_batches_on_product_category_id", using: :btree t.index ["product_category_id"], name: "index_batches_on_product_category_id", using: :btree
t.index ["user_id"], name: "index_batches_on_user_id", using: :btree t.index ["user_id"], name: "index_batches_on_user_id", using: :btree
@@ -125,6 +130,7 @@ ActiveRecord::Schema.define(version: 20180627041112) do
t.string "address" t.string "address"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "user_type"
end end
end end

View File

@@ -1 +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="},"spinner-c1cf81bef2ea82eaa43265a5ff786b7cd74e7d5f4f2de104b586f092ca0fb886.gif":{"logical_path":"spinner.gif","mtime":"2017-02-10T11:04:52+06:30","size":723,"digest":"c1cf81bef2ea82eaa43265a5ff786b7cd74e7d5f4f2de104b586f092ca0fb886","integrity":"sha256-wc+BvvLqguqkMmWl/3hrfNdOfV9PLeEEtYbwksoPuIY="},"application-4b07da359561fb578da05680a32fde19ae94afccd5ce3efeef8c5d0f2caa96df.js":{"logical_path":"application.js","mtime":"2017-03-08T14:08:26+06:30","size":482933,"digest":"4b07da359561fb578da05680a32fde19ae94afccd5ce3efeef8c5d0f2caa96df","integrity":"sha256-SwfaNZVh+1eNoFaAoy/eGa6Ur8zVzj7+74xdDyyqlt8="},"application-e6b1e1192547851708d9ee55b2e3889c54242c9f13777b26a8d33acbd5dedbac.css":{"logical_path":"application.css","mtime":"2017-10-26T17:47:18+06:30","size":260095,"digest":"e6b1e1192547851708d9ee55b2e3889c54242c9f13777b26a8d33acbd5dedbac","integrity":"sha256-5rHhGSVHhRcI2e5VsuOInFQkLJ8Td3smqNM6y9Xe26w="}},"assets":{"application.js":"application-4b07da359561fb578da05680a32fde19ae94afccd5ce3efeef8c5d0f2caa96df.js","application.css":"application-e6b1e1192547851708d9ee55b2e3889c54242c9f13777b26a8d33acbd5dedbac.css","spinner.gif":"spinner-c1cf81bef2ea82eaa43265a5ff786b7cd74e7d5f4f2de104b586f092ca0fb886.gif"}} {"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="},"spinner-c1cf81bef2ea82eaa43265a5ff786b7cd74e7d5f4f2de104b586f092ca0fb886.gif":{"logical_path":"spinner.gif","mtime":"2017-02-10T11:04:52+06:30","size":723,"digest":"c1cf81bef2ea82eaa43265a5ff786b7cd74e7d5f4f2de104b586f092ca0fb886","integrity":"sha256-wc+BvvLqguqkMmWl/3hrfNdOfV9PLeEEtYbwksoPuIY="},"application-4b07da359561fb578da05680a32fde19ae94afccd5ce3efeef8c5d0f2caa96df.js":{"logical_path":"application.js","mtime":"2017-03-08T14:08:26+06:30","size":482933,"digest":"4b07da359561fb578da05680a32fde19ae94afccd5ce3efeef8c5d0f2caa96df","integrity":"sha256-SwfaNZVh+1eNoFaAoy/eGa6Ur8zVzj7+74xdDyyqlt8="},"application-e6b1e1192547851708d9ee55b2e3889c54242c9f13777b26a8d33acbd5dedbac.css":{"logical_path":"application.css","mtime":"2017-10-26T17:47:18+06:30","size":260095,"digest":"e6b1e1192547851708d9ee55b2e3889c54242c9f13777b26a8d33acbd5dedbac","integrity":"sha256-5rHhGSVHhRcI2e5VsuOInFQkLJ8Td3smqNM6y9Xe26w="},"application-62a961955fdd367f048f60546d4b15cc15ffb5faecd7d09cec01fb811ca12a5d.js":{"logical_path":"application.js","mtime":"2018-07-20T09:53:52+06:30","size":482964,"digest":"62a961955fdd367f048f60546d4b15cc15ffb5faecd7d09cec01fb811ca12a5d","integrity":"sha256-YqlhlV/dNn8Ej2BUbUsVzBX/tfrs19Cc7AH7gRyhKl0="},"application-f68cee866216e58c83a5bf63e4323c6c3239ae342e4c39cae71aa00edaedf1ca.css":{"logical_path":"application.css","mtime":"2018-07-20T09:54:01+06:30","size":260219,"digest":"f68cee866216e58c83a5bf63e4323c6c3239ae342e4c39cae71aa00edaedf1ca","integrity":"sha256-9ozuhmIW5YyDpb9j5DI8bDI5rjQuTDnK5xqgDtrt8co="},"application-9a85851664fbb1fae9f2c78a28b8e4d3be5be0793b84a7696f3d92d67cb3a14a.js":{"logical_path":"application.js","mtime":"2018-07-20T15:35:33+06:30","size":485721,"digest":"9a85851664fbb1fae9f2c78a28b8e4d3be5be0793b84a7696f3d92d67cb3a14a","integrity":"sha256-moWFFmT7sfrp8seKKLjk075b4Hk7hKdpbz2S1nyzoUo="}},"assets":{"application.js":"application-9a85851664fbb1fae9f2c78a28b8e4d3be5be0793b84a7696f3d92d67cb3a14a.js","application.css":"application-f68cee866216e58c83a5bf63e4323c6c3239ae342e4c39cae71aa00edaedf1ca.css","spinner.gif":"spinner-c1cf81bef2ea82eaa43265a5ff786b7cd74e7d5f4f2de104b586f092ca0fb886.gif"}}