@extends('layouts.agent') @push('css') @endpush @section('content')
@php $steps = [ 1 => 'Basic Details', 2 => 'Property Details', 3 => 'Location Details', 4 => 'Photos & Videos', ]; $currentStep = request()->route()->getName(); preg_match('/step_(\d+)/', $currentStep, $matches); $activeStep = isset($matches[1]) ? (int) $matches[1] : 1; @endphp
@foreach ($steps as $step => $label)
{{ $step }} {{ $label }} @if ($step < count($steps))
@endif
@endforeach
@csrf
@if (old('rooms', null)) @foreach (old('rooms') as $index => $oldRoom)
Room {{ $index + 1 }} Delete
@foreach (['Private Room', 'Double Sharing', 'Triple Sharing', '3+ Sharing'] as $typeIndex => $type) @endforeach
@error("rooms.$index.type") {{ $message }} @enderror
@error("rooms.$index.total_beds") {{ $message }} @enderror
@error("rooms.$index.rent") {{ $message }} @enderror
@error("rooms.$index.deposit") {{ $message }} @enderror
@php $facilityOptions = [ 'ac' => 'AC', 'tv_in_room' => 'TV in room', 'personal_cupboard' => 'Personal Cupboard', 'table_chair' => 'Table Chair', 'attached_balcony' => 'Attached Balcony', 'attached_bathroom' => 'Attached Bathroom', 'meals_included' => 'Meals Included', ]; $selectedFacilities = old( 'rooms.' . $index . '.facilities', [], ); if (isset($oldRoom['facilities'])) { if (is_array($oldRoom['facilities'])) { $selectedFacilities = $oldRoom['facilities']; } elseif ( is_string($oldRoom['facilities']) && (str_starts_with($oldRoom['facilities'], '[') || str_starts_with($oldRoom['facilities'], '{')) ) { $selectedFacilities = json_decode($oldRoom['facilities'], true) ?: []; } elseif (is_string($oldRoom['facilities'])) { $selectedFacilities = explode( ',', trim($oldRoom['facilities'], '[]"'), ); } } @endphp @foreach ($facilityOptions as $facilityKey => $facilityLabel)
@endforeach
@error("rooms.$index.facilities") {{ $message }} @enderror
@if (isset($oldRoom['id'])) @endif
@endforeach @else @forelse($rooms as $index => $room)
Room {{ $index + 1 }} Delete
@foreach (['Private Room', 'Double Sharing', 'Triple Sharing', '3+ Sharing'] as $typeIndex => $type) type === $type ? 'checked' : '' }}> @endforeach
@php $facilityOptions = [ 'ac' => 'AC', 'tv_in_room' => 'TV in room', 'personal_cupboard' => 'Personal Cupboard', 'table_chair' => 'Table Chair', 'attached_balcony' => 'Attached Balcony', 'attached_bathroom' => 'Attached Bathroom', 'meals_included' => 'Meals Included', ]; $selectedFacilities = []; if (isset($room->facilities)) { if (is_array($room->facilities)) { $selectedFacilities = $room->facilities; } elseif ( is_string($room->facilities) && (str_starts_with($room->facilities, '[') || str_starts_with($room->facilities, '{')) ) { $selectedFacilities = json_decode($room->facilities, true) ?: []; } elseif (is_string($room->facilities)) { $selectedFacilities = explode( ',', trim($room->facilities, '[]"'), ); } } @endphp @foreach ($facilityOptions as $facilityKey => $facilityLabel)
@endforeach
@empty
Room 1 Delete
@foreach (['Private Room', 'Double Sharing', 'Triple Sharing', '3+ Sharing'] as $typeIndex => $type) @endforeach
@foreach ([ 'ac' => 'AC', 'tv_in_room' => 'TV in room', 'personal_cupboard' => 'Personal Cupboard', 'table_chair' => 'Table Chair', 'attached_balcony' => 'Attached Balcony', 'attached_bathroom' => 'Attached Bathroom', 'meals_included' => 'Meals Included', ] as $facilityKey => $facilityLabel)
@endforeach
@endforelse @endif
{{ __('Back') }}
@endsection @section('scripts') @endsection