updated Buildplate View
This commit is contained in:
@@ -2,14 +2,33 @@
|
||||
|
||||
namespace App\Livewire\Filament;
|
||||
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
use App\Models\Buildplate as BuildplateModel;
|
||||
|
||||
#[title('Buildplates')]
|
||||
class Buildplate extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
|
||||
#[Validate('required')]
|
||||
public $name = '';
|
||||
|
||||
public $search ='';
|
||||
|
||||
// Edit Modal + Query
|
||||
public $editquery = '';
|
||||
|
||||
public $editid = '';
|
||||
public $deleteid = '';
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.filament.buildplate');
|
||||
return view('livewire.filament.buildplate', [
|
||||
'buildplates' => BuildplateModel::search('name', $this->search)->paginate(20)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,113 @@
|
||||
<div>
|
||||
{{-- If your happiness depends on money, you will never be happy with yourself. --}}
|
||||
<section>
|
||||
<x-header>
|
||||
{{ __('Buildplates') }}
|
||||
|
||||
<x-slot name="headerleft">
|
||||
<input type="text" placeholder="Search..." wire:model.live="search" class="bg-zinc-800 rounded focus:border-accent focus:ring-accent" />
|
||||
</x-slot>
|
||||
|
||||
<x-slot name="headerright">
|
||||
<flux:modal.trigger name="createModal">
|
||||
<flux:button variant="primary" class="bg-nuke-400 hover:bg-nuke-300">Create Buildplate</flux:button>
|
||||
</flux:modal.trigger>
|
||||
</x-slot>
|
||||
</x-header>
|
||||
|
||||
|
||||
|
||||
<div class="container m-auto my-8">
|
||||
<x-table>
|
||||
<x-slot name="tableheader">
|
||||
<x-table.header>Name</x-table.header>
|
||||
<x-table.header>Description</x-table.header>
|
||||
<x-table.header>Manufacturer</x-table.header>
|
||||
<x-table.header>Max Temp.</x-table.header>
|
||||
<x-table.header class="w-1/6"></x-table.header>
|
||||
</x-slot>
|
||||
|
||||
@foreach ($buildplates as $buildplate)
|
||||
<tr wire:key="{{ $buildplate->id }}" class="border-b border-blackout-950">
|
||||
<x-table.item><p class="p-4 px-3 pl-6 font-bold">{{ $buildplate->name }}</p></x-table.item>
|
||||
<x-table.item><p class="p-4 px-3">{{ $buildplate->description }}</p></x-table.item>
|
||||
<x-table.item><p class="p-4 px-3">{{ $buildplate->manufacturer_id->name }}</p></x-table.item>
|
||||
<x-table.item><p class="p-4 px-3 text-left">{{ $buildplate->temp_max }}</p></x-table.item>
|
||||
<x-table.item><p class="p-4 px-3"></p></x-table.item>
|
||||
<x-table.item>
|
||||
<div class="flex flex-row gap-4 justify-end pr-8">
|
||||
<flux:button wire:click="edit({{ $buildplate->id }})" icon="pencil">Edit</flux:button>
|
||||
<flux:button wire:click="deleteModal({{ $buildplate->id }})" icon="x-mark">Delete</flux:button>
|
||||
</div>
|
||||
</x-table.item>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<x-slot name="pagination">
|
||||
{{ $buildplates->links() }}
|
||||
</x-slot>
|
||||
</x-table>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Create Form -->
|
||||
<flux:modal wire:model.self='createModal' name="createModal" class="md:w-128">
|
||||
<form wire:submit.prevent="create">
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<flux:heading size="lg" class="text-nuke-400">Create color</flux:heading>
|
||||
<flux:text class="mt-2">Create a new color.</flux:text>
|
||||
</div>
|
||||
<flux:input label="Name" wire:model="name" placeholder="Color Name" required />
|
||||
<flux:input label="hex" wire:model="hex" type="color" required />
|
||||
<div class="flex gap-2">
|
||||
<flux:spacer />
|
||||
<flux:button variant="ghost" wire:click='cancel'>Cancel</flux:button>
|
||||
<flux:button type="submit" variant="primary" class="bg-nuke-400 hover:bg-nuke-500">Create</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</flux:modal>
|
||||
|
||||
<!-- Edit Form -->
|
||||
@empty($buildplate)
|
||||
@else
|
||||
<flux:modal wire:model.self='editModal' name="editModal" class="md:w-128">
|
||||
<form wire:submit.prevent="save({{ $editid }})">
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<flux:heading size="lg" class="text-etheral-300">Edit buildplate</flux:heading>
|
||||
<flux:text class="mt-2">Edit an existing buildplate.</flux:text>
|
||||
</div>
|
||||
<flux:input label="Name" wire:model="name" placeholder="Color Name" required />
|
||||
<flux:input label="hex" wire:model="hex" type="color" required />
|
||||
<div class="flex gap-2">
|
||||
<flux:spacer />
|
||||
<flux:button variant="ghost" wire:click='cancel'>Cancel</flux:button>
|
||||
<flux:button type="submit" variant="primary" class="bg-etheral-300 hover:bg-etheral-400">Save</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</flux:modal>
|
||||
@endempty
|
||||
|
||||
<!-- Delete Form -->
|
||||
<flux:modal wire:model.self='deleteModal' name="deleteModal" class="md:w-128">
|
||||
<form wire:submit.prevent="delete({{ $deleteid }})">
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<flux:heading size="lg" class="text-red-500">Delete buildplate?</flux:heading>
|
||||
<flux:text class="mt-2">
|
||||
<p>You're about to delete this buildplate.</p>
|
||||
<p>This action cannot be reversed.</p>
|
||||
</flux:text>
|
||||
</div>
|
||||
<flux:input label="Name" wire:model="name" disabled placeholder="Buildplate Name" required />
|
||||
<flux:input label="hex" wire:model="hex" disabled type="color" required />
|
||||
<div class="flex gap-2">
|
||||
<flux:spacer />
|
||||
<flux:button variant="ghost" wire:click='cancel'>Cancel</flux:button>
|
||||
<flux:button type="submit" variant="danger">Delete color</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</flux:modal>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user