<?php declare(strict_types = 0);
window.condition_popup = new class {
if (overlays_stack.stack.includes('operation-condition')) {
this.overlay = overlays_stack.getById('operation-condition');
else if (overlays_stack.stack[0] === 'action-edit') {
this.overlay = overlays_stack.getById('action-condition');
this.dialogue = this.overlay.$dialogue[0];
this.form = this.overlay.$dialogue.$body[0].querySelector('form');
if (this.form.querySelector('#condition-type').value == <?= ZBX_CONDITION_TYPE_SERVICE ?>) {
$('#service-new-condition')
.multiSelect('getSelectButton')
.addEventListener('click', () => this.selectServices());
this.form.querySelector('#condition-type').onchange = () => reloadPopup(this.form, 'popup.condition.edit');
const trigger_context = this.form.querySelector('#trigger_context');
if (trigger_context !== null) {
trigger_context.onchange = () => reloadPopup(this.form, 'popup.condition.edit');
this._disableChosenMultiselectValues();
const curl = new Curl('zabbix.php');
const fields = getFormFields(this.form);
if (this.overlay == overlays_stack.getById('operation-condition')) {
curl.setArgument('action', 'action.operation.condition.check');
curl.setArgument('action', 'popup.condition.check');
if (typeof(fields.value) == 'string') {