@php /** * Flow card markup — visual design mirrors the static mockup at * tutot (3)/flows.html. Round category icon · status pill · * title + description · 3-item check bullet list · "Open * builder" CTA + inline icon actions. * * The data-* hooks (data-flow-toggle, data-flow-delete, * data-flow-card) are unchanged so the existing JS keeps working. */ $categoryStyles = [ 'welcome' => [ 'icon' => 'M3 11s2-1 5-1 5 1 5 1M5 6.5h.01M11 6.5h.01M8 9.5s1 .8 0 1.5', 'bg' => 'bg-wa-bubble', 'text' => 'text-wa-deep', ], 'cart' => ['icon' => 'M3 5h8l1 6H4z', 'bg' => 'bg-wa-mint', 'text' => 'text-wa-deep'], 'cart-recovery' => ['icon' => 'M3 5h8l1 6H4z', 'bg' => 'bg-wa-mint', 'text' => 'text-wa-deep'], 'post-purchase' => [ 'icon' => 'M8 1.5l1.6 4.2H14l-3.5 2.5 1.4 4.3L8 9.9l-3.9 2.6 1.4-4.3L2 5.7h4.4z', 'bg' => 'bg-[#FCE0D5]', 'text' => 'text-[#A1431F]', ], 're-engagement' => [ 'icon' => 'M3 8a5 5 0 0 1 8.5-3.5L13 6M13 3v3h-3M13 8a5 5 0 0 1-8.5 3.5L3 10M3 13v-3h3', 'bg' => 'bg-[#F3E9FF]', 'text' => 'text-[#5B3D8A]', ], 'lead' => [ 'icon' => 'M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM2 14c0-3 2.7-5 6-5s6 2 6 5', 'bg' => 'bg-[#D9E5F2]', 'text' => 'text-[#13478A]', ], 'lead-nurture' => [ 'icon' => 'M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM2 14c0-3 2.7-5 6-5s6 2 6 5', 'bg' => 'bg-[#D9E5F2]', 'text' => 'text-[#13478A]', ], 'event' => ['icon' => 'M3 4h10v9H3zM3 7h10M6 2v3M10 2v3', 'bg' => 'bg-wa-bubble', 'text' => 'text-wa-deep'], 'special-events' => [ 'icon' => 'M3 4h10v9H3zM3 7h10M6 2v3M10 2v3', 'bg' => 'bg-wa-bubble', 'text' => 'text-wa-deep', ], ]; $stateStyle = [ 'live' => [ 'bg' => 'bg-wa-green/10', 'text' => 'text-wa-deep', 'border' => 'border-wa-green/30', 'dot' => 'bg-wa-green', 'label' => 'Live', ], 'paused' => [ 'bg' => 'bg-[#EFE5F5]', 'text' => 'text-[#5B3D8A]', 'border' => 'border-[#D9C7E8]', 'dot' => 'bg-[#5B3D8A]', 'label' => 'Paused', ], 'draft' => [ 'bg' => 'bg-paper-50', 'text' => 'text-ink-500', 'border' => 'border-paper-200', 'dot' => 'bg-paper-300', 'label' => 'Draft', ], ]; @endphp @forelse ($flows as $flow) @php $state = $flow->is_published ? ($flow->is_active ? 'live' : 'paused') : 'draft'; $sty = $stateStyle[$state]; $cat = $flow->category ?: 'uncategorized'; $catSty = $categoryStyles[$cat] ?? [ 'icon' => 'M2 4h12v8H2zM2 7h12', 'bg' => 'bg-paper-100', 'text' => 'text-ink-700', ]; $decoded = $flow->decoded_flow_data ?? []; $nodeCount = is_array($decoded['flowNodes'] ?? null) ? count($decoded['flowNodes']) : 0; $edgeCount = is_array($decoded['flowEdges'] ?? null) ? count($decoded['flowEdges']) : 0; // Short purpose copy — derived from category since we don't // have a `description` column. Falls back to a generic line. $purpose = match ($cat) { 'welcome' => 'Routes new subscribers into catalog, support, or first-order incentive paths.', 'cart', 'cart-recovery' => 'Triggers after checkout drop-off with product context and a support fallback.', 'post-purchase' => 'Follows up after delivery to drive reviews, repeat orders, and feedback.', 're-engagement' => 'Re-activates dormant contacts with a personalised offer or check-in.', 'lead', 'lead-nurture' => 'Nurtures new leads with educational touches before handing to sales.', 'event', 'special-events' => 'Time-boxed broadcast around a launch, sale, or seasonal moment.', default => 'Automated WhatsApp journey built in the flow editor.', }; @endphp
{{ $purpose }}
@php // Audience trigger label — derived from flows.trigger_kind which // is denormed at save time from the trigger node's data.kind. $triggerLabel = match ($flow->trigger_kind) { 'tag_added' => 'Auto · on tag', 'group_join' => 'Auto · on group join', 'manual_enroll' => 'Manual enroll', default => 'Keyword', }; $hasSubscribers = $flow->active_subscriber_count + $flow->completed_subscriber_count + $flow->failed_subscriber_count > 0; $isManual = $flow->trigger_kind === 'manual_enroll'; @endphp