Initial commit

This commit is contained in:
2026-09-03 12:21:17 +02:00
commit 6d40da0410
155 changed files with 21554 additions and 0 deletions
@@ -0,0 +1,91 @@
<x-app-layout :active="'well-operation.index'" title="SoftSPM 2 - Eksploatacja studni">
<div class="space-y-stack-gap">
@if (session('status'))
<div class="status-chip-ok px-3 py-2 rounded-lg font-body-sm text-body-sm">{{ session('status') }}</div>
@endif
<div>
<h1 class="font-headline-lg text-headline-lg text-on-surface">Eksploatacja studni</h1>
<p class="font-body-sm text-body-sm text-on-surface-variant mt-1">
Oddział: <span class="font-data-label">{{ $department ?? '-' }}</span>
· Wyników: <span class="font-data-label">{{ $wells->total() }}</span>
</p>
</div>
{{-- Wyszukiwarka --}}
<form method="GET" action="{{ route('well-operation.index') }}"
class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card p-card-inner-padding">
<div class="flex flex-wrap items-end gap-4">
<div class="space-y-1">
<label for="q" class="font-data-label text-data-label text-on-surface-variant tracking-wide">Studnia</label>
<input id="q" name="q" type="text" value="{{ $search }}" placeholder="nazwa studni"
class="bg-surface-container-low border border-outline-variant px-3 py-2 rounded focus:ring-1 focus:ring-primary focus:border-primary font-data-label text-on-surface">
</div>
<div class="space-y-1">
<label for="status" class="font-data-label text-data-label text-on-surface-variant tracking-wide">Status</label>
<select id="status" name="status"
class="bg-surface-container-low border border-outline-variant px-3 py-2 rounded focus:ring-1 focus:ring-primary focus:border-primary font-data-label text-on-surface">
@foreach ($statusOptions as $id => $label)
<option value="{{ $id }}" {{ (int) $status === (int) $id ? 'selected' : '' }}>{{ $label }}</option>
@endforeach
<option value="{{ $statusAll }}" {{ (int) $status === $statusAll ? 'selected' : '' }}>Wszystkie</option>
</select>
</div>
<button type="submit"
class="bg-secondary text-on-secondary px-5 py-2.5 rounded-full font-title-sm text-title-sm hover:opacity-90 transition-all active:scale-95">
Szukaj
</button>
</div>
</form>
{{-- Lista studni w eksploatacji --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<table class="w-full text-left">
<thead class="bg-secondary/10 border-b border-outline-variant/40">
<tr class="font-data-label text-data-label text-on-surface-variant tracking-wide">
<th class="px-4 py-3 w-12">Lp.</th>
<x-sortable-th column="name">Studnia</x-sortable-th>
<x-sortable-th column="bariera">Ujęcie / Bariera</x-sortable-th>
<x-sortable-th column="pump">Pompa</x-sortable-th>
<x-sortable-th column="pump_no">Nr fabryczny pompy [S/N]</x-sortable-th>
<x-sortable-th column="engine">Silnik</x-sortable-th>
<x-sortable-th column="engine_no">Nr fabryczny silnika [S/N]</x-sortable-th>
<x-sortable-th column="type">Typ</x-sortable-th>
<th class="px-4 py-3 text-center">Stan</th>
</tr>
</thead>
<tbody class="divide-y divide-outline-variant/30 font-body-md text-body-md">
@forelse ($wells as $well)
<tr class="hover:bg-surface-container transition-colors cursor-pointer"
onclick="location.href='{{ route('well-operation.show', $well->drs_id) }}'">
<td class="px-4 py-3 font-data-label text-on-surface-variant">{{ $wells->firstItem() + $loop->index }}.</td>
<td class="px-4 py-3 font-semibold text-on-surface">{{ $well->well_name }}</td>
<td class="px-4 py-3">{{ $well->bariera }}</td>
<td class="px-4 py-3">{{ $well->pump_name }}</td>
<td class="px-4 py-3 font-data-label">{{ $well->pump_no }}</td>
<td class="px-4 py-3">{{ $well->engine_name }}</td>
<td class="px-4 py-3 font-data-label">{{ $well->engine_no }}</td>
<td class="px-4 py-3">{{ $well->sys_type }}</td>
<td class="px-4 py-3 text-center">
@if ($well->onoff === 'ON')
<span class="status-chip status-chip-ok">ON</span>
@else
<span class="status-chip status-chip-alert">OFF</span>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="9" class="px-4 py-8 text-center font-body-md text-body-md text-on-surface-variant">
Brak studni dla wybranych kryteriów.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div>{{ $wells->links() }}</div>
</div>
</x-app-layout>
@@ -0,0 +1,247 @@
<x-app-layout :active="'well-operation.index'" title="SoftSPM 2 - Parametry: {{ $well->well_name }}">
@php
$fmt = fn ($v, $d = 2) => $v === null || $v === '' ? '-' : number_format(round((float) $v, $d), $d, ',', ' ');
$iv = fn ($v, $d) => ($v === null || $v === '') ? '' : number_format(round((float) $v, $d), $d, ',', '');
// <option> nie renderuje HTML - zamiana sup/sub na unicode, reszta tagów usuwana.
$optClean = fn ($s) => strip_tags(strtr((string) $s, [
'<sup>2</sup>' => '²', '<sup>3</sup>' => '³',
'<sub>0</sub>' => '₀', '<sub>1</sub>' => '₁', '<sub>2</sub>' => '₂',
]));
$isOn = $onoff && $onoff->DRD_VALUE === 'ON';
$qMin = $measurement && $measurement->q !== null ? (float) $measurement->q / 60 : null; // m³/min
// Pola pomiaru: [name, etykieta(html), wartość, miejsca dziesiętne].
$pf = [
['q', 'Wydajność Q [m³/min]', $qMin, 3],
['hd', 'Zwierciadło dynamiczne H<sub>D</sub> [m]', $measurement?->hd, 2],
['hst', 'Zwierciadło statyczne H<sub>ST</sub> [m]', $measurement?->hst, 2],
['hst0', 'Zwierciadło statyczne H<sub>ST0</sub> [m]', $measurement?->hst0, 1],
['p1', 'Ciśnienie p<sub>1</sub> [m]', $measurement?->p1, 2],
['p2', 'Ciśnienie p<sub>2</sub> [m]', $measurement?->p2, 2],
['pb', 'Ciśnienie barometryczne p<sub>b</sub> [hPa]', $extra->pb, 2],
['vm3', 'Ilość wypompowanej wody V [m³]', $measurement?->vm3, 2],
['wtemp', 'Temp. wody T<sub>W</sub> [°C]', $measurement?->wtemp, 1],
['pp', 'Ciśnienie p<sub>p</sub> [m]', $measurement?->pp, 2],
['hh', 'Wysokość H<sub>H</sub> [m]', $measurement?->hh, 2],
['throttle', 'Otwarcie przepustnicy [%]', $extra->throttle, 1],
'---',
['pe', 'Moc czynna P<sub>e</sub> [kW]', $measurement?->pe, 2],
['energy_kwh', 'Pobór energii E [kWh]', $extra->energy_kwh, 2],
['i', 'Pobór prądu I [A]', $measurement?->i, 2],
['u', 'Napięcie zasilania U [V]', $measurement?->u, 0],
['cos', 'cos(φ)', $measurement?->cos, 3],
['work_time', 'Czas pracy agregatu t [h]', $measurement?->work_time, 2],
['unit_energy', 'Jednostkowe zużycie energii [Wh/m³/m]', $extra->unit_energy, 2],
];
$inputClass = 'param-input w-32 ml-auto block text-right font-data-label text-on-surface rounded border px-2 py-0.5 bg-surface-container-low border-outline-variant read-only:border-transparent read-only:bg-transparent read-only:px-0 read-only:cursor-default focus:outline-none focus:ring-1 focus:ring-primary';
// Przyciski nawigacyjne (podstrony 401). Tylko „Ocena pracy układu" zbudowana.
$nav = [
['Ocena pracy układu', route('well-operation.show', $well->drs_id), true],
['Historia ocen', null, false],
['Historia agregatów', null, false],
['Historia postojów', null, false],
['Karta otworu', null, false],
['Parametry chemiczne', null, false],
['Stan studni', null, false],
['Kalibracja', null, false],
];
@endphp
<div class="space-y-stack-gap">
@if (session('status'))
<div class="status-chip-ok px-3 py-2 rounded-lg font-body-sm text-body-sm">{{ session('status') }}</div>
@endif
@if (session('error'))
<div class="status-chip-alert px-3 py-2 rounded-lg font-body-sm text-body-sm">{{ session('error') }}</div>
@endif
@if ($errors->any())
<div class="status-chip-alert px-3 py-2 rounded-lg font-body-sm text-body-sm">{{ $errors->first() }}</div>
@endif
{{-- Powrót do oceny pracy układu --}}
<div class="flex items-center gap-2">
<a href="{{ route('well-operation.show', $well->drs_id) }}" class="font-body-sm text-body-sm text-on-surface-variant hover:text-primary">← Ocena pracy układu</a>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-stack-gap items-start">
{{-- ===== LEWA: studnia + parametry techniczne + pracy ===== --}}
<div class="space-y-stack-gap">
{{-- Studnia --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Studnia</div>
<div class="py-4 text-center font-headline-lg text-headline-lg {{ $isOn ? 'text-green-600' : 'text-on-surface' }}">{{ $well->well_name }}</div>
</div>
{{-- Data ostatniej aktualizacji danych z SYNDIS --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Data ostatniej aktualizacji danych z SYNDIS</div>
<div class="py-3 text-center font-headline-md text-headline-md text-secondary">{{ $measurement->date ?? '-' }}</div>
</div>
{{-- Parametry techniczne studni --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Parametry techniczne studni</div>
<table class="w-full font-body-md text-body-md">
<tbody class="divide-y divide-outline-variant/30">
@php
$tech = collect([
['Nazwa', $well->well_name],
['Kategoria SPM', $category ?: '-'],
['Data zabudowy pompy', $availableDate ?: '-'],
]);
foreach ($techParams as $tp) { $tech->push([$tp->label, $tp->value ?: '-']); }
@endphp
@foreach ($tech as [$label, $value])
<tr>
<td class="px-4 py-1.5 w-1/2 bg-surface-container/50 text-on-surface-variant font-data-label text-data-label">{!! $label !!}</td>
<td class="px-4 py-1.5">{{ $value }}</td>
</tr>
@endforeach
<tr><td class="px-4 py-1.5 bg-surface-container/50 text-on-surface-variant font-data-label text-data-label">Głębokość zabudowy pompy L<sub>P</sub> [m]</td><td class="px-4 py-1.5 font-data-label">{{ $fmt($lp, 2) }}</td></tr>
<tr><td class="px-4 py-1.5 bg-surface-container/50 text-on-surface-variant font-data-label text-data-label">Średnica rurociągu D<sub>R</sub> [mm]</td><td class="px-4 py-1.5 font-data-label">{{ $dr === null ? '-' : $fmt((float) $dr * 1000, 0) }}</td></tr>
<tr><td class="px-4 py-1.5 bg-surface-container/50 text-on-surface-variant font-data-label text-data-label">m [m]</td><td class="px-4 py-1.5 font-data-label">{{ $fmt($mParam, 2) }}</td></tr>
</tbody>
</table>
</div>
{{-- Parametry pracy (z ręczną edycją) --}}
<form id="measForm" method="POST" action="{{ route('well-operation.params-store', $well->drs_id) }}">
@csrf
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm flex items-center justify-between gap-2">
<span>Parametry pracy studni i układu pompowego</span>
<span class="flex items-center gap-2">
<button type="button" id="measEdit" title="Wprowadź ręcznie pomiar"
class="px-2.5 py-1 rounded-full bg-on-secondary/15 hover:bg-on-secondary/25 font-data-label text-data-label">✎ Modyfikuj</button>
<span id="measSave" class="hidden items-center gap-2">
<button type="submit" class="px-2.5 py-1 rounded-full bg-on-secondary text-secondary font-data-label text-data-label hover:opacity-90">Zapisz</button>
<button type="button" onclick="location.reload()" class="px-2.5 py-1 rounded-full bg-on-secondary/15 font-data-label text-data-label hover:bg-on-secondary/25">Anuluj</button>
</span>
</span>
</div>
<table class="w-full font-body-md text-body-md">
<tbody class="divide-y divide-outline-variant/30">
<tr>
<td class="px-4 py-1.5 w-2/3 bg-surface-container/50 text-on-surface-variant font-data-label text-data-label">Data pomiaru</td>
<td class="px-4 py-1 text-right">
<div class="flex items-center justify-end gap-1">
<input type="date" name="date" value="{{ now()->format('Y-m-d') }}" readonly class="{{ $inputClass }} w-36">
<input type="time" name="time" value="{{ now()->format('H:i') }}" readonly class="{{ $inputClass }} w-24">
</div>
</td>
</tr>
@foreach ($pf as $row)
@if ($row === '---')
<tr><td colspan="2" class="px-4 py-1 bg-surface-container-low"></td></tr>
@else
<tr>
<td class="px-4 py-1.5 w-2/3 bg-surface-container/50 text-on-surface-variant font-data-label text-data-label">{!! $row[1] !!}</td>
<td class="px-4 py-1 text-right">
<input type="text" name="{{ $row[0] }}" value="{{ $iv($row[2], $row[3]) }}" readonly class="{{ $inputClass }}">
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</form>
</div>
{{-- ===== PRAWA: bilans mocy + rysunek układu ===== --}}
<div class="space-y-stack-gap">
{{-- Bilans mocy --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Bilans mocy</div>
@if ($power)
<table class="w-full font-body-md text-body-md">
<tbody class="divide-y divide-outline-variant/30">
<tr><td colspan="2" class="px-4 py-1.5 bg-surface-container text-center font-semibold text-on-surface">Moc przekazana</td></tr>
<tr><td class="px-4 py-1.5 w-2/3 text-on-surface-variant">Podnoszenie stałe</td><td class="px-4 py-1.5 text-right font-data-label">{{ $fmt($power['pst']) }} [kW]</td></tr>
<tr><td class="px-4 py-1.5 text-on-surface-variant">Geo - hydraulika</td><td class="px-4 py-1.5 text-right font-data-label">{{ $fmt($power['pgh']) }} [kW]</td></tr>
<tr><td class="px-4 py-1.5 text-on-surface-variant">Odpływ</td><td class="px-4 py-1.5 text-right font-data-label">{{ $fmt($power['pp2']) }} [kW]</td></tr>
<tr><td colspan="2" class="px-4 py-1.5 bg-surface-container text-center font-semibold text-on-surface">Moc stracona</td></tr>
<tr><td class="px-4 py-1.5 text-on-surface-variant">Agregat + zasilanie</td><td class="px-4 py-1.5 text-right font-data-label">{{ $fmt($power['paz']) }} [kW]</td></tr>
<tr><td class="px-4 py-1.5 text-on-surface-variant">Straty liniowe</td><td class="px-4 py-1.5 text-right font-data-label">{{ $fmt($power['psl']) }} [kW]</td></tr>
<tr><td class="px-4 py-1.5 text-on-surface-variant">Straty w armaturze</td><td class="px-4 py-1.5 text-right font-data-label">{{ $fmt($power['psa']) }} [kW]</td></tr>
<tr><td colspan="2" class="px-2 py-1"></td></tr>
<tr><td class="px-4 py-1.5 text-on-surface-variant">Moc pobrana P<sub>e</sub></td><td class="px-4 py-1.5 text-right font-data-label font-semibold">{{ $fmt($power['pe']) }} [kW]</td></tr>
<tr><td class="px-4 py-1.5 text-on-surface-variant">Moc zużyta &Sigma;</td><td class="px-4 py-1.5 text-right font-data-label font-semibold">{{ $fmt($power['sum']) }} [kW]</td></tr>
</tbody>
</table>
@else
<p class="p-card-inner-padding font-body-sm text-body-sm text-on-surface-variant">Brak danych pomiarowych do bilansu mocy.</p>
@endif
</div>
{{-- Układ pompowy (rysunek rozkładu mocy) --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Układ pompowy - {{ $well->well_name }}</div>
<div class="p-card-inner-padding">
<div class="rounded border border-outline-variant/40 p-2" style="background:#f7fafb">
<x-power-schematic :power="$power" :on="$isOn" :time="$measurement?->date" />
</div>
<p class="mt-2 font-body-sm text-body-sm text-on-surface-variant">
Pompa: <span class="font-semibold text-on-surface">{{ $well->pump_name ?: '-' }}</span>
@if ($well->pump_no) <span class="font-data-label">({{ $well->pump_no }})</span> @endif
· Silnik: <span class="font-semibold text-on-surface">{{ $well->engine_name ?: '-' }}</span>
@if ($well->engine_no) <span class="font-data-label">({{ $well->engine_no }})</span> @endif
</p>
</div>
</div>
{{-- Historia po zadanym parametrze --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Historia po zadanym parametrze</div>
<div class="p-card-inner-padding flex flex-wrap items-end gap-3">
<div class="space-y-1">
<label for="histparam" class="font-data-label text-data-label text-on-surface-variant tracking-wide">Wybierz parametr</label>
<select id="histparam" class="bg-surface-container-low border border-outline-variant px-3 py-2 rounded font-data-label text-on-surface">
<option value="0">Wybierz z listy</option>
@foreach ($historyParams as $id => $label)
<option value="{{ $id }}">{{ $optClean($label) }}</option>
@endforeach
</select>
</div>
<x-btn :disabled="true" title="W przygotowaniu (historia parametru)">Pokaż</x-btn>
</div>
</div>
{{-- Przyciski nawigacyjne (podstrony) - maks. 2 w rzędzie --}}
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2">
@foreach ($nav as [$label, $href, $active])
@if ($active)
<x-btn as="a" href="{{ $href }}" class="w-full">{{ $label }}</x-btn>
@else
<x-btn :disabled="true" title="W przygotowaniu" class="w-full">{{ $label }}</x-btn>
@endif
@endforeach
<x-btn :disabled="true" title="W przygotowaniu" class="w-full sm:col-span-2">Pomiary na żądanie</x-btn>
</div>
</div>
</div>
</div>
{{-- Toggle ręcznej edycji pomiaru --}}
<script>
(function () {
const eb = document.getElementById('measEdit');
const sv = document.getElementById('measSave');
const fm = document.getElementById('measForm');
if (! eb || ! fm) return;
eb.addEventListener('click', function () {
fm.querySelectorAll('.param-input').forEach(i => i.removeAttribute('readonly'));
eb.classList.add('hidden');
sv.classList.remove('hidden');
sv.classList.add('flex');
const q = fm.querySelector('[name="q"]');
if (q) q.focus();
});
})();
</script>
</x-app-layout>
@@ -0,0 +1,168 @@
<x-app-layout :active="'well-operation.index'" title="SoftSPM 2 - {{ $well->well_name }}">
@php
$fmt = fn ($v, $d = 2) => $v === null || $v === '' ? '-' : number_format(round((float) $v, $d), $d, ',', ' ');
// Klasy komórki oceny wg strefy.
$zoneCell = [
'green' => 'bg-green-100 text-green-900 dark:bg-green-900/30 dark:text-green-200',
'yellow' => 'bg-amber-100 text-amber-900 dark:bg-amber-900/30 dark:text-amber-200',
'red' => 'bg-red-100 text-red-900 dark:bg-red-900/30 dark:text-red-200',
];
$zoneHex = ['green' => '#2e7d32', 'yellow' => '#f9a825', 'red' => '#c62828'];
// Kolor punktu pracy na wykresie Hp = ocena H=f(Q) (jak Evaluation4_HfQ w legacy).
$hfqZone = $assessments['hfq']['zone'] ?? null;
$hfqColor = $hfqZone ? $zoneHex[$hfqZone] : '#5b6566';
$spmType = 'SPM - '.strtoupper(str_replace(['images/spm_', '.png'], '', $spmImage));
$rows = [
['Przedział Q', $assessments['q'] ?? null],
['H = f(Q)', $assessments['hfq'] ?? null],
['Dławienie', $assessments['throttle'] ?? null],
['Straty liniowe', $assessments['loss'] ?? null],
];
$isOn = $onoff && $onoff->DRD_VALUE === 'ON';
@endphp
<div class="space-y-stack-gap">
@if (session('status'))
<div class="status-chip-ok px-3 py-2 rounded-lg font-body-sm text-body-sm">{{ session('status') }}</div>
@endif
@if (session('error'))
<div class="status-chip-alert px-3 py-2 rounded-lg font-body-sm text-body-sm">{{ session('error') }}</div>
@endif
{{-- Nagłówek --}}
<div class="flex flex-wrap items-center justify-between gap-3">
<div class="flex items-center gap-2">
<a href="{{ route('well-operation.index') }}" class="font-body-sm text-body-sm text-on-surface-variant hover:text-primary">← Eksploatacja studni</a>
<h1 class="font-headline-lg text-headline-lg text-on-surface">{{ $well->well_name }}</h1>
</div>
@if ($isOn)
<span class="status-chip status-chip-ok">Załączona</span>
@else
<span class="status-chip status-chip-alert">Wyłączona</span>
@endif
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-stack-gap items-start">
{{-- ===== LEWA KOLUMNA ===== --}}
<div class="space-y-stack-gap">
{{-- Oceny pracy układu pompowego --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Oceny pracy układu pompowego</div>
@if ($assessments === null)
<p class="p-card-inner-padding font-body-sm text-body-sm text-on-surface-variant">Studnia typu „SPM - inne" - brak automatycznej oceny.</p>
@else
<table class="w-full font-body-md text-body-md">
<tbody class="divide-y divide-outline-variant/30">
@foreach ($rows as [$label, $a])
<tr>
<td class="px-4 py-2 w-40 bg-surface-container/60 text-on-surface-variant font-data-label text-data-label align-top">{{ $label }}</td>
<td class="px-4 py-2 {{ $a ? $zoneCell[$a['zone']] : 'text-on-surface-variant' }}">{{ $a['text'] ?? 'Brak oceny' }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
{{-- Układ pompowy + schemat SPM --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Układ pompowy - {{ $well->well_name }}</div>
<div class="p-card-inner-padding space-y-3">
<dl class="grid grid-cols-3 gap-x-4 gap-y-1.5 font-body-md text-body-md">
<dt class="text-on-surface-variant">Ujęcie / Bariera</dt><dd class="col-span-2">{{ $well->bariera ?: '-' }}</dd>
<dt class="text-on-surface-variant">Pompa</dt><dd class="col-span-2 font-semibold">{{ $well->pump_name ?: '-' }} <span class="font-data-label text-on-surface-variant">{{ $well->pump_no ? '· '.$well->pump_no : '' }}</span></dd>
<dt class="text-on-surface-variant">Silnik</dt><dd class="col-span-2 font-semibold">{{ $well->engine_name ?: '-' }} <span class="font-data-label text-on-surface-variant">{{ $well->engine_no ? '· '.$well->engine_no : '' }}</span></dd>
<dt class="text-on-surface-variant">Q<sub>n</sub> [m³/min]</dt><dd class="col-span-2 font-data-label">{{ $fmt($qnMin, 3) }}</dd>
</dl>
<div class="relative rounded border border-outline-variant/40 p-2" style="background:#f7fafb">
<x-well-schematic
:throttle="$assessments['throttle']['zone'] ?? null"
:loss="$assessments['loss']['zone'] ?? null"
:on="$isOn"
:grey="$grey"
:type="$spmType" />
{{-- Status diagnostyki --}}
<span class="absolute top-3 right-3 inline-flex items-center gap-1 px-2 py-0.5 rounded-full font-data-label text-data-label
@if ((int) $diag === 2) bg-red-100 text-red-800 @elseif ((int) $diag === 1) bg-amber-100 text-amber-800 @else bg-green-100 text-green-800 @endif">
@if ((int) $diag === 2) Diagnostyka: błąd @elseif ((int) $diag === 1) Diagnostyka: ostrzeżenie @else Diagnostyka: OK @endif
</span>
</div>
@if ($measurement)
<p class="text-center font-data-label text-data-label text-secondary">Data odpytania SYNDIS: {{ $measurement->date }}</p>
@endif
</div>
</div>
{{-- Stan pracy --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">
Stan pracy - {{ $isOn ? 'Załączona' : 'Wyłączona' }}
@if ($onoff) <span class="font-data-label text-data-label opacity-80">[{{ $onoff->DRD_AUDIT_DATE }}]</span> @endif
</div>
<div class="p-card-inner-padding flex items-center gap-4">
<div class="grid place-items-center w-28 h-14 rounded-lg font-headline-md text-headline-md {{ $isOn ? 'bg-green-600 text-white' : 'bg-surface-container text-on-surface-variant/50' }}">ON</div>
<div class="grid place-items-center w-28 h-14 rounded-lg font-headline-md text-headline-md {{ ! $isOn ? 'bg-red-600 text-white' : 'bg-surface-container text-on-surface-variant/50' }}">OFF</div>
@if ($onoff && ! empty($onoff->reason))
<div class="font-body-sm text-body-sm text-on-surface-variant">
Powód: <span class="font-semibold text-on-surface">{{ $onoff->reason }}</span>
</div>
@endif
</div>
</div>
{{-- Akcje - pod stanem pracy (siatka 2-kol, jak na stronie parametrów) --}}
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2 pt-1">
<x-btn as="a" href="{{ route('well-operation.params', $well->drs_id) }}" class="w-full">Parametry pracy układu</x-btn>
<form method="POST" action="{{ route('well-operation.fetch', $well->drs_id) }}">
@csrf
<x-btn type="submit" class="w-full">Pobierz aktualne dane</x-btn>
</form>
</div>
</div>
{{-- ===== PRAWA KOLUMNA ===== --}}
<div class="space-y-stack-gap">
{{-- Ocena energochłonności --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Ocena energochłonności</div>
<div class="p-card-inner-padding">
@if ($energy)
<x-energy-gauge :eta="$energy['eta']" :ry="$energy['ry']" :yg="$energy['yg']" :zone="$energy['zone']" />
@else
<div class="h-12 rounded bg-surface-container grid place-items-center font-body-sm text-body-sm text-on-surface-variant">Brak oceny</div>
@endif
</div>
</div>
{{-- Wysokość podnoszenia --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Wysokość podnoszenia</div>
<div class="p-card-inner-padding">
@if ($hPlot)
<x-pump-curve :plot="$hPlot" x-label="Q [m³/min]" y-label="H [m]" :op-x="$opQ" :op-y="$opH" :op-color="$hfqColor" op-y-label="H" />
@else
<p class="py-8 text-center font-body-sm text-body-sm text-on-surface-variant">Brak danych próby pompy.</p>
@endif
</div>
</div>
{{-- Sprawność --}}
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
<div class="bg-secondary text-on-secondary px-card-inner-padding py-2 font-title-sm text-title-sm">Sprawność</div>
<div class="p-card-inner-padding">
@if ($etaPlot)
<x-pump-curve :plot="$etaPlot" x-label="Q [m³/min]" y-label="η [-]" :op-x="$opQ" :op-y="$opEta" op-color="#5b6566" :band="true" />
@else
<p class="py-8 text-center font-body-sm text-body-sm text-on-surface-variant">Brak danych próby pompy.</p>
@endif
</div>
</div>
</div>
</div>
</div>
</x-app-layout>