Tampilan superadmin dan fungsi hapus venue

This commit is contained in:
Stephen Gesityan 2025-05-12 18:53:19 +07:00
parent 4b2325d496
commit ca61a6b0fe
4 changed files with 390 additions and 233 deletions

View File

@ -150,18 +150,30 @@ public function update(Request $request, $id)
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$venue = Venue::findOrFail($id);
// Delete the venue image if exists
if ($venue->image && Storage::disk('public')->exists($venue->image)) {
Storage::disk('public')->delete($venue->image);
}
{
$venue = Venue::findOrFail($id);
$venue->tables()->delete();
$venue->delete();
return redirect()->route('superadmin.venue.index')
->with('success', 'Venue berhasil dihapus!');
// Hapus gambar venue jika ada
if ($venue->image && Storage::disk('public')->exists($venue->image)) {
Storage::disk('public')->delete($venue->image);
}
// Ambil semua meja yang ada di venue ini
$tables = $venue->tables;
// Hapus semua bookings yang terkait dengan meja-meja ini
foreach ($tables as $table) {
$table->bookings()->delete(); // pastikan relasi bookings ada di model Table
}
// Hapus semua meja dari venue
$venue->tables()->delete();
// Hapus venue-nya
$venue->delete();
return redirect()->route('superadmin.venue.index')
->with('success', 'Venue berhasil dihapus!');
}
}

View File

@ -46,13 +46,7 @@ class="flex items-center p-3 rounded-lg hover:bg-blue-700 {{ request()->routeIs(
<span class="ml-3">Dashboard</span>
</a>
</li>
<li class="mb-2">
<a href="{{ route('superadmin.admin.index') }}"
class="flex items-center p-3 rounded-lg hover:bg-blue-700 {{ request()->routeIs('superadmin.admin.*') ? 'bg-blue-700' : '' }}">
<i class="fas fa-users-cog w-5"></i>
<span class="ml-3">Manajemen Admin</span>
</a>
</li>
<li class="mb-2">
<a href="{{ route('superadmin.venue.index') }}"
class="flex items-center p-3 rounded-lg hover:bg-blue-700 {{ request()->routeIs('superadmin.venue.*') ? 'bg-blue-700' : '' }}">
@ -60,6 +54,13 @@ class="flex items-center p-3 rounded-lg hover:bg-blue-700 {{ request()->routeIs(
<span class="ml-3">Manajemen Venue</span>
</a>
</li>
<li class="mb-2">
<a href="{{ route('superadmin.admin.index') }}"
class="flex items-center p-3 rounded-lg hover:bg-blue-700 {{ request()->routeIs('superadmin.admin.*') ? 'bg-blue-700' : '' }}">
<i class="fas fa-users-cog w-5"></i>
<span class="ml-3">Manajemen Admin</span>
</a>
</li>
<li class="mb-2">
<a href="{{ route('logout') }}"
onclick="event.preventDefault(); document.getElementById('logout-form').submit();"

View File

