<core:FragmentDefinition
    xmlns="sap.m"
    xmlns:core="sap.ui.core"
    xmlns:l="sap.ui.layout"
    xmlns:f="sap.ui.layout.form">
 
    <Dialog
        id="newOrderDialog"
        title="{i18n>NewOrder}"
        icon="sap-icon://create-form"
        contentWidth="640px"
        contentHeight="auto"
        resizable="true"
        draggable="true"
        class="f2mNewOrderDialog">
 
        <!-- =============================================================
             SubHeader sotto il titolo del Dialog
             ============================================================= -->
        <subHeader>
            <Bar class="f2mDialogSubHeader" design="SubHeader">
                <contentLeft>
                    <HBox alignItems="Center" class="sapUiTinyMarginBegin">
                        <core:Icon src="sap-icon://create-form"
                                   size="1rem"
                                   class="sapUiTinyMarginEnd f2mDialogSubIcon"/>
                        <Text text="Compila i dati per creare un nuovo ordine"
                              class="f2mDialogSubText"/>
                    </HBox>
                </contentLeft>
            </Bar>
        </subHeader>
 
        <content>
 
            <VBox class="sapUiSmallMargin">
 
                <f:SimpleForm
                    id="newOrderForm"
                    layout="ColumnLayout"
                    editable="true"
                    columnsXL="2"
                    columnsL="2"
                    columnsM="1"
                    labelSpanXL="4"
                    labelSpanL="4"
                    labelSpanM="4"
                    labelSpanS="12"
                    adjustLabelSpan="false"
                    emptySpanXL="0"
                    emptySpanL="0"
                    emptySpanM="0"
                    emptySpanS="0"
                    singleContainerFullSize="false">
 
                    <!-- ============================================== -->
                    <!-- SEZIONE 1 - Dati ordine                        -->
                    <!-- ============================================== -->
                    <core:Title text="Dati ordine" icon="sap-icon://document-text"/>
 
                    <Label text="{i18n>Auart}" labelFor="Auart1"/>
                    <Input
                        id="Auart1"
                        type="Text"
                        placeholder="{i18n>EntAuart}"
                        showSuggestion="true"
                        showValueHelp="true"
                        valueHelpRequest=".onAuartSearch2"
                        suggestionItems="{AuartJsonSH>/Items}"
                        suggestionItemSelected=".onSuggestionItemSelectedAuart">
                        <suggestionItems>
                            <core:ListItem
                                key="{AuartJsonSH>auart}"
                                text="{AuartJsonSH>bezei}"/>
                        </suggestionItems>
                    </Input>
 
                    <Label text="{i18n>Vdatu}" labelFor="DPVdatu"/>
                    <DatePicker
                        id="DPVdatu"
                        placeholder="{i18n>EntVdatu}"
                        valueFormat="dd.MM.yyyy"
                        displayFormat="dd.MM.yyyy"/>
 
                    <Label text="{i18n>Bstkd}" labelFor="Bstkd"/>
                    <Input
                        id="Bstkd"
                        type="Text"
                        placeholder="{i18n>EntBstkd}"/>
 
                    <!-- ============================================== -->
                    <!-- SEZIONE 2 - Cliente                            -->
                    <!-- ============================================== -->
                    <core:Title text="Cliente" icon="sap-icon://customer"/>
 
                    <Label text="{i18n>Sold-To}" labelFor="Kunag1"/>
                    <Input
                        id="Kunag1"
                        type="Text"
                        placeholder="{i18n>EntSoldTo}"
                        showSuggestion="true"
                        showValueHelp="true"
                        valueHelpRequest=".onKunagSearch2"
                        suggestionItems="{KunagJsonSH>/SoldTo}"
                        suggestionItemSelected=".onSuggestionItemSelectedKunag">
                        <suggestionItems>
                            <core:ListItem
                                key="{KunagJsonSH>kunag}"
                                text="{KunagJsonSH>kunag_name1}"/>
                        </suggestionItems>
                    </Input>
 
                    <Label text="{i18n>Ship-To}" labelFor="Kunwe1"/>
                    <Input
                        id="Kunwe1"
                        type="Text"
                        placeholder="{i18n>EntShipTo}"
                        showSuggestion="true"
                        showValueHelp="true"
                        valueHelpRequest=".onKunweSearch2"
                        suggestionItems="{KunweJsonSH>/ShipTo}"
                        suggestionItemSelected=".onSuggestionItemSelectedKunwe">
                        <suggestionItems>
                            <core:ListItem
                                key="{KunweJsonSH>kunwe}"
                                text="{KunweJsonSH>kunwe_name1}"/>
                        </suggestionItems>
                    </Input>
 
                    <!-- ============================================== -->
                    <!-- SEZIONE 3 - Area Vendita                       -->
                    <!-- ============================================== -->
                    <core:Title text="Area vendita" icon="sap-icon://sales-document"/>
 
                    <Label text="{i18n>Vkorg}" labelFor="Vkorg1"/>
                    <Input
                        id="Vkorg1"
                        type="Text"
                        placeholder="{i18n>EntVkorg}"
                        showSuggestion="true"
                        showValueHelp="true"
                        valueHelpRequest=".onVkorgSearch2"
                        suggestionItems="{VkorgJsonSH>/SalesOrg}"
                        suggestionItemSelected=".onSuggestionItemSelectedVkorg">
                        <suggestionItems>
                            <core:ListItem
                                key="{VkorgJsonSH>Vkorg}"
                                text="{VkorgJsonSH>Vtext}"/>
                        </suggestionItems>
                    </Input>
 
                    <Label text="{i18n>Vtweg}" labelFor="Vtweg1"/>
                    <Input
                        id="Vtweg1"
                        type="Text"
                        placeholder="{i18n>EntVtweg}"
                        showSuggestion="true"
                        showValueHelp="true"
                        valueHelpRequest=".onVtwegSearch2"
                        suggestionItems="{VtwegJsonSH>/Channel}"
                        suggestionItemSelected=".onSuggestionItemSelectedVtweg">
                        <suggestionItems>
                            <core:ListItem
                                key="{VtwegJsonSH>Vtweg}"
                                text="{VtwegJsonSH>Vtext}"/>
                        </suggestionItems>
                    </Input>
 
                    <Label text="{i18n>Spart}" labelFor="Spart1"/>
                    <Input
                        id="Spart1"
                        type="Text"
                        placeholder="{i18n>EntSpart}"
                        showSuggestion="true"
                        showValueHelp="true"
                        valueHelpRequest=".onSpartSearch2"
                        suggestionItems="{SpartJsonSH>/Division}"
                        suggestionItemSelected=".onSuggestionItemSelectedSpart">
                        <suggestionItems>
                            <core:ListItem
                                key="{SpartJsonSH>Spart}"
                                text="{SpartJsonSH>VtextSpa}"/>
                        </suggestionItems>
                    </Input>
 
                    <Label text="{i18n>Pltyp}" labelFor="Pltyp1"/>
                    <Input
                        id="Pltyp1"
                        type="Text"
                        placeholder="{i18n>EntPltyp}"
                        showSuggestion="true"
                        showValueHelp="true"
                        valueHelpRequest=".onPltypSearch2"
                        suggestionItems="{PltypJsonSH>/PriceList}"
                        suggestionItemSelected=".onSuggestionItemSelectedPltyp">
                        <suggestionItems>
                            <core:ListItem
                                key="{PltypJsonSH>Pltyp}"
                                text="{PltypJsonSH>Ptext}"/>
                        </suggestionItems>
                    </Input>
 
                    <!-- ============================================== -->
                    <!-- SEZIONE 4 - Note                               -->
                    <!-- ============================================== -->
                    <core:Title text="Note" icon="sap-icon://notes"/>
 
                    <Label text="{i18n>Notes}" labelFor="Notes1"/>
                    <TextArea
                        id="Notes1"
                        rows="4"
                        width="100%"
                        growing="true"
                        growingMaxLines="8"/>
 
                </f:SimpleForm>
 
            </VBox>
 
        </content>
 
        <!-- =============================================================
             Pulsanti del Dialog (posizione standard SAPUI5)
             ============================================================= -->
        <buttons>
            <Button
                icon="sap-icon://accept"
                type="Accept"
                text="Crea"
                press=".onPressCreateNewOrder"/>
            <Button
                icon="sap-icon://decline"
                type="Reject"
                text="Annulla"
                press=".onPressCancelNewOrder"/>
        </buttons>
 
    </Dialog>
 
</core:FragmentDefinition>