@php $workflow = $workflow ?? null; $trigger = $workflow?->triggers?->first(); $triggerType = old('trigger_type', $trigger?->type ?? 'group_join'); $triggerConfig = old('trigger_config', $trigger?->config ?? []); $conditions = old('conditions', $workflow?->conditions ?? []); $existingActions = old('actions'); if (! is_array($existingActions)) { $existingActions = []; foreach ($workflow?->actions ?? [] as $action) { $existingActions[] = array_merge(['type' => $action->type], $action->config ?? []); } } if ($existingActions === []) { $existingActions[] = ['type' => 'send_sms', 'sms_type' => 'plain', 'delay_unit' => 'minutes']; } $timezone = old('timezone', $workflow?->timezone ?: (auth()->user()->timezone ?: 'Asia/Dhaka')); $status = old('status', $workflow?->status ?? 'draft'); @endphp
@error('name')

{{ $message }}

@enderror
@error('timezone')

{{ $message }}

@enderror

{{ __('locale.workflows.trigger') }}

{{ __('locale.workflows.trigger_help') }}


{{ __('locale.workflows.conditions') }}

{{ __('locale.workflows.conditions_help') }}

@forelse($conditions as $index => $condition) @include('customer.Workflows._condition_row', ['index' => $index, 'condition' => $condition]) @empty @endforelse

{{ __('locale.workflows.actions') }}

{{ __('locale.workflows.actions_help') }}

@foreach($existingActions as $index => $action) @include('customer.Workflows._action_row', ['index' => $index, 'action' => $action]) @endforeach
{{ __('locale.buttons.cancel') }}