#3 telah kemaskini category
This commit is contained in:
92
resources/views/category/edit.blade.php
Normal file
92
resources/views/category/edit.blade.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div>
|
||||
<p class="text-sm font-medium uppercase tracking-wider text-indigo-600">{{ __('Categories') }}</p>
|
||||
<h2 class="text-2xl font-semibold leading-tight text-gray-900">
|
||||
{{ __('Edit Category') }}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<a href="{{ route('category.index') }}" class="inline-flex items-center justify-center rounded-lg border border-gray-300 px-4 py-2 text-sm font-semibold text-gray-700 transition hover:bg-white">
|
||||
{{ __('Back to Categories') }}
|
||||
</a>
|
||||
</div>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-10">
|
||||
<div class="mx-auto max-w-4xl px-4 sm:px-6 lg:px-8">
|
||||
@if (session('status') === 'category-updated')
|
||||
<div class="mb-6 rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm font-medium text-emerald-800">
|
||||
{{ __('Category updated successfully.') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<section class="overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm">
|
||||
<div class="border-b border-gray-100 px-6 py-5" style="background: linear-gradient(90deg, {{ $category->color }}20, #ffffff)">
|
||||
<div class="flex items-center gap-4">
|
||||
<span class="h-12 w-12 rounded-xl shadow-sm ring-1 ring-black/5" style="background-color: {{ $category->color }}"></span>
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-gray-900">{{ $category->name }}</h3>
|
||||
<p class="mt-1 font-mono text-sm text-gray-600">{{ $category->slug }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="delete-category-form" method="POST" action="{{ route('category.destroy', $category) }}" onsubmit="return confirm('{{ __('Delete this category?') }}')">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
</form>
|
||||
|
||||
<form method="POST" action="{{ route('category.update', $category) }}" class="space-y-6 p-6">
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
|
||||
<div class="grid gap-6 md:grid-cols-2">
|
||||
<div>
|
||||
<x-input-label for="name" :value="__('Name')" />
|
||||
<x-text-input id="name" class="mt-2 block w-full" type="text" name="name" :value="old('name', $category->name)" required autofocus autocomplete="off" />
|
||||
<x-input-error class="mt-2" :messages="$errors->get('name')" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="slug" :value="__('Slug')" />
|
||||
<x-text-input id="slug" class="mt-2 block w-full" type="text" name="slug" :value="old('slug', $category->slug)" required autocomplete="off" />
|
||||
<x-input-error class="mt-2" :messages="$errors->get('slug')" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="description" :value="__('Description')" />
|
||||
<textarea id="description" name="description" rows="4" class="mt-2 block w-full rounded-lg border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">{{ old('description', $category->description) }}</textarea>
|
||||
<x-input-error class="mt-2" :messages="$errors->get('description')" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="color" :value="__('Color')" />
|
||||
<div class="mt-2 flex items-center gap-3">
|
||||
<input id="color" type="color" name="color" value="{{ old('color', $category->color) }}" class="h-11 w-16 cursor-pointer rounded-lg border border-gray-300 bg-white p-1 shadow-sm">
|
||||
<span class="text-sm text-gray-500">{{ __('Adjust the accent used across category lists.') }}</span>
|
||||
</div>
|
||||
<x-input-error class="mt-2" :messages="$errors->get('color')" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-3 border-t border-gray-100 pt-6 sm:flex-row sm:items-center sm:justify-between">
|
||||
<button type="submit" form="delete-category-form" class="inline-flex items-center justify-center rounded-lg border border-rose-200 px-4 py-2 text-sm font-semibold text-rose-700 transition hover:bg-rose-50">
|
||||
{{ __('Delete Category') }}
|
||||
</button>
|
||||
|
||||
<div class="flex flex-col-reverse gap-3 sm:flex-row sm:items-center">
|
||||
<a href="{{ route('category.index') }}" class="inline-flex items-center justify-center rounded-lg border border-gray-300 px-4 py-2 text-sm font-semibold text-gray-700 transition hover:bg-gray-50">
|
||||
{{ __('Cancel') }}
|
||||
</a>
|
||||
<button type="submit" class="inline-flex items-center justify-center rounded-lg bg-indigo-600 px-4 py-2 text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
|
||||
{{ __('Update Category') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
Reference in New Issue
Block a user