Work on products, first completed broadband

This commit is contained in:
Deon George
2021-12-24 12:14:01 +11:00
parent 8f5293662e
commit 1e9f15b40f
62 changed files with 2139 additions and 894 deletions

View File

@@ -1,32 +1,80 @@
<!-- $o = Service::class -->
<table class="table table-sm">
<thead>
<tr>
<th>&nbsp;</th>
<th>{{ $o->product->type->supplied->supplier_detail->supplier->name }}</th>
<th>Us</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<th>Supplier</th><td>{{ $o->product->type ? $o->product->type->supplier->name : 'Supplier Unknown' }}</td>
<th>Product</th>
<td>#{{ ($s=$o->product->type->supplied)->id }}: {{ $s->name }}</td>
<td>#{{ $o->product->id }}: {{ $o->product->name }}</td>
<td>{{ $s->type }}</td>
</tr>
<tr>
<th>Supplier Product</th><td>#{{ $o->product_id }}: {{ $o->product->type ? $o->product->type->product->product_id : 'Product Unknown' }}</td>
</tr>
@if($o->product->type)
<tr>
<!-- @todo Tax shouldnt be hard coded -->
<th>Supplier Setup</th><td>${{ number_format($o->product->type->product->setup_cost*1.1,2) }}</td>
</tr>
<tr>
<th>Supplier Cost</th><td>${{ number_format($o->product->type->cost,2) }}</td>
</tr>
<tr>
<th>Supplier Contract</th><td>{{ $o->product->type->product->contract_term }} months</td>
</tr>
<tr>
<!-- @todo Tax shouldnt be hard coded -->
<th>Supplier Min Cost</th><td>${{ number_format((($x=$o->product->type->product)->setup_cost+$x->base_cost*$x->contract_term)*1.1,2) }}</td>
</tr>
@endif
<tr>
<th>Price</th><td>${{ number_format($o->billing_monthly_price,2) }} <small>(${{ number_format($o->billing_monthly_price*12,2) }} Annually)</small></td>
</tr>
@if($o->product->type AND $o->product->type->cost)
<tr>
<th>Markup</th><td>{{ number_format(($o->billing_monthly_price/$o->product->type->cost-1)*100,2) }}%</td>
</tr>
@endif
<tr>
<th>Setup</th>
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->setup_cost,$o->account->taxes),2) }}</td>
<td>${{ number_format($b=\App\Models\Tax::tax_calc($o->product->setup_charge,$o->account->taxes),2) }}</td>
<td>
@if ($a > $b)
<span class="badge bg-danger>">({{ number_format(($a-$b)/($b ?: 1)*100,1) }})%</span>
@else
<span class="badge">{{ number_format(($b-$a)/($a ?: 1)*100,1) }}%</span>
@endif
</td>
</tr>
<tr>
<th>Billed</th>
<td>{{ $s->billing_interval_string }}</td>
<td>{{ $o->product->billing_interval_string }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<th>Billing Charge</th>
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,$o->product->billing_interval),$o->account->taxes),2) }}</td>
<td>${{ number_format($b=\App\Models\Tax::tax_calc($o->product->getBaseChargeAttribute($o->billing_interval),$o->account->taxes),2) }}</td>
<td>
@if ($a > $b)
<span class="badge bg-danger>">({{ number_format(($a-$b)/($b ?: 1)*100,1) }})%</span>
@else
<span class="badge">{{ number_format(($b-$a)/($a ?: 1)*100,1) }}%</span>
@endif
</td>
</tr>
<tr>
<th>Monthly Cost</th>
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,1),$o->account->taxes),2) }}</td>
<td>${{ number_format($b=\App\Models\Tax::tax_calc($o->product->getBaseChargeAttribute($o->billing_interval)*\App\Models\Invoice::billing_change($o->billing_interval,1),$o->account->taxes),2) }}</td>
<td>
@if ($a > $b)
<span class="badge bg-danger>">({{ number_format(($a-$b)/($b ?: 1)*100,1) }})%</span>
@else
<span class="badge">{{ number_format(($b-$a)/($a ?: 1)*100,1) }}%</span>
@endif
</td>
</tr>
<tr>
<th>Contract</th>
<td>{{ $s->contract_term }} months</td>
<td>{{ $o->product->contract_term }} months</td>
<td>&nbsp;</td>
</tr>
<tr>
<th>Min Cost</th>
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->min_cost,$o->account->taxes),2) }}</td>
<td>${{ number_format($b=\App\Models\Tax::tax_calc($o->product->getMinChargeAttribute($o->billing_interval),$o->account->taxes),2) }}</td>
<td>
@if ($a > $b)
<span class="badge bg-danger>">({{ number_format(($a-$b)/($b ?: 1)*100,1) }})%</span>
@else
<span class="badge">{{ number_format(($b-$a)/($a ?: 1)*100,1) }}%</span>
@endif
</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,57 @@
@extends('adminlte::layouts.app')
@section('htmlheader_title')
{{ $o->name ?: 'New Supplier' }}
@endsection
@section('page_title')
{{ $o->name ?: 'New Supplier' }}
@endsection
@section('contentheader_title')
{{ $o->name ?: 'New Supplier' }}
@endsection
@section('contentheader_description')
@endsection
@section('main-content')
<div class="row">
<div class="col-12">
@include('adminlte::widget.status')
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header bg-dark d-flex p-0">
<ul class="nav nav-pills w-100 p-2">
<li class="nav-item"><a class="nav-link active" href="#details" data-toggle="tab">Detail</a></li>
<li class="nav-item"><a class="nav-link" href="#products" data-toggle="tab">Products</a></li>
<li class="nav-item"><a class="nav-link" href="#offerings" data-toggle="tab">Offerings</a></li>
<li class="nav-item"><a class="nav-link" href="#connections" data-toggle="tab">Connections</a></li>
</ul>
</div>
<div class="card-body">
<div class="tab-content">
<div class="tab-pane fade active show" id="details" role="tabpanel">
@include('a.supplier.widgets.detail')
</div>
<div class="tab-pane fade" id="products" role="tabpanel">
@include('a.supplier.widgets.products')
</div>
<div class="tab-pane fade" id="offerings" role="tabpanel">
@include('a.supplier.widgets.offerings')
</div>
<div class="tab-pane fade" id="connections" role="tabpanel">
@include('a.supplier.widgets.connections')
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,34 @@
<!-- $o = Supplier::class -->
<div class="row">
<div class="col-9">
<table class="table table-sm">
<thead>
<tr>
<th>Service Type</th>
<th>User Name</th>
<th>Password</th>
<th>URL</th>
<th>Last Connect</th>
<th class="text-right">Offerings</th>
</tr>
</thead>
<tbody>
@foreach ($o->offeringTypes() as $key => $offering)
<tr>
<th>{{ $offering->type }}</th>
@if(Arr::get($o->detail->connections,$key))
<td>{{ Arr::get($o->detail->connections,$key.'.user') }}</td>
<td>{{ Arr::get($o->detail->connections,$key.'.pass') }}</td>
<td>{{ Arr::get($o->detail->connections,$key.'.url') }}</td>
<td>{{ \Carbon\Carbon::createFromFormat('Y-m-d',Arr::get($o->detail->connections,$key.'.last'))->format('Y-m-d') }}</td>
<td class="text-right">{{ number_format($offering->items->count()) }}</td>
@else
<td colspan="5">&nbsp;</td>
@endif
</tr>
@endforeach
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,185 @@
<!-- $o = Supplier::class -->
<div class="row">
<div class="col-12">
<h3>Supplier Details</h3>
<hr>
@if(session()->has('success'))
<span class="ml-3 pt-0 pb-0 pr-1 pl-1 btn btn-outline-success"><small>{{ session()->get('success') }}</small></span>
@endif
<form class="g-0 needs-validation" method="POST" enctype="multipart/form-data" role="form">
@csrf
<div class="row">
<div class="col-4">
<div class="row">
<!-- Supplier Name -->
<div class="col-9">
<div class="form-group has-validation">
<label for="name">Supplier Name</label>
<input type="text" class="form-control form-control-border @error('name') is-invalid @enderror" id="name" name="name" placeholder="Supplier Name" value="{{ old('name',$o->name) }}" required>
<span class="invalid-feedback" role="alert">
@error('name')
{{ $message }}
@else
Supplier Name required.
@enderror
</span>
</div>
</div>
<!-- Supplier Name -->
<div class="col-3">
<div class="form-group">
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
<input type="checkbox" class="custom-control-input" id="active" name="active" {{ old('active',$o->active) ? 'checked' : '' }}>
<label class="custom-control-label" for="active">Active</label>
</div>
</div>
</div>
</div>
<div class="row">
<!-- Address Lines -->
<div class="col-12">
<div class="form-group has-validation">
<label for="address1">Address Lines</label>
<input type="text" class="form-control form-control-border @error('address1') is-invalid @enderror" id="address1" name="address1" placeholder="Address1" value="{{ old('address1',$o->address1) }}" required>
<input type="text" class="form-control form-control-border" id="address2" name="address2" placeholder="Address2" value="{{ old('address2',$o->address2) }}">
<span class="invalid-feedback" role="alert">
@error('address1')
{{ $message }}
@else
Atleast 1 address line required.
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- City -->
<div class="col-12">
<div class="form-group has-validation">
<label for="city">City</label>
<input type="text" class="form-control form-control-border @error('city') is-invalid @enderror" id="city" name="city" placeholder="City" value="{{ old('city',$o->city) }}">
<span class="invalid-feedback" role="alert">
@error('city')
{{ $message }}
@else
City is required.
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- State -->
<div class="col-9">
<div class="form-group has-validation">
<label for="state">State</label>
<input type="text" class="form-control form-control-border @error('state') is-invalid @enderror" id="state" name="state" placeholder="State" value="{{ old('state',$o->state) }}">
<span class="invalid-feedback" role="alert">
@error('state')
{{ $message }}
@else
State is required.
@enderror
</span>
</div>
</div>
<!-- Postal Code -->
<div class="col-3">
<div class="form-group has-validation">
<label for="postcode">Postal Code</label>
<input type="text" class="form-control form-control-border @error('postcode') is-invalid @enderror" id="postcode" name="postcode" placeholder="Postal Code" value="{{ old('postcode',$o->postcode) }}">
<span class="invalid-feedback" role="alert">
@error('postcode')
{{ $message }}
@else
Postcode is required.
@enderror
</span>
</div>
</div>
</div>
</div>
<div class="offset-1 col-4">
<div class="row">
<!-- Accounts Email -->
<div class="col-12">
<div class="form-group has-validation">
<label for="accounts">Accounts Email</label>
<input type="accounts" class="form-control form-control-border @error('supplier_details.accounts') is-invalid @enderror" id="accounts" name="supplier_details[accounts]" placeholder="Accounts Email" value="{{ old('supplier_details.accounts',($o->detail ? $o->detail->accounts : '')) }}">
<span class="invalid-feedback" role="alert">
@error('supplier_details.accounts')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- Support Email -->
<div class="col-12">
<div class="form-group has-validation">
<label for="support">Support Email</label>
<input type="support" class="form-control form-control-border @error('supplier_details.support') is-invalid @enderror" id="support" name="supplier_details[support]" placeholder="Support Email" value="{{ old('supplier_details.support',($o->detail ? $o->detail->support : '')) }}">
<span class="invalid-feedback" role="alert">
@error('supplier_details.support')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- Payment Details -->
<div class="col-12">
<div class="form-group has-validation">
<label for="payments">Payment Details</label>
<input type="payments" class="form-control form-control-border @error('supplier_details.payments') is-invalid @enderror" id="payments" name="supplier_details[payments]" placeholder="Payment Details" value="{{ old('supplier_details.payments',($o->detail ? $o->detail->payments : '')) }}">
<span class="invalid-feedback" role="alert">
@error('supplier_details.payments')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<!-- Notes -->
<div class="col-12">
<div class="form-group has-validation">
<label for="notes">Notes</label>
<textarea class="form-control @error('supplier_details.notes') is-invalid @enderror" id="notes" name="supplier_details[notes]" placeholder="Notes...">{{ old('supplier_details.notes',($o->detail ? $o->detail->notes : '')) }}</textarea>
<span class="input-helper">Notes.</span>
<span class="invalid-feedback" role="alert">
@error('supplier_details.notes')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- Buttons -->
<div class="col-12">
<a href="{{ url('/home') }}" class="btn btn-danger">Cancel</a>
@can('wholesaler')
<button type="submit" name="submit" class="btn btn-success mr-0 float-right">@if ($o->exists)Save @else Add @endif</button>
@endcan
</div>
</div>
</form>
</div>
</div>

