Files
usher-manage-stack/resources/views/admin/issue-labels/edit.blade.php
2025-11-20 23:21:05 +08:00

78 lines
4.6 KiB
PHP

<x-app-layout>
<x-slot name="header">
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
{{ __('Edit Label') }} - {{ $issueLabel->name }}
</h2>
</x-slot>
<div class="py-12">
<div class="mx-auto max-w-2xl sm:px-6 lg:px-8">
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800 px-4 py-5 sm:p-6">
<form method="POST" action="{{ route('admin.issue-labels.update', $issueLabel) }}" class="space-y-6">
@csrf
@method('PATCH')
<div>
<label for="name" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Name') }} <span class="text-red-500">*</span>
</label>
<input type="text" name="name" id="name" value="{{ old('name', $issueLabel->name) }}" required maxlength="255"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100 @error('name') border-red-300 @enderror">
@error('name')<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>@enderror
</div>
<div>
<label for="color" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Color') }} <span class="text-red-500">*</span>
</label>
<div class="mt-1 flex gap-2">
<input type="color" name="color" id="color" value="{{ old('color', $issueLabel->color) }}" required
class="h-10 w-20 rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-600">
<input type="text" id="color-text" value="{{ old('color', $issueLabel->color) }}" maxlength="7"
class="flex-1 rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
</div>
@error('color')<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>@enderror
</div>
<div>
<label for="description" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Description') }}
</label>
<textarea name="description" id="description" rows="3" maxlength="500"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">{{ old('description', $issueLabel->description) }}</textarea>
@error('description')<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>@enderror
</div>
<div class="flex items-center justify-end gap-x-4 border-t border-gray-200 pt-6 dark:border-gray-700">
<a href="{{ route('admin.issue-labels.index') }}"
class="rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 dark:bg-gray-700 dark:text-gray-100 dark:ring-gray-600">
{{ __('Cancel') }}
</a>
<button type="submit"
class="inline-flex justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 dark:bg-indigo-500 dark:hover:bg-indigo-400">
{{ __('Update Label') }}
</button>
</div>
</form>
</div>
</div>
</div>
<script>
// Sync color picker and text input
const colorPicker = document.getElementById('color');
const colorText = document.getElementById('color-text');
colorPicker.addEventListener('input', (e) => {
colorText.value = e.target.value.toUpperCase();
});
colorText.addEventListener('input', (e) => {
const value = e.target.value;
if (/^#[0-9A-Fa-f]{6}$/.test(value)) {
colorPicker.value = value;
}
});
</script>
</x-app-layout>