<style>
    .flow_button_trigger__automationBtn {
        display: block;
        width: 100%;
        text-align: left;
    }
    .flow_button_trigger__dropdownGroup {
        position: absolute;
        top: 110%;
        left: -3px;
        background-color: white;
        border: 1px solid #ccc;
        padding: 0;
        width: 150px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        display: none;
        z-index: 10;
    }
    .flow_button_trigger__iconPlaceholder {
        display: inline-block;
        width: 16px;
        height: 16px;
    }
    .flow_button_trigger__dropdownItem {
        display: flex;
        align-items: center;
    }
    .flow_button_trigger__visible {
        display: block !important;
    }
    .flow_button_trigger__buttonLabel {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
        display: inline-block;
        text-align: left;
        position: relative;
        top: -2px;
    }
</style>

<script>
    idoit.Translate.set('LC__MODULE__SYNETICS_FLOWS__FLOW_STARTED', '[{isys type="lang" ident="LC__MODULE__SYNETICS_FLOWS__FLOW_STARTED"}]');
    idoit.Translate.set('LC__MODULE__SYNETICS_FLOWS__FLOWS_STARTED', '[{isys type="lang" ident="LC__MODULE__SYNETICS_FLOWS__FLOWS_STARTED"}]');
    idoit.Translate.set('LC__MODULE__SYNETICS_FLOWS__FLOW_NOT_STARTED', '[{isys type="lang" ident="LC__MODULE__SYNETICS_FLOWS__FLOW_NOT_STARTED"}]');
    idoit.Translate.set('LC__MODULE__SYNETICS_FLOWS__FLOWS_NOT_STARTED', '[{isys type="lang" ident="LC__MODULE__SYNETICS_FLOWS__FLOWS_NOT_STARTED"}]');
    idoit.Translate.set('LC__MODULE__SYNETICS_FLOWS__TRIGGER_FLOW', '[{isys type="lang" ident="LC__MODULE__SYNETICS_FLOWS__TRIGGER_FLOW"}]');
    idoit.Translate.set('LC__MODULE__SYNETICS_FLOWS__SHOW_ALL_FLOWS', '[{isys type="lang" ident="LC__MODULE__SYNETICS_FLOWS__SHOW_ALL_FLOWS"}]');

    const baseApiUrl = `[{isys_application::instance()->www_path}]api/flows/automation/invoke/[{$smarty.get.objID|strip_tags|escape}]`;
    const idoitPath = `[{isys_application::instance()->www_path}]`;
    const buttons = JSON.parse(
        '[{$triggerButtons|json_encode|escape:"javascript"}]',
    );
    (() => {
        const navbar = document.getElementById("navBar");
        const buttonsContainer = document.createElement("div");
        buttonsContainer.style.display = "flex";
        navbar.insertBefore(buttonsContainer, navbar.querySelector("div[style]"));
        if (!Array.isArray(buttons)) {
            return;
        }
        AutomationButtons.setBaseEndpointUri(baseApiUrl);
        AutomationButtons.setIdoitRootPath(idoitPath);
        AutomationButtons.initButtons(buttonsContainer, buttons);
    })();
</script>