169 lines
11 KiB
PHP
169 lines
11 KiB
PHP
<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>
|