@@ -12,6 +12,13 @@ const routes: Routes = [{ | |||||
component: LoginComponent | component: LoginComponent | ||||
},{ | },{ | ||||
path: 'shop-details', | path: 'shop-details', | ||||
redirectTo: 'shop-details/dashboard', | |||||
pathMatch: 'full', | |||||
}, { | |||||
path: 'shop-details/:page', | |||||
component: WidgetsHolderComponent | |||||
}, { | |||||
path: 'shop-details/:page/:params', | |||||
component: WidgetsHolderComponent | component: WidgetsHolderComponent | ||||
}, | }, | ||||
]; | ]; | ||||
@@ -2,8 +2,6 @@ | |||||
<section class="order-stats"> | <section class="order-stats"> | ||||
<div class="widget-heading-holder"> | <div class="widget-heading-holder"> | ||||
<header> Dashboard </header> | <header> Dashboard </header> | ||||
<!-- <app-custom-selector header="Date" [options]="filterOptions" width="200" | |||||
[defaultOptionId]="filterOptions[1].id"></app-custom-selector> --> | |||||
</div> | </div> | ||||
<ul> | <ul> | ||||
@@ -20,7 +18,7 @@ | |||||
</div> | </div> | ||||
<div class="column"> | <div class="column"> | ||||
<button class="rect-button" (click)="goToOrdersPage('pending')"> View </button> | |||||
<button class="rect-button" [routerLink]="['/shop-details/orders/pending']"> View </button> | |||||
</div> | </div> | ||||
</li> | </li> | ||||
@@ -37,7 +35,7 @@ | |||||
</div> | </div> | ||||
<div class="column"> | <div class="column"> | ||||
<button class="rect-button" (click)="goToOrdersPage('confirmed')"> View </button> | |||||
<button class="rect-button" [routerLink]="['/shop-details/orders/confirmed']"> View </button> | |||||
</div> | </div> | ||||
</li> | </li> | ||||
@@ -54,7 +52,7 @@ | |||||
</div> | </div> | ||||
<div class="column"> | <div class="column"> | ||||
<button class="rect-button" (click)="goToOrdersPage('delivered')"> View </button> | |||||
<button class="rect-button" [routerLink]="['/shop-details/orders/delivered']"> View </button> | |||||
</div> | </div> | ||||
</li> | </li> | ||||
</ul> | </ul> | ||||
@@ -63,7 +61,7 @@ | |||||
<ul class="pending-orders" *ngIf="getFilteredOrders('pending').length > 0"> | <ul class="pending-orders" *ngIf="getFilteredOrders('pending').length > 0"> | ||||
<div class="heading"> | <div class="heading"> | ||||
<header> Pending Orders: </header> | <header> Pending Orders: </header> | ||||
<a (click)="goToOrdersPage('pending')"> View All </a> | |||||
<a [routerLink]="['/shop-details/orders/pending']"> View All </a> | |||||
</div> | </div> | ||||
<li *ngFor="let order of getFilteredOrders('pending')"> | <li *ngFor="let order of getFilteredOrders('pending')"> | ||||
<div class="info"> | <div class="info"> | ||||
@@ -130,11 +130,4 @@ export class DashboardComponent implements OnInit { | |||||
}) | }) | ||||
} | } | ||||
goToOrdersPage(type: 'pending' | 'delivered' | 'confirmed') { | |||||
this.dashboardEvents.emit({ | |||||
nav: 'orders', | |||||
type: type | |||||
}); | |||||
} | |||||
} | } |
@@ -33,7 +33,7 @@ export class OrdersComponent implements OnInit { | |||||
ngOnInit() { | ngOnInit() { | ||||
if (this.params) { | if (this.params) { | ||||
try { | try { | ||||
switch(this.params.filterType) { | |||||
switch(this.params) { | |||||
case 'pending': this.filterOption = { | case 'pending': this.filterOption = { | ||||
orderStatus: 'Pending', | orderStatus: 'Pending', | ||||
orderstatus_id: 6 | orderstatus_id: 6 | ||||
@@ -29,32 +29,32 @@ | |||||
</section> | </section> | ||||
<ul> | <ul> | ||||
<li [ngClass]="{'active' : selected_nav.name === 'dashboard'}" (click)="selected_nav.name = 'dashboard'"> | |||||
<li [ngClass]="{'active' : selected_nav.name === 'dashboard'}" [routerLink]="['/shop-details/dashboard']"> | |||||
<i class="icon ion-ios-home"></i> <label> Dashboard </label> | <i class="icon ion-ios-home"></i> <label> Dashboard </label> | ||||
</li> | </li> | ||||
<li [ngClass]="{'active' : selected_nav.name === 'orders'}" (click)="selected_nav.name = 'orders'"> | |||||
<li [ngClass]="{'active' : selected_nav.name === 'orders'}" [routerLink]="['/shop-details/orders/pending']"> | |||||
<i class="icon ion-ios-cube"></i> <label> Orders </label> | <i class="icon ion-ios-cube"></i> <label> Orders </label> | ||||
</li> | </li> | ||||
<li *ngIf="profile_type === 'VENDOR'" [ngClass]="{'active' : selected_nav.name === 'items'}" (click)="selected_nav.name = 'items'"> | |||||
<li *ngIf="profile_type === 'VENDOR'" [ngClass]="{'active' : selected_nav.name === 'items'}" [routerLink]="['/shop-details/items']"> | |||||
<i class="icon ion-ios-clipboard"></i> <label> Menu Items & Offers </label> | <i class="icon ion-ios-clipboard"></i> <label> Menu Items & Offers </label> | ||||
</li> | </li> | ||||
<li *ngIf="profile_type === 'VENDOR'" [ngClass]="{'active' : selected_nav.name === 'schedule'}" (click)="selected_nav.name = 'schedule'"> | |||||
<li *ngIf="profile_type === 'VENDOR'" [ngClass]="{'active' : selected_nav.name === 'schedule'}" [routerLink]="['/shop-details/schedule']"> | |||||
<i class="icon ion-ios-calendar"></i> <label> Shop Schedules </label> | <i class="icon ion-ios-calendar"></i> <label> Shop Schedules </label> | ||||
</li> | </li> | ||||
<li *ngIf="profile_type === 'VENDOR'" [ngClass]="{'active' : selected_nav.name === 'profile'}" (click)="selected_nav.name = 'profile'"> | |||||
<li *ngIf="profile_type === 'VENDOR'" [ngClass]="{'active' : selected_nav.name === 'profile'}" [routerLink]="['/shop-details/profile']"> | |||||
<i class="icon ion-ios-person"></i> <label> Profile </label> | <i class="icon ion-ios-person"></i> <label> Profile </label> | ||||
</li> | </li> | ||||
<li *ngIf="profile_type === 'VENDOR'" [ngClass]="{'active' : selected_nav.name === 'settings'}" (click)="selected_nav.name = 'settings'"> | |||||
<li *ngIf="profile_type === 'VENDOR'" [ngClass]="{'active' : selected_nav.name === 'settings'}" [routerLink]="['/shop-details/settings']"> | |||||
<i class="icon ion-ios-cog"></i> <label> Settings </label> | <i class="icon ion-ios-cog"></i> <label> Settings </label> | ||||
</li> | </li> | ||||
<li [ngClass]="{'active' : selected_nav.name === 'more'}" (click)="selected_nav.name = 'more'"> | |||||
<li [ngClass]="{'active' : selected_nav.name === 'more'}" [routerLink]="['/shop-details/more']"> | |||||
<i class="icon ion-ios-more"></i> <label> More </label> | <i class="icon ion-ios-more"></i> <label> More </label> | ||||
</li> | </li> | ||||
</ul> | </ul> | ||||
</section> | </section> | ||||
<section class="widgets"> | <section class="widgets"> | ||||
<app-dashboard *ngIf="selected_nav.name === 'dashboard'" (dashboardEvents)="getWidgetsEvents($event)"></app-dashboard> | |||||
<app-dashboard *ngIf="selected_nav.name === 'dashboard'"></app-dashboard> | |||||
<app-orders [params]="selected_nav.params" *ngIf="selected_nav.name === 'orders'"></app-orders> | <app-orders [params]="selected_nav.params" *ngIf="selected_nav.name === 'orders'"></app-orders> | ||||
<app-menu-items *ngIf="selected_nav.name === 'items'"></app-menu-items> | <app-menu-items *ngIf="selected_nav.name === 'items'"></app-menu-items> | ||||
<app-schedules *ngIf="selected_nav.name === 'schedule'"></app-schedules> | <app-schedules *ngIf="selected_nav.name === 'schedule'"></app-schedules> | ||||
@@ -1,5 +1,6 @@ | |||||
import { Component, OnInit } from '@angular/core'; | import { Component, OnInit } from '@angular/core'; | ||||
import { Router } from '@angular/router'; | import { Router } from '@angular/router'; | ||||
import { ActivatedRoute } from '@angular/router'; | |||||
@Component({ | @Component({ | ||||
selector: 'app-widgets-holder', | selector: 'app-widgets-holder', | ||||
@@ -18,10 +19,22 @@ export class WidgetsHolderComponent implements OnInit { | |||||
profile_type: string; | profile_type: string; | ||||
constructor( | constructor( | ||||
private router: Router | |||||
private router: Router, | |||||
private activatedRoute: ActivatedRoute | |||||
) { } | ) { } | ||||
ngOnInit() { | ngOnInit() { | ||||
this.activatedRoute.params.subscribe((params) => { | |||||
if (params.params) { | |||||
this.selected_nav = { | |||||
name: params.page, | |||||
params: params.params | |||||
}; | |||||
} else { | |||||
this.selected_nav.name = params.page; | |||||
} | |||||
}); | |||||
this.profile_type = localStorage.current_login_type; | this.profile_type = localStorage.current_login_type; | ||||
if (this.profile_type === 'VENDOR') { | if (this.profile_type === 'VENDOR') { | ||||
@@ -34,19 +47,6 @@ export class WidgetsHolderComponent implements OnInit { | |||||
} | } | ||||
getNavPage(page: string) { | |||||
this.selected_nav.name = page; | |||||
} | |||||
getWidgetsEvents(event: any) { | |||||
if (event.nav === 'orders') { | |||||
this.selected_nav.name = 'orders' | |||||
this.selected_nav.params = { | |||||
filterType: event.type | |||||
}; | |||||
} | |||||
} | |||||
logout() { | logout() { | ||||
localStorage.clear(); | localStorage.clear(); | ||||
this.router.navigate(['/']); | this.router.navigate(['/']); | ||||