Rapport-Laravel/resources/views/ivareport/planner.blade.php

103 lines
4.8 KiB
PHP

@extends(($isMobile ?? false) ? 'layouts.vertical-individual' : 'layouts.vertical', ['page_title' => $title])
@section('css')
@if (!empty($isMobile))
<meta name="viewport" content="width=device-width, initial-scale=1">
@endif
<link href="{{ asset('assets/libs/select2/select2.min.css') }}" rel="stylesheet" type="text/css" />
@endsection
@section('content')
<div class="container-fluid{{ !empty($isMobile) ? ' iva-mobile' : '' }}">
<div class="row">
<div class="col-md-4 p-2">
@if (!empty($isMobile))
<a href="{{ $mobileBackUrl }}" class="iva-mobile-back">&larr; Back</a>
@endif
<h4 class="page-title">{{ $title }}</h4>
</div>
<div class="col-md-8 p-2 d-flex justify-content-end align-items-center">
@include('ivareport._filters')
</div>
</div>
@if (!empty($error))
<div class="alert alert-danger">{{ $error }}</div>
@endif
@if (empty($isMobile))
@include('ivareport._tabs')
@endif
<div class="row">
<div class="col-12">
<div class="card">
@include('ivareport._export_header')
<div class="card-body">
<div class="iva-report-scroll">
@php
$groups = $brandGroups ?? [];
$colCount = 2;
foreach ($groups as $group) {
$colCount += count($group['columns'] ?? []);
}
@endphp
<table class="table table-centered table-nowrap mb-0 iva-report-table">
<thead>
<tr>
<th rowspan="2" class="sticky-first-col iva-th-id">Territory</th>
<th rowspan="2" class="iva-th-id">KAM Name</th>
@foreach ($groups as $group)
<th colspan="{{ count($group['columns']) }}"
class="text-center iva-group-start {{ $group['style']['class'] ?? '' }}">{{ $group['name'] }}</th>
@endforeach
</tr>
<tr>
@foreach ($groups as $group)
@foreach ($group['columns'] as $j => $col)
<th class="iva-th-metric @if ($j === 0) iva-group-start @endif">
{{ $col['label'] }}
</th>
@endforeach
@endforeach
</tr>
</thead>
<tbody>
@forelse ($rows as $row)
<tr>
<td class="sticky-first-col">{{ $row['territory'] }}</td>
<td>{{ $row['kam_name'] }}</td>
@foreach ($groups as $group)
@php
$brand = $row['brands'][$group['name']] ?? [];
@endphp
<td class="iva-group-start">{{ $ivaFmt($brand['plan'] ?? 0) }}</td>
<td>{{ $ivaFmt($brand['done'] ?? 0) }}</td>
<td>{{ $ivaFmt($brand['pct'] ?? 0, true) }}</td>
@endforeach
</tr>
@empty
<tr>
<td colspan="{{ max(1, $colCount) }}" class="text-center text-muted py-3">
No data
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@include('ivareport._styles')
@if (!empty($isMobile))
@include('ivareport._mobile')
@endif
@endsection
@section('script')
@include('ivareport._scripts')
@endsection