<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">

<t t-name="web.X2ManyFieldDialog">
    <Dialog t-props="dialogProps">
        <FormRenderer readonly="readonly" record="record" archInfo="archInfo"/>
        <t t-set-slot="footer">
            <t t-if="footerArchInfo">
                <FormRenderer readonly="readonly" record="record" archInfo="footerArchInfo">
                    <t t-set-slot="default_buttons">
                        <t t-call="web.X2ManyFieldDialogDefaultButtons"/>
                    </t>
                </FormRenderer>
            </t>
            <t t-else="">
                <t t-call="web.X2ManyFieldDialogDefaultButtons"/>
            </t>
        </t>
    </Dialog>
</t>

<t t-name="web.Many2XAutocomplete" >
    <div class="o_input_dropdown" t-ref="autocomplete_container">
        <input t-if="env.isSmall and props.dropdown"
            type="text"
            t-att-id="props.id"
            class="o_input"
            readonly=""
            autocomplete="off"
            t-att-placeholder="props.placeholder"
            t-att-value="props.value"
            t-on-click="onSearchMore"
            t-on-barcode-search="onBarcodeSearch"
        />
        <AutoComplete t-else="" t-props="autoCompleteProps">
            <t t-set-slot="option" t-slot-scope="optionScope">
                <t t-slot="{{ optionScope.data.slotName }}" t-props="optionScope.data" label="optionScope.label">
                    <t t-out="optionScope.label"/>
                </t>
            </t>
        </AutoComplete>
        <span class="o_dropdown_button" />
    </div>
</t>

<t t-name="web.X2ManyFieldDialogDefaultButtons">
    <t t-if="record.isInEdition">
        <t t-if="canCreate">
            <button class="btn btn-primary o_form_button_save" t-on-click="save" data-hotkey="c">Save &amp; Close</button>
            <button class="btn btn-primary o_form_button_save_new" t-on-click="saveAndNew" data-hotkey="n">Save &amp; New</button>
        </t>
        <t t-else="">
            <button class="btn btn-primary o_form_button_save" t-on-click="save" data-hotkey="c">Save</button>
        </t>
        <button class="btn btn-secondary o_form_button_cancel" t-on-click="discard" data-hotkey="j">Discard</button>

        <t t-if="props.delete and displayDeleteButton">
            <button class="btn btn-secondary d-flex flex-nowrap align-items-center justify-content-center gap-1 ms-md-auto o_btn_remove" t-on-click="remove" data-hotkey="k">
                <i class="fa fa-trash"/>
                <t t-if="props.deleteButtonLabel" t-out="props.deleteButtonLabel"/>
                <t t-else="">Remove</t>
            </button>
        </t>
    </t>
    <t t-else="">
        <button class="btn btn-primary o_form_button_cancel" t-on-click="() => this.props.close()" data-hotkey="j">Close</button>
    </t>
</t>

</templates>
