feat: derive autoresponder schedule from backend

This commit is contained in:
Marek Miklewicz
2026-06-02 19:55:07 +02:00
parent a0bd158a2e
commit f3abc7b33f
19 changed files with 248 additions and 43 deletions
+4 -2
View File
@@ -108,14 +108,16 @@ final class AppContext
private function scripts(): string
{
return <<<'JS'
$selectedLabel = json_encode($this->t('Selected'), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
return <<<JS
(function () {
var selectedLabel = {$selectedLabel};
document.querySelectorAll('[data-date-value]').forEach(function (btn) {
btn.addEventListener('click', function () {
var target = document.getElementById(btn.getAttribute('data-date-target'));
var label = document.getElementById(btn.getAttribute('data-date-label'));
if (target) { target.value = btn.getAttribute('data-date-value') || ''; }
if (label) { label.textContent = 'Wybrano: ' + (btn.getAttribute('data-date-value') || ''); }
if (label) { label.textContent = selectedLabel + ': ' + (btn.getAttribute('data-date-value') || ''); }
btn.closest('.br-restore-calendar').querySelectorAll('.br-cal-day').forEach(function (d) { d.classList.remove('is-selected'); });
btn.classList.add('is-selected');
});