<core:FragmentDefinition
    xmlns="sap.m"
    xmlns:core="sap.ui.core"
    xmlns:dnd="sap.ui.core.dnd"
    xmlns:grid="sap.ui.layout.cssgrid"
    xmlns:l="sap.ui.layout"
    xmlns:layout="sap.ui.layout"
    xmlns:f="sap.ui.layout.form"
    core:require="{
    format: 'sap/mcsuite/model/Format', 
    translate: 'sap/mcsuite/model/Translate', 
    utils: 'sap/mcsuite/model/Utils'
  }"
>
    <Dialog
        draggable="true"
        contentHeight="auto"
        contentWidth="auto"
        showHeader="false"
        class="mc-dialog"
        afterClose="utils.AlertDetail.onAlertDetailDialogClose"
    >
        <VBox
            class="mc-dialog-header"
            alignItems="Stretch"
            justifyContent="SpaceBetween"
        >
            <HBox
                alignItems="Center"
                justifyContent="Start"
            >
                <Avatar
                    initials="{=${_contact_id/surname}.charAt(0) + ${_contact_id/forename}.charAt(0)}"
                    displaySize="S"
                    class="sapUiTinyMarginEnd"
                />
                <Title
                    text="{_contact_id/name}"
                    level="H3"
                />
            </HBox>
        </VBox>
        <VBox
            class='mc-form'
            backgroundDesign='Solid'
            alignContent='SpaceAround'
            id='contact-detail-add'
        >
            <List
                id="subtaskContactDetails-phones"
                class="mc-contact-detail-list phones"
                width="100%"
            >
                <headerToolbar>
                    <Toolbar>
                        <Title text="Telefon" level="H3" />
                    </Toolbar>
                </headerToolbar>
                <dragDropConfig>
                    <dnd:DragDropInfo
                        dragStart="utils.Availabilities.onPhoneDrag"
                        drop="utils.Availabilities.onPhoneDrop"
                        sourceAggregation="items"
                        targetAggregation="items"
                        dropPosition="Between"
                    />
                </dragDropConfig>
            </List>
            <grid:CSSGrid
                class="sapUiSmallMargin"
                gridTemplateColumns="1fr 1fr"
            >
                <Label
                    text="{parts: [{value:'LABEL'}, {value:'Sortieren'}], formatter: 'translate.Label.get'}"
                />
                <CheckBox id="checkEnableDrag" selected="{object>/sort}" />    
            </grid:CSSGrid>
            <grid:CSSGrid
                class="sapUiSmallMargin"
                gridTemplateColumns="1fr 1fr"
            >
                <Label
                    text="{parts: [{value:'crm_alerts_dt'}, {value:'prio'}], formatter: 'translate.Field.get'}"
                />
                <StepInput
                    value="{prio}"
                    min="0"
                    max="9"
                    step="1"
                />
            </grid:CSSGrid>
            <grid:CSSGrid
                class="sapUiSmallMargin"
                gridTemplateColumns="1fr 1fr"
            >
                <Label
                    text="{parts: [{value:'LABEL'}, {value:'quitting_type'},  {value:'Quittierung'}], formatter: 'translate.Label.get'}"
                />
                <Select
                    id="quittingTypeSelect"
                    selectedKey="{object>/quitting_type}"
                >   
                    <core:Item
                        key="0"
                        text="Keine Quittierung notwendig"
                    />
                    <core:Item
                        key="32"
                        text="Läuten bereits als Quittierung bewerten"
                    />
                    <core:Item
                        key="2"
                        text="Quittierung durch Zifferntaste des Teilnehmers"
                    />
                    
                    <core:Item
                        key="2050"
                        text="Neutrale Ansage bis zur Eingabe der Zifferntaste"
                    />
                    <core:Item
                        key="1"
                        text="Quittierung durch Auflegen des Teilnehmers"
                    />
                </Select>
            </grid:CSSGrid>
            <grid:CSSGrid
                class="sapUiSmallMargin"
                gridTemplateColumns="1fr 1fr"
            >
                <Label
                    text="{parts: [{value:'crm_alerts_dt'}, {value:'status'}], formatter: 'translate.Field.get'}"
                />
                
                <Select
                    id="alert-detail-pos-select"
                    selectedKey="{object>/temporary_inactive}"
                    forceSelection="true"
                >
                    <core:Item key="false" text="{parts: [{value:'LITERAL'}, {value:'ACTIVE'}, {value:'Aktiv'}], formatter: 'translate.Label.get'}" />
                    <core:Item key="true" text="{parts: [{value:'LITERAL'}, {value:'INACTIVE'}, {value:'Inaktiv'}], formatter: 'translate.Label.get'}" />
                
                </Select>
            </grid:CSSGrid>
            <HBox
                class="sapUiSmallMargin"
                justifyContent="Center"
                alignContent="Center"
            >
                <Button
                    text="{parts: [{value:'BUTTON'}, {value:'SAVE'}, {value:'Save'}], formatter: 'translate.Label.get'}"
                    type="Emphasized"
                    press="utils.AlertDetail.onAlertDetailDialogSave"
                />
            </HBox>
        </VBox>
    </Dialog>
</core:FragmentDefinition>
