Created FilamentTypeController & FilamentType Model

This commit is contained in:
2025-03-10 19:28:46 +01:00
parent 9fd01ee43a
commit 21f33383ae
15 changed files with 404 additions and 5 deletions
+36
View File
@@ -0,0 +1,36 @@
<x-app-layout>
<x-slot name="header">
{{ __('Create Types') }}
</x-slot>
<x-slot name="headeraction">
<div class="flex gap-4 justify-end">
<a href="{{ route('types.index') }}" class=" text-zinc-50 hover:text-zinc-300 font-bold text-base py-2 px-4 rounded cursor-pointer">Back</a>
<a href="{{ route('types.store') }}" onclick="event.preventDefault(); document.getElementById('create-type-form').submit();" class="bg-green-500 hover:bg-green-700 text-zinc-700 hover:text-white font-bold text-base py-2 px-4 rounded cursor-pointer">Submit</a>
</div>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-zinc-700 p-4 overflow-hidden shadow-xl sm:rounded-lg">
<form id="create-type-form" class="flex flex-col gap-6" method="POST" action="{{ route('types.store') }}">
@csrf
<div class="form-group flex flex-col">
<label for="name" class="text-lg ">Name</label>
<input type="text" id="name" name="name" class="form-control bg-white dark:bg-zinc-800 border-zinc-50 dark:border-zinc-600 rounded" required="">
</div>
<div class="form-group flex flex-col">
<label for="description">Description</label>
<textarea name="description" class="form-control bg-white dark:bg-zinc-800 border-zinc-50 dark:border-zinc-600 rounded" required=""></textarea>
</div>
<div class="flex justify-end gap-4">
<a href="{{ route('types.index') }}" class="bg-zinc-500 hover:bg-zinc-700 text-zinc-800 hover:text-white font-bold py-2 px-4 rounded cursor-pointer">Cancel</a>
<button type="submit" class="bg-green-500 hover:bg-green-700 text-zinc-800 hover:text-white font-bold py-2 px-4 rounded cursor-pointer">Submit</button>
</div>
</form>
</div>
</div>
</div>
</x-app-layout>
+30
View File
@@ -0,0 +1,30 @@
<x-app-layout>
<x-slot name="header">
{{ __('Create Types') }}
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-zinc-700 p-4 overflow-hidden shadow-xl sm:rounded-lg">
<form id="update-type-form" class="flex flex-col gap-6" method="POST" action="{{ route('types.update', $type->id) }}">
@csrf
@method('PUT')
<div class="form-group flex flex-col">
<label for="name" class="text-lg ">Name</label>
<input type="text" id="name" name="name" class="form-control bg-white dark:bg-zinc-800 border-zinc-50 dark:border-zinc-600 rounded" required="" value="{{ $type->name }}">
</div>
<div class="form-group flex flex-col">
<label for="description">Description</label>
<textarea name="description" class="form-control bg-white dark:bg-zinc-800 border-zinc-50 dark:border-zinc-600 rounded" required="" value="{{ $type->description }}"></textarea>
</div>
<div class="flex justify-end gap-4">
<a href="{{ route('types.index') }}" class="bg-zinc-500 hover:bg-zinc-700 text-zinc-800 hover:text-white font-bold py-2 px-4 rounded cursor-pointer">Cancel</a>
<button type="submit" class="bg-green-500 hover:bg-green-700 text-zinc-800 hover:text-white font-bold py-2 px-4 rounded cursor-pointer">Submit</button>
</div>
</form>
</div>
</div>
</div>
</x-app-layout>
+29
View File
@@ -0,0 +1,29 @@
<x-app-layout>
<x-slot name="header">
{{ __('Types') }}
</x-slot>
<x-slot name="headeraction">
<div class="flex gap-4 justify-end">
<a href="{{ route('types.create') }}" class="bg-zinc-500 hover:bg-green-500 text-zinc-50 hover:text-zinc-700 font-bold text-base py-2 px-4 rounded cursor-pointer">Create</a>
</div>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-zinc-700 overflow-hidden shadow-xl sm:rounded-lg">
<ul class="">
<li class="flex gap-6 bg-zinc-50 dark:bg-zinc-900 p-2 px-4"><div class="">ID</div><div class="">Name</div><div class="">Options</div></li>
@foreach ($types as $type)
<li class="flex gap-6 py-3 px-4 items-center">
<div class="p-2">{{ $type->id }}</div>
<div class="p-2"><a href="/types/{{ $type->id }}">{{ $type->name }}</a></div>
<div class="px-2"><a href="{{ route('types.edit', $type->id) }}"><flux:icon.ellipsis class="hover:text-zinc-50 hover:bg-zinc-500 stroke-3 rounded "/></a></div>
</li>
@endforeach
</ul>
</div>
</div>
</div>
</x-app-layout>
+31
View File
@@ -0,0 +1,31 @@
<x-app-layout>
<x-slot name="header">
{{ $type->name }}
</x-slot>
<x-slot name="headeraction">
<div class="flex gap-4 justify-end">
<a href="{{ route('types.index') }}" class=" text-zinc-50 hover:text-zinc-300 font-bold text-base py-2 px-4 rounded cursor-pointer">Back</a>
<a href="{{ route('types.edit', $type->id) }}" class="bg-zinc-500 hover:bg-zinc-700 text-zinc-50 hover:text-white font-bold text-base py-2 px-4 rounded cursor-pointer">Edit</a>
<a href="{{ route('types.destroy', $type->id) }}" onclick="event.preventDefault(); document.getElementById('delete-form-{{ $type->id }}').submit();" class="bg-red-500 hover:bg-red-500 text-zinc-50 hover:text-white font-bold text-base py-2 px-4 rounded cursor-pointer">Delete</a>
</div>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-zinc-700 overflow-hidden shadow-xl sm:rounded-lg">
<div class="p-4">
<div class="text-lg font-bold">Description</div>
<div class="p-4">
{{ $type->description }}
</div>
</div>
<form id="delete-form-{{ $type->id }}" method="POST" action="{{ route('types.destroy', $type->id) }}" class="hidden">
@csrf
@method('DELETE')
</form>
</div>
</div>
</div>
</x-app-layout>