@extends('layouts.dashboard') @section('content') @php /** * Admin → Automated drips. The list of sequences, the master switch, and the add/edit modal. * * Composed from the shipped admin analogs rather than a new look: the page action goes to the * top-bar subhead slot and the list is a .qm-table inside a .qm-card exactly as * resources/views/admin/deals.blade.php does it, and the master switch is the .qm-switch-row row used by * Maintenance and Header. * * @var array $rows sequences with their step + enrolment counts * @var array $restaurants for the scope picker * @var array $triggerTypes the three trigger keys * @var bool $masterOn drip_enabled * @var bool $canSend whether outbound mail is configured * @var int $liveTemplates how many email templates are switched on */ $rows = $rows ?? []; $restaurants = $restaurants ?? []; $triggerTypes = $triggerTypes ?? ['lapsed', 'post_order', 'signup']; $masterOn = $masterOn ?? false; $canSend = $canSend ?? false; $liveTemplates = (int) ($liveTemplates ?? 0); @endphp @php /* .qm-d2: the dashboard density standard (app.css §35) */ @endphp
@php ob_start(); @endphp @php \App\Support\View::slot('subhead', ob_get_clean()); @endphp @php // The master switch. Separate from each sequence's own toggle and from the cron job's // enable flag, so an operator can stop every drip at once without editing anything. @endphp
@csrf
@if (!$canSend)

{{ t_raw('admin.drip.needs_smtp') }} {{ t_raw('admin.messages.mail_off_link') }}

@elseif ($liveTemplates === 0)

{{ t_raw('admin.drip.needs_template') }} {{ t_raw('nav.email_templates') }}

@endif

{{ t_raw('admin.drip.list_heading') }}

@if ($rows) @foreach ($rows as $s) @php $active = (int) $s['is_active'] === 1; $steps = (int) $s['step_count']; @endphp @endforeach @else @partial('table-empty', ['colspan' => 7, 'icon' => 'fa-paper-plane', 'msg' => t('admin.drip.empty')]) @endif
{{ t_raw('admin.drip.list_heading') }}
{{ t_raw('common.name') }} {{ t_raw('admin.drip.col_trigger') }} {{ t_raw('admin.drip.col_scope') }} {{ t_raw('admin.drip.col_steps') }} {{ t_raw('admin.drip.col_enrolled') }} {{ t_raw('common.status') }} {{ t_raw('common.actions') }}
{{ (string) $s['name'] }} @php // A live sequence with no steps queues nothing. Say so on the row rather // than leaving the operator to read an empty run history. @endphp @if ($active && $steps === 0)
{{ t_raw('admin.drip.warn_no_steps') }}
@endif
{{ t_raw('admin.drip.trigger_' . e((string) $s['trigger_type'])) }}
{{ t_raw('admin.drip.trigger_days_cell', [':days' => (int) $s['trigger_days']]) }}
{!! !empty($s['restaurant_name']) ? e((string) $s['restaurant_name']) : t('admin.deals.scope_platform_wide') !!} {{ $steps }} {{ (int) $s['active_count'] }}@if ((int) $s['done_count'] > 0)
{{ t_raw('admin.drip.completed_cell', [':n' => (int) $s['done_count']]) }}
@endif
@csrf
@csrf
@php /* /.qm-d2 */ @endphp @endsection