View File

@@ -0,0 +1,84 @@
<!-- $o = Supplier::class -->
<div class="row">
<div class="col-5 col-sm-3">
<div class="nav flex-column nav-tabs h-100" role="tablist" aria-orientation="vertical">
@foreach($o->offeringTypes() 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>
<div class="col-7 col-sm-9">
<div class="tab-content">
@foreach($o->offeringTypes() 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(['types.product.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>
<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($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('types')->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>
</tr>
</tfoot>
</table>
</div>
@endforeach
</div>
</div>
</div>
@section('page-scripts')
@css(datatables,bootstrap4)
@js(datatables,bootstrap4)
<script type="text/javascript">
$(document).ready(function() {
@foreach($o->offeringTypes() as $key => $offering)
$('#offering-{{ $key }}-table').DataTable();
$('#offering-{{ $key }}-table tbody').on('click','tr', function () {
$(this).toggleClass('selected');
});
@endforeach
});
</script>
@append

View File

@@ -0,0 +1,88 @@
<!-- $o = Supplier::class -->
<div class="row">
<div class="col-5 col-sm-3">
<div class="nav flex-column nav-tabs h-100" role="tablist" aria-orientation="vertical">
@foreach($o->offeringTypes() 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>
</div>
<div class="col-7 col-sm-9">
<div class="tab-content">
@foreach($o->offeringTypes() 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>
<tr>
<th colspan="7">Product</th>
<th colspan="4">Services</th>
</tr>
<tr>
<th>ID</th>
<th>Product ID</th>
<th>Product Name</th>
<th>Active</th>
<th>Default Billing</th>
<th class="text-right">Setup Cost</th>
<th class="text-right">Base Cost</th>
<th class="text-right">Setup Charge</th>
<th class="text-right">Base Charge</th>
<th class="text-right">Sold</th>
<th class="text-right">Active</th>
</tr>
</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)
<tr>
<td>{{ $po->lid }}</td>
<td>{{ $po->name_short }}</td>
<td>{{ $po->name }}</td>
<td class="text-right">{{ $po->active ? 'YES' : 'NO' }}</td>
<td class="text-right">{{ $po->billing_interval_string }}</td>
<td class="text-right">{{ number_format($po->setup_cost_taxable,2) }}</td>
<td class="text-right">{{ number_format($po->base_cost_taxable,2) }}</td>
<td class="text-right">{{ number_format($po->setup_charge_taxable,2) }}</td>
<td class="text-right">{{ number_format($po->base_charge_taxable,2) }}</td>
<td class="text-right">{{ number_format($po->services->count()) }}</td>
<td class="text-right">{{ number_format($po->services->where('active')->count()) }}</td>
</tr>
@endforeach
@endforeach
</tbody>
<tfoot>
<tr>
<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->where('active')->count()) }}</td>
</tr>
</tfoot>
</table>
</div>
@endforeach
</div>
</div>
</div>
@section('page-scripts')
@css(datatables,bootstrap4)
@js(datatables,bootstrap4)
<script type="text/javascript">
$(document).ready(function() {
@foreach($o->offeringTypes() as $key => $offering)
$('#products-{{ $key }}-table').DataTable();
$('#products-{{ $key }}-table tbody').on('click','tr', function () {
$(this).toggleClass('selected');
});
@endforeach
});
</script>
@append

View File

@@ -1,225 +0,0 @@
@extends('adminlte::layouts.app')
@section('htmlheader_title')
{{ $o->name ?: 'New Supplier' }}
@endsection
@section('page_title')
{{ $o->name ?: 'New Supplier' }}
@endsection
@section('contentheader_title')
{{ $o->name ?: 'New Supplier' }}
@endsection
@section('contentheader_description')
@endsection
@section('main-content')
<div class="row">
<div class="col-12">
@include('adminlte::widget.status')
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header bg-dark d-flex p-0">
<ul class="nav nav-pills w-100 p-2">
<li class="nav-item"><a class="nav-link active" href="#details" data-toggle="tab">Details</a></li>
<li class="nav-item"><a class="nav-link " href="#products" data-toggle="tab">Products</a></li>
</ul>
</div>
<div class="card-body">
<div class="tab-content">
<div class="tab-pane fade active show" id="details" role="tabpanel">
<h3>Supplier Details</h3>
<hr>
@if(session()->has('success'))
<span class="ml-3 pt-0 pb-0 pr-1 pl-1 btn btn-outline-success"><small>{{ session()->get('success') }}</small></span>
@endif
<form class="g-0 needs-validation" method="POST" enctype="multipart/form-data" role="form">
@csrf
<div class="row">
<div class="col-4">
<div class="row">
<!-- Supplier Name -->
<div class="col-9">
<div class="form-group has-validation">
<label for="name">Supplier Name</label>
<input type="text" class="form-control form-control-border @error('name') is-invalid @enderror" id="name" name="name" placeholder="Supplier Name" value="{{ old('name',$o->name) }}" required>
<span class="invalid-feedback" role="alert">
@error('name')
{{ $message }}
@else
Supplier Name required.
@enderror
</span>
</div>
</div>
<!-- Supplier Name -->
<div class="col-3">
<div class="form-group">
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
<input type="checkbox" class="custom-control-input" id="active" name="active" {{ old('active',$o->active) ? 'checked' : '' }}>
<label class="custom-control-label" for="active">Active</label>
</div>
</div>
</div>
</div>
<div class="row">
<!-- Address Lines -->
<div class="col-12">
<div class="form-group has-validation">
<label for="address1">Address Lines</label>
<input type="text" class="form-control form-control-border @error('address1') is-invalid @enderror" id="address1" name="address1" placeholder="Address1" value="{{ old('address1',$o->address1) }}" required>
<input type="text" class="form-control form-control-border" id="address2" name="address2" placeholder="Address2" value="{{ old('address2',$o->address2) }}">
<span class="invalid-feedback" role="alert">
@error('address1')
{{ $message }}
@else
Atleast 1 address line required.
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- City -->
<div class="col-12">
<div class="form-group has-validation">
<label for="city">City</label>
<input type="text" class="form-control form-control-border @error('city') is-invalid @enderror" id="city" name="city" placeholder="City" value="{{ old('city',$o->city) }}">
<span class="invalid-feedback" role="alert">
@error('city')
{{ $message }}
@else
City is required.
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- State -->
<div class="col-9">
<div class="form-group has-validation">
<label for="state">State</label>
<input type="text" class="form-control form-control-border @error('state') is-invalid @enderror" id="state" name="state" placeholder="State" value="{{ old('state',$o->state) }}">
<span class="invalid-feedback" role="alert">
@error('state')
{{ $message }}
@else
State is required.
@enderror
</span>
</div>
</div>
<!-- Postal Code -->
<div class="col-3">
<div class="form-group has-validation">
<label for="postcode">Postal Code</label>
<input type="text" class="form-control form-control-border @error('postcode') is-invalid @enderror" id="postcode" name="postcode" placeholder="Postal Code" value="{{ old('postcode',$o->postcode) }}">
<span class="invalid-feedback" role="alert">
@error('postcode')
{{ $message }}
@else
Postcode is required.
@enderror
</span>
</div>
</div>
</div>
</div>
<div class="offset-1 col-4">
<div class="row">
<!-- Accounts Email -->
<div class="col-12">
<div class="form-group has-validation">
<label for="accounts">Accounts Email</label>
<input type="accounts" class="form-control form-control-border @error('supplier_details.accounts') is-invalid @enderror" id="accounts" name="supplier_details[accounts]" placeholder="Accounts Email" value="{{ old('supplier_details.accounts',($o->detail ? $o->detail->accounts : '')) }}">
<span class="invalid-feedback" role="alert">
@error('supplier_details.accounts')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- Support Email -->
<div class="col-12">
<div class="form-group has-validation">
<label for="support">Support Email</label>
<input type="support" class="form-control form-control-border @error('supplier_details.support') is-invalid @enderror" id="support" name="supplier_details[support]" placeholder="Support Email" value="{{ old('supplier_details.support',($o->detail ? $o->detail->support : '')) }}">
<span class="invalid-feedback" role="alert">
@error('supplier_details.support')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- Payment Details -->
<div class="col-12">
<div class="form-group has-validation">
<label for="payments">Payment Details</label>
<input type="payments" class="form-control form-control-border @error('supplier_details.payments') is-invalid @enderror" id="payments" name="supplier_details[payments]" placeholder="Payment Details" value="{{ old('supplier_details.payments',($o->detail ? $o->detail->payments : '')) }}">
<span class="invalid-feedback" role="alert">
@error('supplier_details.payments')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<!-- Notes -->
<div class="col-12">
<div class="form-group has-validation">
<label for="notes">Notes</label>
<textarea class="form-control @error('supplier_details.notes') is-invalid @enderror" id="notes" name="supplier_details[notes]" placeholder="Notes...">{{ old('supplier_details.notes',($o->detail ? $o->detail->notes : '')) }}</textarea>
<span class="input-helper">Notes.</span>
<span class="invalid-feedback" role="alert">
@error('supplier_details.notes')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- Buttons -->
<div class="col-12">
<a href="{{ url('/home') }}" class="btn btn-danger">Cancel</a>
@can('wholesaler')
<button type="submit" name="submit" class="btn btn-success mr-0 float-right">@if ($o->exists)Save @else Add @endif</button>
@endcan
</div>
</div>
</form>
</div>
<div class="tab-pane fade" id="products" role="tabpanel">
Products.
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -102,7 +102,7 @@
<tr id="invoice-services">
<td>{{ $po->count }}</td>
<td>#{{ $po->lid }}</td>
<td colspan="2">{{ $po->name($o->account->user->language) }}</td>
<td colspan="2">{{ $po->name }}</td>
<td colspan="3" class="text-right">${{ number_format($o->items->filter(function($item) use ($po) {return $item->product_id == $po->id; })->sum('total'),$o->currency()->rounding) }}</td>
</tr>

View File

@@ -42,7 +42,8 @@
<li class="nav-item"><a class="nav-link" href="#emails" data-toggle="tab">Emails</a></li>
--}}
@can('wholesaler')
<li class="nav-item ml-auto"><a class="nav-link" href="#internal" data-toggle="tab">Internal</a></li>
<li class="nav-item ml-auto"><a class="nav-link" href="#internal" data-toggle="tab">Billing History</a></li>
<li class="nav-item"><a class="nav-link" href="#internal" data-toggle="tab">Internal</a></li>
<li class="nav-item"><a class="nav-link {{ session()->has('service_update') ? 'active' : '' }}" href="#update" data-toggle="tab">Update</a></li>
@endcan
</ul>

View File

@@ -10,7 +10,7 @@
<thead>
<tr>
<th>ID</th>
<th>Category</th>
<th>Type</th>
<th>Service</th>
<th>Product</th>
<th>Next Invoice</th>
@@ -21,9 +21,9 @@
@foreach ($o->services as $oo)
<tr>
<td><a href="{{ url('u/service',[$oo->id]) }}">{{ $oo->sid }}</a></td>
<td>{{ $oo->product_category }}</td>
<td>{{ $oo->service_type }}</td>
<td>{{ $oo->name_short }}</td>
<td>{{ $oo->product_name }}</td>
<td>{{ $oo->product->name }}</td>
<td>{{ $oo->external_billing ? '-' : $oo->next_invoice->format('Y-m-d') }}</td>
</tr>
@endforeach

View File

@@ -7,7 +7,7 @@
@php
$po = $selected = NULL;
@endphp
@foreach (\App\Models\Product::active()->get()->filter(function($item) { return $item->type && (get_class($item->type) == 'App\Models\Product\Adsl'); })->sortBy('name') as $o)
@foreach (\App\Models\Product::active()->get()->filter(function($item) { return $item->type && (get_class($item->type) == 'App\Models\Product\Broadband'); })->sortBy('name') as $o)
@php
if ($o->id == old('product_id')) {
$selected = 'selected';

View File

@@ -1,3 +1,4 @@
<!-- $o = Service\Broadband::class -->
<div class="card">
@if($o->service->isPending())
<div class="ribbon-wrapper ribbon-lg">
@@ -44,7 +45,7 @@
@endif
<tr>
<th>Speed</th>
<td>{{ $o->service->product->type->product->speed }} Mbps</td>
<td>{{ $o->supplied()->speed() }} Mbps</td>
</tr>
<!-- @todo -->
<tr>

View File

@@ -9,7 +9,7 @@
<div class="container">
<div class="col-12">
<h1>Order Service</h1>
@if ($errors->count()))<h4><span class="note-danger">There were errors with your order, please try again.</span></h4>@endif
@if ($errors->count())<h4><span class="note-danger">There were errors with your order, please try again.</span></h4>@endif
<div class="order-page" id="order-page">
<div class="row">
<div class="col-3">

View File

@@ -1,8 +1,9 @@
@if(View::exists('order.widget.info.'.$o->category))
<!-- $o = Product::class [{{$o->product_type}}]-->
@if(View::exists('order.widget.info.'.strtolower($o->product_type)))
<div class="box box-primary">
<div class="box-body">
{{-- Return Category Requirements --}}
@include('order.widget.info.'.$o->category)
@include('order.widget.info.'.strtolower($o->product_type))
{{-- Return Supplier Requirements --}}
{{-- Return Product Requirements --}}

View File

@@ -1,30 +0,0 @@
<div class="col-md-12">
<p>{!! $o->description !!}</p>
</div>
<table class="table table-condensed">
<tr>
<th>Type</th>
<td class="text-right">VOIP</td>
</tr>
<tr>
<th>Setup Charges</th>
<td class="text-right">${{ is_numeric($o->setup_cost) ? number_format($o->setup_cost,2) : $o->setup_cost }}</td>
</tr>
<tr>
<th>Cost</th>
<td class="text-right">${{ is_numeric($o->default_cost) ? number_format($o->default_cost,2) : $o->default_cost }}</td>
</tr>
<tr>
<th>Default Billing</th>
<td class="text-right">{{ is_numeric($o->default_billing) ? number_format($o->default_billing,2) : $o->default_billing }}</td>
</tr>
<tr>
<th>Contract Term</th>
<td class="text-right">{{ $o->contract_term }} mths</td>
</tr>
<tr>
<th>Minimum Costs</th>
<td class="text-right">${{ is_numeric($o->minimum_cost) ? number_format($o->minimum_cost,2) : $o->minimum_cost }}</td>
</tr>
</table>

View File

@@ -1,3 +1,4 @@
<!-- $o = Product::class -->
<div class="col-md-12">
<p>{!! $o->description !!}</p>
</div>
@@ -9,15 +10,15 @@
</tr>
<tr>
<th>Setup Charges <sup>*</sup></th>
<td class="text-right">${{ is_numeric($o->setup_cost) ? number_format($o->setup_cost,2) : $o->setup_cost }}</td>
<td class="text-right">${{ number_format($o->setup_charge_taxable,2) }}</td>
</tr>
<tr>
<th>Cost <sup>+</sup></th>
<td class="text-right">${{ is_numeric($o->default_cost) ? number_format($o->default_cost,2) : $o->default_cost }}</td>
<td class="text-right">${{ number_format($o->base_charge_taxable,2) }}</td>
</tr>
<tr>
<th>Default Billing</th>
<td class="text-right">{{ is_numeric($o->default_billing) ? number_format($o->default_billing,2) : $o->default_billing }}</td>
<td class="text-right">{{ $o->billing_interval_string }}</td>
</tr>
<tr>
<th>Contract Term</th>
@@ -25,7 +26,7 @@
</tr>
<tr>
<th>Minimum Costs <sup>+*</sup></th>
<td class="text-right">${{ is_numeric($o->minimum_cost) ? number_format($o->minimum_cost,2) : $o->minimum_cost }}</td>
<td class="text-right">${{ number_format($o->min_charge_taxable,2) }}</td>
</tr>
<tfoot>

View File

@@ -0,0 +1,31 @@
<!-- $o = Product::class -->
<div class="col-md-12">
<p>{!! $o->description !!}</p>
</div>
<table class="table table-condensed">
<tr>
<th>Type</th>
<td class="text-right">{{ $o->product_type }}</td>
</tr>
<tr>
<th>Setup Charges</th>
<td class="text-right">${{ number_format($o->setup_charge_taxable,2) }}</td>
</tr>
<tr>
<th>Cost</th>
<td class="text-right">${{ number_format($o->base_charge_taxable,2) }}</td>
</tr>
<tr>
<th>Default Billing</th>
<td class="text-right">{{ $o->billing_interval_string }}</td>
</tr>
<tr>
<th>Contract Term</th>
<td class="text-right">{{ $o->contract_term }} mths</td>
</tr>
<tr>
<th>Minimum Costs</th>
<td class="text-right">${{ number_format($o->min_charge_taxable,2) }}</td>
</tr>
</table>

View File

@@ -1,4 +1,5 @@
@if(View::exists('order.widget.order.'.$o->category))
<!-- $o = Product::class -->
@if(View::exists('order.widget.order.'.strtolower($o->product_type)))
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Order Configuration</h3>
@@ -6,7 +7,7 @@
<div class="box-body">
{{-- Return Category Requirements --}}
@include('order.widget.order.'.$o->category)
@include('order.widget.order.'.strtolower($o->product_type))
{{-- Return Supplier Requirements --}}
{{-- Return Product Requirements --}}