@extends('admin.layouts.app') @section('title', 'Edit Package') @section('page-title', 'Edit Package') @section('page-subtitle', 'Perbarui informasi package: ' . $package->title) @section('header-actions') Lihat Detail Kembali @endsection @section('content') @php // Parse comma-separated fields back to arrays $includeArr = $package->include ? explode('//', $package->include) : ['']; $excludeArr = $package->exclude ? explode('//', $package->exclude) : ['']; $itineraryArr = $package->itinerary ? explode('//', $package->itinerary) : ['']; $notesArr = $package->notes ? explode('//', $package->notes) : ['']; $highlightItemArr = $package->highlight_item ? explode('//', $package->highlight_item) : ['']; @endphp
@csrf @method('PUT')
{{-- Left Column: Main Info --}}
{{-- Basic Info Card --}}

1 Informasi Dasar

@error('title')

{{ $message }}

@enderror
Rp
@php $existingHighlightImages = $package->highlight_image ? explode(',', $package->highlight_image) : []; @endphp {{-- Highlight Package Card --}}

2 Highlight Package

@error('highlight_desc')

{{ $message }}

@enderror
@include('admin.packages._dynamic_list', [ 'fieldName' => 'highlight_item', 'placeholder' => 'Contoh: Private pool villa', 'color' => 'brand', 'values' => old('highlight_item', $highlightItemArr), 'iconPath' => 'M5 13l4 4L19 7', ])
@if(count($existingHighlightImages))

Highlight Gambar Saat Ini

@foreach($existingHighlightImages as $img)
@endforeach
@endif

Format JPG, PNG, atau WEBP. Maks. 2MB per gambar.

@error('highlight_image.*')

{{ $message }}

@enderror
{{-- Harga per Grup (Tiered Pricing) --}}

3 Harga per Grup

Tambahkan tingkatan harga berdasarkan jumlah tamu, contoh: 2 Guests, 3 Guests, Family Package, dst.

@php $oldGroupLabel = old('group_label'); @endphp @if($oldGroupLabel) {{-- kalau validasi gagal, render ulang dari old() --}} @foreach($oldGroupLabel as $i => $label)
Rp
$
@endforeach @elseif(count($groupPrices)) {{-- data existing dari DB --}} @foreach($groupPrices as $i => $gp)
Rp
$
@endforeach @endif
{{-- Add-on Opsional --}}

4 Add-on Opsional

Contoh: English-Speaking Cultural Guide, tambahan makan siang, dll.

@php $oldAddonName = old('addon_name'); @endphp @if($oldAddonName) @foreach($oldAddonName as $i => $name)
Rp
$
@endforeach @elseif(count($addons)) @foreach($addons as $i => $ad)
Rp
$
@endforeach @endif
@php $existingImages = $package->images ? explode(',', $package->images) : []; @endphp {{-- Gambar Package --}}

2 Gambar Package

@if(count($existingImages))

Gambar Saat Ini

@foreach($existingImages as $img)
@endforeach
@endif

Format JPG, PNG, atau WEBP. Maks. 2MB per gambar.

@error('images.*')

{{ $message }}

@enderror
{{-- Include / Exclude --}}

Include

@include('admin.packages._dynamic_list', [ 'fieldName' => 'include', 'placeholder' => 'Contoh: Tiket pesawat PP', 'color' => 'emerald', 'values' => old('include', $includeArr), 'iconPath' => 'M12 4v16m8-8H4', ])

Exclude

@include('admin.packages._dynamic_list', [ 'fieldName' => 'exclude', 'placeholder' => 'Contoh: Biaya visa', 'color' => 'red', 'values' => old('exclude', $excludeArr), 'iconPath' => 'M12 4v16m8-8H4', ])
{{-- Itinerary --}}

3 Itinerary

Setiap baris mewakili satu item perjalanan, pisahkan per hari/aktivitas.

@include('admin.packages._dynamic_list', [ 'fieldName' => 'itinerary', 'placeholder' => 'Contoh: Hari 1 – Tiba di Bali, check-in hotel', 'color' => 'violet', 'values' => old('itinerary', $itineraryArr), 'iconPath' => 'M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2', ])
{{-- Notes --}}

4 Notes / Catatan

@include('admin.packages._dynamic_list', [ 'fieldName' => 'notes', 'placeholder' => 'Contoh: Harga dapat berubah sewaktu-waktu', 'color' => 'amber', 'values' => old('notes', $notesArr), 'iconPath' => 'M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z', ])
{{-- Right Column --}}

Simpan Perubahan

Package ID: #{{ $package->id }}

Batal

Zona Bahaya

@if($package->created_at)

Dibuat: {{ \Carbon\Carbon::parse($package->created_at)->format('d M Y, H:i') }}

@endif @if($package->updated_at)

Diperbarui: {{ \Carbon\Carbon::parse($package->updated_at)->format('d M Y, H:i') }}

@endif
{{-- Standalone delete form — OUTSIDE main form to avoid nested form issue --}} @endsection @push('scripts') @endpush