first&last
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<div class="grid gap-4 lg:grid-cols-3">
|
||||
<div class="card"><div class="card-body space-y-3">
|
||||
<h2 class="text-lg font-semibold">{{ $editingId ? 'Редактировать оборудование' : 'Новое оборудование' }}</h2>
|
||||
<input wire:model.defer="name" placeholder="Название" class="w-full rounded-xl border border-slate-300 px-3 py-2">
|
||||
<input wire:model.defer="serialNumber" placeholder="Серийный номер" class="w-full rounded-xl border border-slate-300 px-3 py-2">
|
||||
<input wire:model.defer="inventoryNumber" placeholder="Инвентарный номер" class="w-full rounded-xl border border-slate-300 px-3 py-2">
|
||||
<select wire:model.defer="categoryId" class="w-full rounded-xl border border-slate-300 px-3 py-2"><option value="">Категория</option>@foreach($categories as $c)<option value="{{ $c->id }}">{{ $c->name }}</option>@endforeach</select>
|
||||
<select wire:model.defer="clientId" class="w-full rounded-xl border border-slate-300 px-3 py-2"><option value="">Клиент</option>@foreach($clients as $c)<option value="{{ $c->id }}">{{ $c->name }}</option>@endforeach</select>
|
||||
<div class="grid gap-2 md:grid-cols-2"><input wire:model.defer="purchaseDate" type="date" class="w-full rounded-xl border border-slate-300 px-3 py-2"><input wire:model.defer="warrantyUntil" type="date" class="w-full rounded-xl border border-slate-300 px-3 py-2"></div>
|
||||
<select wire:model.defer="condition" class="w-full rounded-xl border border-slate-300 px-3 py-2"><option value="good">Хорошее</option><option value="fair">Удовлетворительное</option><option value="poor">Плохое</option></select>
|
||||
<textarea wire:model.defer="notes" rows="3" placeholder="Примечания" class="w-full rounded-xl border border-slate-300 px-3 py-2"></textarea>
|
||||
<button wire:click="save" class="rounded-xl bg-slate-900 text-white px-3 py-2 text-sm">Сохранить</button>
|
||||
</div></div>
|
||||
|
||||
<div class="card lg:col-span-2 overflow-hidden">
|
||||
<table class="min-w-full text-sm">
|
||||
<thead class="bg-slate-50"><tr><th class="px-3 py-2 text-left">Название</th><th class="px-3 py-2 text-left">Категория</th><th class="px-3 py-2 text-left">Клиент</th><th class="px-3 py-2 text-left">Гарантия</th><th></th></tr></thead>
|
||||
<tbody>
|
||||
@foreach($items as $item)
|
||||
@php
|
||||
$expired = $item->warranty_until && $item->warranty_until->isPast();
|
||||
$expiring = $item->warranty_until && !$expired && $item->warranty_until->lte(now()->addDays(30));
|
||||
@endphp
|
||||
<tr class="border-t border-slate-100">
|
||||
<td class="px-3 py-2"><p class="font-medium">{{ $item->name }}</p><p class="text-xs text-slate-500">{{ $item->inventory_number }}</p></td>
|
||||
<td class="px-3 py-2">{{ $item->category?->name }}</td>
|
||||
<td class="px-3 py-2">{{ $item->client?->name ?? '—' }}</td>
|
||||
<td class="px-3 py-2 {{ $expired ? 'text-rose-600' : ($expiring ? 'text-amber-600' : '') }}">{{ $item->warranty_until?->format('d.m.Y') ?? '—' }}</td>
|
||||
<td class="px-3 py-2 text-right"><button wire:click="edit({{ $item->id }})" class="text-xs mr-2">Изм.</button><button wire:click="delete({{ $item->id }})" class="text-xs text-rose-600">Удалить</button></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="p-4">{{ $items->links() }}</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user