osb/resources/views/theme/backend/adminlte/supplier/widget/offerings.blade.php

85 lines
3.3 KiB
PHP
Raw Normal View History

<!-- $spo=Supplier::class -->
@use(App\Models\Supplier)
<div class="row">
2022-02-01 05:40:46 +00:00
<div class="col-5 col-sm-2">
<div class="nav flex-column nav-tabs h-100" role="tablist" aria-orientation="vertical">
@foreach(Supplier::offeringTypes($spo) 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>
</div>
2022-02-01 05:40:46 +00:00
<div class="col-7 col-sm-10">
<div class="tab-content">
@foreach(Supplier::offeringTypes($spo) 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>
<tr>
<th colspan="8">Product</th>
<th colspan="2">Services</th>
</tr>
<tr>
<th>ID</th>
<th>Product ID</th>
<th>Product Name</th>
<th>Active</th>
<th class="text-right">Setup Cost</th>
<th class="text-right">Base Cost</th>
<th class="text-right">Types</th>
<th class="text-right">Products</th>
<th class="text-right">Sold</th>
<th class="text-right">Active</th>
</tr>
</thead>
<tbody>
@foreach($xx=$offering->items->with(['products.products.services'])->get() as $oo)
<tr>
<td>{{ $oo->id }}</td>
<td>{{ $oo->name }}</td>
<td>{{ $oo->name_long }}</td>
<td class="text-right">{{ $oo->active ? 'YES' : 'NO' }}</td>
2023-05-05 05:48:24 +00:00
<td class="text-right">{{ number_format($site->taxed($oo->setup_cost),2) }}</td>
<td class="text-right">{{ number_format($site->taxed($oo->base_cost),2) }}</td>
<td class="text-right">{{ number_format($oo->products->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('products')->flatten()->pluck('services')->flatten()->filter())->count()) }}</td>
<td class="text-right">{{ number_format($x->where('active')->count()) }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<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('products')->flatten()->filter())->count()) }}</td>
<td class="text-right">{{ number_format($x->pluck('products')->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>
</tr>
</tfoot>
</table>
</div>
@endforeach
</div>
</div>
</div>
@pa(datatables)
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
@foreach(Supplier::offeringTypes($spo) as $key => $offering)
$('#offering-{{ $key }}-table').DataTable();
$('#offering-{{ $key }}-table tbody').on('click','tr', function () {
$(this).toggleClass('selected');
});
@endforeach
});
</script>
@append