mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-21 05:24:17 +00:00
added comments to shipping order controller and test
This commit is contained in:
@@ -12,8 +12,11 @@ class SoController extends Controller
|
||||
{
|
||||
|
||||
public function showso($id)
|
||||
{
|
||||
{
|
||||
// Fix : find the shipping order that belongs to the user
|
||||
$so = So::findOrFail($id);
|
||||
|
||||
// Fix : return with json not view
|
||||
return view('home')->with('so', $so);
|
||||
}
|
||||
|
||||
@@ -28,11 +31,20 @@ class SoController extends Controller
|
||||
$user = Auth::user();
|
||||
|
||||
$so = new So;
|
||||
|
||||
// Fix : contact undefined, for now just get it from input
|
||||
$so->ff_id = $contact->id; //ff contact list id
|
||||
|
||||
// TODO : check ff_id is belongs to user's friend
|
||||
|
||||
$so->supplier_company_name = $request->input('supplier_company_name');
|
||||
$so->supplier_contact_person = $request->input('supplier_contact_person');
|
||||
$so->supplier_contact_person_no = $request->input('supplier_contact_person_no');
|
||||
|
||||
// TODO, FIX : $deliveryinfo undefined, this one need deliveryinfo branch
|
||||
$so->delivery_id = $deliveryinfo->id; //deli-info id
|
||||
|
||||
// TODO, FIX : $warehouse undefined, this one need warehouse branch
|
||||
$so->warehouse_id = $warehouse->id; //warehouse id
|
||||
$so->com_id = $user->company(); //company id
|
||||
$so->save();
|
||||
@@ -40,29 +52,26 @@ class SoController extends Controller
|
||||
$soitems = $request->input('soitem');
|
||||
foreach ($soitems as $soitem)
|
||||
{
|
||||
$new_soitem = new Soitem(array(
|
||||
'so_id'=>$so->id,
|
||||
'status'=>$soitem['status'],
|
||||
'brand_no'=>$soitem['brand_no'],
|
||||
'model_no'=>$soitem['model_no'],
|
||||
'item_code'=>$soitem['item_code'],
|
||||
'quantity_of_item'=>$soitem['quantity_of_item'],
|
||||
'uom'=>$soitem['uom'],
|
||||
'quantity_of_carton'=>$soitem['quantity_of_carton'],
|
||||
'packaging_type'=>$soitem['packaging_type'],
|
||||
'packaging_height'=>$soitem['packaging_height'],
|
||||
'packaging_width'=>$soitem['packaging_width'],
|
||||
'packaging_depth'=>$soitem['packaging_depth'],
|
||||
'packaging_gross'=>$soitem['packaging_gross'],
|
||||
'packaging_nett'=>$soitem['packaging_nett'],
|
||||
));
|
||||
$new_soitem = new Soitem(array(
|
||||
'so_id'=>$so->id,
|
||||
'status'=>$soitem['status'],
|
||||
'brand_no'=>$soitem['brand_no'],
|
||||
'model_no'=>$soitem['model_no'],
|
||||
'item_code'=>$soitem['item_code'],
|
||||
'quantity_of_item'=>$soitem['quantity_of_item'],
|
||||
'uom'=>$soitem['uom'],
|
||||
'quantity_of_carton'=>$soitem['quantity_of_carton'],
|
||||
'packaging_type'=>$soitem['packaging_type'],
|
||||
'packaging_height'=>$soitem['packaging_height'],
|
||||
'packaging_width'=>$soitem['packaging_width'],
|
||||
'packaging_depth'=>$soitem['packaging_depth'],
|
||||
'packaging_gross'=>$soitem['packaging_gross'],
|
||||
'packaging_nett'=>$soitem['packaging_nett'],
|
||||
));
|
||||
|
||||
$new_soitem->save();
|
||||
|
||||
}
|
||||
|
||||
return response()->json(['so'=>$so], 201);
|
||||
|
||||
$new_soitem->save();
|
||||
}
|
||||
return response()->json(['so'=>$so], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,6 +113,7 @@ class SoController extends Controller
|
||||
return response()->json(['message'=>'Access Denied!'], 404);
|
||||
}
|
||||
|
||||
// Fix : contact undefined, for now just get it from input
|
||||
$so->ff_id = $contact->id;
|
||||
$so->supplier_company_name = $request->input('supplier_company_name');
|
||||
$so->supplier_contact_person = $request->input('supplier_contact_person');
|
||||
|
||||
Reference in New Issue
Block a user