794 lines
47 KiB
PHP
794 lines
47 KiB
PHP
@extends('layouts.vertical', ['page_title' => 'Datatables'])
|
|
|
|
@section('css')
|
|
<link href="{{ asset('assets/libs/datatables/datatables.min.css') }}" rel="stylesheet" type="text/css" />
|
|
<link href="{{ asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
|
|
type="text/css" />
|
|
<link href="{{ asset('assets/libs/select2/select2.min.css') }}" rel="stylesheet" type="text/css" />
|
|
@endsection
|
|
|
|
@section('content')
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-4 p-2">
|
|
<h4 class="page-title">{{ $title }}</h4>
|
|
</div>
|
|
<div class="col-md-8 p-2 d-flex justify-content-end align-items-center">
|
|
@php
|
|
// Helper to get all months from July 2025 to current month
|
|
$start = \Carbon\Carbon::create(2025, 7, 1);
|
|
$end = \Carbon\Carbon::now()->startOfMonth();
|
|
$months = [];
|
|
while ($start <= $end) {
|
|
$months[] = $start->format('F Y');
|
|
$start->addMonth();
|
|
}
|
|
$selectedMonth = request()->get('month', \Carbon\Carbon::now()->format('F Y'));
|
|
$exportHierParams = '';
|
|
foreach (request()->get('filter_hier', []) as $exportHierId) {
|
|
$exportHierParams .= '&filter_hier[]=' . urlencode($exportHierId);
|
|
}
|
|
@endphp
|
|
<form id="month-select-form" class="me-2" method="get" action="">
|
|
<div class="d-flex align-items-center gap-2">
|
|
<div class="dropdown">
|
|
<button
|
|
class="btn btn-outline-secondary dropdown-toggle form-select"
|
|
type="button"
|
|
id="hierDropdown"
|
|
data-bs-toggle="dropdown"
|
|
data-bs-auto-close="outside"
|
|
style="width:220px;"
|
|
>
|
|
Hierarchy
|
|
</button>
|
|
|
|
<div class="dropdown-menu dropdown-menu-end p-3"
|
|
style="min-width:280px; max-height:340px;">
|
|
<div style="max-height:240px; overflow-y:auto;">
|
|
<div class="mb-2">
|
|
<input
|
|
type="text"
|
|
class="form-control form-control-sm"
|
|
id="hierSearch"
|
|
placeholder="Search hierarchy..."
|
|
>
|
|
</div>
|
|
|
|
@foreach ($filter_hier as $h)
|
|
<div class="form-check">
|
|
<input class="form-check-input hier-checkbox" type="checkbox"
|
|
name="filter_hier[]"
|
|
value="{{ $h->id }}" id="hier-{{ $h->id }}"
|
|
{{ in_array($h->id, request()->get('filter_hier', [])) ? 'checked' : '' }}>
|
|
<label class="form-check-label" for="hier-{{ $h->id }}">
|
|
{{ $h->name }} ({{ $h->type }})
|
|
</label>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
<hr class="my-2">
|
|
|
|
<div class="d-flex justify-content-between">
|
|
<button type="button" class="btn btn-sm btn-light" id="clearHier">Clear</button>
|
|
<button type="submit" class="btn btn-sm btn-primary">Apply</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<select class="form-select" name="month" id="month-select" style="width:160px;">
|
|
@foreach (array_reverse($months) as $month)
|
|
<option value="{{ $month }}" {{ $selectedMonth == $month ? 'selected' : '' }}>
|
|
{{ $month }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</form>
|
|
@if (isset($buttons))
|
|
@foreach ($buttons as $button)
|
|
<a href="{{ $button['link'] }}"
|
|
class="btn btn-{{ $button['title'] == 'Add New' ? 'success' : 'dark' }} waves-effect waves-light float-end ms-2"
|
|
id="btn-{{ strtolower(str_replace(' ', '-', $button['title'])) }}">{{ $button['title'] }}</a>
|
|
@endforeach
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@if (session()->has('message'))
|
|
<div class="alert alert-success">
|
|
{{ session()->get('message') }}
|
|
</div>
|
|
@endif
|
|
@if (session()->has('error'))
|
|
<div class="alert alert-danger">
|
|
{{ session()->get('error') }}
|
|
</div>
|
|
@endif
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body ">
|
|
<!-- Monthly Summary Table -->
|
|
<div class="card mb-4">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="card-title mb-0">1. Monthly Summary ( {{ $selectedMonth }}
|
|
)
|
|
</h5>
|
|
<a href="/gennovadcreport/export?type=monthsummary&month={{ $selectedMonth }}"
|
|
class="btn btn-sm btn-primary"> Export
|
|
</a>
|
|
</div>
|
|
<div class="card-body">
|
|
<div style="overflow-x:auto; width:100%;">
|
|
<table class="table table-centered table-nowrap table-borderless mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
@foreach ($monthsummary as $col)
|
|
<th>{{ $col['name'] }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($monthsummarysubmission as $row)
|
|
<tr>
|
|
@foreach ($monthsummary as $col)
|
|
@php
|
|
$val = $row->{$col['key']} ?? '';
|
|
@endphp
|
|
<td class="m-2">
|
|
@php
|
|
if (is_numeric($val)) {
|
|
if (floor($val) == $val) {
|
|
echo number_format($val);
|
|
} else {
|
|
echo number_format($val, 2);
|
|
}
|
|
} else {
|
|
echo $val;
|
|
}
|
|
@endphp
|
|
</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
<tr class="table-secondary">
|
|
<td><strong>Total</strong></td>
|
|
@foreach (array_slice($monthsummary, 1) as $col)
|
|
@php
|
|
$key = $col['key'];
|
|
@endphp
|
|
<td><strong>
|
|
@if ($key === 'percent_ach')
|
|
{{ $monthTotals['units_plan'] > 0 ? round(($monthTotals['units_ach'] / $monthTotals['units_plan']) * 100) : 0 }}%
|
|
@else
|
|
@php
|
|
$totalVal = $monthTotals[$key] ?? 0;
|
|
if (floor($totalVal) == $totalVal) {
|
|
echo number_format($totalVal);
|
|
} else {
|
|
echo number_format($totalVal, 2);
|
|
}
|
|
@endphp
|
|
@endif
|
|
</strong></td>
|
|
@endforeach
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<!-- Weekly Summary Table -->
|
|
<div class="card mb-4">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="card-title mb-0">2. Weekly Summary ( {{ $selectedMonth }} )
|
|
</h5>
|
|
<a href="/gennovadcreport/export?type=weeksummary&month={{ $selectedMonth }}"
|
|
class="btn btn-sm btn-primary"> Export
|
|
</a>
|
|
</div>
|
|
<div class="card-body">
|
|
<div style="overflow-x:auto; width:100%;">
|
|
<table class="table table-centered table-nowrap table-borderless mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
@foreach ($weeklysummary as $col)
|
|
<th>{{ $col['label'] }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($weeklysummarysubmission as $row)
|
|
<tr>
|
|
@foreach ($weeklysummary as $col)
|
|
@php
|
|
$val = $row->{$col['key']} ?? '';
|
|
@endphp
|
|
<td class="m-2">
|
|
@if (is_numeric($val))
|
|
{{ number_format($val) }}
|
|
@else
|
|
{{ $val }}
|
|
@endif
|
|
</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
|
|
@if (count($weeklysummarysubmission) > 0)
|
|
<tr class="table-secondary">
|
|
<td><strong>Total</strong></td>
|
|
|
|
@foreach ($weeklysummary as $col)
|
|
@if ($col['key'] === 'product_name')
|
|
@continue
|
|
@elseif ($col['key'] === 'percent_ach')
|
|
<td>
|
|
<strong>
|
|
{{ $weeklyTotals['month_plan'] > 0
|
|
? number_format(($weeklyTotals['units_ach'] / $weeklyTotals['month_plan']) * 100)
|
|
: 0 }}%
|
|
</strong>
|
|
</td>
|
|
@else
|
|
<td><strong>{{ number_format($weeklyTotals[$col['key']] ?? 0) }}</strong>
|
|
</td>
|
|
@endif
|
|
@endforeach
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<!-- Center Summary Table -->
|
|
<div class="card mb-4">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
|
|
<h5 class="card-title mb-0">3. Center Summary</h5>
|
|
<a href="/gennovadcreport/export?type=centersummary&month={{ $selectedMonth }}"
|
|
class="btn btn-sm btn-primary"> Export
|
|
</a>
|
|
|
|
</div>
|
|
<div class="card-body">
|
|
<div style="overflow-x:auto; width:100%;">
|
|
<table class="table table-centered table-nowrap table-borderless mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
@foreach ($centersummary as $col)
|
|
<th>{{ $col['name'] }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($centersummarysubmission as $row)
|
|
<tr>
|
|
@foreach ($centersummary as $col)
|
|
@php $val = $row->{$col['key']} ?? ''; @endphp
|
|
<td class="m-2">
|
|
@if ($col['key'] === 'percent_ach')
|
|
{{ round($val) }}
|
|
@elseif (is_numeric($val))
|
|
{{ number_format($val) }}
|
|
@else
|
|
{{ $val }}
|
|
@endif
|
|
</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
|
|
@if ($centerTotals)
|
|
<tr class="table-secondary">
|
|
<td><strong>Total</strong></td>
|
|
|
|
@foreach ($centersummary as $index => $col)
|
|
@if ($index === 0)
|
|
{{-- Skip the first column since "Total" text already there --}}
|
|
@continue
|
|
@endif
|
|
|
|
@php
|
|
$key = $col['key'];
|
|
$val = $centerTotals->{$key} ?? 0;
|
|
@endphp
|
|
|
|
@if ($key === 'percent_ach')
|
|
@php
|
|
$plan = $centerTotals->centers_plan ?? 0;
|
|
$ach = $centerTotals->centers_ach ?? 0;
|
|
$percent =
|
|
$plan > 0 ? number_format(($ach / $plan) * 100) : 0;
|
|
@endphp
|
|
<td><strong>{{ $percent }}%</strong></td>
|
|
@else
|
|
<td><strong>{{ number_format($val) }}</strong></td>
|
|
@endif
|
|
@endforeach
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<!-- Center Trend Summary Table -->
|
|
<div class="card-body">
|
|
<div class="card mb-4">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
|
|
<h5 class="card-title mb-0">4. Center Trend Summary</h5>
|
|
<a href="/gennovadcreport/export?type=centertrendsummary&month={{ $selectedMonth }}"
|
|
class="btn btn-sm btn-primary">
|
|
Export </a>
|
|
|
|
</div>
|
|
<div class="card-body">
|
|
<div style="overflow-x:auto; width:100%;">
|
|
<table class="table table-centered table-nowrap table-borderless mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
@foreach ($centertrendsummary as $col)
|
|
<th>{{ $col['name'] }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($centertrendsummarysubmission as $row)
|
|
@php
|
|
$centerTrendRow = (array) json_decode(json_encode($row), true);
|
|
@endphp
|
|
<tr>
|
|
@foreach ($centertrendsummary as $col)
|
|
@php
|
|
$val = $centerTrendRow[$col['key']] ?? '';
|
|
@endphp
|
|
<td class="m-2">
|
|
{{ is_numeric($val) ? number_format($val) : $val }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
|
|
@if (count($centertrendsummarysubmission) > 0)
|
|
<tr class="table-secondary">
|
|
<td><strong>Total</strong></td>
|
|
@foreach (array_slice($centertrendsummary, 1) as $col)
|
|
@php
|
|
$val = $centerTrendTotals[$col['key']] ?? 0;
|
|
@endphp
|
|
<td><strong>{{ number_format($val) }}</strong></td>
|
|
@endforeach
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<!-- Unit Trend Summary Table -->
|
|
<div class="card-body">
|
|
|
|
<div class="card mb-4">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
|
|
<h5 class="card-title mb-0">5. Unit Trend Summary</h5>
|
|
<a href="/gennovadcreport/export?type=unittrendsummary&month={{ $selectedMonth }}"
|
|
class="btn btn-sm btn-primary">
|
|
Export </a>
|
|
|
|
</div>
|
|
<div class="card-body">
|
|
<div style="overflow-x:auto; width:100%;">
|
|
|
|
<table class="table table-centered table-nowrap table-borderless mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
@foreach ($unittrendsummary as $col)
|
|
<th>{{ $col['name'] }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($unittrendsummarysubmission as $row)
|
|
@php
|
|
$unitTrendRow = (array) json_decode(json_encode($row), true);
|
|
@endphp
|
|
<tr>
|
|
@foreach ($unittrendsummary as $col)
|
|
@php
|
|
$val = $unitTrendRow[$col['key']] ?? '';
|
|
@endphp
|
|
<td class="m-2">
|
|
{{ is_numeric($val) ? number_format($val) : $val }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
|
|
@if (count($unittrendsummarysubmission) > 0)
|
|
<tr class="table-secondary">
|
|
<td><strong>Total</strong></td>
|
|
@foreach (array_slice($unittrendsummary, 1) as $col)
|
|
<td><strong>{{ number_format($unitTrendTotals[$col['key']] ?? 0) }}</strong>
|
|
</td>
|
|
@endforeach
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<!-- Transplant Penetration Table -->
|
|
<div class="card-body">
|
|
<div class="card mb-4">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="card-title mb-0">6. Transplant Penetration</h5>
|
|
<a href="/gennovadcreport/export?type=transplantpenetration&month={{ $selectedMonth }}{{ $exportHierParams }}"
|
|
class="btn btn-sm btn-primary"> Export
|
|
</a>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="gennova-report-scroll">
|
|
<table class="table table-centered table-nowrap table-borderless mb-0 gennova-sticky-col-table">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th rowspan="2" class="sticky-first-col">Transplant Type</th>
|
|
<th rowspan="2">Monthly Expected no. of Transplant</th>
|
|
<th rowspan="2">Gennova Share Denovo Plan</th>
|
|
<th rowspan="2">Gennova Share Switch Plan</th>
|
|
<th rowspan="2">Gennova Share Grafsol Tx Plan</th>
|
|
<th rowspan="2">Total Actual Transplants</th>
|
|
<th colspan="4" class="text-center">Gennova Share Denovo Actual</th>
|
|
<th colspan="4" class="text-center">Gennova Share Switch Actual</th>
|
|
<th colspan="4" class="text-center">Gennova Share Grafsol Tx Actual</th>
|
|
</tr>
|
|
<tr>
|
|
<th>Week-1</th>
|
|
<th>Week-2</th>
|
|
<th>Week-3</th>
|
|
<th>Week-4</th>
|
|
<th>Week-1</th>
|
|
<th>Week-2</th>
|
|
<th>Week-3</th>
|
|
<th>Week-4</th>
|
|
<th>Week-1</th>
|
|
<th>Week-2</th>
|
|
<th>Week-3</th>
|
|
<th>Week-4</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php
|
|
$tpRows = $transplantPenetrationSubmission ?? [];
|
|
$tpGet = function ($row, $key, $default = '') {
|
|
if (is_object($row) && isset($row->{$key})) {
|
|
return $row->{$key};
|
|
}
|
|
if (is_array($row) && array_key_exists($key, $row)) {
|
|
return $row[$key];
|
|
}
|
|
return $default;
|
|
};
|
|
$tpGetNested = function ($row, $key, $nestedKey, $default = '') use ($tpGet) {
|
|
$parent = $tpGet($row, $key, null);
|
|
if (is_object($parent) && isset($parent->{$nestedKey})) {
|
|
return $parent->{$nestedKey};
|
|
}
|
|
if (is_array($parent) && array_key_exists($nestedKey, $parent)) {
|
|
return $parent[$nestedKey];
|
|
}
|
|
return $default;
|
|
};
|
|
$tpFmt = function ($val) {
|
|
if ($val === null || $val === '') {
|
|
return '';
|
|
}
|
|
if (is_numeric($val)) {
|
|
return floor($val) == $val ? number_format($val) : number_format($val, 2);
|
|
}
|
|
return $val;
|
|
};
|
|
@endphp
|
|
|
|
@if (!empty($tpRows))
|
|
@foreach ($tpRows as $row)
|
|
<tr>
|
|
<td class="m-2 sticky-first-col">{{ $tpFmt($tpGet($row, 'Transplant Type')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGet($row, 'Monthly Expected no. of Transplant')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGet($row, 'Gennova Share Dennovo Plan')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGet($row, 'Gennova Share Switch Plan')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGet($row, 'Gennova Share Graftsol Tx Plan')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGet($row, 'Total Actual Transplants')) }}</td>
|
|
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Dennovo Actual', 'Week-1')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Dennovo Actual', 'Week-2')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Dennovo Actual', 'Week-3')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Dennovo Actual', 'Week-4')) }}</td>
|
|
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Switch Actual', 'Week-1')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Switch Actual', 'Week-2')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Switch Actual', 'Week-3')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Switch Actual', 'Week-4')) }}</td>
|
|
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Graftsol Tx Actual', 'Week-1')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Graftsol Tx Actual', 'Week-2')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Graftsol Tx Actual', 'Week-3')) }}</td>
|
|
<td class="m-2">{{ $tpFmt($tpGetNested($row, 'Gennova Share Graftsol Tx Actual', 'Week-4')) }}</td>
|
|
</tr>
|
|
@endforeach
|
|
@else
|
|
<tr>
|
|
<td colspan="18" class="text-center text-muted py-3">No data</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<!-- Transplant Summary Table -->
|
|
<div class="card-body">
|
|
<div class="card mb-4">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="card-title mb-0">7. Transplant Summary</h5>
|
|
<a href="/gennovadcreport/export?type=transplantsummary&month={{ $selectedMonth }}{{ $exportHierParams }}"
|
|
class="btn btn-sm btn-primary"> Export
|
|
</a>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="gennova-report-scroll">
|
|
<table class="table table-centered table-nowrap mb-0 transplant-summary-table gennova-sticky-col-table">
|
|
<thead class="table-light">
|
|
@php
|
|
$tsRows = $transplantSummarySubmission ?? [];
|
|
$tsFlat = $transplantSummaryFlat ?? [];
|
|
$tsGroups = $transplantSummaryGroups ?? [];
|
|
$tsColCount = count($tsFlat);
|
|
foreach ($tsGroups as $group) {
|
|
$tsColCount += count($group['columns'] ?? []);
|
|
}
|
|
$tsFlatCount = count($tsFlat);
|
|
@endphp
|
|
|
|
<tr>
|
|
@foreach ($tsFlat as $i => $col)
|
|
<th rowspan="2"
|
|
@if ($i === 0) class="sticky-first-col"
|
|
@elseif ($i === $tsFlatCount - 1) class="ts-section-end"
|
|
@endif>
|
|
{{ $col['label'] ?? $col['key'] }}
|
|
</th>
|
|
@endforeach
|
|
@foreach ($tsGroups as $group)
|
|
<th colspan="{{ count($group['columns'] ?? []) }}"
|
|
class="text-center ts-group-start">
|
|
{{ $group['name'] ?? '' }}
|
|
</th>
|
|
@endforeach
|
|
</tr>
|
|
<tr>
|
|
@foreach ($tsGroups as $group)
|
|
@foreach (($group['columns'] ?? []) as $j => $col)
|
|
<th @if ($j === 0) class="ts-group-start" @endif>
|
|
{{ $col['label'] ?? $col['key'] }}
|
|
</th>
|
|
@endforeach
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if (!empty($tsRows) && ($tsColCount ?? 0) > 0)
|
|
@foreach ($tsRows as $row)
|
|
<tr>
|
|
@foreach ($tsFlat as $i => $col)
|
|
<td class="m-2 @if ($i === 0) sticky-first-col @endif @if ($i === $tsFlatCount - 1) ts-section-end @endif">
|
|
{{ $tpFmt($tpGet($row, $col['key'])) }}
|
|
</td>
|
|
@endforeach
|
|
@foreach ($tsGroups as $group)
|
|
@foreach (($group['columns'] ?? []) as $j => $col)
|
|
<td class="m-2 @if ($j === 0) ts-group-start @endif">
|
|
{{ $tpFmt($tpGet($row, $col['key'])) }}
|
|
</td>
|
|
@endforeach
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
@else
|
|
<tr>
|
|
<td colspan="{{ max(1, $tsColCount ?? 1) }}"
|
|
class="text-center text-muted py-3">
|
|
No data
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<!-- Activity Summary Table -->
|
|
<div class="card-body">
|
|
<div class="card mb-4">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="card-title mb-0">8. Activity Summary</h5>
|
|
<a href="/gennovadcreport/export?type=activitysummary&month={{ $selectedMonth }}{{ $exportHierParams }}"
|
|
class="btn btn-sm btn-primary"> Export
|
|
</a>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="gennova-report-scroll">
|
|
<table class="table table-centered table-nowrap table-borderless mb-0 gennova-sticky-col-table">
|
|
<thead class="table-light">
|
|
<tr>
|
|
@foreach (($activitySummaryColumns ?? []) as $col)
|
|
<th @if ($loop->first) class="sticky-first-col" @endif>{{ $col['label'] ?? '' }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php
|
|
$asRows = $activitySummarySubmission ?? [];
|
|
$asCols = $activitySummaryColumns ?? [];
|
|
@endphp
|
|
|
|
@if (!empty($asRows) && !empty($asCols))
|
|
@foreach ($asRows as $row)
|
|
<tr>
|
|
@foreach ($asCols as $col)
|
|
@php
|
|
$parent = $col['parent'] ?? '';
|
|
$child = $col['child'] ?? null;
|
|
$val = $child === null ? $tpGet($row, $parent) : $tpGetNested($row, $parent, $child);
|
|
@endphp
|
|
<td class="m-2 @if ($loop->first) sticky-first-col @endif">{{ $tpFmt($val) }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
@else
|
|
<tr>
|
|
<td colspan="{{ max(1, count($asCols)) }}"
|
|
class="text-center text-muted py-3">
|
|
No data
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<style type="text/css">
|
|
.gennova-report-scroll {
|
|
overflow-x: auto;
|
|
width: 100%;
|
|
}
|
|
|
|
.gennova-sticky-col-table {
|
|
border-collapse: separate;
|
|
border-spacing: 0;
|
|
}
|
|
|
|
.gennova-sticky-col-table th.sticky-first-col,
|
|
.gennova-sticky-col-table td.sticky-first-col {
|
|
position: sticky;
|
|
left: 0;
|
|
z-index: 2;
|
|
background-color: #fff;
|
|
box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
|
|
min-width: 120px;
|
|
}
|
|
|
|
.gennova-sticky-col-table thead th.sticky-first-col {
|
|
z-index: 4;
|
|
background-color: #f8f9fa;
|
|
}
|
|
|
|
.transplant-summary-table th,
|
|
.transplant-summary-table td {
|
|
border: 1px solid #dee2e6;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.transplant-summary-table thead th.sticky-first-col {
|
|
background-color: #f8f9fa;
|
|
}
|
|
|
|
.transplant-summary-table .ts-section-end {
|
|
border-right: 2px solid #6c757d;
|
|
}
|
|
|
|
.transplant-summary-table .ts-group-start {
|
|
border-left: 2px solid #6c757d;
|
|
}
|
|
</style>
|
|
@endsection
|
|
|
|
@section('script')
|
|
<script src="{{ asset('assets/libs/select2/select2.min.js') }}"></script>
|
|
<script src="{{ asset('assets/libs/datatables/datatables.min.js') }}"></script>
|
|
<script src="{{ asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$('#month-select').on('change', function() {
|
|
$('#month-select-form').submit();
|
|
});
|
|
});
|
|
</script>
|
|
<script>
|
|
const checkboxes = document.querySelectorAll('.hier-checkbox');
|
|
const dropdownBtn = document.getElementById('hierDropdown');
|
|
|
|
function updateLabel() {
|
|
const checked = document.querySelectorAll('.hier-checkbox:checked').length;
|
|
dropdownBtn.innerText = checked ? `Hierarchy (${checked})` : 'Hierarchy';
|
|
}
|
|
|
|
updateLabel();
|
|
checkboxes.forEach(cb => cb.addEventListener('change', updateLabel));
|
|
|
|
document.getElementById('clearHier').addEventListener('click', function() {
|
|
checkboxes.forEach(cb => cb.checked = false);
|
|
updateLabel();
|
|
});
|
|
</script>
|
|
<script>
|
|
const hierSearch = document.getElementById('hierSearch');
|
|
|
|
if (hierSearch) {
|
|
hierSearch.addEventListener('keyup', function () {
|
|
const term = this.value.toLowerCase();
|
|
document.querySelectorAll('.hier-checkbox').forEach(cb => {
|
|
const label = cb.closest('.form-check').innerText.toLowerCase();
|
|
cb.closest('.form-check').style.display =
|
|
label.includes(term) ? '' : 'none';
|
|
});
|
|
});
|
|
}
|
|
</script>
|
|
|
|
@endsection
|