Progress on order progress

This commit is contained in:
Deon George
2020-04-19 08:33:41 +10:00
parent e6f823da39
commit 6480f40b22
16 changed files with 505 additions and 224 deletions

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\View\View;
use App\Models\Service;
class ServiceController extends Controller
{
/**
* Update a service
*
* @note: Route Middleware protects this path
* @param Service $o
* @return View|void
*/
public function update(Request $request,Service $o)
{
switch ($o->order_status) {
case 'ORDER-SENT':
if ($request->post()) {
foreach (['reference','notes'] as $key) {
$o->setOrderInfo($key,$request->post($key));
}
$o->save();
foreach ($request->post($o->stype) as $k=>$v) {
$o->type->{$k} = $v;
}
$o->type->save();
return redirect()->to(url('u/service',$o->id))->with('updated','Order sent notes updated.');
}
return $this->update_order_status($o);
default:
abort(499,'Not yet implemented');
}
}
private function update_order_status(Service $o)
{
return View('r.service.order.sent',['o'=>$o]);
}
}