table reservasi, tabel dashboard, form, success page

This commit is contained in:
hildaaaevs 2025-05-25 00:26:30 +07:00
parent 871aa2fa2d
commit ed9c5a5b8b
8 changed files with 35 additions and 11 deletions

View File

@ -52,6 +52,9 @@ public static function form(Form $form): Form
->searchable()
->preload()
->required(),
TextInput::make('nama')
->label('Nama')
->required(),
Select::make('metode_pembayaran')
->label('Metode pembayaran')
->options([
@ -181,8 +184,8 @@ public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('user.name')
->label('Nama User')
Tables\Columns\TextColumn::make('nama')
->label('Nama')
->searchable(),
Tables\Columns\TextColumn::make('tanggal')
@ -190,11 +193,12 @@ public static function table(Table $table): Table
->sortable(),
Tables\Columns\TextColumn::make('waktu')
->label('Jam'),
->label('Jam')
->time('H:i'),
Tables\Columns\TextColumn::make('promo.kode')
->label('Kode Promo')
Tables\Columns\TextColumn::make('detail.paketFoto.nama_paket_foto')
->label('Paket Foto')
->listWithLineBreaks()
->searchable(),
Tables\Columns\TextColumn::make('total')

View File

@ -22,16 +22,22 @@ public function table(Table $table): Table
->defaultSort('created_at', 'desc')
->columns([
TextColumn::make('id')
->label('ID Reservasi')
->label('ID')
->searchable(),
TextColumn::make('user.name')
TextColumn::make('nama')
->label('Nama')
->searchable(),
TextColumn::make('detail.paketFoto.nama_paket_foto')
->label('Paket Foto')
->searchable(),
TextColumn::make('tanggal')
->label('Tanggal')
->sortable(),
->date('d F Y')
->sortable()
->searchable(),
TextColumn::make('waktu')
->label('Jam'),
->label('Jam')
->time('H:i'),
TextColumn::make('tipe_pembayaran')
->label('Tipe Pembayaran')
->badge()

View File

@ -108,6 +108,7 @@ public function placeOrder()
// Membuat reservasi baru
$reservasi = Reservasii::create([
'user_id' => auth()->id(),
'nama' => $this->nama,
'tanggal' => $this->tanggal,
'waktu' => $this->waktu,
'promo_id' => null, // Logika promo bisa ditambahkan di sini

View File

@ -12,12 +12,21 @@ class SuccesPage extends Component
public function mount()
{
if (!auth()->check()) {
return redirect()->route('login');
}
// Ambil booking terakhir dari user yang sedang login
$this->booking = Reservasii::with(['user', 'detail.paketFoto'])
->where('user_id', auth()->id())
->latest()
->first();
if (!$this->booking) {
session()->flash('error', 'Tidak ada data booking yang ditemukan');
return redirect()->route('home');
}
// Ambil nama dari session
$this->bookingName = session('booking_name');
}

View File

@ -11,6 +11,7 @@ class Reservasii extends Model
protected $fillable = [
'user_id',
'nama',
'tanggal',
'waktu',
'promo_id',

View File

@ -14,6 +14,7 @@ public function up(): void
Schema::create('reservasiis', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->string('nama');
$table->date('tanggal');
$table->time('waktu');
$table->foreignId('promo_id')->nullable()->constrained('promos');

View File

@ -9,7 +9,9 @@
<div class="flex flex-col items-start justify-start space-y-2">
<p class="text-lg font-semibold leading-4 text-left text-gray-800 dark:text-gray-400">
{{ $bookingName }}</p>
@if($booking && $booking->user)
<p class="text-sm leading-4 text-gray-600 dark:text-gray-400">{{ $booking->user->email }}</p>
@endif
</div>
</div>
</div>

View File

@ -14,7 +14,7 @@
use App\Livewire\SuccesPage;
use Illuminate\Support\Facades\Route;
Route::get('/', HomePage::class);
Route::get('/', HomePage::class)->name('home');
Route::get('/paketfoto', PaketFotoPage::class);
Route::get('/paketfoto/{nama_paket_foto}', DetailPaketFotoPage::class);