@extends('layouts.app') @section('title', __('superadmin::lang.compliance_management')) @section('content') @php $util = app(\App\Utils\ComplianceUtil::class); @endphp

@lang('superadmin::lang.compliance_management') @lang('superadmin::lang.compliance_management_desc')

@include('layouts.partials.error') {{-- Bucket chips, worst first. Each filters the table so one rung can be worked through at a time; the counts always reflect the whole register. --}}
@lang('lang_v1.all') @foreach($counts as $bucket => $count) {{ $util->bucketLabel($bucket) }} {{ $count }} @endforeach
{{-- Filters --}}
{!! Form::open(['url' => route('compliance.index'), 'method' => 'get', 'class' => 'form-inline']) !!} @if(!empty($filters['bucket'])) {!! Form::hidden('bucket', $filters['bucket']) !!} @endif
{!! Form::label('tier', __('superadmin::lang.compliance_tier') . ':') !!} {!! Form::select('tier', ['' => __('lang_v1.all'), 'store' => __('superadmin::lang.compliance_stores'), 'warehouse' => __('superadmin::lang.compliance_warehouses')], $filters['tier'], ['class' => 'form-control']) !!}
{!! Form::label('license_type', __('superadmin::lang.compliance_license') . ':') !!} {!! Form::select('license_type', ['' => __('lang_v1.all')] + collect($license_types)->map(fn($t) => $t['label'])->all(), $filters['license_type'], ['class' => 'form-control']) !!}
{!! Form::label('business_id', __('business.business') . ':') !!} {!! Form::select('business_id', ['' => __('lang_v1.all')] + $businesses->all(), $filters['business_id'], ['class' => 'form-control select2']) !!}
{{-- No custom export button: the table below is a standard DataTable, so it inherits the chain-wide CSV / Excel / PDF / print / column buttons from the project defaults in common.js. --}} {!! Form::close() !!}
{{-- not-export: the action button is UI, not register data. --}} @forelse($rows as $r) @empty @endforelse
@lang('business.business') @lang('superadmin::lang.compliance_tier') @lang('superadmin::lang.compliance_license') @lang('superadmin::lang.compliance_license_no') @lang('superadmin::lang.compliance_expiry') @lang('superadmin::lang.compliance_days_left') @lang('lang_v1.status') @lang('superadmin::lang.compliance_last_action')@lang('messages.action')
{{ $r['business_name'] }} @if($r['critical']) {{-- A drug licence lapse stops the site trading, unlike a trade or FSSAI lapse. Marked so it is never triaged at the same level as the rest. --}} @lang('superadmin::lang.compliance_critical') @endif {{ $r['tier'] === 'warehouse' ? __('superadmin::lang.compliance_warehouse') : __('superadmin::lang.compliance_store') }} {{ $r['license_label'] }} {{ $r['number'] ?: '--' }} {{ $r['expiry'] ? \Carbon::parse($r['expiry'])->format('d-m-Y') : '--' }} @if($r['days'] === null) -- @else {{ $r['days'] }} @endif {{ $util->bucketLabel($r['bucket']) }} @if(!empty($r['last_log'])) {{ $r['last_log']->statusLabel() }}
{{ $r['last_log']->created_at->format('d-m-Y H:i') }} @if(!empty($r['last_log']->created_by_user)) — {{ $r['last_log']->created_by_user->user_full_name }} @endif @if(!empty($r['last_log']->note))
{{ \Illuminate\Support\Str::limit($r['last_log']->note, 70) }} @endif @else @lang('superadmin::lang.compliance_no_action') @endif
@lang('superadmin::lang.compliance_update_status')
@endsection {{-- MUST be @section('javascript'): the layout yields it after jQuery/DataTables are loaded. Inside the content section this would run before they exist. --}} @section('javascript') @endsection