Some order processing
This commit is contained in:
@@ -5,11 +5,43 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
use App\Models\SiteDetails;
|
||||
use App\Mail\OrderRequestApprove;
|
||||
use App\Models\{Service,SiteDetails};
|
||||
|
||||
class AdminHomeController extends Controller
|
||||
{
|
||||
public function service(Service $o)
|
||||
{
|
||||
return View('a.service',['o'=>$o]);
|
||||
}
|
||||
|
||||
public function service_update(Request $request, Service $o)
|
||||
{
|
||||
switch (strtolower($request->input('action')))
|
||||
{
|
||||
case 'approve':
|
||||
// Send an email to the supplier.
|
||||
// @todo Change to address to suppliers email address.
|
||||
Mail::to('help@graytech.net.au')
|
||||
->queue((new OrderRequestApprove($o,$request->input('order_notes') ?: 'NONE'))->onQueue('high'));
|
||||
|
||||
// Send an email to the client.
|
||||
// @todo Your order has been submitted to supplier.
|
||||
|
||||
// Update the service to "ORDER-SENT"
|
||||
$o->nextStatus();
|
||||
break;
|
||||
|
||||
// No action specified.
|
||||
default:
|
||||
return $this->service($o);
|
||||
}
|
||||
|
||||
return redirect(url('/a/service/',[$o->id]));
|
||||
}
|
||||
|
||||
public function setup()
|
||||
{
|
||||
return view('a.setup');
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\{Invoice,Service};
|
||||
use App\User;
|
||||
use PDF;
|
||||
|
||||
@@ -14,16 +14,6 @@ class UserHomeController extends Controller
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function invoice(Invoice $o)
|
||||
{
|
||||
return View('u.invoice',['o'=>$o]);
|
||||
}
|
||||
|
||||
public function invoice_pdf(Invoice $o)
|
||||
{
|
||||
return PDF::loadView('u.invoice', ['o'=>$o])->stream(sprintf('%s.pdf',$o->invoice_account_id));
|
||||
}
|
||||
|
||||
public function home()
|
||||
{
|
||||
switch (Auth::user()->role()) {
|
||||
@@ -41,6 +31,16 @@ class UserHomeController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function invoice(Invoice $o)
|
||||
{
|
||||
return View('u.invoice',['o'=>$o]);
|
||||
}
|
||||
|
||||
public function invoice_pdf(Invoice $o)
|
||||
{
|
||||
return PDF::loadView('u.invoice', ['o'=>$o])->stream(sprintf('%s.pdf',$o->invoice_account_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to redirect to the old site, when functions are not available in this one.
|
||||
*
|
||||
@@ -55,6 +55,11 @@ class UserHomeController extends Controller
|
||||
abort(307,sprintf('http://www.graytech.net.au/u/%s/%s/%s',$type,$action,$id));
|
||||
}
|
||||
|
||||
public function service(Service $o)
|
||||
{
|
||||
return View('u.service',['o'=>$o]);
|
||||
}
|
||||
|
||||
public function User(User $o)
|
||||
{
|
||||
// @todo Check authorised to see this account.
|
||||
|
Reference in New Issue
Block a user