@@ -1,6 +1,7 @@ | |||||
import { NgModule } from '@angular/core'; | import { NgModule } from '@angular/core'; | ||||
import { Routes, RouterModule } from '@angular/router'; | import { Routes, RouterModule } from '@angular/router'; | ||||
import { LoginComponent } from './login/login.component'; | import { LoginComponent } from './login/login.component'; | ||||
import { OutletsComponent } from './outlets/outlets.component'; | |||||
import { WidgetsHolderComponent } from './widgets-holder/widgets-holder.component'; | import { WidgetsHolderComponent } from './widgets-holder/widgets-holder.component'; | ||||
const routes: Routes = [{ | const routes: Routes = [{ | ||||
@@ -20,7 +21,10 @@ const routes: Routes = [{ | |||||
}, { | }, { | ||||
path: 'shop-details/:page/:params', | path: 'shop-details/:page/:params', | ||||
component: WidgetsHolderComponent | component: WidgetsHolderComponent | ||||
}, | |||||
},{ | |||||
path: 'outlets', | |||||
component:OutletsComponent | |||||
} | |||||
]; | ]; | ||||
@NgModule({ | @NgModule({ | ||||
@@ -28,6 +28,7 @@ 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'; | import { FaqService } from './services/faq.service'; | ||||
import { OutletsComponent } from './outlets/outlets.component'; | |||||
@NgModule({ | @NgModule({ | ||||
declarations: [ | declarations: [ | ||||
@@ -42,7 +43,8 @@ import { FaqService } from './services/faq.service'; | |||||
FaqComponent, | FaqComponent, | ||||
SupportComponent, | SupportComponent, | ||||
SettingsComponent, | SettingsComponent, | ||||
MoreComponent | |||||
MoreComponent, | |||||
OutletsComponent | |||||
], | ], | ||||
imports: [ | imports: [ | ||||
BrowserModule, | BrowserModule, | ||||
@@ -34,7 +34,7 @@ export class DashboardComponent implements OnInit { | |||||
calculateOrders() { | calculateOrders() { | ||||
this.profile_type = localStorage.current_login_type; | 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.profile_info = JSON.parse(localStorage.vendor_info); | ||||
this.orderService.getOrders().then((data) => { | this.orderService.getOrders().then((data) => { | ||||
@@ -3,32 +3,33 @@ import { Router } from '@angular/router'; | |||||
import { AuthService } from '../services/auth.service'; | import { AuthService } from '../services/auth.service'; | ||||
@Component({ | @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 { | export class LoginComponent implements OnInit { | ||||
credentials = { | credentials = { | ||||
username: 'suresh', | |||||
username: 'ramsesrh', | |||||
password: '123456789', | password: '123456789', | ||||
login_type: "OUTLET" | |||||
login_type: "ROLE_VENDOR" | |||||
}; | }; | ||||
// ramsesrh | |||||
// ramsesrh suresh | |||||
login_types = ['VENDOR', 'OUTLET']; | |||||
login_types = ['ROLE_VENDOR', 'OUTLET']; | |||||
errorMessage: string = ''; | errorMessage: string = ''; | ||||
constructor( | |||||
public router: Router, | |||||
constructor( | |||||
public router: Router, | |||||
private authService: AuthService | private authService: AuthService | ||||
) { } | |||||
) { } | |||||
ngOnInit() { | |||||
} | |||||
ngOnInit() { | |||||
} | |||||
requestAuthentication() { | |||||
requestAuthentication() { | |||||
this.authService.authenticateUser(this.credentials).then((data: any) => { | this.authService.authenticateUser(this.credentials).then((data: any) => { | ||||
console.log(data); | console.log(data); | ||||
@@ -37,19 +38,27 @@ export class LoginComponent implements OnInit { | |||||
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']); | ||||
if (this.credentials.login_type === 'VENDOR') { | |||||
if (this.credentials.login_type === 'ROLE_VENDOR') { | |||||
localStorage.vendor_info = JSON.stringify(data['Info Info']); | localStorage.vendor_info = JSON.stringify(data['Info Info']); | ||||
} else { | } else { | ||||
localStorage.outlet_info = JSON.stringify(data['Outlet Info']); | 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) => { | }, (err: any) => { | ||||
this.errorMessage = 'Please check your credentials'; | this.errorMessage = 'Please check your credentials'; | ||||
setTimeout(() => { | setTimeout(() => { | ||||
this.errorMessage = ''; | this.errorMessage = ''; | ||||
}, 3000); | }, 3000); | ||||
}); | }); | ||||
} | |||||
} | |||||
} | } |
@@ -46,7 +46,7 @@ export class MenuItemsComponent implements OnInit { | |||||
ngOnInit() { | ngOnInit() { | ||||
this.profile_type = localStorage.current_login_type; | 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.profile_info = JSON.parse(localStorage.vendor_info); | ||||
} else if (this.profile_type === 'OUTLET') { | } else if (this.profile_type === 'OUTLET') { | ||||
this.profile_info = JSON.parse(localStorage.outlet_info); | 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.itemService.updateMenuItem(menuItem, this.profile_info.outlet_id).then((data) => { | ||||
this.profile_info.menuitems = JSON.parse(JSON.stringify(this.menuItems)); | 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); | localStorage.vendor_info = JSON.stringify(this.profile_info); | ||||
} else if (this.profile_type === 'OUTLET') { | } else if (this.profile_type === 'OUTLET') { | ||||
localStorage.outlet_info = JSON.stringify(this.profile_info); | localStorage.outlet_info = JSON.stringify(this.profile_info); | ||||
@@ -86,7 +86,7 @@ export class MenuItemsComponent implements OnInit { | |||||
this.menuItems.push(data); | this.menuItems.push(data); | ||||
this.profile_info.menuitems = this.menuItems; | 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); | localStorage.vendor_info = JSON.stringify(this.profile_info); | ||||
} else if (this.profile_type === 'OUTLET') { | } else if (this.profile_type === 'OUTLET') { | ||||
localStorage.outlet_info = JSON.stringify(this.profile_info); | localStorage.outlet_info = JSON.stringify(this.profile_info); | ||||
@@ -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.profile_info = JSON.parse(localStorage.vendor_info); | ||||
this.orderService.getOrders().then((data) => { | this.orderService.getOrders().then((data) => { | ||||
@@ -0,0 +1,28 @@ | |||||
<section class="nav-bar"> | |||||
<div> | |||||
<img src="assets/logo.svg" alt="Logo"> | |||||
<header>Welcome to {{venderInfo.vendorName}}</header> | |||||
</div> | |||||
<nav> | |||||
<a> Support</a> | |||||
<button class="rect-button" (click)="logout()"> Logout </button> | |||||
</nav> | |||||
</section> | |||||
<section> | |||||
<li *ngFor='let outlet of outlets' (click)="outletSwitch(outlet);"> | |||||
<figure> | |||||
<img src="https://www.w3schools.com/html/pic_trulli.jpg" alt=""> | |||||
</figure> | |||||
<div class="upfold"> | |||||
<h4>{{outlet.outlet_name}} ({{outlet.outlet_id}})</h4> | |||||
<div> | |||||
<span>Type: {{outlet.outlet_type}}</span> | |||||
<span>Rating:{{outlet.rating}}/5</span> | |||||
</div> | |||||
<p>{{outlet.description}}</p> | |||||
</div> | |||||
</li> | |||||
</section> |
@@ -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; | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -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<OutletsComponent>; | |||||
beforeEach(async(() => { | |||||
TestBed.configureTestingModule({ | |||||
declarations: [ OutletsComponent ] | |||||
}) | |||||
.compileComponents(); | |||||
})); | |||||
beforeEach(() => { | |||||
fixture = TestBed.createComponent(OutletsComponent); | |||||
component = fixture.componentInstance; | |||||
fixture.detectChanges(); | |||||
}); | |||||
it('should create', () => { | |||||
expect(component).toBeTruthy(); | |||||
}); | |||||
}); |
@@ -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<string> = []; | |||||
outlets: Array<string> = []; | |||||
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(['/']); | |||||
} | |||||
} |
@@ -69,7 +69,7 @@ export class SchedulesComponent implements OnInit { | |||||
this.profile_type = localStorage.current_login_type; | 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.profile_info = JSON.parse(localStorage.vendor_info); | ||||
} else if (this.profile_type === 'OUTLET') { | } else if (this.profile_type === 'OUTLET') { | ||||
this.profile_info = JSON.parse(localStorage.outlet_info); | this.profile_info = JSON.parse(localStorage.outlet_info); | ||||
@@ -12,7 +12,7 @@ | |||||
<div class="container"> | <div class="container"> | ||||
<section class="side-navigation"> | <section class="side-navigation"> | ||||
<section class="user-info" *ngIf="profile_type === 'VENDOR'"> | |||||
<section class="user-info" *ngIf="profile_type === 'ROLE_VENDOR'"> | |||||
<img> | <img> | ||||
<div class="name"> {{ profile_info.vendorName }} </div> | <div class="name"> {{ profile_info.vendorName }} </div> | ||||
<div class="other-info"> Vendor ID: {{ profile_info.vendor_Id }} </div> | <div class="other-info"> Vendor ID: {{ profile_info.vendor_Id }} </div> | ||||
@@ -37,7 +37,7 @@ export class WidgetsHolderComponent implements OnInit { | |||||
this.profile_type = localStorage.current_login_type; | 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.profile_info = JSON.parse(localStorage.vendor_info); | ||||
} else if (this.profile_type === 'OUTLET') { | } else if (this.profile_type === 'OUTLET') { | ||||
this.profile_info = JSON.parse(localStorage.outlet_info); | this.profile_info = JSON.parse(localStorage.outlet_info); | ||||
@@ -0,0 +1 @@ | |||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#FFFFFF"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7.07 18.28c.43-.9 3.05-1.78 4.93-1.78s4.51.88 4.93 1.78C15.57 19.36 13.86 20 12 20s-3.57-.64-4.93-1.72zm11.29-1.45c-1.43-1.74-4.9-2.33-6.36-2.33s-4.93.59-6.36 2.33C4.62 15.49 4 13.82 4 12c0-4.41 3.59-8 8-8s8 3.59 8 8c0 1.82-.62 3.49-1.64 4.83zM12 6c-1.94 0-3.5 1.56-3.5 3.5S10.06 13 12 13s3.5-1.56 3.5-3.5S13.94 6 12 6zm0 5c-.83 0-1.5-.67-1.5-1.5S11.17 8 12 8s1.5.67 1.5 1.5S12.83 11 12 11z"/></svg> |
@@ -0,0 +1 @@ | |||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#808080"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12 7.13l.97 2.29.47 1.11 1.2.1 2.47.21-1.88 1.63-.91.79.27 1.18.56 2.41-2.12-1.28-1.03-.64-1.03.62-2.12 1.28.56-2.41.27-1.18-.91-.79-1.88-1.63 2.47-.21 1.2-.1.47-1.11.97-2.27M12 2L9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2z"/></svg> |