{# @copyright   Copyright (C) 2010-2024 Combodo SAS #}
{# @license     http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}

$('#dlg_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }}').dialog({
    width: $(window).width()*0.8,
    height: $(window).height()*0.8,
    title:"{{ 'UI:AddObjectsOf_Class_LinkedWith_Class'|dict_format(oUIBlock.oUILinksWidget.GetLinkedClassLabel(), oUIBlock.oUILinksWidget.GetClassLabel()) }}" ,
    autoOpen: false,
    modal: true,
    resizeStop: oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.UpdateSizes,
    buttons: [
        { 
            text: "{{ 'UI:Button:Cancel'| dict_s }}",
            class: "ibo-is-alternative ibo-is-neutral",
            click: function() {
                $(this).dialog('close');
            } 
        },
        { 
            text:  "{{ 'UI:Button:Add'| dict_s }}",
            class: "ibo-is-regular ibo-is-primary",
            id: "btn_ok_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }}",
            click: function() {
                return oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.DoAddObjects();
            } 
        },
    ],

});

$('#SearchFormToAdd_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }} form').on('submit.uilinksWizard', oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.SearchObjectsToAdd);
$('#SearchFormToAdd_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }}').on('resize', oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.UpdateSizes);

{% endapply %}