Source
schedule.querySelector(`input[name="schedule_periods[${element.value}]"]`).disabled = !element.checked;
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/**
* @var CView $this
*/
?>
window.sla_edit_popup = new class {
init({slaid, service_tags, excluded_downtimes}) {
this._initTemplates();
this.slaid = slaid;
this.overlay = overlays_stack.getById('sla_edit');
this.dialogue = this.overlay.$dialogue[0];
this.form = this.overlay.$dialogue.$body[0].querySelector('form');
this.footer = this.overlay.$dialogue.$footer[0];
for (const excluded_downtime of excluded_downtimes) {
this._addExcludedDowntime(excluded_downtime);
}
// Update form field state according to the form data.
for (const element of document.querySelectorAll('#schedule_mode input[type="radio"')) {
element.addEventListener('change', () => this._update());
}
for (const element of document.querySelectorAll('#schedule input[type="checkbox"]')) {
element.addEventListener('change', () => this._update());
}
// Setup Problem tags.
const $service_tags = jQuery(document.getElementById('service-tags'));
$service_tags.dynamicRows({
template: '#service-tag-row-tmpl',
rows: service_tags,
allow_empty: true
});
// Setup Excluded downtimes.
document
.getElementById('excluded-downtimes')
.addEventListener('click', (e) => {
if (e.target.classList.contains('js-add')) {
this._editExcludedDowntime();