Initial commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<x-app-layout :active="'engines.index'" title="SoftSPM 2 - Nowy silnik">
|
||||
<div class="max-w-2xl space-y-stack-gap">
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('engines.index') }}" class="font-body-sm text-body-sm text-on-surface-variant hover:text-primary">← Wróć</a>
|
||||
<h1 class="font-headline-lg text-headline-lg text-on-surface">Nowy silnik</h1>
|
||||
</div>
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="status-chip-alert px-3 py-2 rounded-lg font-body-sm text-body-sm">{{ $errors->first() }}</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('engines.store') }}"
|
||||
class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card p-card-inner-padding space-y-4">
|
||||
@csrf
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<x-well-field name="name" label="Typ silnika" :value="old('name')" required class="sm:col-span-2" />
|
||||
<x-well-select name="manufacturer_id" label="Producent" :options="$manufacturers" :selected="old('manufacturer_id')" required placeholder="- wybierz -" class="sm:col-span-2" />
|
||||
|
||||
<x-well-field name="power" label="Moc [kW]" :value="old('power')" required />
|
||||
<x-well-field name="voltage" label="Napięcie [V]" :value="old('voltage')" required />
|
||||
<x-well-field name="current" label="Prąd [A]" :value="old('current')" />
|
||||
<x-well-field name="eta" label="Sprawność η [-]" :value="old('eta')" />
|
||||
<x-well-field name="cos_fi" label="Wsp. mocy cos(φ) [-]" :value="old('cos_fi')" />
|
||||
<x-well-field name="rpm" label="Obroty [1/min]" :value="old('rpm')" />
|
||||
<x-well-field name="length" label="Długość [mm]" :value="old('length')" />
|
||||
<x-well-field name="weight" label="Masa [kg]" :value="old('weight')" />
|
||||
<x-well-field name="diameter" label="Średnica [mm]" :value="old('diameter')" />
|
||||
<x-well-field name="wires" label="Wprowadzenie przewodów" :value="old('wires')" />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2 pt-2">
|
||||
<button type="submit" class="bg-primary text-on-primary px-6 py-2.5 rounded-full font-title-sm text-title-sm hover:bg-primary-container transition-all active:scale-95 shadow-card">Zapisz</button>
|
||||
<a href="{{ route('engines.index') }}" class="px-5 py-2.5 rounded-full font-title-sm text-title-sm text-on-surface-variant hover:bg-surface-container transition-all">Anuluj</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
@@ -0,0 +1,39 @@
|
||||
<x-app-layout :active="'engines.index'" title="SoftSPM 2 - Edycja silnika">
|
||||
<div class="max-w-2xl space-y-stack-gap">
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('engines.show', $engine) }}" class="font-body-sm text-body-sm text-on-surface-variant hover:text-primary">← Wróć</a>
|
||||
<h1 class="font-headline-lg text-headline-lg text-on-surface">Edycja silnika: {{ $engine->ENG_NAME }}</h1>
|
||||
</div>
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="status-chip-alert px-3 py-2 rounded-lg font-body-sm text-body-sm">{{ $errors->first() }}</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('engines.update', $engine) }}"
|
||||
class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card p-card-inner-padding space-y-4">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<x-well-field name="name" label="Typ silnika" :value="$engine->ENG_NAME" required class="sm:col-span-2" />
|
||||
<x-well-select name="manufacturer_id" label="Producent" :options="$manufacturers" :selected="$engine->ENG_MCF_ID" required class="sm:col-span-2" />
|
||||
|
||||
<x-well-field name="power" label="Moc [kW]" :value="$engine->ENG_POWER" required />
|
||||
<x-well-field name="voltage" label="Napięcie [V]" :value="$engine->ENG_VOLTAGE" required />
|
||||
<x-well-field name="current" label="Prąd [A]" :value="$engine->ENG_ELECTRICITY" />
|
||||
<x-well-field name="eta" label="Sprawność η [-]" :value="$engine->ENG_ETA" />
|
||||
<x-well-field name="cos_fi" label="Wsp. mocy cos(φ) [-]" :value="$engine->ENG_COS_FI" />
|
||||
<x-well-field name="rpm" label="Obroty [1/min]" :value="$engine->ENG_RPM" />
|
||||
<x-well-field name="length" label="Długość [mm]" :value="$engine->ENG_LENGTH" />
|
||||
<x-well-field name="weight" label="Masa [kg]" :value="$engine->ENG_WEIGHT" />
|
||||
<x-well-field name="diameter" label="Średnica [mm]" :value="$engine->ENG_DIAMETER" />
|
||||
<x-well-field name="wires" label="Wprowadzenie przewodów" :value="$engine->ENG_WIRES" />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2 pt-2">
|
||||
<button type="submit" class="bg-primary text-on-primary px-6 py-2.5 rounded-full font-title-sm text-title-sm hover:bg-primary-container transition-all active:scale-95 shadow-card">Zapisz zmiany</button>
|
||||
<a href="{{ route('engines.show', $engine) }}" class="px-5 py-2.5 rounded-full font-title-sm text-title-sm text-on-surface-variant hover:bg-surface-container transition-all">Anuluj</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
@@ -0,0 +1,84 @@
|
||||
<x-app-layout :active="'engines.index'" title="SoftSPM 2 - Katalog silników">
|
||||
<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 class="flex items-end justify-between">
|
||||
<div>
|
||||
<h1 class="font-headline-lg text-headline-lg text-on-surface">Katalog silników</h1>
|
||||
<p class="font-body-sm text-body-sm text-on-surface-variant mt-1">Wyników: <span class="font-data-label">{{ $engines->total() }}</span></p>
|
||||
</div>
|
||||
<a href="{{ route('engines.create') }}"
|
||||
class="bg-primary text-on-primary px-5 py-2.5 rounded-full font-title-sm text-title-sm hover:bg-primary-container transition-all active:scale-95 shadow-card">
|
||||
Dodaj silnik
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<form method="GET" action="{{ route('engines.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="by" class="font-data-label text-data-label text-on-surface-variant tracking-wide">Kryterium</label>
|
||||
<select id="by" name="by" class="bg-surface-container-low border border-outline-variant px-3 py-2 rounded font-data-label text-on-surface">
|
||||
<option value="name" {{ $by === 'name' ? 'selected' : '' }}>Typ silnika</option>
|
||||
<option value="power" {{ $by === 'power' ? 'selected' : '' }}>Moc</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
<label for="q" class="font-data-label text-data-label text-on-surface-variant tracking-wide">Szukaj</label>
|
||||
<input id="q" name="q" type="text" value="{{ $q }}" placeholder="typ lub wartość Moc"
|
||||
class="bg-surface-container-low border border-outline-variant px-3 py-2 rounded font-data-label text-on-surface">
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
<label for="mcf" class="font-data-label text-data-label text-on-surface-variant tracking-wide">Producent</label>
|
||||
<select id="mcf" name="mcf" class="bg-surface-container-low border border-outline-variant px-3 py-2 rounded font-data-label text-on-surface">
|
||||
<option value="{{ $mcfAll }}" {{ (int) $mcf === $mcfAll ? 'selected' : '' }}>Wszyscy</option>
|
||||
@foreach ($manufacturers as $id => $name)
|
||||
<option value="{{ $id }}" {{ (int) $mcf === (int) $id ? 'selected' : '' }}>{{ $name }}</option>
|
||||
@endforeach
|
||||
</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>
|
||||
|
||||
<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">Typ silnika</x-sortable-th>
|
||||
<x-sortable-th column="voltage" align="right">Napięcie [V]</x-sortable-th>
|
||||
<x-sortable-th column="power" align="right">Moc [kW]</x-sortable-th>
|
||||
<x-sortable-th column="mcf">Producent</x-sortable-th>
|
||||
<th class="px-4 py-3 text-right">Akcje</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-outline-variant/30 font-body-md text-body-md">
|
||||
@forelse ($engines as $engine)
|
||||
<tr class="hover:bg-surface-container transition-colors">
|
||||
<td class="px-4 py-3 font-data-label text-on-surface-variant">{{ $engines->firstItem() + $loop->index }}.</td>
|
||||
<td class="px-4 py-3 font-semibold text-on-surface">
|
||||
<a href="{{ route('engines.show', $engine) }}" class="hover:text-primary">{{ $engine->ENG_NAME }}</a>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-right font-data-label">{{ $engine->ENG_VOLTAGE }}</td>
|
||||
<td class="px-4 py-3 text-right font-data-label">{{ $engine->ENG_POWER }}</td>
|
||||
<td class="px-4 py-3">{{ $engine->manufacturer?->MCF_NAME }}</td>
|
||||
<td class="px-4 py-3 text-right whitespace-nowrap">
|
||||
<a href="{{ route('engines.show', $engine) }}" class="font-body-sm text-body-sm text-secondary hover:underline">Szczegóły</a>
|
||||
<span class="text-outline-variant mx-1">·</span>
|
||||
<a href="{{ route('engines.edit', $engine) }}" class="font-body-sm text-body-sm text-secondary hover:underline">Edytuj</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="6" class="px-4 py-8 text-center font-body-md text-body-md text-on-surface-variant">Brak silników dla wybranych kryteriów.</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>{{ $engines->links() }}</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
@@ -0,0 +1,75 @@
|
||||
<x-app-layout :active="'engines.index'" title="SoftSPM 2 - {{ $engine->ENG_NAME }}">
|
||||
@php $fmt = fn ($v, $d = 2) => $v === null ? '-' : number_format(round((float) $v, $d), $d, ',', ' '); @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
|
||||
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('engines.index') }}" class="font-body-sm text-body-sm text-on-surface-variant hover:text-primary">← Katalog silników</a>
|
||||
<h1 class="font-headline-lg text-headline-lg text-on-surface">{{ $engine->ENG_NAME }}</h1>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('engines.edit', $engine) }}"
|
||||
class="bg-secondary text-on-secondary px-4 py-2 rounded-full font-title-sm text-title-sm hover:opacity-90 transition-all active:scale-95">Edytuj</a>
|
||||
<x-confirm-delete :action="route('engines.destroy', $engine)"
|
||||
message="Czy na pewno usunąć silnik „{{ $engine->ENG_NAME }}”? Tej operacji nie można cofnąć." />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-stack-gap">
|
||||
{{-- Dane techniczne --}}
|
||||
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card p-card-inner-padding">
|
||||
<h2 class="font-title-sm text-title-sm text-tertiary mb-3">Dane techniczne silnika</h2>
|
||||
<dl class="grid grid-cols-2 gap-x-4 gap-y-2 font-body-md text-body-md">
|
||||
<dt class="text-on-surface-variant">Typ silnika</dt><dd class="font-semibold">{{ $engine->ENG_NAME }}</dd>
|
||||
<dt class="text-on-surface-variant">Producent</dt><dd>{{ $engine->manufacturer?->MCF_NAME ?? '-' }}</dd>
|
||||
<dt class="col-span-2 border-t border-outline-variant/30 mt-1 pt-1"></dt>
|
||||
<dt class="text-on-surface-variant">Napięcie [V]</dt><dd class="font-data-label">{{ $engine->ENG_VOLTAGE ?? '-' }}</dd>
|
||||
<dt class="text-on-surface-variant">Moc [kW]</dt><dd class="font-data-label">{{ $fmt($engine->ENG_POWER) }}</dd>
|
||||
<dt class="text-on-surface-variant">Prąd [A]</dt><dd class="font-data-label">{{ $fmt($engine->ENG_ELECTRICITY) }}</dd>
|
||||
<dt class="text-on-surface-variant">Sprawność η [-]</dt><dd class="font-data-label">{{ $fmt($engine->ENG_ETA) }}</dd>
|
||||
<dt class="text-on-surface-variant">Wsp. mocy cos(φ) [-]</dt><dd class="font-data-label">{{ $fmt($engine->ENG_COS_FI) }}</dd>
|
||||
<dt class="text-on-surface-variant">Obroty [1/min]</dt><dd class="font-data-label">{{ $fmt($engine->ENG_RPM) }}</dd>
|
||||
<dt class="col-span-2 border-t border-outline-variant/30 mt-1 pt-1"></dt>
|
||||
<dt class="text-on-surface-variant">Długość [mm]</dt><dd class="font-data-label">{{ $fmt($engine->ENG_LENGTH) }}</dd>
|
||||
<dt class="text-on-surface-variant">Średnica [mm]</dt><dd class="font-data-label">{{ $fmt($engine->ENG_DIAMETER) }}</dd>
|
||||
<dt class="text-on-surface-variant">Masa [kg]</dt><dd class="font-data-label">{{ $fmt($engine->ENG_WEIGHT) }}</dd>
|
||||
<dt class="text-on-surface-variant">Wprow. przewodów</dt><dd>{{ $engine->ENG_WIRES ?? '-' }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
{{-- Lista pomp dla silnika --}}
|
||||
<div class="bg-surface-container-lowest border border-outline-variant/40 rounded-lg shadow-card overflow-hidden">
|
||||
<div class="px-card-inner-padding pt-card-inner-padding">
|
||||
<h2 class="font-title-sm text-title-sm text-tertiary mb-2">Lista pomp dla silnika</h2>
|
||||
</div>
|
||||
<table class="w-full text-left">
|
||||
<thead class="bg-secondary/10 border-y border-outline-variant/40">
|
||||
<tr class="font-data-label text-data-label text-on-surface-variant tracking-wide">
|
||||
<th class="px-4 py-2">Typ pompy</th>
|
||||
<th class="px-4 py-2 text-right">Q<sub>n</sub> [m³/h]</th>
|
||||
<th class="px-4 py-2 text-right">H<sub>p</sub> [m]</th>
|
||||
<th class="px-4 py-2">Producent</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-outline-variant/30 font-body-md text-body-md">
|
||||
@forelse ($relatedPumps as $p)
|
||||
<tr>
|
||||
<td class="px-4 py-1.5">{{ $p->PUP_NAME }}</td>
|
||||
<td class="px-4 py-1.5 text-right font-data-label">{{ number_format(round((float) $p->q_n, 3), 3, ',', ' ') }}</td>
|
||||
<td class="px-4 py-1.5 text-right font-data-label">{{ $p->PUP_H_P }}</td>
|
||||
<td class="px-4 py-1.5">{{ $p->MCF_NAME }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="4" class="px-4 py-4 text-center font-body-sm text-on-surface-variant">Brak powiązanych pomp.</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
Reference in New Issue
Block a user