This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Deon George c7e2a6866e WIP
2017-11-21 21:47:44 +11:00

213 lines
9.0 KiB
PHP

@php
use App\Models\Product;
use App\Models\Prodsum;
$codata = $data->filter(function($item,$key) use ($co) { return $item['category_id'] == $co->id; })->pop();
@endphp
@section('account')
<div class="col-sm-6 col-md-offset-0">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Deployment Summary [{{$co->name}}]</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body no-padding">
<div id="donutchart"></div>
</div>
</div>
</div>
<div class="col-sm-5 col-md-offset-0">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Account Summary [{{$co->name}}]</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<ul class="list-unstyled">
<li>Type: <strong>{{ $ao->diamond }}</strong> @if (! is_null($ao->diamondreport) AND $ao->diamond == 'Diamond') @if ($ao->diamondreport) <small>(Reporting)</small> @else <small>(Not Reporting)</small> @endif @endif</li>
<li>SDL: <strong>{{ $ao->sdl }}</strong></li>
<li>{{ $co->name }} Entitlement: <strong>J${{ array_get($codata,'entitled',0) }}m</strong> [ J${{ $data->sum('entitled') }}m ]</li>
<li>Contracts: <strong>{{ $ao->contracts()->count() }}</strong> [<strong>{{ $ao->contracts()->min('contract_start') }}</strong> -> <strong>{{ $ao->contracts()->max('contract_end') }}</strong>]</li>
<li>Projects: <strong>{{ $ao->projects()->count() }}</strong></li>
<li>Estimated Sub IN: <strong>J${{ $codata['subin'] }}m</strong></li>
<li>Estimated Sub OUT: <strong>J${{ $codata['subout'] }}m</strong></li>
@if(array_get($codata,'subchance')) <li>Estimated Sub RISK: <strong>{{ $codata['subchance'] }}</strong></li>@endif
</ul>
</div>
</div>
</div>
<div class="col-sm-5 col-md-offset-0">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Substitution Position</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body no-padding">
<div id="substitution"></div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-offset-0">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Contracts with [{{$co->name}}] Entitlement or Deployment</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body no-padding">
<table width="100%" class="table table-striped table-bordered table-hover small">
<tr>
<th>Name</th><th>Start</th><th>End</th><th>Progress</th><th>Status</th><th>Type</th>
<th class="sd-entitled">Entitled</th>
<th class="sd-actual">Actual</th>
<th class="sd-ahead">Ahead</th>
<th class="sd-behind">Behind</th>
<th class="sd-over">Over</th>
<th class="sd-assigned">Assigned</th>
<th class="sd-unassigned">Unassigned</th>
</tr>
@foreach ($ao->contracts->sortBy(['contract_start']) as $o)
<tr>
@php
$filter = $o->category_summary($ido)->filter(function($item,$key) use ($co) { return $item['category_id'] == $co->id; })->pop();
@endphp
<td>{{ $o->name }}</td>
<td>{{ $o->contract_start->format('Y-m-d') }}</td>
<td>{{ $o->contract_end->format('Y-m-d') }}</td>
<td>{{ number_format($o->progress($ido->import_date->lastOfHalf())*100,1) }}%</td>
<td>{{ $o->contract_status }} @if ($o->contract_status_reason) ({{ $o->contract_status_reason }}) @endif</td>
<td>{{ $o->contract_type }}</td>
<td class="sd-entitled">J${{ number_format(array_get($filter,'entitled'),3) }}m</td>
<td class="sd-actual">J${{ number_format(array_get($filter,'actual'),3) }}m</td>
<td class="sd-ahead">J${{ number_format(array_get($filter,'ahead'),3) }}m</td>
<td class="sd-behind">J${{ number_format(array_get($filter,'behind'),3) }}m</td>
<td class="sd-over">J${{ number_format(array_get($filter,'over'),3) }}m</td>
<td class="sd-assigned">J${{ number_format(array_get($filter,'assigned'),3) }}m</td>
<td class="sd-unassigned">J${{ number_format(array_get($filter,'unassigned'),3) }}m</td>
</tr>
@endforeach
</table>
</div>
</div>
</div>
<div class="col-sm-12 col-md-offset-0">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Projects with [{{$co->name}}] Deployment</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body no-padding">
<table width="100%" class="table table-striped table-bordered table-hover small" id="dataTables-contracts">
<tr>
<th>Name</th><th>Start</th><th>End</th><th>Status</th>
</tr>
@foreach ($ao->product_projects($ido)->filter(function($item,$key) use ($co) { return $item->category_id == $co->id; }) as $o)
<tr>
<td>{{ $o->project_name }}</td><td>{{ $o->project_start }}</td><td>{{ $o->project_end }}</td><td>{{ $o->project_status }}</td>
</tr>
@endforeach
</table>
</div>
</div>
</div>
<div class="col-sm-12 col-md-offset-0">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">[{{$co->name}}] Products</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body no-padding">
<table width="100%" class="table table-striped table-bordered table-hover small" id="dataTables-contracts">
<tr>
<th>&nbsp;</td>
<th colspan="2" class="text-center sd-entitled">Entitled</td>
<th colspan="3" class="text-center sd-deployed">Deployment</td>
<th colspan="2" class="text-center sd-unassigned">Unassigned</td>
</tr>
<tr>
<th>Name</th>
<th class="text-right sd-entitled">Qty</th>
<th class="text-right sd-entitled">Value</th>
<th class="text-right sd-deployed">Qty</th>
<th class="text-right sd-deployed">Deployed</th>
<th class="text-right sd-assigned">Assigned</th>
<th class="text-right sd-unassigned">Qty</th>
<th class="text-right sd-unassigned">Unassigned</th>
</tr>
@foreach ($ao->product_summary($ido)->filter(function($item,$key) use ($co) { return $item['category_id'] == $co->id; }) as $o)
<tr>
<td>
@if (isset($o['id']))
{{ $o['id'] }}: <a href="{{ url('/product/'.$o['id']) }}">{{ Product::find($o['id'])->name }}</a>
@elseif (isset($o['prodsum_id']))
<a href="{{ url('/prodsum/'.$o['prodsum_id']) }}">{{ Prodsum::find($o['prodsum_id'])->name }}</a>
@else
Other
@endif
</td>
<td class="text-right sd-entitled">{{ $q=$o['entitled_qty'] }}</td>
<td class="text-right sd-entitled">J${{ number_format($o['entitled'],3) }}m</td>
<td class="text-right sd-deployed">{{ $r=$o['qty'] }}</td>
<td class="text-right sd-deployed">J${{ number_format($o['deployed'],3) }}m</td>
<td class="text-right sd-assigned">J${{ number_format($o['assigned'],3) }}m</td>
<td class="text-right sd-unassigned">{{ $q-$r < 0 ? 0 : $q-$r }}</td>
<td class="text-right sd-unassigned">J${{ number_format($o['unassigned'],3) }}m</td>
</tr>
@endforeach
</table>
</div>
</div>
</div>
@endsection
@include('widgets.donut_chart',['chart'=>$codata])
@include('widgets.sub_scater',['chart'=>$data])