| @@ -27,6 +27,7 @@ import { MoreComponent } from './more/more.component'; | |||||
| import { AuthService } from './services/auth.service'; | import { AuthService } from './services/auth.service'; | ||||
| import { OrderService } from './services/order.service'; | import { OrderService } from './services/order.service'; | ||||
| import { ItemService } from './services/item.service'; | import { ItemService } from './services/item.service'; | ||||
| import { FaqService } from './services/faq.service'; | |||||
| @NgModule({ | @NgModule({ | ||||
| declarations: [ | declarations: [ | ||||
| @@ -53,7 +54,8 @@ import { ItemService } from './services/item.service'; | |||||
| providers: [ | providers: [ | ||||
| AuthService, | AuthService, | ||||
| OrderService, | OrderService, | ||||
| ItemService | |||||
| ItemService, | |||||
| FaqService | |||||
| ], | ], | ||||
| bootstrap: [AppComponent] | bootstrap: [AppComponent] | ||||
| }) | }) | ||||
| @@ -1,4 +1,5 @@ | |||||
| import { Component, OnInit } from '@angular/core'; | import { Component, OnInit } from '@angular/core'; | ||||
| import { FaqService } from '../services/faq.service'; | |||||
| @Component({ | @Component({ | ||||
| selector: 'app-faq', | selector: 'app-faq', | ||||
| @@ -9,10 +10,13 @@ export class FaqComponent implements OnInit { | |||||
| showDetails: boolean = true; | showDetails: boolean = true; | ||||
| selectedCard: number = null; | selectedCard: number = null; | ||||
| constructor() { } | |||||
| constructor(private faqService: FaqService) { } | |||||
| ngOnInit() { | ngOnInit() { | ||||
| window.innerWidth <= 1023? this.selectedCard = null: this.selectedCard = 1; | window.innerWidth <= 1023? this.selectedCard = null: this.selectedCard = 1; | ||||
| this.faqService.getFaqContent().then(data => console.log(data)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -30,6 +30,9 @@ export class LoginComponent implements OnInit { | |||||
| requestAuthentication() { | requestAuthentication() { | ||||
| this.authService.authenticateUser(this.credentials).then((data: any) => { | this.authService.authenticateUser(this.credentials).then((data: any) => { | ||||
| console.log(data); | |||||
| localStorage.current_login_type = this.credentials.login_type; | localStorage.current_login_type = this.credentials.login_type; | ||||
| localStorage.token = data.access_Token; | localStorage.token = data.access_Token; | ||||
| localStorage.user_info = JSON.stringify(data['User Info']); | localStorage.user_info = JSON.stringify(data['User Info']); | ||||
| @@ -13,7 +13,7 @@ export class MenuItemsComponent implements OnInit { | |||||
| searchTerm: string = ''; | searchTerm: string = ''; | ||||
| menuItems: any = []; | menuItems: any = []; | ||||
| showAddItemModal: boolean = true; | |||||
| showAddItemModal: boolean = false; | |||||
| newItem: { | newItem: { | ||||
| image_url: string, | image_url: string, | ||||
| @@ -100,7 +100,7 @@ export class MenuItemsComponent implements OnInit { | |||||
| } | } | ||||
| addNewItem() { | addNewItem() { | ||||
| this.itemService.addMenuItem(this.newItem).then((data) => { | |||||
| this.itemService.addMenuItem(this.newItem, this.profile_info.outlet_id).then((data) => { | |||||
| console.log(data); | console.log(data); | ||||
| }, (err) => { | }, (err) => { | ||||
| alert("Failed to create item"); | alert("Failed to create item"); | ||||
| @@ -0,0 +1,12 @@ | |||||
| import { TestBed } from '@angular/core/testing'; | |||||
| import { FaqService } from './faq.service'; | |||||
| describe('FaqService', () => { | |||||
| beforeEach(() => TestBed.configureTestingModule({})); | |||||
| it('should be created', () => { | |||||
| const service: FaqService = TestBed.get(FaqService); | |||||
| expect(service).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,25 @@ | |||||
| import { Injectable } from '@angular/core'; | |||||
| import { URL } from '../data/url'; | |||||
| import { HttpClient, HttpHeaders } from '@angular/common/http'; | |||||
| @Injectable({ | |||||
| providedIn: 'root' | |||||
| }) | |||||
| export class FaqService { | |||||
| constructor( | |||||
| private http: HttpClient | |||||
| ) { } | |||||
| getFaqContent() { | |||||
| const httpOptions = { | |||||
| headers: new HttpHeaders({ | |||||
| 'Access-Control-Allow-Origin': '*', | |||||
| 'Content-Type': 'application/json', | |||||
| 'Authorization': 'Bearer ' + localStorage.token | |||||
| }) | |||||
| }; | |||||
| return this.http.get(URL + '/api/maioraservice/faq/getall/', httpOptions).toPromise(); | |||||
| } | |||||
| } | |||||
| @@ -25,7 +25,14 @@ export class ItemService { | |||||
| return this.http.put(URL + '/api/maioraservice/menuitems/v1/update/', menuItem, httpOptions).toPromise(); | return this.http.put(URL + '/api/maioraservice/menuitems/v1/update/', menuItem, httpOptions).toPromise(); | ||||
| } | } | ||||
| addMenuItem(menuItem: any) { | |||||
| addMenuItem(menuItem: any, outlet_id: number) { | |||||
| menuItem.outlet = { | |||||
| outlet_id: outlet_id | |||||
| }; | |||||
| console.log(menuItem); | |||||
| const httpOptions = { | const httpOptions = { | ||||
| headers: new HttpHeaders({ | headers: new HttpHeaders({ | ||||
| 'Access-Control-Allow-Origin': '*', | 'Access-Control-Allow-Origin': '*', | ||||
| @@ -41,15 +41,15 @@ | |||||
| <li [ngClass]="{'active' : selected_nav.name === 'schedule'}" [routerLink]="['/shop-details/schedule']"> | <li [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 [ngClass]="{'active' : selected_nav.name === 'profile'}" [routerLink]="['/shop-details/profile']"> | |||||
| <!-- <li [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 [ngClass]="{'active' : selected_nav.name === 'settings'}" [routerLink]="['/shop-details/settings']"> | |||||
| </li> --> | |||||
| <!-- <li [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'}" [routerLink]="['/shop-details/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> | ||||