248 lines
18 KiB
PHP
248 lines
18 KiB
PHP
<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 Σ</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>
|