edit ticket controller
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
class Api::AuthController < ApplicationController
|
class Api::AuthController < ApplicationController
|
||||||
skip_before_filter :verify_authenticity_token
|
skip_before_filter :verify_authenticity_token
|
||||||
def login
|
def login
|
||||||
|
|
||||||
username = params[:username]
|
username = params[:username]
|
||||||
access = params[:access_code]
|
access = params[:access_code]
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ class Api::BatchLineItemsController < ApplicationController
|
|||||||
batch_id=params[:batch_id]
|
batch_id=params[:batch_id]
|
||||||
session_token=params[:session_token]
|
session_token=params[:session_token]
|
||||||
manufacture_uid = params[:card_manufacture]
|
manufacture_uid = params[:card_manufacture]
|
||||||
# card_type = params[:card_type]
|
|
||||||
user_id=""
|
user_id=""
|
||||||
|
|
||||||
check_member= Member.authenticate_session_token(session_token)
|
check_member= Member.authenticate_session_token(session_token)
|
||||||
@@ -15,7 +14,10 @@ class Api::BatchLineItemsController < ApplicationController
|
|||||||
encrypt_key=find_user.secrect_key
|
encrypt_key=find_user.secrect_key
|
||||||
user_id=find_user.id
|
user_id=find_user.id
|
||||||
end
|
end
|
||||||
|
|
||||||
if !encrypt_key.nil?
|
if !encrypt_key.nil?
|
||||||
|
check_manufacture = BatchLineItem.find_by_manufacture_uid(manufacture_uid)
|
||||||
|
if check_manufacture.nil?
|
||||||
serial_no=BatchLineItem.generate_serial_no(user_id.to_s)
|
serial_no=BatchLineItem.generate_serial_no(user_id.to_s)
|
||||||
str="manufacture_uid="+manufacture_uid.to_s+"&serial_no="+serial_no.to_s
|
str="manufacture_uid="+manufacture_uid.to_s+"&serial_no="+serial_no.to_s
|
||||||
|
|
||||||
@@ -23,9 +25,10 @@ class Api::BatchLineItemsController < ApplicationController
|
|||||||
hex_data=digest_data.hex
|
hex_data=digest_data.hex
|
||||||
hex_str=hex_data.to_s
|
hex_str=hex_data.to_s
|
||||||
wristband_code=hex_str[0..15]
|
wristband_code=hex_str[0..15]
|
||||||
|
check_wirstband=BatchLineItem.find_by_wristband_code(wristband_code)
|
||||||
|
|
||||||
check_manufacture = BatchLineItem.find_by_manufacture_uid_and_wristband_code(manufacture_uid,wristband_code)
|
if check_wirstband.nil?
|
||||||
if check_manufacture.nil?
|
puts 'Check Wristband'
|
||||||
card_type=""
|
card_type=""
|
||||||
find_batch= Batch.find_by_id(batch_id)
|
find_batch= Batch.find_by_id(batch_id)
|
||||||
if !find_batch.nil?
|
if !find_batch.nil?
|
||||||
@@ -49,10 +52,13 @@ class Api::BatchLineItemsController < ApplicationController
|
|||||||
@out=false,'Error occurs in registration encoder!'
|
@out=false,'Error occurs in registration encoder!'
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@out=false,'Wristband code is already exists!'
|
@out=false,'Wristband is already registered!'
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@out=false,'Invalid Encryption Key!'
|
@out=false,'Wristband is already registered!'
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@out=false,'Invalid User!'
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@out=false,'Sorry!Unauthorized user!'
|
@out=false,'Sorry!Unauthorized user!'
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ class BatchLineItemsController < ApplicationController
|
|||||||
user_id=current_member.user_id
|
user_id=current_member.user_id
|
||||||
|
|
||||||
@batches=Batch.where('user_id=?',user_id)
|
@batches=Batch.where('user_id=?',user_id)
|
||||||
@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)
|
@batchLineItems=BatchLineItem.joins('inner join batches on batches.id=batch_line_items.batch_id')
|
||||||
|
.where('batches.user_id=?',user_id)
|
||||||
|
.select('batch_line_items.*,batches.order_ref as batch_name').page(params[:page]).per(2)
|
||||||
end
|
end
|
||||||
def export
|
def export
|
||||||
batch_list=params[:batch]
|
batch_list=params[:batch]
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
class BatchesController < ApplicationController
|
class BatchesController < ApplicationController
|
||||||
|
skip_before_filter :verify_authenticity_token
|
||||||
|
before_action :authenticate_member!
|
||||||
def index
|
def index
|
||||||
@batches=Batch.joins('inner join users on users.id=batches.user_id')
|
@batches=Batch.joins('inner join users on users.id=batches.user_id')
|
||||||
.select('batches.*,users.name as user_name').order('batches.id desc').page(params[:page])
|
.select('batches.*,users.name as user_name').order('batches.id desc').page(params[:page])
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class HomeController < ApplicationController
|
class HomeController < ApplicationController
|
||||||
skip_before_filter :verify_authenticity_token
|
skip_before_filter :verify_authenticity_token
|
||||||
|
before_action :authenticate_member!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
redirect_to new_member_session_path
|
redirect_to new_member_session_path
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
skip_before_filter :verify_authenticity_token
|
skip_before_filter :verify_authenticity_token
|
||||||
|
before_action :authenticate_member!
|
||||||
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
# GET /users
|
# GET /users
|
||||||
@@ -32,7 +33,7 @@ class UsersController < ApplicationController
|
|||||||
key=cipher.random_key
|
key=cipher.random_key
|
||||||
secrect_key= Base64.encode64(key)
|
secrect_key= Base64.encode64(key)
|
||||||
@user.secrect_key=secrect_key
|
@user.secrect_key=secrect_key
|
||||||
|
@email=email
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @user.save
|
if @user.save
|
||||||
member_id= current_member.id
|
member_id= current_member.id
|
||||||
|
|||||||
@@ -24,13 +24,12 @@ class BatchLineItem < ApplicationRecord
|
|||||||
find_lookup=Lookup.find_by_name('generate_serial_no')
|
find_lookup=Lookup.find_by_name('generate_serial_no')
|
||||||
if !find_lookup.nil?
|
if !find_lookup.nil?
|
||||||
max_value=find_lookup.max_value
|
max_value=find_lookup.max_value
|
||||||
|
max_value=max_value +1
|
||||||
prefix=find_lookup.prefix
|
prefix=find_lookup.prefix
|
||||||
max_length=find_lookup.max_length
|
max_length=find_lookup.max_length
|
||||||
|
|
||||||
max_value=max_value +1
|
|
||||||
sufix_len=max_length-prefix.length
|
sufix_len=max_length-prefix.length
|
||||||
sufix_str="0" * sufix_len
|
sufix_str="0" * sufix_len
|
||||||
|
value_len= max_value.to_s.length
|
||||||
start=0
|
start=0
|
||||||
ends=sufix_len-value_len-1
|
ends=sufix_len-value_len-1
|
||||||
sufix_str= sufix_str[start..ends]
|
sufix_str= sufix_str[start..ends]
|
||||||
@@ -39,13 +38,6 @@ class BatchLineItem < ApplicationRecord
|
|||||||
|
|
||||||
serial_no=prefix_str.to_s+sufix_str+max_value.to_s
|
serial_no=prefix_str.to_s+sufix_str+max_value.to_s
|
||||||
return serial_no
|
return serial_no
|
||||||
else
|
|
||||||
lookup= Lookup.new
|
|
||||||
lookup.name="generate_serial_no"
|
|
||||||
lookup.max_value=0
|
|
||||||
lookup.prefix='0000'
|
|
||||||
lookup.max_length=16
|
|
||||||
lookup.save
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def self.to_csv(user_id)
|
def self.to_csv(user_id)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<div class="col-md-5" >
|
<div class="col-md-5" >
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email" class="string optional control-label">Registered Email:</label>
|
<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">
|
<input type="text" id="registered_email" name="registered_email" class="form-control" placeholder="Please enter member mail" value="<%= @email %>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-1">
|
<div class="col-md-1">
|
||||||
@@ -65,10 +65,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<script >
|
<script >
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
error_count="<%= @user.errors.count %>"
|
||||||
|
if (error_count>0){
|
||||||
|
status=''
|
||||||
|
}else{
|
||||||
status='disabled'
|
status='disabled'
|
||||||
|
}
|
||||||
|
|
||||||
name=$("#user_name").val()
|
name=$("#user_name").val()
|
||||||
if (name.trim() !=""){
|
if (name.trim() !=""){
|
||||||
status=''
|
status=''
|
||||||
|
|||||||
Reference in New Issue
Block a user