This commit is contained in:
Sunandar
2017-02-07 18:04:06 +06:30
parent 6fa89a9e75
commit 264debf89a
13 changed files with 185 additions and 117 deletions

View File

@@ -11,18 +11,23 @@ class Api::BatchesController < ApplicationController
adult_or_child=params[:adult_or_child]
client_id=params[:client_id]
user_id=check_member.user_id
batch = Batch.create_batch(created_by,date,order_ref,card_qty,user_id,adult_or_child,client_id)
if !batch.nil?
@out=true,batch.id
else
@out=false,'Error occurs in creating batch!'
end
else
@out = false, "Sorry!Unauthorized user!"
find_client=Client.find_by_id(client_id)
if !find_client.nil?
user_id=check_member.user_id
batch = Batch.create_batch(created_by,date,order_ref,card_qty,user_id,adult_or_child,client_id)
if !batch.nil?
@out=true,batch.id
else
@out=false,'Error occurs in creating batch!'
end
else
@out = false, "Client does not exist!"
end
else
@out = false, "Sorry!Unauthorized user!"
end
end
def batch_end
end
def batch_end
session_token=params[:session_token]
batch_id=params[:batch_id]
@@ -66,8 +71,7 @@ class Api::BatchesController < ApplicationController
session_token=params[:session_token]
created_by=params[:created_by]
check_member= Member.authenticate_session_token(session_token)
check_member= Member.authenticate_session_token(session_token)
if !check_member.nil?
if !created_by.nil?
batches = Batch.where('batch_end is null and created_by=?', created_by)