<Page class="page-container">
    <ActionBar flat="true">
        <NavigationButton (tap)="onBackButton()" android.systemIcon="ic_menu_back" text="Zpět"></NavigationButton>
        <Label class="action-bar-title" text="Detail výpůjčky" textWrap="true"></Label>
    </ActionBar>

    <GridLayout class="page page-content">
        <ScrollView>
            <StackLayout class="page-area">
                <GridLayout class="line-info-item m-y-2" columns="*, *" rows="auto"
                            visibility="{{reservation.WarehouseItem ? 'visible' : 'collapsed'}}">
                    <Label (tap)="onItemTap()" class="p-r-5" text="Položka:" textWrap="true"></Label>
                    <Label (tap)="onItemTap()" [text]="reservation.WarehouseItem" class="h5" col="1"
                           textAlignment="right" textWrap="true"></Label>
                </GridLayout>
                <LineInfoItem [value]="reservation.WarehouseItemReservationState" name="Stav rezervace:"></LineInfoItem>
                <LineInfoItem [value]="reservation.UserName" name="Zadal:"></LineInfoItem>

                <GridLayout class="line-info-item m-y-2" columns="auto *" rows="auto"
                            visibility="{{reservation.Warehouse ? 'visible' : 'collapsed'}}">
                    <Label (tap)="onWarehouseTap()" class="p-r-5" text="Do skladu:" textWrap="true"></Label>
                    <Label (tap)="onWarehouseTap()" [text]="reservation.Warehouse" class="h5" col="1"
                           textAlignment="right" textWrap="true"></Label>
                </GridLayout>
                <LineInfoItem [value]="reservation.Person" name="Kontaktní osoba:"></LineInfoItem>
                <GridLayout class="line-info-item m-y-2" columns="* *" rows="auto"
                            visibility="{{reservation.Phone ? 'visible' : 'collapsed'}}">
                    <Label (tap)="onCallTap()" class="p-r-5" text="Telefon na kontaktní osobu:" textWrap="true"></Label>
                    <Label (tap)="onCallTap()" [text]="reservation.Phone" class="h5" col="1" textAlignment="right"
                           textWrap="true"></Label>
                </GridLayout>
                <GridLayout class="line-info-item m-y-2" columns="* *" rows="auto"
                            visibility="{{reservation.Email ? 'visible' : 'collapsed'}}">
                    <Label (tap)="onEmailTap()" class="p-r-5" text="Email na kontaktní osobu:" textWrap="true"></Label>
                    <Label (tap)="onEmailTap()" [text]="reservation.Email" class="h5" col="1" textAlignment="right"
                           textWrap="true"></Label>
                </GridLayout>
                <LineInfoItem [value]="reservation.EstimatedStartDate" name="Půjčeno (odhad):"
                              type="date"></LineInfoItem>
                <LineInfoItem [value]="reservation.EstimatedEndDate" name="Vráceno (odhad):" type="date"></LineInfoItem>
                <LineInfoItem [value]="reservation.RealStartDate" name="Půjčeno:" type="date"></LineInfoItem>
                <LineInfoItem *ngIf="reservation.Note" [value]=" " name="Poznámka:"></LineInfoItem>
                <LineInfoItem *ngIf="reservation.Note" [name]="reservation.Note" value=" "></LineInfoItem>
                <!-- <Label [text]="reservation.Note" *ngIf="reservation.Note" textWrap="true"></Label>  -->
            </StackLayout>
        </ScrollView>

        <GridLayout [visibility]="(isLoading$ | async) || othersIsLoading ? 'visible' : 'collapsed'"
                    class="activity-indicator-wrapper">
            <ActivityIndicator [busy]="(isLoading$ | async) || othersIsLoading"></ActivityIndicator>
        </GridLayout>
    </GridLayout>
</Page>
