diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index faebccf..7e3c825 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -43,6 +43,14 @@ class ProductController extends Controller ->sortBy('name') ->values(); + case 'App\Models\Product\Phone': + return Product\Phone::select(['id','supplier_item_id']) + ->with(['supplied.supplier_detail.supplier']) + ->get() + ->map(function($item) { return ['id'=>$item->id,'name'=>sprintf('%s: %s',$item->supplied->supplier_detail->supplier->name,$item->supplied->name)]; }) + ->sortBy('name') + ->values(); + default: throw new \Exception('Unknown type: '.$request->type); } @@ -91,7 +99,8 @@ class ProductController extends Controller if (! $o->exists && $request->name) $o = Product::where('name',$request->name)->firstOrNew(); - return view('a.product.details') + return view('product.details') + ->with('breadcrumb',collect(['Products'=>url('a/product')])) ->with('o',$o); } @@ -103,6 +112,6 @@ class ProductController extends Controller */ public function home() { - return view('a.product.home'); + return view('product.home'); } } \ No newline at end of file diff --git a/app/Models/Service.php b/app/Models/Service.php index d9d9308..fe0ae9b 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -775,7 +775,7 @@ class Service extends Model implements IDs */ public function getNameShortAttribute() { - return $this->type->getServiceNameAttribute() ?: 'SID:'.$this->sid; + return ($this->type && $this->type->getServiceNameAttribute()) ? $this->type->getServiceNameAttribute() : 'SID:'.$this->sid; } /** @@ -790,7 +790,7 @@ class Service extends Model implements IDs */ public function getNameDetailAttribute() { - return $this->type->getServiceDescriptionAttribute(); + return ($this->type && $this->type->getServiceDescriptionAttribute()) ? $this->type->getServiceDescriptionAttribute() : 'No Description'; } /** diff --git a/app/Models/SupplierDetail.php b/app/Models/SupplierDetail.php index 19887a7..1661ed1 100644 --- a/app/Models/SupplierDetail.php +++ b/app/Models/SupplierDetail.php @@ -53,6 +53,10 @@ class SupplierDetail extends Model $item = $this->broadbands->where('id',$id); break; + case 'phone': + $item = $this->phones->where('id',$id); + break; + default: throw new \Exception('Unknown type: '.$type); } diff --git a/resources/views/theme/backend/adminlte/a/product/home.blade.php b/resources/views/theme/backend/adminlte/a/product/home.blade.php deleted file mode 100644 index 9538acc..0000000 --- a/resources/views/theme/backend/adminlte/a/product/home.blade.php +++ /dev/null @@ -1,70 +0,0 @@ -@extends('adminlte::layouts.app') - -@section('htmlheader_title') - Product -@endsection -@section('page_title') - Product -@endsection - -@section('contentheader_title') - Product -@endsection -@section('contentheader_description') -@endsection - -@section('main-content') -
ID | +Date Start | +Date Stop | +Data Invoiced | +Active | +Charge | +
---|---|---|---|---|---|
{{ $so->sid }} | +{{ $so->start_at ? $so->start_at->format('Y-m-d') : '-' }} | +{{ $so->stop_at ? $so->stop_at->format('Y-m-d') : '-' }} | +{{ $so->invoice_to ? $so->invoice_to->format('Y-m-d') : '-' }} | +{{ $so->active ? 'YES' : 'NO' }} | +{{ number_format($so->billing_charge,2) }} | +
No services use this product.
+ @endif +