Add cancellation request

This commit is contained in:
Deon George
2020-04-22 22:54:05 +10:00
parent 6480f40b22
commit 1934c6dfeb
6 changed files with 207 additions and 3 deletions

View File

@@ -19,6 +19,26 @@ class ServiceController extends Controller
public function update(Request $request,Service $o)
{
switch ($o->order_status) {
case 'CANCEL-REQUEST':
if ($request->post()) {
if (! $request->post('date_end'))
return redirect()->back()->withErrors('Cancellation Date not provided');
$o->date_end = $request->post('date_end');
foreach (['cancel_notes'] as $key) {
if ($request->post($key))
$o->setOrderInfo($key,$request->post($key));
}
$o->order_status='CANCEL-PENDING';
$o->save();
return redirect()->to(url('u/service',$o->id))->with('updated','Service cancellation submitted.');
}
return $this->update_request_cancel($o);
case 'ORDER-SENT':
if ($request->post()) {
foreach (['reference','notes'] as $key) {
@@ -43,6 +63,11 @@ class ServiceController extends Controller
}
}
private function update_request_cancel(Service $o)
{
return View('u.service.order.cancel',['o'=>$o]);
}
private function update_order_status(Service $o)
{
return View('r.service.order.sent',['o'=>$o]);