Le listbox non applicavano sport e altri criteri; ora i filtri sono checkbox, c'è «mai contattati» e dal cruscotto si cancellano le bozze. La lista organizzazioni allinea le colonne al foglio campagna. Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
|
|
export default class extends Controller {
|
|
static targets = ["intent"]
|
|
|
|
disconnect() {
|
|
clearTimeout(this.refreshTimer)
|
|
}
|
|
|
|
refresh() {
|
|
clearTimeout(this.refreshTimer)
|
|
this.refreshTimer = setTimeout(() => this.submitPreview(), 250)
|
|
}
|
|
|
|
apply() {
|
|
clearTimeout(this.refreshTimer)
|
|
this.persistOpenSections()
|
|
this.setIntent("apply")
|
|
}
|
|
|
|
submitPreview() {
|
|
this.persistOpenSections()
|
|
this.setIntent("preview")
|
|
this.element.requestSubmit()
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|