This commit is contained in:
Sunandar
2017-02-10 17:25:12 +06:30
parent 9931152796
commit 723ad7462a
8 changed files with 39 additions and 29 deletions

View File

@@ -10,15 +10,13 @@ class Api::BatchesController < ApplicationController
client_id=params[:client_id]
product_category_id=params[:product_category_id]
find_user=User.find_by_id(check_member.user_id)
created_by=find_user.name
find_client=Client.find_by_id(client_id)
if !find_client.nil?
find_product_category=ProductCategory.find_by_id(product_category_id)
if !find_product_category.nil?
user_id=check_member.user_id
batch = Batch.create_batch(date,order_ref,user_id,created_by,adult_or_child,client_id,product_category_id)
batch = Batch.create_batch(date,order_ref,user_id,adult_or_child,client_id,product_category_id)
if !batch.nil?
@out=true,batch.id
else
@@ -76,16 +74,16 @@ class Api::BatchesController < ApplicationController
end
def batch_progress_list
session_token=params[:session_token]
created_by=params[:created_by]
user_id=params[:created_by]
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)
if !batches.blank?
if !user_id.nil?
batches = Batch.where('batch_end is null and user_id=?', user_id)
if !batches.empty?
@out=true,batches
else
@out = false, "No Batch"
@out = false, batches
end
else
@out = false, "Sorry!Unauthorized user!"