@extends('layouts.vertical-individual', ['page_title' => $title ?? 'Ciphaler / SB Units Report']) @section('css') @endsection @section('content') @php $pagination = $pagination ?? (object) ['page' => 1, 'per_page' => 50, 'total' => 0, 'total_pages' => 0]; $currentPage = (int) ($pagination->page ?? 1); $totalPages = (int) ($pagination->total_pages ?? 0); $perPage = (int) ($perPage ?? $pagination->per_page ?? 50); $totalDoctors = (int) ($pagination->total ?? 0); $search = trim((string) ($search ?? '')); $type = $type ?? 'ciphaler'; $pageQuery = http_build_query(array_filter([ 'type' => $type, 'per_page' => $perPage, 'search' => $search !== '' ? $search : null, 'token' => !empty($token ?? '') ? $token : null, ], fn ($value) => $value !== null && $value !== '')); $pageBase = $base_url . '/report?' . $pageQuery; $metaColumnCount = 3; @endphp
Loading report...
@include('team2unitsreport._pagination', ['paginationPosition' => 'team2-units-report-pagination-top'])
@foreach ($months as $month) @endforeach @foreach ($months as $month) @foreach ($metrics as $metric) @endforeach @endforeach @forelse ($doctors as $doctor) @foreach ($months as $monthIndex => $month) @php $monthKey = $month->key ?? ''; $doctorData = $data->{$doctor->id} ?? null; $monthData = is_object($doctorData) ? ($doctorData->{$monthKey} ?? null) : null; $prevMonthKey = $monthIndex > 0 ? ($months[$monthIndex - 1]->key ?? '') : ''; $prevMonthData = ($prevMonthKey !== '' && is_object($doctorData)) ? ($doctorData->{$prevMonthKey} ?? null) : null; @endphp @foreach ($metrics as $metric) @php $metricId = $metric->id ?? ''; $value = is_object($monthData) ? ($monthData->{$metricId} ?? null) : null; $cellClass = 'text-center'; if ($monthIndex > 0 && $value !== null && $value !== '' && is_numeric($value)) { $prevValue = is_object($prevMonthData) ? ($prevMonthData->{$metricId} ?? null) : null; if ($prevValue !== null && $prevValue !== '' && is_numeric($prevValue)) { $currentNum = (float) $value; $prevNum = (float) $prevValue; if ($currentNum > $prevNum) { $cellClass .= ' table-success'; } elseif ($currentNum < $prevNum) { $cellClass .= ' table-danger'; } } } @endphp @endforeach @endforeach @empty @endforelse
Doctor Name MSL Code User{{ $month->label ?? $month->key }}
{{ $metric->label ?? $metric->id }}
{{ $doctor->name }} {{ $doctor->msl_code ?? '-' }} {{ $doctor->user ?? '-' }}{{ $value !== null && $value !== '' ? $value : '-' }}
@if ($search !== '') No doctors found matching "{{ $search }}". @else No doctor data found. @endif
@include('team2unitsreport._pagination')
@endsection @section('script-bottom') @endsection