Enable editing of supplier products and listing services connected to them

This commit is contained in:
Deon George
2022-06-30 23:51:20 +10:00
parent fb416306e7
commit 5297ae8a62
33 changed files with 963 additions and 182 deletions

View File

@@ -14,7 +14,7 @@
</thead>
<tbody>
@foreach ($o->offeringTypes() as $key => $offering)
@foreach (\App\Models\Supplier::offeringTypes($o) as $key => $offering)
<tr>
<th>{{ $offering->type }}</th>
@if(Arr::get($o->detail->connections,$key))

View File

@@ -6,7 +6,7 @@
<select class="form-control form-control-border" id="cost_id" name="cost_id">
<option value=""></option>
<option value="">Add New</option>
@foreach(\App\Models\Cost::orderBy('billed_at','DESC')->get() as $oo)
@foreach(\App\Models\Cost::where('supplier_id',$o->id)->orderBy('billed_at','DESC')->get() as $oo)
<option value="{{ $oo->id }}">{{ $oo->billed_at->format('Y-m-d') }}: ${{ number_format($oo->total,2) }}</option>
@endforeach
</select>

View File

@@ -2,7 +2,7 @@
<div class="row">
<div class="col-5 col-sm-2">
<div class="nav flex-column nav-tabs h-100" role="tablist" aria-orientation="vertical">
@foreach($o->offeringTypes() as $key => $offering)
@foreach(\App\Models\Supplier::offeringTypes($o) as $key => $offering)
<a class="nav-link @if($loop->first)active @endif" id="offering-{{ $key }}-tab" data-toggle="pill" href="#offering-{{ $key }}-profile" role="tab" aria-controls="offering-{{ $key }}-tab" aria-selected="true">{{ $offering->type }}</a>
@endforeach
</div>
@@ -10,7 +10,7 @@
<div class="col-7 col-sm-10">
<div class="tab-content">
@foreach($o->offeringTypes() as $key => $offering)
@foreach(\App\Models\Supplier::offeringTypes($o) as $key => $offering)
<div class="tab-pane text-left fade show @if($loop->first)active @endif" id="offering-{{ $key }}-profile" role="tabpanel" aria-labelledby="offering-{{ $key }}-tab">
<table class="table table-sm table-bordered w-100" id="offering-{{ $key }}-table">
<thead>
@@ -33,7 +33,7 @@
</thead>
<tbody>
@foreach($xx=$offering->items->with(['types.product.services'])->get() as $oo)
@foreach($xx=$offering->items->with(['products.product.services'])->get() as $oo)
<tr>
<td>{{ $oo->id }}</td>
<td>{{ $oo->name }}</td>
@@ -41,9 +41,9 @@
<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->base_cost_taxable,2) }}</td>
<td class="text-right">{{ number_format($oo->types->count()) }}</td>
<td class="text-right">{{ number_format($oo->types->pluck('product')->filter()->count()) }}</td>
<td class="text-right">{{ number_format(($x=$oo->types->pluck('product.services')->flatten()->filter())->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(($x=$oo->products->pluck('product.services')->flatten()->filter())->count()) }}</td>
<td class="text-right">{{ number_format($x->where('active')->count()) }}</td>
</tr>
@endforeach
@@ -53,7 +53,7 @@
<tr>
<th colspan="3">TOTALS</th>
<td class="text-right" colspan="3">{{ $xx->where('active',TRUE)->count() }}</td>
<td class="text-right">{{ number_format(($x=$xx->pluck('types')->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(($xxx=$x->pluck('product.services')->flatten()->filter())->count()) }}</td>
<td class="text-right">{{ number_format($xxx->where('active')->count()) }}</td>
@@ -72,7 +72,7 @@
<script type="text/javascript">
$(document).ready(function() {
@foreach($o->offeringTypes() as $key => $offering)
@foreach(\App\Models\Supplier::offeringTypes($o) as $key => $offering)
$('#offering-{{ $key }}-table').DataTable();
$('#offering-{{ $key }}-table tbody').on('click','tr', function () {

View File

@@ -2,7 +2,7 @@
<div class="row">
<div class="col-5 col-sm-2">
<div class="nav flex-column nav-tabs h-100" role="tablist" aria-orientation="vertical">
@foreach($o->offeringTypes() as $key => $offering)
@foreach(\App\Models\Supplier::offeringTypes($o) as $key => $offering)
<a class="nav-link @if($loop->first)active @endif" id="products-{{ $key }}-tab" data-toggle="pill" href="#products-{{ $key }}-profile" role="tab" aria-controls="products-{{ $key }}-tab" aria-selected="true">{{ $offering->type }}</a>
@endforeach
</div>
@@ -10,7 +10,7 @@
<div class="col-7 col-sm-10">
<div class="tab-content">
@foreach($o->offeringTypes() as $key => $offering)
@foreach(\App\Models\Supplier::offeringTypes($o) as $key => $offering)
<div class="tab-pane text-left fade show @if($loop->first)active @endif" id="products-{{ $key }}-profile" role="tabpanel" aria-labelledby="products-{{ $key }}-tab">
<table class="table table-sm table-bordered w-100" id="products-{{ $key }}-table">
<thead>
@@ -34,11 +34,11 @@
</thead>
<tbody>
@foreach($xx=$offering->items->with(['types.product.services','types.product.type.supplied','types.product.description'])->get() as $oo)
@foreach($oo->types->pluck('product')->filter() as $po)
@foreach($xx=$offering->items->with(['products.product.services','products.product.type.supplied','products.product.description'])->get() as $oo)
@foreach($oo->products->pluck('product')->filter() as $po)
<tr>
<td>{{ $po->lid }}</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 }}</td>
<td class="text-right">{{ $po->active ? 'YES' : 'NO' }}</td>
@@ -59,7 +59,7 @@
<th colspan="3">TOTALS</th>
<td class="text-right">{{ $xx->where('active',TRUE)->count() }}</td>
<th colspan="5">&nbsp;</th>
<td class="text-right">{{ number_format(($xxx=$xx->pluck('types')->flatten()->pluck('product.services')->flatten()->filter())->count()) }}</td>
<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->where('active')->count()) }}</td>
</tr>
</tfoot>
@@ -76,7 +76,7 @@
<script type="text/javascript">
$(document).ready(function() {
@foreach($o->offeringTypes() as $key => $offering)
@foreach(\App\Models\Supplier::offeringTypes($o) as $key => $offering)
$('#products-{{ $key }}-table').DataTable();
$('#products-{{ $key }}-table tbody').on('click','tr', function () {