@extends('layouts.app') @section('title', $meeting ? 'Edit meeting' : 'New meeting') @push('stylesheets') @endpush @section('contents') @if ($errors->any()) @foreach ($errors->all() as $err) {{ $err }} @endforeach @endif @php $participantIds = old('participant_user_ids', $meeting ? $meeting->participants->whereNotNull('user_id')->pluck('user_id')->all() : []); $participantIds = array_values(array_filter( array_map('intval', is_array($participantIds) ? $participantIds : []), static fn (int $id) => $id > 0 && ! is_current_user_id($id) )); $guestRows = old('guests', null); if (is_array($guestRows)) { $guestRows = array_values(array_filter($guestRows, fn ($g) => is_array($g))); } elseif ($meeting) { $guestRows = $meeting->participants->whereNull('user_id')->map(fn ($p) => [ 'label' => $p->guest_label, 'email' => $p->guest_email, ])->values()->all(); } else { $guestRows = []; } if ($guestRows === []) { $guestRows = [['label' => '', 'email' => '']]; } $mwsIsCreate = !$meeting; $mwsCreateTypePerms = is_array($mwsCreateTypePerms ?? null) ? $mwsCreateTypePerms : ($mwsIsCreate ? mws_allowed_scheme_meeting_create_types() : ['pre_pdwp' => true, 'pdwp' => true, 'ddwp' => true]); $mwsGeneralProfile = $mwsIsCreate && ! empty($mwsGeneralProfile ?? false); $mwsRrcProfile = $mwsIsCreate && ! empty($mwsRrcProfile ?? false); $mwsMecActivityCreate = $mwsIsCreate && is_mec_role() && ! empty($mwsMecActivityCreate ?? false); $mwsMecActivityType = $mwsMecActivityCreate ? (string) ($mwsMecActivityType ?? 'Meeting') : ''; $mwsMecActivityIsTraining = $mwsMecActivityCreate && $mwsMecActivityType === 'Training'; $mwsSkipProfileModal = ($mwsIsCreate && (! empty($mwsSkipProfileModal ?? false))) || ($mwsIsCreate && (string) old('mws_skip_profile_modal', '') === '1'); $mwsShowProfileModal = $mwsIsCreate && ! $errors->any() && ! $mwsSkipProfileModal; $mwsSchemeFreeMeeting = $mwsIsCreate && ( $mwsMecActivityCreate || $mwsRrcProfile || is_scheme_free_mws_meeting_type(old('meeting_type')) || is_mec_activity_meeting_type(old('meeting_type')) ); $mwsGeneralFromOld = $mwsSchemeFreeMeeting; $mwsDeferSubjectUi = $mwsShowProfileModal; $mwsRescheduleEditMode = ! empty($mwsRescheduleEditMode ?? false); $mwsMeetingScheduledLocked = $meeting && $meeting->status === \App\MeetingWorkspace\MeetingLifecycleStatus::Scheduled && ! $mwsRescheduleEditMode; $mwsAuthId = auth()->id(); $mwsCanCancelMeeting = ! $meeting || ($mwsAuthId && ((int) $mwsAuthId === (int) ($meeting->created_by ?? 0) || (int) $mwsAuthId === (int) ($meeting->organizer_user_id ?? 0))); $mwsCreateStatusDefault = $mwsIsCreate && $mwsSchemeFreeMeeting ? \App\MeetingWorkspace\MeetingLifecycleStatus::Scheduled->value : \App\MeetingWorkspace\MeetingLifecycleStatus::Draft->value; $mwsStatusSelected = old('status', $meeting ? $meeting->status->value : $mwsCreateStatusDefault); $mwsOrganizerUserId = (string) old('organizer_user_id', $meeting ? $meeting->organizer_user_id : $mwsAuthId); $mwsDefaultMeetingType = $mwsMecActivityCreate ? $mwsMecActivityType : ($mwsRrcProfile ? 'RRC' : ($mwsGeneralProfile ? 'General' : ($mwsSkipProfileModal ? (trim((string) ($mwsPrefillMeetingType ?? '')) !== '' ? (string) $mwsPrefillMeetingType : 'PDWP') : ''))); $mwsTrainingSessionRows = old( 'training_sessions', $meeting && $meeting->isTrainingActivity() ? $meeting->plannerOccurrences() : [['session_date' => '', 'start_time' => '', 'end_time' => '']] ); if (! is_array($mwsTrainingSessionRows) || $mwsTrainingSessionRows === []) { $mwsTrainingSessionRows = [['session_date' => '', 'start_time' => '', 'end_time' => '']]; } $mwsTrainingSessionRows = array_values($mwsTrainingSessionRows); $mwsMeetingTypeEffective = trim((string) old('meeting_type', $meeting?->meeting_type ?? $mwsDefaultMeetingType)); $mwsMeetingTypeIsGeneral = $mwsSchemeFreeMeeting && ! $mwsMecActivityCreate && is_scheme_free_mws_meeting_type($mwsMeetingTypeEffective); // One picker row per created PC / PCN (with or without a scheme). Approved records are excluded. $mwsCatalogSchemeKey = static function (array $row): string { return \App\Services\PC\MeetingWorkspaceSubjectCatalog::catalogSchemeKey($row); }; $mwsSubjectSchemes = array_values(array_filter( $subjectLinkCatalog['schemes'] ?? [], static function ($sc) use ($mwsCatalogSchemeKey): bool { return is_array($sc) && $mwsCatalogSchemeKey($sc) !== ''; } )); $mwsSchemeSelectLabelLimit = 80; $mwsSchemeSelectOption = static function (array $sc) use ($mwsSchemeSelectLabelLimit): array { $name = (string) ($sc['name'] ?? ''); $mark = trim((string) ($sc['kind_mark'] ?? '')); return [ 'name' => $name, 'mark' => $mark, 'label' => \App\Services\PC\MeetingWorkspaceSubjectCatalog::schemeSelectOptionLabel( $name, $mark, $mwsSchemeSelectLabelLimit ), 'adp' => trim((string) ($sc['adp_label'] ?? '')) !== '' ? (string) $sc['adp_label'] : \App\Services\PC\MeetingWorkspaceSubjectCatalog::DASH_LABEL, 'uid' => trim((string) ($sc['uid_label'] ?? $sc['uid'] ?? '')) !== '' ? (string) ($sc['uid_label'] ?? $sc['uid']) : \App\Services\PC\MeetingWorkspaceSubjectCatalog::DASH_LABEL, ]; }; $mwsSubjectLinkCatalogForScript = array_merge($subjectLinkCatalog, [ 'schemes' => $mwsSubjectSchemes, ]); $mwsCatalogOptionHtml = static function (?array $sc, string $field, bool $selected) use ($mwsCatalogSchemeKey, $mwsSchemeSelectOption): string { if (! is_array($sc)) { return ''; } $scKey = $mwsCatalogSchemeKey($sc); if ($scKey === '') { return ''; } $scOpt = $mwsSchemeSelectOption($sc); $label = match ($field) { 'adp' => $scOpt['adp'], 'uid' => $scOpt['uid'], default => $scOpt['label'], }; $title = $field === 'scheme' ? $scOpt['label'] : $label; $attrs = 'value="'.e($scKey).'" title="'.e($title).'" data-full-name="'.e($scOpt['name']).'" data-adp-label="'.e($scOpt['adp']).'" data-uid-label="'.e($scOpt['uid']).'"'; if ($scOpt['mark'] !== '') { $attrs .= ' data-kind-mark="'.e($scOpt['mark']).'"'; } if ($selected) { $attrs .= ' selected'; } return ''.e($label).''; }; @endphp @csrf @if ($meeting) @method('PUT') @endif @if ($mwsIsCreate && $mwsSkipProfileModal) @endif @if ($mwsIsCreate) @endif @if ($mwsMeetingScheduledLocked) Scheduled Meeting: This meeting is currently in Scheduled status. To make changes, please select Edit from the meeting details page and confirm the rescheduling process to unlock this form. Once saved, the meeting will revert to Draft status, an updated meeting notice PDF will be emailed to all participants, and notice editing will be re-enabled. @endif @if ($mwsRescheduleEditMode) Reschedule Mode: Any changes will take effect once you click Save. The meeting will be moved to Draft status, and all participants will receive the updated meeting notice PDF via email. @endif {{ $meeting ? 'Edit meeting' : 'Schedule a meeting' }} Back to planner @if ($meeting && can('meeting_workspace', 'view')) View detail @endif $mwsSchemeFreeMeeting])> Scheme, ADP No. & UID * Scheme * ADP No. UID Actions @foreach ($subjectLinkRows as $idx => $sl) @php $slId = $sl['id'] ?? ''; $slPid = $sl['project_id'] ?? ''; $slFid = $sl['pc_form_id'] ?? ''; $slPcnId = $sl['project_concept_note_id'] ?? ''; $slPcnLocked = (string) $slPcnId !== ''; $slPidInt = (int) $slPid; $slFidInt = (int) $slFid; if ($slPcnLocked) { $slSelectKey = \App\Services\PC\MeetingWorkspaceSubjectCatalog::pcnCatalogKey((int) $slPcnId); } elseif ($slFidInt > 0) { $slSelectKey = \App\Services\PC\MeetingWorkspaceSubjectCatalog::formCatalogKey($slFidInt); } else { $slSelectKey = ''; if ($slPidInt > 0) { foreach ($mwsSubjectSchemes as $scPrefill) { if ((int) ($scPrefill['project_id'] ?? 0) !== $slPidInt) { continue; } if ((int) ($scPrefill['pc_form_id'] ?? 0) <= 0) { continue; } $slSelectKey = \App\Services\PC\MeetingWorkspaceSubjectCatalog::catalogSchemeKey($scPrefill); break; } if ($slSelectKey === '') { $slSelectKey = (string) $slPidInt; } } } @endphp Select PC / PCN @php $mwsSelectedScheme = null; if ($slSelectKey !== '') { foreach ($mwsSubjectSchemes as $scPrefillOpt) { if (\App\Services\PC\MeetingWorkspaceSubjectCatalog::catalogSchemeKey($scPrefillOpt) === $slSelectKey) { $mwsSelectedScheme = $scPrefillOpt; break; } } } @endphp {!! $mwsCatalogOptionHtml($mwsSelectedScheme, 'scheme', true) !!} Select ADP {!! $mwsCatalogOptionHtml($mwsSelectedScheme, 'adp', true) !!} Select UID {!! $mwsCatalogOptionHtml($mwsSelectedScheme, 'uid', true) !!} @if ($idx === 0) Add Scheme @else Remove @endif @endforeach Select PC / PCN Select ADP Select UID Remove @if ($mwsGeneralFromOld) @else @endif {{ $mwsMecActivityCreate ? __('Title') : __('Subject') }} * {{ $mwsMecActivityCreate ? __('Activity Type') : __('Meeting type') }} {{ __('Date') }} * {{ __('Start') }} * {{ __('End') }} * {{ __('Training dates') }} * {{ __('Add each day the training will run, with its own start and end time.') }} {{ __('Date') }} {{ __('Start') }} {{ __('End') }} @foreach ($mwsTrainingSessionRows as $mwsTrainingIdx => $mwsTrainingRow) @if ($mwsTrainingIdx === 0) {{ __('Add date') }} @else {{ __('Remove') }} @endif @endforeach {{ __('Remove') }} Location Online link Create Google Meet Create Zoom Meeting Organizer / host @foreach ($users as $u) id)>{{ $u->name }} @endforeach Priority * @foreach (\App\MeetingWorkspace\MeetingPriority::cases() as $p) priority?->value ?? 'normal') === $p->value)>{{ $p->label() }} @endforeach Status @foreach (\App\MeetingWorkspace\MeetingLifecycleStatus::cases() as $s) @if ($s === \App\MeetingWorkspace\MeetingLifecycleStatus::Cancelled && ! $mwsCanCancelMeeting && $mwsStatusSelected !== \App\MeetingWorkspace\MeetingLifecycleStatus::Cancelled->value) @continue @endif value)>{{ $s->label() }} @endforeach @unless ($mwsRescheduleEditMode) Cancellation reason status === \App\MeetingWorkspace\MeetingLifecycleStatus::Cancelled) readonly @endif placeholder="Explain why this meeting is being cancelled.">{{ old('cancellation_reason', $meeting?->cancellation_reason) }} @error('cancellation_reason') {{ $message }} @enderror @endunless Participants Internal participants * @foreach ($users as $u) id, $participantIds, true))>{{ ! empty($mwsParticipantNameOnly) ? $u->name : $u->name . ' — ' . $u->email }} @endforeach @error('participant_user_ids') {{ $message }} @enderror Select at least one participant (the meeting organizer is added automatically). External guests (optional) Name Email Actions @foreach ($guestRows as $idx => $g) @if ($idx === 0) Add Guest @else Remove @endif @endforeach Remove Reminders (dispatch-ready) Stored for a future scheduler. Channels are persisted only; no messages are sent from this screen. @php $mwsReminderRows = 1; if ($meeting !== null) { $mwsReminderRows = max(1, $meeting->reminders->count()); } if ($errors->any() && is_array(old('reminders'))) { foreach (array_keys(old('reminders')) as $_mwsRk) { if (is_numeric($_mwsRk)) { $mwsReminderRows = max($mwsReminderRows, (int) $_mwsRk + 1); } } } $mwsReminderRows = min($mwsReminderRows, 50); @endphp Remind atChannel @for ($i = 0; $i < $mwsReminderRows; $i++) @php $rm = $meeting?->reminders[$i] ?? null; @endphp @foreach (\App\MeetingWorkspace\ReminderChannel::cases() as $ch) channel?->value ?? 'in_app') === $ch->value)>{{ $ch->label() }} @endforeach @endfor Instructions {{ old('description', $meeting?->description) }} Save Cancel @if ($mwsIsCreate) @endif @if ($mwsIsCreate) Schedule a new meeting × Choose the meeting workflow. Meeting type will be filled in automatically and locked for this draft. General — not tied to a PC-I form RRC — Review & Recommendation Committee (PC-IV) @if (! empty($mwsCreateTypePerms['pre_pdwp'])) Pre-PDWP @endif @if (! empty($mwsCreateTypePerms['pdwp'])) PDWP @endif @if (! empty($mwsCreateTypePerms['ddwp'])) DDWP @endif @endif @endsection @push('scripts') @php $mwsSubjectStandardPayload = [ 'buckets' => $mwsSubjectOrdinalBuckets, 'tail' => $mwsSubjectStandardTail, 'meetingId' => $meeting?->id, 'initialSubject' => $mwsPrefillStandardSubject, ]; @endphp @endpush
{{ __('Add each day the training will run, with its own start and end time.') }}
Stored for a future scheduler. Channels are persisted only; no messages are sent from this screen.
Choose the meeting workflow. Meeting type will be filled in automatically and locked for this draft.