Fix display of supplier products and offerings - wasnt including all services
This commit is contained in:
parent
b719efb58c
commit
a6f01d0864
@ -4,7 +4,6 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
|
|
||||||
use App\Http\Requests\{SupplierAddEdit,SupplierProductAddEdit};
|
use App\Http\Requests\{SupplierAddEdit,SupplierProductAddEdit};
|
||||||
use App\Models\{Cost,Supplier,SupplierDetail};
|
use App\Models\{Cost,Supplier,SupplierDetail};
|
||||||
|
@ -6,7 +6,7 @@ use Illuminate\Support\Collection;
|
|||||||
|
|
||||||
interface ProductItem
|
interface ProductItem
|
||||||
{
|
{
|
||||||
public function product();
|
public function products();
|
||||||
|
|
||||||
public function supplied();
|
public function supplied();
|
||||||
|
|
||||||
|
@ -20,11 +20,11 @@ abstract class Type extends Model
|
|||||||
/**
|
/**
|
||||||
* The product that sells this type
|
* The product that sells this type
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\MorphOne
|
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||||
*/
|
*/
|
||||||
public function product()
|
public function products()
|
||||||
{
|
{
|
||||||
return $this->morphOne(Product::class, null,'model','model_id');
|
return $this->morphMany(Product::class, null,'model','model_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,17 +33,17 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach($xx=$offering->items->with(['products.product.services'])->get() as $oo)
|
@foreach($xx=$offering->items->with(['products.products.services'])->get() as $oo)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $oo->id }}</td>
|
<td>{{ $oo->id }}</td>
|
||||||
<td>{{ $oo->name_short }}</td>
|
<td>{{ $oo->name }}</td>
|
||||||
<td>{{ $oo->name_detail }}</td>
|
<td>{{ $oo->name_long }}</td>
|
||||||
<td class="text-right">{{ $oo->active ? 'YES' : 'NO' }}</td>
|
<td class="text-right">{{ $oo->active ? 'YES' : 'NO' }}</td>
|
||||||
<td class="text-right">{{ number_format($oo->setup_cost_taxable,2) }}</td>
|
<td class="text-right">{{ number_format($oo->setup_cost_taxable,2) }}</td>
|
||||||
<td class="text-right">{{ number_format($oo->base_cost_taxable,2) }}</td>
|
<td class="text-right">{{ number_format($oo->base_cost_taxable,2) }}</td>
|
||||||
<td class="text-right">{{ number_format($oo->products->count()) }}</td>
|
<td class="text-right">{{ number_format($oo->products->count()) }}</td>
|
||||||
<td class="text-right">{{ number_format($oo->products->pluck('product')->filter()->count()) }}</td>
|
<td class="text-right">{{ number_format($oo->products->pluck('products')->filter()->count()) }}</td>
|
||||||
<td class="text-right">{{ number_format(($x=$oo->products->pluck('product.services')->flatten()->filter())->count()) }}</td>
|
<td class="text-right">{{ number_format(($x=$oo->products->pluck('products')->flatten()->pluck('services')->flatten()->filter())->count()) }}</td>
|
||||||
<td class="text-right">{{ number_format($x->where('active')->count()) }}</td>
|
<td class="text-right">{{ number_format($x->where('active')->count()) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
@ -54,8 +54,8 @@
|
|||||||
<th colspan="3">TOTALS</th>
|
<th colspan="3">TOTALS</th>
|
||||||
<td class="text-right" colspan="3">{{ $xx->where('active',TRUE)->count() }}</td>
|
<td class="text-right" colspan="3">{{ $xx->where('active',TRUE)->count() }}</td>
|
||||||
<td class="text-right">{{ number_format(($x=$xx->pluck('products')->flatten()->filter())->count()) }}</td>
|
<td class="text-right">{{ number_format(($x=$xx->pluck('products')->flatten()->filter())->count()) }}</td>
|
||||||
<td class="text-right">{{ number_format($x->pluck('product')->filter()->count()) }}</td>
|
<td class="text-right">{{ number_format($x->pluck('products')->filter()->count()) }}</td>
|
||||||
<td class="text-right">{{ number_format(($xxx=$x->pluck('product.services')->flatten()->filter())->count()) }}</td>
|
<td class="text-right">{{ number_format(($xxx=$x->pluck('products')->flatten()->pluck('services')->flatten()->filter())->count()) }}</td>
|
||||||
<td class="text-right">{{ number_format($xxx->where('active')->count()) }}</td>
|
<td class="text-right">{{ number_format($xxx->where('active')->count()) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
@ -34,9 +34,8 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach($xx=$offering->items->with(['products.product.services','products.product.type.supplied','products.product.description'])->get() as $oo)
|
@foreach($xx=$offering->items->with(['products.products.services','products.products.type.supplied','products.products.translate'])->get() as $oo)
|
||||||
@foreach($oo->products->pluck('product')->filter() as $po)
|
@foreach($oo->products->pluck('products')->flatten()->filter() as $po)
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ url('a/supplier/product/addedit',[$po->supplier->id,$po->supplied->id,$po->supplied->category]) }}">{{ $po->lid }}</a></td>
|
<td><a href="{{ url('a/supplier/product/addedit',[$po->supplier->id,$po->supplied->id,$po->supplied->category]) }}">{{ $po->lid }}</a></td>
|
||||||
<td>{{ $po->name_short }}</td>
|
<td>{{ $po->name_short }}</td>
|
||||||
@ -59,7 +58,7 @@
|
|||||||
<th colspan="3">TOTALS</th>
|
<th colspan="3">TOTALS</th>
|
||||||
<td class="text-right">{{ $xx->where('active',TRUE)->count() }}</td>
|
<td class="text-right">{{ $xx->where('active',TRUE)->count() }}</td>
|
||||||
<th colspan="5"> </th>
|
<th colspan="5"> </th>
|
||||||
<td class="text-right">{{ number_format(($xxx=$xx->pluck('products')->flatten()->pluck('product.services')->flatten()->filter())->count()) }}</td>
|
<td class="text-right">{{ number_format(($xxx=$xx->pluck('products')->flatten()->pluck('products')->flatten()->pluck('services')->flatten()->filter())->count()) }}</td>
|
||||||
<td class="text-right">{{ number_format($xxx->where('active')->count()) }}</td>
|
<td class="text-right">{{ number_format($xxx->where('active')->count()) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
Loading…
Reference in New Issue
Block a user