Aggiunge filtri avanzati per i destinatari delle campagne email.
La scelta della lista passa da un wizard a tre passi, con anteprima del conteggio e lista congelata solo dopo la conferma. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["intent"]
|
||||
|
||||
refresh() {
|
||||
this.persistOpenSections()
|
||||
this.setIntent("preview")
|
||||
this.element.requestSubmit()
|
||||
}
|
||||
|
||||
apply() {
|
||||
this.persistOpenSections()
|
||||
this.setIntent("apply")
|
||||
}
|
||||
|
||||
persistOpenSections() {
|
||||
this.element.querySelectorAll("input[data-open-section]").forEach((input) => input.remove())
|
||||
this.element.querySelectorAll("details[data-section]").forEach((details) => {
|
||||
if (!details.open) return
|
||||
|
||||
const input = document.createElement("input")
|
||||
input.type = "hidden"
|
||||
input.name = "open_sections[]"
|
||||
input.value = details.dataset.section
|
||||
input.setAttribute("data-open-section", "")
|
||||
this.element.appendChild(input)
|
||||
})
|
||||
}
|
||||
|
||||
setIntent(value) {
|
||||
if (this.hasIntentTarget) this.intentTarget.value = value
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user