la_bloger/resources/views/admin/taxonomy/form.blade.php

41 lines
1.7 KiB
PHP

@extends('admin::layouts.app')
@section('title', $term->exists ? 'Edit Term' : 'New Term')
@section('content')
<div class="flex items-center justify-between mb-6">
<h1 class="text-xl font-semibold text-gray-900">
{{ $term->exists ? 'Edit Term' : 'New Term' }}
</h1>
<a href="{{ route('admin.taxonomy.index') }}" class="text-sm text-gray-500 hover:text-gray-700"> Taxonomy</a>
</div>
<div class="max-w-lg">
<form method="POST" action="{{ $term->exists ? route('admin.taxonomy.update', $term) : route('admin.taxonomy.store') }}">
@csrf
@if($term->exists) @method('PUT') @endif
<div class="bg-white rounded shadow p-5 space-y-4">
<div x-data="{ title: '{{ old('title', $term->title) }}' }">
<label class="block text-sm font-medium text-gray-700 mb-1">Title</label>
<input type="text" name="title" x-model="title" autofocus
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 @error('title') border-red-500 @enderror">
@error('title') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
<p class="mt-2 text-xs text-gray-400">
Slug: <span class="font-mono" x-text="title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || '—'"></span>
</p>
</div>
</div>
<div class="mt-4">
<button type="submit"
class="px-6 py-2 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium rounded">
{{ $term->exists ? 'Save changes' : 'Create term' }}
</button>
</div>
</form>
</div>
@endsection