Added approve action to order view
This commit is contained in:
@@ -19,7 +19,12 @@ class AdminHomeController extends Controller
|
||||
|
||||
public function service_update(Request $request, Service $o)
|
||||
{
|
||||
switch (strtolower($request->input('action')))
|
||||
if (! $o->validStatus(strtolower($request->input('action'))))
|
||||
return $this->service($o);
|
||||
|
||||
$action = strtolower($request->input('action'));
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case 'approve':
|
||||
// Send an email to the supplier.
|
||||
@@ -31,20 +36,17 @@ class AdminHomeController extends Controller
|
||||
// @todo Your order has been submitted to supplier.
|
||||
|
||||
// Update the service to "ORDER-SENT"
|
||||
$o->nextStatus();
|
||||
$o->nextStatus($action);
|
||||
|
||||
break;
|
||||
|
||||
case 'reject':
|
||||
if (! $x=$o->validStatus(strtolower($request->input('action'))))
|
||||
return $this->service($o);
|
||||
|
||||
$o->order_info = array_merge($o->order_info ? $o->order_info : [],['reason'=>$request->input('notes')]);
|
||||
$o->order_status = $x;
|
||||
$o->save();
|
||||
|
||||
// Send mail to user
|
||||
Mail::to($o->orderby->email)->queue((new OrderRequestReject($o,$request->input('notes')))->onQueue('email'));
|
||||
|
||||
$o->nextStatus($action);
|
||||
break;
|
||||
|
||||
// No action specified.
|
||||
|
Reference in New Issue
Block a user