@ -1,101 +1,218 @@
@extends('layouts.super-admin')
@section('content')
<div class="mb-6">
<h1 class="text-3xl font-bold text-gray-800">Tambah Admin</h1>
<p class="text-gray-600">Tambahkan akun admin baru untuk venue</p>
</div>
<div class="min-h-screen bg-gray-50 flex items-center justify-center px-4 sm:px-6 lg:px-8 py-12">
<div class="w-full max-w-2xl">
<div class="bg-white rounded-xl shadow-2xl overflow-hidden" style="backdrop-filter: blur(20px); background-color: rgba(255, 255, 255, 0.8);">
<div class="p-6 sm:p-10">
<h2 class="text-center text-4xl font-semibold text-gray-900 mb-8">
{{ __('Tambah Admin Baru') }}
</h2>
<div class="bg-white rounded-lg shadow p-6">
<form action="{{ route('superadmin.admin.store') }}" method="POST">
@csrf
@if ($errors->any())
<div class="mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded-lg">
<ul class="space-y-1 text-sm text-red-700">
@foreach ($errors->all() as $error)
<li class="flex items-center">
<svg class="h-4 w-4 mr-2 text-red-500" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-11.293a1 1 0 00-1.414-1.414L10 8.586 7.707 6.293a1 1 0 00-1.414 1.414L8.586 10l-2.293 2.293a1 1 0 101.414 1.414L10 11.414l2.293 2.293a1 1 0 001.414-1.414L11.414 10l2.293-2.293z" clip-rule="evenodd"/>
</svg>
{{ $error }}
</li>
@endforeach
</ul>
</div>
@endif
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Nama Admin -->
<div>
<label for="name" class="block text-sm font-medium text-gray-700 mb-1">Nama Admin</label>
<input type="text" name="name" id="name" value="{{ old('name') }}"
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 @error('name') border-red-300 @enderror"
required>
@error('name')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<form
action="{{ route('superadmin.admin.store') }}"
method="POST"
x-data="adminForm()"
class="space-y-6"
>
@csrf
<!-- Email -->
<div>
<label for="email" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input type="email" name="email" id="email" value="{{ old('email') }}"
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 @error('email') border-red-300 @enderror"
required>
@error('email')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div class="grid md:grid-cols-2 gap-6">
{{-- Nama Admin --}}
<div class="col-span-2 md:col-span-1">
<label for="name" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Nama Admin') }}
</label>
<input
type="text"
id="name"
name="name"
value="{{ old('name') }}"
required
autocomplete="name"
autofocus
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out"
placeholder="Masukkan nama admin"
>
</div>
<!-- Password -->
<div>
<label for="password" class="block text-sm font-medium text-gray-700 mb-1">Password</label>
<input type="password" name="password" id="password"
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 @error('password') border-red-300 @enderror"
required>
@error('password')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
{{-- Email --}}
<div class="col-span-2 md:col-span-1">
<label for="email" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Email') }}
</label>
<input
type="email"
id="email"
name="email"
value="{{ old('email') }}"
required
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out"
placeholder="Masukkan email admin"
>
</div>
</div>
<!-- Konfirmasi Password -->
<div>
<label for="password_confirmation" class="block text-sm font-medium text-gray-700 mb-1">Konfirmasi
Password</label>
<input type="password" name="password_confirmation" id="password_confirmation"
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
required>
</div>
<div class="grid md:grid-cols-2 gap-6">
{{-- Password --}}
<div>
<label for="password" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Password') }}
</label>
<div class="relative">
<input
type="password"
id="password"
name="password"
required
x-bind:type="showPassword ? 'text' : 'password'"
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out"
placeholder="Masukkan password"
>
<button
type="button"
@click="togglePasswordVisibility()"
class="absolute inset-y-0 right-0 pr-3 flex items-center text-sm leading-5"
>
<svg x-show="!showPassword" class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
<svg x-show="showPassword" class="h-5 w-5 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
</button>
</div>
</div>
<!-- Venue -->
<div>
<label for="venue_id" class="block text-sm font-medium text-gray-700 mb-1">Venue</label>
<select name="venue_id" id="venue_id"
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 @error('venue_id') border-red-300 @enderror"
required>
<option value="">-- Pilih Venue --</option>
@foreach($venues as $venue)
<option value="{{ $venue->id }}" {{ old('venue_id') == $venue->id ? 'selected' : '' }}>
{{ $venue->name }}
</option>
@endforeach
</select>
@error('venue_id')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
{{-- Konfirmasi Password --}}
<div>
<label for="password_confirmation" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Konfirmasi Password') }}
</label>
<div class="relative">
<input
type="password"
id="password_confirmation"
name="password_confirmation"
required
x-bind:type="showConfirmPassword ? 'text' : 'password'"
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out"
placeholder="Konfirmasi password"
>
<button
type="button"
@click="toggleConfirmPasswordVisibility()"
class="absolute inset-y-0 right-0 pr-3 flex items-center text-sm leading-5"
>
<svg x-show="!showConfirmPassword" class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
<svg x-show="showConfirmPassword" class="h-5 w-5 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
</button>
</div>
</div>
</div>
<!-- Role (defaultnya Admin, tapi bisa diganti) -->
<div>
<label for="role" class="block text-sm font-medium text-gray-700 mb-1">Role</label>
<select name="role" id="role"
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 @error('role') border-red-300 @enderror"
required>
<option value="admin" {{ old('role') == 'admin' ? 'selected' : '' }}>Admin</option>
<option value="user" {{ old('role') == 'user' ? 'selected' : '' }}>User</option>
</select>
@error('role')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
<div class="grid md:grid-cols-2 gap-6">
{{-- Venue --}}
<div>
<label for="venue_id" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Venue') }}
</label>
<select
id="venue_id"
name="venue_id"
required
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out"
>
<option value="">-- Pilih Venue --</option>
@foreach($venues as $venue)
<option
value="{{ $venue->id }}"
{{ old('venue_id') == $venue->id ? 'selected' : '' }}
>
{{ $venue->name }}
</option>
@endforeach
</select>
</div>
{{-- Role --}}
<div>
<label for="role" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Role') }}
</label>
<select
id="role"
name="role"
required
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out"
>
<option value="admin" {{ old('role') == 'admin' ? 'selected' : '' }}>
Admin
</option>
<option value="user" {{ old('role') == 'user' ? 'selected' : '' }}>
User
</option>
</select>
</div>
</div>
{{-- Tombol Aksi --}}
<div class="flex justify-end space-x-4 pt-6">
<a
href="{{ route('superadmin.admin.index') }}"
class="px-6 py-3 text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-lg font-medium transition duration-300 ease-in-out"
>
{{ __('Batal') }}
</a>
<button
type="submit"
class="px-6 py-3 bg-blue-500 text-white rounded-lg font-medium hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition duration-300 ease-in-out"
>
{{ __('Simpan') }}
</button>
</div>
</form>
</div>
</div>
<div class="mt-6 flex items-center justify-end">
<a href="{{ route('superadmin.admin.index') }}"
class="bg-white py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Batal
</a>
<button type="submit"
class="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Simpan
</button>
</div>
</form>
</div>
</div>
@push('scripts')
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
<script>
function adminForm() {
return {
showPassword: false,
showConfirmPassword: false,
togglePasswordVisibility() {
this.showPassword = !this.showPassword;
},
toggleConfirmPasswordVisibility() {
this.showConfirmPassword = !this.showConfirmPassword;
}
}
}
</script>
@endpush
@endsection

