<?php declare(strict_types = 0);
window.action_edit_popup = new class {
init({condition_operators, condition_types, conditions, actionid, eventsource}) {
this.overlay = overlays_stack.getById('action-edit');
this.dialogue = this.overlay.$dialogue[0];
this.form = this.overlay.$dialogue.$body[0].querySelector('form');
this.condition_operators = condition_operators;
this.condition_types = condition_types;
this.actionid = actionid;
this.eventsource = eventsource;
this._initActionButtons();
this._processTypeOfCalculation();
if (typeof(conditions) === 'object') {
conditions = Object.values(conditions);
for (const condition of conditions) {
this._createConditionsRow(condition);
const esc_period = document.querySelector('#esc_period');
esc_period.addEventListener('change', () => {
this.recovery = <?= ACTION_OPERATION ?>;
this._loadOperationTable();
this.form.style.display = '';
this.overlay.recoverFocus();
_loadOperationTable(new_operation = {}) {
if (this.recovery == <?= ACTION_RECOVERY_OPERATION ?>) {
this.$operation_table = $('#recovery-operations-container');
else if (this.recovery == <?= ACTION_UPDATE_OPERATION ?>) {
this.$operation_table = $('#update-operations-container');
this.$operation_table = $('#operations-container');
const fields = getFormFields(this.form);
const curl = new Curl('zabbix.php');
curl.setArgument('action', 'popup.action.operations.list');
curl.setArgument('type', <?= PAGE_TYPE_TEXT_RETURN_JSON ?>);
if (document.querySelector('#esc_period')) {
let esc_period = (document.querySelector('#esc_period').value).trim();
curl.setArgument('esc_period', esc_period);
'Accept': 'application/json',
'Content-Type': 'application/json'
'operations': fields.operations,
'recovery_operations': fields.recovery_operations,
'update_operations': fields.update_operations,