@extends('layouts.dashboard') @section('content') @php // The same form serves first-create and resubmit-after-reject/expire. // `$existingEvent` is only set in resubmit mode; pre-fill helpers below // safely fall back to empty strings via the null-coalescing chain. $isResubmit = $isResubmit ?? false; $existing = $existingEvent ?? null; $existingServices = $existingServices ?? collect(); $formAction = $isResubmit ? url('/rm/resubmit-event') : url('/rm/store-event'); $submitLabel = $isResubmit ? 'Edit and Resend Confirmation' : 'Create Event'; // Resubmit edits take priority over the original RM-request defaults // (RM may have been told to change category/location during chat). $defaultType = $isResubmit ? ($existing->type ?? '') : (optional($rmDetails->categoryDetails)->type === 'corporate' ? 'professional' : (optional($rmDetails->categoryDetails)->type ?? '')); $defaultCategory = $isResubmit ? ($existing->category ?? '') : $rmDetails->category; $defaultStateId = $isResubmit ? ($existing->state_id ?? '') : $rmDetails->state_id; $defaultCityId = $isResubmit ? ($existing->cities_id ?? '') : $rmDetails->city_id; @endphp
@if(Session::has('msg'))

{{ Session::get('msg') }}

@endif
{{-- Client Info Card (read-only) --}}

Client Information

Name: {{ $rmDetails->clientDetails->name ?? 'N/A' }}
Contact: {{ $rmDetails->clientDetails->phone ?? 'N/A' }}
Email: {{ $rmDetails->clientDetails->email_id ?? 'N/A' }}
@if($rmDetails->budget)
RM Budget: {{ $rmDetails->budget }}
@endif
{{-- Create Event Form --}}

Event Details

{{ csrf_field() }}
{{-- Event Type --}}
{{-- Category --}}
{{-- Event Name --}}
{{-- Number of Guests --}}
{{-- Event Date --}}
{{-- type="text" (not "date") so Flatpickr can fully own the UX. Flatpickr's altInput mode (see createEvent.js) shows DD-MM-YYYY to the user while this hidden real input still submits YYYY-MM-DD to Laravel — best of both worlds. --}}
{{-- Event Time --}}
{{-- Trim to HH:MM. MySQL TIME columns return "HH:MM:SS"; passing that into a type="time" input with step=60 leaves some browsers in an invalid state where element.value reads empty and jQuery Validate's `required` false-fires. --}} @php $rawTime = old('event_start_time', $existing->event_start_time ?? ''); $timeInit = $rawTime ? substr($rawTime, 0, 5) : ''; @endphp {{-- Deliberately NOT setting step=60. Chrome's picker treats step as strict for keyboard entry and rejects mid-typing states, leaving .value=""; the spinner + picker still work fine without it and default to 1-minute increments anyway. --}}
{{-- Country (locked to default country — disabled select cannot submit, hidden input carries the value) --}}
{{-- State --}}
{{-- City --}}
{{-- Description --}}
{{-- Services Section --}}

Services

@php $serviceRows = $isResubmit && $existingServices->count() ? $existingServices->values() : collect([(object) ['service_id' => '', 'amount' => 0]]); @endphp @foreach($serviceRows as $idx => $row)
@endforeach
{{-- Pass services data to JS for dynamic row creation --}} @endsection