Aggiunge fascia oraria, prova manuale obbligatoria e cruscotto invii email.
Le campagne rispettano orario e giorni lavorativi, richiedono una mail di test con dati inseriti a mano prima dell'invio massivo e offrono una dashboard per monitorare l'avanzamento. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<div class="space-y-6">
|
||||
<%= tag.div class: "space-y-6", data: (@mailing.sending? ? { controller: "auto-reload", auto_reload_interval_value: 10_000 } : {}) do %>
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold tracking-tight"><%= @mailing.name %></h1>
|
||||
@@ -12,10 +12,21 @@
|
||||
<% if @mailing.interval_seconds.positive? %>
|
||||
· pausa <%= @mailing.interval_seconds %>s
|
||||
<% end %>
|
||||
<% if @mailing.send_window_enabled? %>
|
||||
· fascia <%= @mailing.send_window_label %>
|
||||
<% end %>
|
||||
</p>
|
||||
<% if @mailing.sending? && @mailing.next_send_at.present? && @mailing.next_send_at > Time.current %>
|
||||
<p class="mt-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-100">
|
||||
In pausa fino a <%= l(@mailing.next_send_at, format: :long) %>
|
||||
<% if @mailing.send_window_enabled? %>
|
||||
(fuori fascia o giorno non lavorativo).
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<%= link_to "Tutti gli invii", mailings_path, class: btn_secondary %>
|
||||
<%= link_to "Cruscotto invii", dashboard_mailings_path, class: btn_secondary %>
|
||||
<% if @mailing.editable? %>
|
||||
<%= link_to "Modifica contenuto", edit_mailing_path(@mailing), class: btn_secondary %>
|
||||
<%= button_to "Aggiorna lista", refresh_recipients_mailing_path(@mailing), method: :post, class: btn_secondary %>
|
||||
@@ -23,6 +34,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if @mailing.sending? || @mailing.sent? %>
|
||||
<%= render "mailings/progress_card", mailing: @mailing %>
|
||||
<% end %>
|
||||
|
||||
<div class="grid gap-4 sm:grid-cols-4">
|
||||
<div class="<%= card_class %> p-4">
|
||||
<div class="text-xs uppercase tracking-wide text-zinc-500">Da inviare</div>
|
||||
@@ -158,9 +173,22 @@
|
||||
</section>
|
||||
|
||||
<section class="space-y-4">
|
||||
<% if @mailing.draft? %>
|
||||
<div class="<%= card_class %> space-y-3 p-4">
|
||||
<h2 class="font-semibold">1. Prova con dati manuali</h2>
|
||||
<p class="text-sm text-zinc-500">Compila i campi, controlla l’anteprima e manda <strong>una sola email subito</strong> a un indirizzo tuo. Non parte l’invio di massa.</p>
|
||||
<% if @mailing.tested? %>
|
||||
<p class="rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-sm text-emerald-900 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-100">
|
||||
Ultima prova inviata a <%= @mailing.test_sent_to %> il <%= l(@mailing.test_sent_at, format: :short) %>.
|
||||
</p>
|
||||
<% end %>
|
||||
<%= render "mailings/test_send_form", mailing: @mailing %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="<%= card_class %> p-4">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<h2 class="font-semibold">Anteprima<%= " #{@preview_variant}" if @mailing.ab_test? %></h2>
|
||||
<h2 class="font-semibold">Anteprima da lista<%= " #{@preview_variant}" if @mailing.ab_test? %></h2>
|
||||
<% if @preview_recipient %>
|
||||
<span class="text-xs text-zinc-500"><%= @preview_recipient.organization.name %></span>
|
||||
<% end %>
|
||||
@@ -179,20 +207,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if @mailing.draft? || @mailing.sending? %>
|
||||
<% if @mailing.draft? %>
|
||||
<div class="<%= card_class %> space-y-3 p-4">
|
||||
<% if @mailing.ab_test? %>
|
||||
<%= button_to "Invia prova A a me", test_send_mailing_path(@mailing, recipient_id: @preview_recipient&.id, variant: "A"), method: :post, class: btn_secondary %>
|
||||
<%= button_to "Invia prova B a me", test_send_mailing_path(@mailing, recipient_id: @preview_recipient&.id, variant: "B"), method: :post, class: btn_secondary %>
|
||||
<% else %>
|
||||
<%= button_to "Invia prova a me (#{current_user.email})", test_send_mailing_path(@mailing), method: :post, class: btn_secondary %>
|
||||
<% end %>
|
||||
<% if @mailing.pending_count.positive? %>
|
||||
<%= button_to "Invia a #{@mailing.pending_count} destinatari", queue_mailing_path(@mailing), method: :post,
|
||||
<h2 class="font-semibold">2. Autorizza l’invio di massa</h2>
|
||||
<% if @mailing.tested? && @mailing.pending_count.positive? %>
|
||||
<p class="text-sm text-zinc-500">Se l’output della prova è corretto, autorizza il job. Partirà rispettando pausa e fascia oraria.</p>
|
||||
<%= button_to "Autorizza invio a #{@mailing.pending_count} destinatari", queue_mailing_path(@mailing), method: :post,
|
||||
class: btn_primary,
|
||||
form: { data: { turbo_confirm: "Inviare #{@mailing.pending_count} email da #{@mailing.mail_identity.from_email}?" } } %>
|
||||
<% else %>
|
||||
form: { data: { turbo_confirm: @mailing.send_window_enabled? ? "Autorizzare l'invio di #{@mailing.pending_count} email da #{@mailing.mail_identity.from_email} nella fascia #{@mailing.send_window_label}?" : "Autorizzare l'invio di #{@mailing.pending_count} email da #{@mailing.mail_identity.from_email}?" } } %>
|
||||
<% elsif @mailing.pending_count.zero? %>
|
||||
<p class="text-sm text-zinc-500">Nessun destinatario da inviare. Spunta almeno un contatto con email valida.</p>
|
||||
<% else %>
|
||||
<p class="text-sm text-zinc-500">L’invio di massa resta bloccato finché non mandi una prova.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -204,4 +230,4 @@
|
||||
<% end %>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user