{{-- One list of steps and what closes it (an end card, or — after a condition — its two branches). Recursive: a condition includes this same partial for each branch. Expects: $seq, $path ('' for the top list, "steps.2.yes" for a branch), $readOnly, $flat, $describer. --}} @php $listPath = $path === '' ? 'steps' : $path.'.steps'; $steps = $seq['steps'] ?? []; $count = count($steps); $endsWithCondition = $count > 0 && ($steps[$count - 1]['type'] ?? '') === 'condition'; $kinds = ['action' => ['پیامک', 'bg-indigo-100 text-indigo-700'], 'wait' => ['انتظار', 'bg-sky-100 text-sky-700'], 'condition' => ['شرط', 'bg-amber-100 text-amber-700']]; @endphp
@foreach ($steps as $i => $step) @php $stepPath = $listPath.'.'.$i; [$kindLabel, $kindClass] = $kinds[$step['type']]; $enabled = $step['is_enabled'] ?? true; @endphp @include('livewire.automation.workflows._insert', ['listPath' => $listPath, 'index' => $i, 'allowCondition' => false, 'readOnly' => $readOnly])
$enabled, 'border-dashed border-gray-300 opacity-60' => ! $enabled])>
{{ $kindLabel }} {{ $step['name'] }} @unless ($enabled) غیرفعال @endunless

{{ $describer->describe($step) }}

@if (($step['type'] ?? '') === 'action' && ($step['config']['retry']['enabled'] ?? false))

تلاش مجدد: تا {{ (int) ($step['config']['retry']['max_attempts'] ?? 0) }} بار

@endif
@unless ($readOnly)
@if ($step['type'] !== 'condition') @endif
@endunless
@if ($step['type'] === 'condition')
@foreach (['yes' => ['اگر شرط برقرار بود', 'border-emerald-300'], 'no' => ['اگر برقرار نبود', 'border-rose-300']] as $branch => [$branchLabel, $branchBorder])

{{ $branchLabel }}

@include('livewire.automation.workflows._sequence', ['seq' => $step[$branch], 'path' => $stepPath.'.'.$branch, 'readOnly' => $readOnly, 'flat' => $flat, 'describer' => $describer])
@endforeach
@endif @endforeach @unless ($endsWithCondition) @include('livewire.automation.workflows._insert', ['listPath' => $listPath, 'index' => $count, 'allowCondition' => true, 'readOnly' => $readOnly]) @php $end = $seq['end'] ?? null; @endphp @if ($end)
پایان {{ $describer->describeEnd($end, $flat) }}
@unless ($readOnly) @endunless
@endif @endunless