More product cleanup

This commit is contained in:
2023-05-05 22:05:42 +10:00
parent dc74a064ba
commit 691180b3f0
7 changed files with 109 additions and 87 deletions

View File

@@ -17,7 +17,7 @@
<!-- $o = App\Models\Service::class -->
@section('main-content')
<div class="row">
<div class="col-4">
<div class="col-12 col-lg-4">
<form role="form" method="POST" enctype="multipart/form-data">
<div class="card card-dark">
{{ csrf_field() }}
@@ -146,26 +146,13 @@
</div>
<!-- Current Plan -->
<div class="col-4">
<div class="col-12 col-lg-8">
<div class="card card-dark">
<div class="card-body">
<div class="card-header">
<h3 class="card-title">Current Plan</h3>
</div>
@include('service.widget.internal',['o'=>$o,'p'=>$o->product])
<div class="card-header">
<h3 class="card-title">Plan Information</h3>
</div>
</div>
</div>
<!-- Proposed Plan -->
<div class="col-4">
<div class="card card-dark">
<div class="card-body">
<div class="card-header">
<h3 class="card-title">Proposed Plan</h3>
</div>
@include('service.widget.internal',['o'=>$o,'p'=>\App\Models\Product::where('id',Arr::get($o->order_info,'change_product_id'))->singleOrFail()])
</div>
</div>

View File

@@ -89,7 +89,7 @@
</div>
@can('wholesaler')
<div class="tab-pane fade" id="internal" role="tabpanel">
@include('service.widget.internal',['o'=>$o,'p'=>$o->product])
@include('service.widget.internal',['o'=>$o,'p'=>new \App\Models\Product()])
</div>
<div class="tab-pane fade {{ session()->pull('service_update') ? 'active show' : '' }}" id="update" role="tabpanel">

View File

@@ -1,13 +1,24 @@
<!-- $o = Service::class, $p = Product::class -->
@php($c=$o->product)
<table class="table table-sm">
<thead>
<tr>
<th>&nbsp;</th>
@if (($s=$o->supplied) && $s->exists)
<th>{{ $s->supplier->name }}</th>
<th class="text-center" colspan="2">This Plan</th>
<th>&nbsp;</th>
@if($p->exists)
<th class="text-center" colspan="2">Proposed Plan</th>
<th>&nbsp;</th>
@endif
<th>Us</th>
@if ($s->exists)
</tr>
<tr>
<th>&nbsp;</th>
<th>Client</th>
<th>Supplier</th>
<th>&nbsp;</th>
@if($p->exists)
<th>Client</th>
<th>Supplier</th>
<th>&nbsp;</th>
@endif
</tr>
@@ -16,75 +27,91 @@
<tbody>
<tr>
<th>Product</th>
@if ($s->exists)
<td>#{{ $s->id }}: {{ $s->name }}</td>
@endif
<td>#{{ $p->id }}: {{ $p->name }}</td>
@if ($s->exists)
<td>{{ $p->category_name }}</td>
<td class="text-center" colspan="2">#{{ $c->supplied->id }}: {{ $c->supplied->name_long }}</td>
@if ($p->exists)
<th>&nbsp;</th>
<td class="text-center" colspan="2">#{{ $p->supplied->id }}: {{ $p->supplied->name_long }}</td>
@endif
<td>{{ $c->category_name }}</td>
</tr>
<tr>
<th>Setup</th>
@if ($s->exists)
<td>${{ number_format($a=$o->account->taxed($s->setup_cost),2) }}</td>
<td>${{ number_format($b=$o->account->taxed($p->setup_charge),2) }}</td>
<td>${{ number_format($b=$o->account->taxed($c->setup_charge),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($c->setup_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@else
<td>-</td>
@if ($p->exists)
<td>${{ number_format($b=$o->account->taxed($p->setup_charge),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->setup_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@endif
</tr>
{{--
<tr>
<th>Billed</th>
@if ($s->exists)
<td>{{ $s->billing_interval_string }}</td>
@endif
<td>{{ $o->billing_interval_string }}</td>
@if ($s->exists)
<td>{{ $c->type->billing_interval_string }}</td>
<td>&nbsp;</td>
@if ($p->exists)
<td>{{ $o->billing_interval_string }}</td>
<td>{{ $p->type->billing_interval_string }}</td>
<td>&nbsp;</td>
@endif
</tr>
<tr>
<th>Billing Price</th>
@if ($s->exists)
<td>${{ number_format($a=$o->account->taxed($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,$p->billing_interval)),2) }}</td>
@endif
<td>${{ number_format($b=$o->billing_charge,2) }}</td>
@if ($s->exists)
<td @if($o->isChargeOverriden())class="text-danger"@endif>${{ number_format($b=$o->billing_charge,2) }}</td>
<td>${{ number_format($a=$o->account->taxed($c->base_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@if ($p->exists)
<td @if($o->isChargeOverriden())class="text-danger"@endif>${{ number_format($b=$o->account->taxed($p->base_charge),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->base_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@endif
</tr>
<tr>
<th>Monthly Price</th>
@if ($s->exists)
<td>${{ number_format($a=$o->account->taxed($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,1)),2) }}</td>
@endif
<td @if($x=$o->isChargeOverriden()) class="text-danger" @endif>${{ number_format($b=($x ? $o->account->taxed($p->base_charge) : $o->billing_monthly_price),2) }}</td>
@if ($s->exists)
<td @if($x=$o->isChargeOverriden()) class="text-danger" @endif>
@if($x)
<abbr title="${{ number_format($b=$o->account->taxed($c->base_charge)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}">${{ number_format($b=$o->billing_monthly_price,2) }}
@else
{{ number_format($b=$o->account->taxed($c->base_charge)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}
@endif
</td>
<td>${{ number_format($a=$o->account->taxed($c->base_cost)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@if ($p->exists)
<td @if($x=$o->isChargeOverriden()) class="text-danger" @endif>${{ number_format($b=$o->account->taxed($p->base_charge)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->base_cost)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@endif
</tr>
<tr>
<th>Contract</th>
@if ($s->exists)
<td>{{ $s->contract_term }} months</td>
@endif
<td>{{ $p->contract_term }} months</td>
@if ($s->exists)
<td>{{ $o->contract_term }} months</td>
<td>{{ $c->supplied->contract_term }} months</td>
<td>&nbsp;</td>
@if ($p->exists)
<td>{{ $p->contract_term }} months</td>
<td>{{ $p->supplied->contract_term }} months</td>
<td>&nbsp;</td>
@endif
</tr>
<tr>
<th>Min Price</th>
@if ($s->exists)
<td>${{ number_format($a=$o->account->taxed($s->min_cost),2) }}</td>
<td>${{ number_format($b=$o->account->taxed($p->getMinChargeAttribute($o->billing_interval)),2) }}</td>
<!-- @todo change this to $o->min_charge when implemented -->
<td>${{ number_format($b=$o->account->taxed($o->product->min_charge),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($c->supplied->min_cost),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@else
<td>-</td>
@if ($p->exists)
<td>${{ number_format($a=$o->account->taxed($p->min_charge),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->supplied->min_cost ?? 0),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@endif
</tr>
--}}
</tbody>
</table>