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.
memberdb/resources/theme/backend/adminlte/widgets/product-iot.blade.php

108 lines
5.0 KiB
PHP
Raw Permalink Normal View History

2017-08-05 23:53:57 +00:00
@section('product')
@php
$cols = $model->find($pdata->pluck($model_key)->unique())->sortBy('name');
@endphp
<!-- Default box -->
<div class="container-fluid spark-screen">
<div class="row">
<div class="col-md-12 col-md-offset-0">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"> Product Data: {{ $co->name }} ({{$co->segment->unit->name."|".$co->segment->name}}) as at {{ $ido->import_date->format('Y-m-d') }}</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">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active"><a data-target="#entitled" data-toggle="tab">Entitled</a></li>
<li><a data-target="#unassigned" data-toggle="tab">Unassigned</a></li>
</ul>
<div class="tab-content">
@foreach (['entitled','unassigned'] as $show)
<div class="tab-pane @if($show=='entitled') active @endif" id="{{ $show }}">
<table width="100%" class="table table-striped table-bordered table-hover" style="color: #000000;">
<tr>
<th>&nbsp;</th>
@foreach ($cols as $col)
<th class="text-right" colspan="2">{{ $col->name }}</th>
@endforeach
<th class="text-right" colspan="2">TOTAL</th>
</tr>
<tr>
<th>&nbsp;</th>
@foreach ($cols as $col)
<th class="text-right">#</th>
<th class="text-right">$</th>
@endforeach
<th class="text-right">#</th>
<th class="text-right">$</th>
</tr>
<!-- Show group products -->
@foreach (\App\Models\Prodsum::find($pdata->pluck('prodsum_id')->unique())->sortBy('name') as $o)
<tr>
<td><a href="{{ $next ? url('/prodsum/'.$o->id) : '#' }}"> {{ $o->name }}</a></td>
@foreach ($cols as $col)
<td class="text-right">{{$pdata->filter(function($item,$key) use ($o,$col) { return isset($item->prodsum_id) AND $item->prodsum_id == $o->id AND $item->iot_id == $col->id; })->pluck('account_id')->unique()->count() }}</td>
<td class="text-right">{{ number_format($pdata->filter(function($item,$key) use ($o,$col) { return isset($item->prodsum_id) AND $item->prodsum_id == $o->id AND $item->iot_id == $col->id; })->sum($show),3) }}</td>
@endforeach
<th class="text-right">{{$pdata->filter(function($item,$key) use ($o,$col) { return isset($item->prodsum_id) AND $item->prodsum_id == $o->id; })->pluck('account_id')->unique()->count()}}</th>
<th class="text-right">{{ number_format($pdata->filter(function($item,$key) use ($o,$col) { return isset($item->prodsum_id) AND $item->prodsum_id == $o->id; })->sum($show),3) }}</th>
</tr>
@endforeach
<!-- Show non-group products -->
@php
$rest = $pdata->reject(function($item,$key) { return isset($item->prodsum_id); });
//dd($rest);
@endphp
<tr>
<td><i>Other Items</i></td>
@foreach ($cols as $col)
<td class="text-right">{{ $rest->filter(function($item,$key) use ($col) { return $item->iot_id == $col->id; })->pluck('account_id')->unique()->count() }}</td>
<td class="text-right">{{ number_format($rest->filter(function($item,$key) use ($col) { return $item->iot_id == $col->id; })->sum($show),3) }}</td>
@endforeach
<th class="text-right">{{ $rest->pluck('account_id')->unique()->count() }}</th>
<th class="text-right">{{ number_format($rest->sum($show),3) }}</th>
</tr>
<tr>
<th>TOTAL</th>
@foreach ($cols as $col)
<th class="text-right">{{ $pdata->filter(function($item,$key) use ($col) { return $item->iot_id == $col->id; })->pluck('account_id')->unique()->count() }}</th>
<th class="text-right">{{ number_format($pdata->filter(function($item,$key) use ($col) { return $item->iot_id == $col->id; })->sum($show),3) }}</th>
@endforeach
<th class="text-right">{{ $pdata->pluck('account_id')->unique()->count() }}</th>
<th class="text-right">{{ number_format($pdata->sum($show),3) }}</th>
</tr>
</table>
</div>
@endforeach
</div>
</div>
<p><strong>Please Note:</strong> This view is a product centric view and does not reduce the "Unassigned" value when clients
deploy products that they do not have a recorded entitlement allocated to it. For a truer representation of Risk, please use the Geography/Market view</p>
</div>
</div>
</div>
</div>
</div>
@endsection