View File

@ -1,142 +1,169 @@
@extends('layouts.super-admin')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Tambah Venue Baru') }}</div>
<div class="min-h-screen bg-gray-50 flex items-center justify-center px-4 sm:px-6 lg:px-8 py-12">
<div class="w-full max-w-2xl">
<div class="bg-white rounded-xl shadow-2xl overflow-hidden"
style="backdrop-filter: blur(20px); background-color: rgba(255, 255, 255, 0.8);">
<div class="p-6 sm:p-10">
<h2 class="text-center text-4xl font-semibold text-gray-900 mb-8">
{{ __('Tambah Venue Baru') }}
</h2>
<div class="card-body">
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
@if ($errors->any())
<div class="mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded-lg">
<ul class="space-y-1 text-sm text-red-700">
@foreach ($errors->all() as $error)
<li class="flex items-center">
<svg class="h-4 w-4 mr-2 text-red-500" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-11.293a1 1 0 00-1.414-1.414L10 8.586 7.707 6.293a1 1 0 00-1.414 1.414L8.586 10l-2.293 2.293a1 1 0 101.414 1.414L10 11.414l2.293 2.293a1 1 0 001.414-1.414L11.414 10l2.293-2.293z"
clip-rule="evenodd" />
</svg>
{{ $error }}
</li>
@endforeach
</ul>
</div>
@endif
<form method="POST" action="{{ route('superadmin.venue.store') }}" enctype="multipart/form-data"
x-data="venueForm()" class="space-y-6">
@csrf
<div class="grid md:grid-cols-2 gap-6">
{{-- Nama Venue --}}
<div class="col-span-2 md:col-span-1">
<label for="name" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Nama Venue') }}
</label>
<input type="text" id="name" name="name" value="{{ old('name') }}" required
autocomplete="name" autofocus
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out"
placeholder="Masukkan nama venue">
</div>
@endif
<form method="POST" action="{{ route('superadmin.venue.store') }}" enctype="multipart/form-data">
@csrf
{{-- Nomor Telepon --}}
<div class="col-span-2 md:col-span-1">
<label for="phone" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Nomor Telepon') }}
</label>
<input type="tel" id="phone" name="phone" value="{{ old('phone') }}" required
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out"
placeholder="Masukkan nomor telepon">
</div>
</div>
<div class="form-group row mb-3">
<label for="name"
class="col-md-4 col-form-label text-md-right">{{ __('Nama Venue') }}</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror"
name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
@error('name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
{{-- Alamat --}}
<div>
<label for="address" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Alamat') }}
</label>
<textarea id="address" name="address" required rows="3"
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out"
placeholder="Masukkan alamat lengkap venue">{{ old('address') }}</textarea>
</div>
{{-- Deskripsi --}}
<div>
<label for="description" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Deskripsi') }}
</label>
<textarea id="description" name="description" rows="4" required
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out"
placeholder="Berikan deskripsi venue">{{ old('description') }}</textarea>
</div>
{{-- Jam Operasional --}}
<div class="grid md:grid-cols-2 gap-6">
<div>
<label for="open_time" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Jam Buka') }}
</label>
<input type="time" id="open_time" name="open_time" value="{{ old('open_time') }}" required
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out">
</div>
<div>
<label for="close_time" class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Jam Tutup') }}
</label>
<input type="time" id="close_time" name="close_time" value="{{ old('close_time') }}"
required
class="block w-full px-4 py-3 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300 ease-in-out">
</div>
</div>
{{-- Upload Gambar --}}
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
{{ __('Gambar Venue') }}
</label>
<div x-ref="dropzone" @dragover.prevent="dragover = true" @dragleave.prevent="dragover = false"
@drop.prevent="handleDrop($event)"
class="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-lg transition duration-300 ease-in-out"
:class="dragover ? 'border-blue-500 bg-blue-50' : 'hover:border-blue-500'">
<div class="space-y-1 text-center">
<svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none"
viewBox="0 0 48 48" aria-hidden="true">
<path
d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
<div class="flex text-sm text-gray-600 justify-center">
<label for="image"
class="relative cursor-pointer rounded-md font-medium text-blue-600 hover:text-blue-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-blue-500">
<span>{{ __('Unggah file') }}</span>
<input id="image" name="image" type="file" class="sr-only" accept="image/*"
@change="handleFileSelect($event)">
</label>
<p class="pl-1">{{ __('atau seret dan lepas') }}</p>
</div>
<p class="text-xs text-gray-500">
{{ __('PNG, JPG, GIF hingga 2MB') }}
</p>
<p x-text="fileName" class="text-sm text-gray-600 mt-2"></p>
</div>
</div>
</div>
<div class="form-group row mb-3">
<label for="address"
class="col-md-4 col-form-label text-md-right">{{ __('Alamat') }}</label>
<div class="col-md-6">
<textarea id="address" class="form-control @error('address') is-invalid @enderror"
name="address" required>{{ old('address') }}</textarea>
@error('address')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row mb-3">
<label for="phone"
class="col-md-4 col-form-label text-md-right">{{ __('Nomor Telepon') }}</label>
<div class="col-md-6">
<input id="phone" type="text" class="form-control @error('phone') is-invalid @enderror"
name="phone" value="{{ old('phone') }}" required>
@error('phone')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row mb-3">
<label for="description"
class="col-md-4 col-form-label text-md-right">{{ __('Deskripsi') }}</label>
<div class="col-md-6">
<textarea id="description"
class="form-control @error('description') is-invalid @enderror" name="description"
rows="4" required>{{ old('description') }}</textarea>
@error('description')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row mb-3">
<label for="open_time"
class="col-md-4 col-form-label text-md-right">{{ __('Jam Buka') }}</label>
<div class="col-md-6">
<input id="open_time" type="time"
class="form-control @error('open_time') is-invalid @enderror" name="open_time"
value="{{ old('open_time') }}" required>
@error('open_time')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row mb-3">
<label for="close_time"
class="col-md-4 col-form-label text-md-right">{{ __('Jam Tutup') }}</label>
<div class="col-md-6">
<input id="close_time" type="time"
class="form-control @error('close_time') is-invalid @enderror" name="close_time"
value="{{ old('close_time') }}" required>
@error('close_time')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row mb-3">
<label for="image"
class="col-md-4 col-form-label text-md-right">{{ __('Gambar Venue') }}</label>
<div class="col-md-6">
<input id="image" type="file" class="form-control @error('image') is-invalid @enderror"
name="image" accept="image/*" required>
<small class="form-text text-muted">Format: JPG, PNG, GIF. Ukuran maksimal: 2MB</small>
@error('image')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Simpan') }}
</button>
<a href="{{ route('superadmin.venue.index') }}" class="btn btn-secondary">
{{ __('Batal') }}
</a>
</div>
</div>
</form>
</div>
{{-- Tombol Aksi --}}
<div class="flex justify-end space-x-4 pt-6">
<a href="{{ route('superadmin.venue.index') }}"
class="px-6 py-3 text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-lg font-medium transition duration-300 ease-in-out">
{{ __('Batal') }}
</a>
<button type="submit"
class="px-6 py-3 bg-blue-500 text-white rounded-lg font-medium hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition duration-300 ease-in-out">
{{ __('Simpan') }}
</button>
</div>
</form>
</div>
</div>
</div>
</div>
@push('scripts')
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
<script>
function venueForm() {
return {
dragover: false,
fileName: '',
handleFileSelect(event) {
const file = event.target.files[0];
this.fileName = file ? file.name : '';
},
handleDrop(event) {
this.dragover = false;
const file = event.dataTransfer.files[0];
if (file) {
document.getElementById('image').files = event.dataTransfer.files;
this.fileName = file.name;
}
}
}
}
</script>
@endpush
@endsection