diff --git a/app/Http/Controllers/SupplierController.php b/app/Http/Controllers/SupplierController.php index 718483f..27f1cd7 100644 --- a/app/Http/Controllers/SupplierController.php +++ b/app/Http/Controllers/SupplierController.php @@ -4,10 +4,11 @@ namespace App\Http\Controllers; use Carbon\Carbon; use Illuminate\Http\Request; +use Illuminate\Support\Arr; use App\Http\Requests\{SupplierAddEdit,SupplierProductAddEdit}; -use App\Models\{Cost,Supplier,SupplierDetail}; use App\Jobs\ImportCosts; +use App\Models\{Cost,Supplier,SupplierDetail}; class SupplierController extends Controller { @@ -20,9 +21,7 @@ class SupplierController extends Controller */ public function addedit(SupplierAddEdit $request,Supplier $o) { - $this->middleware(['auth','wholesaler']); - - foreach ($request->except(['_token','supplier_details','api_key','api_secret','submit']) as $key => $item) + foreach (Arr::except($request->validated(),['supplier_details','api_key','api_secret','submit']) as $key => $item) $o->{$key} = $item; $o->active = (bool)$request->active; @@ -51,19 +50,6 @@ class SupplierController extends Controller ->with('success','Supplier Saved'); } - /** - * Site up site wide suppliers, or a site's supplier details - * - * @note This method is protected by the routes - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View - */ - public function admin_home() - { - $this->middleware(['auth','wholesaler']); - - return view('theme.backend.adminlte.supplier.home'); - } - /** * Show the suppliers invoice * @@ -99,19 +85,9 @@ class SupplierController extends Controller $filename, )->onQueue('low'); - return redirect()->back()->with('success','File uploaded'); - } - - /** - * New Product from a supplier - * - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View - */ - public function product_add() - { - return view('theme.backend.adminlte.supplier.product.addedit') - ->with('o',new Supplier) - ->with('oo',NULL); + return redirect() + ->back() + ->with('success','File uploaded'); } public function product_addedit(SupplierProductAddEdit $request,Supplier $o,int $id,string $type) @@ -127,7 +103,7 @@ class SupplierController extends Controller $oo = Supplier\Broadband::findOrNew($id); // @todo these are broadband requirements - get them from the broadband class. - foreach ($request->only([ + foreach (Arr::only($request->validated(),[ 'supplier_detail_id', 'product_id'. 'product_desc', @@ -151,8 +127,8 @@ class SupplierController extends Controller $oo->$key = $value; // Our boolean values - foreach ($request->only(['active','extra_shaped','extra_charged']) as $key => $value) - $oo->$key = ($value == 'on' ? 1 : 0); + foreach (Arr::only($request->validated(),['active','extra_shaped','extra_charged']) as $key => $value) + $oo->{$key} = ($value == 'on' ? 1 : 0); break; @@ -162,28 +138,11 @@ class SupplierController extends Controller $oo->save(); - return redirect()->back() + return redirect() + ->back() ->with('success','Saved'); } - /** - * Edit a supplier product - * - * @param Supplier $o - * @param int $id - * @param string $type - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View - */ - public function product_view(Supplier $o,int $id,string $type) - { - $oo = $o->detail->find($type,$id); - $oo->load(['products.product.services.product.type']); - - return view('theme.backend.adminlte.supplier.product.addedit') - ->with('o',$o) - ->with('oo',$oo); - } - /** * Return the form for a specific product type * @@ -200,24 +159,10 @@ class SupplierController extends Controller $request->session()->flashInput($request->old); if ($o) - $o->load(['products.product.services']); + $o->load(['products.products.services']); return view('theme.backend.adminlte.supplier.product.widget.'.$type) ->with('o',$id ? $o : NULL) ->withErrors($request->errors); } - - /** - * View a supplier. - * - * @param Supplier|null $o - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View - */ - public function view(?Supplier $o) - { - $this->middleware(['auth','wholesaler']); - - return view('theme.backend.adminlte.supplier.details') - ->with('o',$o); - } } \ No newline at end of file diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 0d8005f..40a4cbf 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -7,6 +7,8 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; use Intuit\Traits\IntuitSocialite; +use App\Models\{Checkout,Payment,Product,Service,Supplier}; + class AppServiceProvider extends ServiceProvider { use IntuitSocialite; @@ -33,9 +35,10 @@ class AppServiceProvider extends ServiceProvider $this->bootIntuitSocialite(); - Route::model('co',\App\Models\Checkout::class); - Route::model('po',\App\Models\Payment::class); - Route::model('pdo',\App\Models\Product::class); - Route::model('so',\App\Models\Service::class); + Route::model('co',Checkout::class); + Route::model('po',Payment::class); + Route::model('pdo',Product::class); + Route::model('so',Service::class); + Route::model('spo',Supplier::class); } } \ No newline at end of file diff --git a/resources/views/theme/backend/adminlte/supplier/details.blade.php b/resources/views/theme/backend/adminlte/supplier/details.blade.php index 461ba85..986668c 100644 --- a/resources/views/theme/backend/adminlte/supplier/details.blade.php +++ b/resources/views/theme/backend/adminlte/supplier/details.blade.php @@ -1,14 +1,14 @@ @extends('adminlte::layouts.app') @section('htmlheader_title') - {{ $o->name ?: 'New Supplier' }} + {{ $spo->name ?: 'New Supplier' }} @endsection @section('page_title') - {{ $o->name ?: 'New Supplier' }} + {{ $spo->name ?: 'New Supplier' }} @endsection @section('contentheader_title') - {{ $o->name ?: 'New Supplier' }} + {{ $spo->name ?: 'New Supplier' }} @endsection @section('contentheader_description') @endsection @@ -20,7 +20,7 @@
Values determine the included traffic. A value of 0 means no traffic is included and charged at the Extra Traffic rates. An empty value means the traffic is not counted in this category.
-Any values charged at extra rates, the rate determines the value charged, and if the value is empty it will roll up to the Peak category or Down Peak if the Peak category is null.
-Values determine the included traffic. A value of 0 means no traffic is included and charged at the Extra Traffic rates. An empty value means the traffic is not counted in this category.
+Any values charged at extra rates, the rate determines the value charged, and if the value is empty it will roll up to the Peak category or Down Peak if the Peak category is null.
+{{ $offering->type }} | - @if(Arr::get($o->detail->connections,$key)) -{{ Arr::get($o->detail->connections,$key.'.user') }} | -{{ Arr::get($o->detail->connections,$key.'.pass') }} | -{{ Arr::get($o->detail->connections,$key.'.url') }} | -{{ \Carbon\Carbon::createFromFormat('Y-m-d',Arr::get($o->detail->connections,$key.'.last'))->format('Y-m-d') }} | + @if(Arr::get($spo->detail->connections,$key)) +{{ Arr::get($spo->detail->connections,$key.'.user') }} | +{{ Arr::get($spo->detail->connections,$key.'.pass') }} | +{{ Arr::get($spo->detail->connections,$key.'.url') }} | +{{ Carbon::createFromFormat('Y-m-d',Arr::get($spo->detail->connections,$key.'.last'))->format('Y-m-d') }} | {{ number_format($offering->items->count()) }} | @elsediff --git a/resources/views/theme/backend/adminlte/supplier/widget/detail.blade.php b/resources/views/theme/backend/adminlte/supplier/widget/detail.blade.php index 956b4ca..19c1deb 100644 --- a/resources/views/theme/backend/adminlte/supplier/widget/detail.blade.php +++ b/resources/views/theme/backend/adminlte/supplier/widget/detail.blade.php @@ -1,10 +1,10 @@ - + |
---|