Added product report, showing just active products and number of services

This commit is contained in:
Deon George
2023-05-09 16:50:39 +09:00
parent b3539e6c7e
commit 45dd74aad4
5 changed files with 140 additions and 30 deletions

View File

@@ -15,34 +15,38 @@
@section('main-content')
<div class="col-md-12">
<table class="table table-sm table-striped" id="table">
<thead>
<tr>
<th>ID</th>
<th>Service</th>
<th>Product</th>
<th class="text-right">Monthly</th>
<th class="text-right">Cost</th>
<th class="text-right">Traffic (GB)</th>
<th>Supplier</th>
</tr>
</thead>
<div class="card">
<div class="card-body">
<table class="table table-sm table-striped" id="table">
<thead>
<tr>
<th>ID</th>
<th>Service</th>
<th>Product</th>
<th class="text-right">Monthly</th>
<th class="text-right">Cost</th>
<th class="text-right">Traffic (GB)</th>
<th>Supplier</th>
</tr>
</thead>
<tbody>
{{-- @todo This query is expensive still --}}
@foreach (\App\Models\Service::active()->with(['type','product.type.supplied.supplier_detail.supplier','product.translate'])->get() as $o)
<tr>
<td><a href="{{ url('u/service',[$o->id]) }}">{{ $o->id }}</a></td>
<td>{{ $o->name }}</td>
<td>{{ $o->product->name }}</td>
<td class="text-right">{{ number_format($o->billing_monthly_price,2) }}</td>
<td class="text-right">{{ number_format($o->product->cost_normalized(),2) }}</td>
<td class="text-right">{{ $o->category == 'broadband' ? number_format($o->type->usage_summary(0)->sum()/1000,1) : '-' }}</td>
<td>{{ $o->product->supplier->name }}</td>
</tr>
@endforeach
</tbody>
</table>
<tbody>
{{-- @todo This query is expensive still --}}
@foreach (\App\Models\Service::active()->with(['type','product.type.supplied.supplier_detail.supplier','product.translate'])->get() as $o)
<tr>
<td><a href="{{ url('u/service',[$o->id]) }}">{{ $o->id }}</a></td>
<td>{{ $o->name }}</td>
<td>{{ $o->product->name }}</td>
<td class="text-right">{{ number_format($o->billing_monthly_price,2) }}</td>
<td class="text-right">{{ number_format($o->product->cost_normalized(),2) }}</td>
<td class="text-right">{{ $o->category == 'broadband' ? number_format($o->type->usage_summary(0)->sum()/1000,1) : '-' }}</td>
<td>{{ $o->product->supplier->name }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection