<ion-header>
    <ion-navbar>
        <button ion-button menuToggle>
            <ion-icon name="menu"></ion-icon>
        </button>
        <ion-title>{{ getTitle() }}</ion-title>
        <ion-buttons end>
			<button ion-button icon-only (click)="toggleSearch()" [disabled]="getSelectedItem()">
				<i class="fa fa-search fa-lg"></i>
			</button>
		</ion-buttons>
    </ion-navbar>
</ion-header>
<ion-toolbar *ngIf="isSearch()">
    <ion-searchbar placeholder="Buscar" debounce="1000" (ionInput)="performSearch($event)"></ion-searchbar>
    <ion-buttons end>
        <button ion-button icon-only (click)="toggleSearch()">
            <i class="fa fa-undo fa-lg"></i>
        </button>
    </ion-buttons>
</ion-toolbar>
<ion-content>
    <ion-list>
        <ion-item *ngFor="let item of getItemsShown()" (doubleTap)="openOptions(item)" [ngClass]="{ 'selected-item': item === getSelectedItem() }">
            <h2>{{ item.name }}</h2>
            <p>
                <strong>Cantidad:</strong>
                {{ item.cart_quantity }}
            </p>
            <p>
                <strong>Subtotal:</strong>
                {{ item.amount_untaxed }}
            </p>
            <p>
                <strong>Impuestos:</strong>
                {{ item.amount_tax }}
            </p>
            <p>
                <strong>Total:</strong>
                {{ item.amount_total }}
            </p>
            <p>
                <strong>Fecha:</strong>
                {{ item.date_order }}
            </p>
        </ion-item>
    </ion-list>
    <ion-infinite-scroll (ionInfinite)="expand($event)">
        <ion-infinite-scroll-content></ion-infinite-scroll-content>
    </ion-infinite-scroll>
    <div class="no-items" *ngIf="!hasItemsShown()">
        <h2>Sin elementos</h2>
    </div>
    <ion-fab right bottom>
        <button ion-fab (click)="goToDetails()">
            <ion-icon name="add"></ion-icon>
        </button>
    </ion-fab>
</ion-content>
<ion-footer>
	<p text-center>Se muestran {{ getItemsShown().length }} de {{ getItems().length }} elementos</p>
</ion-footer>
