Source
tags_container.querySelectorAll('[name="tags_evaltype"], [name$="[operator]"]').forEach((radio_button) => {
<?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/>.
**/
?>
window.maintenance_edit = new class {
init({maintenanceid, timeperiods, tags, allowed_edit}) {
this._maintenanceid = maintenanceid;
this._overlay = overlays_stack.getById('maintenance-edit');
this._dialogue = this._overlay.$dialogue[0];
this._form = this._overlay.$dialogue.$body[0].querySelector('form');
timeperiods.forEach((timeperiod, row_index) => {
this._addTimePeriod({row_index, ...timeperiod});
});
// Setup Tags.
jQuery(document.getElementById('tags')).dynamicRows({
template: '#tag-row-tmpl',
rows: tags,
allow_empty: true
});
if (allowed_edit) {
// Setup Time periods.
document.getElementById('timeperiods').addEventListener('click', (e) => {
if (e.target.classList.contains('js-add')) {
this._editTimePeriod();
}
else if (e.target.classList.contains('js-edit')) {
this._editTimePeriod(e.target.closest('tr'));
}
else if (e.target.classList.contains('js-remove')) {
e.target.closest('tr').remove();
}
});
// Preselect already selected data in multiselect popups.
const $groupids = $('#groupids_');
$groupids.on('change', () => this._updateMultiselect($groupids));
this._updateMultiselect($groupids);
const $hostids = $('#hostids_');
$hostids.on('change', () => this._updateMultiselect($hostids));
this._updateMultiselect($hostids);