<ion-content [scrollEvents]="true" *ngIf="mall_details" (ionScroll)="onScroll($event)">
    <div class="overlay" [ngClass]="{ 'active' : show_sort_popup }"></div>

    <div class="header-bar" [ngClass]="{'active' : show_top_bar }">
        <div class="heading-holder">
            <button (click)="back()"> <ion-icon name="arrow-back"></ion-icon> </button>
            <h3> {{ mall_details.mall_name }} </h3>
        </div>
        <div class="stats-holder">
            <div class="stat"> <ion-icon name="star"></ion-icon> {{ mall_details.rating }} </div>
            <div class="stat"> <ion-icon name="pin"></ion-icon> {{ mall_details.mall_distance }} km</div>
        </div>
        <div class="utilities-buttons-holder">
            <button [ngClass]="{'active' : mall_details.is_bookmarked }"> <ion-icon name="bookmark"></ion-icon> </button>
            <button> <ion-icon name="share"></ion-icon> </button>
            <a target="_blank" href="https://maps.google.com/?q=">
                <ion-icon name="navigate"></ion-icon>
            </a>
        </div>
    </div>

    <div class="upfold-holder">
		<img [src]="mall_details.image_url">
        <div class="icons-holder">
            <div>
                <button (click)="back()"> <ion-icon name="arrow-back"></ion-icon> </button>
            </div>
            <div class="action-buttons-holder">
                <button [ngClass]="{'active' : mall_details.is_bookmarked }">
                    <ion-icon name="bookmark"></ion-icon>
                </button>
                <button> <ion-icon name="share"></ion-icon> </button>
				<a target="_blank" href="https://maps.google.com/?q=">
	                <ion-icon name="navigate"></ion-icon>
	            </a>
            </div>
        </div>
    </div>
    <div class="card-holder">
        <div class="card">
            <h3> {{ mall_details.mall_name }} </h3>
			<p> {{ mall_details.mall_address }} </p>
            <div class="stats-holder">
                <div class="stat"> <ion-icon name="star"></ion-icon> {{ mall_details.rating }} </div>
                <div class="stat"> <ion-icon name="pin"></ion-icon> {{ mall_details.mall_distance }} km</div>
            </div>
            <p> {{ mall_details.description }} </p>
        </div>
    </div>

    <div class="tabs-holder" [ngClass]="{ 'right' : selected_tab === 'shopping' }">
        <button class="tab" [ngClass]="{ 'active' : selected_tab === 'food' }"
        (click)="selected_tab = 'food'"> FOOD OUTLETS </button>
        <button class="tab" [ngClass]="{ 'active' : selected_tab === 'shopping' }"
        (click)="selected_tab = 'shopping'"> SHOPS </button>
    </div>

    <div class="results-utilities-holder">
        <h5 *ngIf="mall_details"> {{ mall_details.outlet.length }} OUTLETS </h5>
        <ion-button color="default" fill="clear" (click)="togglePopup()"> SORT / FILTER </ion-button>
    </div>

    <ion-list lines="none" class="result-list" *ngIf="selected_tab === 'food'">
        <ion-item *ngFor="let outlet of mall_details.outlet">
            <img src="{{ outlet.image_url }}" slot="start">
            <ion-label>
                <h3>
                    {{ outlet.outlet_name }}
                    <div class="rating-holder">
                        <ion-icon name="star"></ion-icon> {{ outlet.rating }}
                    </div>
                    <ion-icon name="bookmark" [ngClass]="{'active' : outlet.is_bookmarked }"></ion-icon>
                </h3>
                <p class="description">
                    {{ outlet.description }}
                    <button class="share-button">
                        <ion-icon name="share"></ion-icon>
                    </button>
                </p>
                <div class="offers-holder">
                    <div class="offer">
                        <span *ngIf="outlet.outlet_type"> <ion-icon name="restaurant"></ion-icon> Food </span>
                        <span *ngIf="!outlet.outlet_type"> <ion-icon name="basket"></ion-icon> Shopping </span>
                        Offers: <strong> {{ outlet.offers.length }}  </strong>
                    </div>
                </div>
            </ion-label>
        </ion-item>
    </ion-list>

    <div class="advertisement-slots">
        <figure>
            <img src="https://static.couponspy.in/picture/coupon/89472.jpg">
        </figure>

        <figure>
            <img src="https://content.adidas.co.in/static/sign_up_popup/sign_up_popup.jpg">
        </figure>

        <figure>
            <img src="https://fsmc.s3.amazonaws.com/a/90804/adidas.jpg">
        </figure>

        <figure>
            <img src="https://static.couponspy.in/picture/coupon/89472.jpg">
        </figure>

        <figure>
            <img src="https://static.couponspy.in/picture/coupon/89472.jpg">
        </figure>
    </div>

    <div class="common-semi-modal sort-holder" [ngClass]="{'active' : show_sort_popup }">
        <header>
            Sort / Filter <button (click)="togglePopup()"> Done </button>
        </header>

        <div class="sort-buttons-holder">
            <button [ngClass]="{'active' : selected_sort === 'name'}"
            (click)="sortBy('name')">
                <div class="icon-holder"> A-Z </div>
                <span> NAME </span>
            </button>
            <button [ngClass]="{'active' : selected_sort === 'rating'}"
            (click)="sortBy('rating')">
                <div class="icon-holder"> <ion-icon name="star"></ion-icon> </div>
                <span> RATING </span>
            </button>
        </div>
    </div>

</ion-content>
