diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 31270ee..5c83d12 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { LoginComponent } from './login/login.component'; +import { OutletsComponent } from './outlets/outlets.component'; import { WidgetsHolderComponent } from './widgets-holder/widgets-holder.component'; const routes: Routes = [{ @@ -20,7 +21,10 @@ const routes: Routes = [{ }, { path: 'shop-details/:page/:params', component: WidgetsHolderComponent - }, + },{ + path: 'outlets', + component:OutletsComponent + } ]; @NgModule({ diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 5662f5e..ed18605 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -28,6 +28,7 @@ import { AuthService } from './services/auth.service'; import { OrderService } from './services/order.service'; import { ItemService } from './services/item.service'; import { FaqService } from './services/faq.service'; +import { OutletsComponent } from './outlets/outlets.component'; @NgModule({ declarations: [ @@ -42,7 +43,8 @@ import { FaqService } from './services/faq.service'; FaqComponent, SupportComponent, SettingsComponent, - MoreComponent + MoreComponent, + OutletsComponent ], imports: [ BrowserModule, diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index bbb6f82..9b0b3b0 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -34,7 +34,7 @@ export class DashboardComponent implements OnInit { calculateOrders() { this.profile_type = localStorage.current_login_type; - if (this.profile_type === 'VENDOR') { + if (this.profile_type === 'ROLE_VENDOR') { this.profile_info = JSON.parse(localStorage.vendor_info); this.orderService.getOrders().then((data) => { diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index 2e8f727..c0a71ea 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -3,32 +3,33 @@ import { Router } from '@angular/router'; import { AuthService } from '../services/auth.service'; @Component({ - selector: 'app-login', - templateUrl: './login.component.html', - styleUrls: ['./login.component.scss'] + selector: 'app-login', + templateUrl: './login.component.html', + styleUrls: ['./login.component.scss'] }) export class LoginComponent implements OnInit { credentials = { - username: 'suresh', + username: 'ramsesrh', password: '123456789', - login_type: "OUTLET" + login_type: "ROLE_VENDOR" }; - // ramsesrh + // ramsesrh suresh - login_types = ['VENDOR', 'OUTLET']; + + login_types = ['ROLE_VENDOR', 'OUTLET']; errorMessage: string = ''; - constructor( - public router: Router, + constructor( + public router: Router, private authService: AuthService - ) { } + ) { } - ngOnInit() { - } + ngOnInit() { + } - requestAuthentication() { + requestAuthentication() { this.authService.authenticateUser(this.credentials).then((data: any) => { console.log(data); @@ -37,19 +38,27 @@ export class LoginComponent implements OnInit { localStorage.token = data.access_Token; localStorage.user_info = JSON.stringify(data['User Info']); - if (this.credentials.login_type === 'VENDOR') { + if (this.credentials.login_type === 'ROLE_VENDOR') { localStorage.vendor_info = JSON.stringify(data['Info Info']); } else { localStorage.outlet_info = JSON.stringify(data['Outlet Info']); + this.router.navigate(['shop-details']); } - this.router.navigate(['shop-details']); + if (this.credentials.login_type === 'ROLE_VENDOR') { + console.log("Logging as Vendor") + this.router.navigate(['outlets']); + }else{ + console.log("Logging as Outlet") + this.router.navigate(['shop-details']); + } + }, (err: any) => { this.errorMessage = 'Please check your credentials'; setTimeout(() => { this.errorMessage = ''; }, 3000); }); - } + } } diff --git a/src/app/menu-items/menu-items.component.ts b/src/app/menu-items/menu-items.component.ts index e360b8b..101be9d 100644 --- a/src/app/menu-items/menu-items.component.ts +++ b/src/app/menu-items/menu-items.component.ts @@ -46,7 +46,7 @@ export class MenuItemsComponent implements OnInit { ngOnInit() { this.profile_type = localStorage.current_login_type; - if (this.profile_type === 'VENDOR') { + if (this.profile_type === 'ROLE_VENDOR') { this.profile_info = JSON.parse(localStorage.vendor_info); } else if (this.profile_type === 'OUTLET') { this.profile_info = JSON.parse(localStorage.outlet_info); @@ -61,7 +61,7 @@ export class MenuItemsComponent implements OnInit { this.itemService.updateMenuItem(menuItem, this.profile_info.outlet_id).then((data) => { this.profile_info.menuitems = JSON.parse(JSON.stringify(this.menuItems)); - if (this.profile_type === 'VENDOR') { + if (this.profile_type === 'ROLE_VENDOR') { localStorage.vendor_info = JSON.stringify(this.profile_info); } else if (this.profile_type === 'OUTLET') { localStorage.outlet_info = JSON.stringify(this.profile_info); @@ -86,7 +86,7 @@ export class MenuItemsComponent implements OnInit { this.menuItems.push(data); this.profile_info.menuitems = this.menuItems; - if (this.profile_type === 'VENDOR') { + if (this.profile_type === 'ROLE_VENDOR') { localStorage.vendor_info = JSON.stringify(this.profile_info); } else if (this.profile_type === 'OUTLET') { localStorage.outlet_info = JSON.stringify(this.profile_info); diff --git a/src/app/orders/orders.component.ts b/src/app/orders/orders.component.ts index 3732fb5..9d88848 100644 --- a/src/app/orders/orders.component.ts +++ b/src/app/orders/orders.component.ts @@ -94,7 +94,7 @@ export class OrdersComponent implements OnInit { }]; }); - if (this.profile_type === 'VENDOR') { + if (this.profile_type === 'ROLE_VENDOR') { this.profile_info = JSON.parse(localStorage.vendor_info); this.orderService.getOrders().then((data) => { diff --git a/src/app/outlets/outlets.component.html b/src/app/outlets/outlets.component.html new file mode 100644 index 0000000..5942a95 --- /dev/null +++ b/src/app/outlets/outlets.component.html @@ -0,0 +1,28 @@ + + +
+
  • + +
    + +
    + +
    +

    {{outlet.outlet_name}} ({{outlet.outlet_id}})

    +
    + Type: {{outlet.outlet_type}} + Rating:{{outlet.rating}}/5 +
    +

    {{outlet.description}}

    +
    +
  • +
    \ No newline at end of file diff --git a/src/app/outlets/outlets.component.scss b/src/app/outlets/outlets.component.scss new file mode 100644 index 0000000..771e1a5 --- /dev/null +++ b/src/app/outlets/outlets.component.scss @@ -0,0 +1,143 @@ +.nav-bar { + display: flex; + width: 100%; + height: 70px; + align-items: center; + justify-content: space-between; + padding: 0 4%; + box-shadow: 0px 0px 8px var(--grey); + position: relative; + z-index: 1; + background-color: white; + + header{ + display: inline-flex; + vertical-align: middle; + font-weight: 600; + color: var(--dark-grey); + padding-left: 15px; + } + + @media screen and (max-width: 1023px) { + display: none; + } + + img { + width: 70px; + vertical-align: middle; + } + + nav { + height: 70px; + display: flex; + align-items: center; + + a, button { + margin: 0 25px; + } + + a { + color: var(--grey); + font-size: 16px; + height: 70px; + display: flex; + align-items: center; + justify-content: center; + position: relative; + + &.active { + &::before { + content: ''; + position: absolute; + left: 0; + bottom: 0; + height: 3px; + width: 100%; + background-color: var(--brand-blue); + } + } + } + + button { + background-color: transparent; + border: 2px solid var(--brand-blue); + color: var(--brand-blue); + width: 100px; + height: 40px; + margin-right: 0; + } + } +} + +section{ + list-style: none; + display: grid; + grid-template-columns: repeat(4, 1fr); + + li{ + position: relative; + margin: 50px; + width: 400px; + filter: brightness(120%); + cursor: pointer; + + + &:before{ + content: ''; + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + border-radius: 10px; + box-shadow: 0 0 5px 0px var(--grey); + border: 2px solid var(--grey); + filter: brightness(130%); + } + + figure{ + img{ + display: block; + border-radius: 10px; + width: calc(100% - 10px); + height: 200px; + margin: 0 auto; + padding-top: 5px; + } + } + + + .upfold{ + padding: 0 20px; + position: relative; + + div{ + display: flex; + justify-content: space-between; + } + } + + h4{ + font-size: 18px; + color: var(--dark-grey); + margin: 10px 0; + } + p{ + margin: 20px 0 0; + text-align: justify; + color: var(--dark-grey); + height: 70px; + } + + + span{ + color: var(--dark-grey); + font-weight: 500; + + img{ + vertical-align: middle; + fill: black; + } + } + } +} \ No newline at end of file diff --git a/src/app/outlets/outlets.component.spec.ts b/src/app/outlets/outlets.component.spec.ts new file mode 100644 index 0000000..de5ad20 --- /dev/null +++ b/src/app/outlets/outlets.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OutletsComponent } from './outlets.component'; + +describe('OutletsComponent', () => { + let component: OutletsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ OutletsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OutletsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/outlets/outlets.component.ts b/src/app/outlets/outlets.component.ts new file mode 100644 index 0000000..8057d1c --- /dev/null +++ b/src/app/outlets/outlets.component.ts @@ -0,0 +1,43 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + +@Component({ + selector: 'app-outlets', + templateUrl: './outlets.component.html', + styleUrls: ['./outlets.component.scss'] +}) +export class OutletsComponent implements OnInit { + + venderInfo: Array = []; + outlets: Array = []; + outletInfo: any; + + constructor( + private router: Router, + ) { } + + ngOnInit() { + this.getVendorInfo(); + this.getOutletInfo(); + } + + getVendorInfo() { + this.venderInfo = JSON.parse(localStorage.vendor_info); + } + + getOutletInfo() { + let outlets: any = this.venderInfo + this.outlets = outlets.outlet + } + + outletSwitch(selectedOutlet: any) { + this.router.navigate(['shop-details']); + console.log(selectedOutlet) + } + + logout() { + localStorage.clear(); + this.router.navigate(['/']); + } + +} diff --git a/src/app/schedules/schedules.component.ts b/src/app/schedules/schedules.component.ts index 04c26d4..7090d15 100644 --- a/src/app/schedules/schedules.component.ts +++ b/src/app/schedules/schedules.component.ts @@ -69,7 +69,7 @@ export class SchedulesComponent implements OnInit { this.profile_type = localStorage.current_login_type; - if (this.profile_type === 'VENDOR') { + if (this.profile_type === 'ROLE_VENDOR') { this.profile_info = JSON.parse(localStorage.vendor_info); } else if (this.profile_type === 'OUTLET') { this.profile_info = JSON.parse(localStorage.outlet_info); diff --git a/src/app/widgets-holder/widgets-holder.component.html b/src/app/widgets-holder/widgets-holder.component.html index 48b2b47..4cc1e5b 100644 --- a/src/app/widgets-holder/widgets-holder.component.html +++ b/src/app/widgets-holder/widgets-holder.component.html @@ -12,7 +12,7 @@
    -