<ion-header>
  <ion-toolbar>
    <ion-buttons slot="start" *ngIf="name!=0">
      <ion-back-button icon="arrow-round-back"></ion-back-button>
    </ion-buttons>
    <ion-menu-button slot="start" *ngIf="name==0">
      <ion-icon name="menu"></ion-icon>
    </ion-menu-button>
    <ion-title *ngIf="name==0">
      {{'Categories'|translate}}
    </ion-title>
    <ion-title *ngIf="name!=0">
      {{name}}
    </ion-title>
    <ion-buttons slot="end">
      <ion-button fill="clear" routerLink="/search" routerDirection="forward">
        <ion-icon slot="icon-only" name="search"></ion-icon>
      </ion-button>
      <ion-button fill="clear" routerLink="/cart" routerDirection="forward">
        <ion-icon name="basket"></ion-icon>
        <ion-badge color="secondary">{{shared.cartTotalItems()}}</ion-badge>
      </ion-button>
    </ion-buttons>
  </ion-toolbar>
</ion-header>

<ion-content>
  <ion-grid class="ion-no-padding">
    <ion-row class="ion-no-padding">
      <ion-col *ngFor="let c of shared.getCategoriesPageItems(parent)" (click)="openProducts(c.id,c.name)"
        class="animate-item" size="6" class="ion-no-padding">
        <ion-card routerDirection="forward">
          <ion-thumbnail>
            <img *ngIf="c.image" src="{{c.image.src}}" />
          </ion-thumbnail>
          <ion-text>
            <h6>{{c.name|translate}}</h6>
            <p>{{c.count}} {{'Products'| translate }}</p>
          </ion-text>
        </ion-card>
      </ion-col>
    </ion-row>
  </ion-grid>

  <div class="ion-text-center">
    <ion-button *ngIf="parent!=0" icon-end clear color="secondary" (click)="openParentProducts()">
      {{ 'View All' | translate }}
      <ion-icon name="md-arrow-dropright"></ion-icon>
    </ion-button>
  </div>
</ion-content>