소스 검색

Admin Login intergration

master
prahalad 3 년 전
부모
커밋
1c665ed95b
13개의 변경된 파일777개의 추가작업 그리고 302개의 파일을 삭제
  1. +103
    -1
      src/app/admin/malls/malls.component.html
  2. +248
    -56
      src/app/admin/malls/malls.component.ts
  3. +258
    -0
      src/app/admin/malls/malls.ts
  4. +4
    -3
      src/app/admin/vendors/vendors.component.html
  5. +8
    -156
      src/app/admin/vendors/vendors.component.scss
  6. +14
    -3
      src/app/admin/vendors/vendors.component.ts
  7. +29
    -11
      src/app/dashboard/dashboard.component.ts
  8. +10
    -4
      src/app/login/login.component.html
  9. +5
    -3
      src/app/login/login.component.ts
  10. +33
    -27
      src/app/menu-items/menu-items.component.ts
  11. +49
    -25
      src/app/orders/orders.component.ts
  12. +4
    -2
      src/app/schedules/schedules.component.ts
  13. +12
    -11
      src/app/widgets-holder/widgets-holder.component.ts

+ 103
- 1
src/app/admin/malls/malls.component.html 파일 보기

@@ -125,7 +125,109 @@
newMall.outlet[0].outlet_name &&
newMall.outlet[0].image_url) === 0)}' (click)="addMall()" [disabled]='(newMall.mall_name.length && newMall.mall_address.length && newMall.image_url.length &&
newMall.advertisement[0].createdBy.length && newMall.advertisement[0].image.length && newMall.advertisement[0].type.length &&
newMall.outlet[0].outlet_name.length && newMall.outlet[0].image_url.length) === 0'>Add</button>
newMall.outlet[0].outlet_name.length && newMall.outlet[0].image_url.length) === 0'>Add Mall</button>
</div>
</div>
</div>

<div class="popUp" *ngIf='updateMallModal === true'>
<div class="popup-box">
<ul class="input-list">
<h4>Update Mall Details:</h4>

<div class="mallDetails">
<li>
<label>Name:</label>
<input type="text" [(ngModel)]="newMall.mall_name">
</li>
<li>
<label>Description:</label>
<input type="text" [(ngModel)]='newMall.description'>
</li>
<li>
<label>Image:</label>
<input type="text" [(ngModel)]='newMall.image_url'>
</li>
<li>
<label>Address:</label>
<input type="text" [(ngModel)]='newMall.mall_address'>
</li>
<li>
<label>Mall Distance:</label>
<input type="number" [(ngModel)]='newMall.mall_distance'>
</li>
<li>
<label>Rating:</label>
<input type="number" [(ngModel)]='newMall.rating'>
</li>
<li>
<label>Offers Count:</label>
<input type="number" [(ngModel)]='newMall.offers_count'>
</li>
</div>

<h4>Update Advertisement:</h4>
<div class="addDetails">
<li>
<label>Created By</label>
<input type="text" [(ngModel)]="newMall.advertisement[0].createdBy">
</li>
<li>
<label>Image</label>
<input type="text" [(ngModel)]="newMall.advertisement[0].image">
</li>
<li>
<label>Type</label>
<input type="text" [(ngModel)]="newMall.advertisement[0].type">
</li>
<li>
<label>Updated By</label>
<input type="text" [(ngModel)]="newMall.advertisement[0].updatedBy">
</li>
</div>

<h4>Update Outlet Details:</h4>
<div class="outletdistance">
<li>
<label>Outlet Name</label>
<input type="text" [(ngModel)]="newMall.outlet[0].outlet_name">
</li>
<li>
<label>Description</label>
<input type="text" [(ngModel)]="newMall.outlet[0].description">
</li>
<li>
<label>Outlet Timings</label>
<input type="text" [(ngModel)]="newMall.outlet[0].outlet_timing">
</li>
<li>
<label>Image</label>
<input type="text" [(ngModel)]="newMall.outlet[0].image_url">
</li>
<li>
<label>Outlet GST</label>
<input type="number" [(ngModel)]="newMall.outlet[0].outlet_Gst">
</li>
<li>
<label>Outlet Type</label>
<input type="text" [(ngModel)]="newMall.outlet[0].outlet_type">
</li>
<li>
<label>Rating</label>
<input type="number" [(ngModel)]="newMall.outlet[0].rating">
</li>
</div>
</ul>

<div class="action-buttons">
<button class="rect-button cancel" (click)="updateMallModal = false">Cancel</button>
<button class="rect-button" [ngClass]='{disable: ((newMall.mall_name.length && newMall.mall_address.length &&
newMall.image_url.length &&
newMall.advertisement[0].createdBy &&
newMall.advertisement[0].image.length &&
newMall.advertisement[0].type &&
newMall.outlet[0].outlet_name &&
newMall.outlet[0].image_url) === 0)}' (click)="addMall()">Update</button>
</div>
</div>
</div>

+ 248
- 56
src/app/admin/malls/malls.component.ts 파일 보기

@@ -1,5 +1,6 @@
import { Component, ElementRef, OnInit, ViewChild, Input } from '@angular/core';
import { MallsService } from '../../services/malls.service'
import { IUpdateMall, INewMall } from './malls';


@Component({
@@ -17,79 +18,268 @@ export class MallsComponent implements OnInit {
tempMalls: any = [];

showModal: boolean = false;
updateMallModal: boolean = false;

newMall: {
mall_name: string,
mall_address: string,
description: string,
image_url: string,
newMall: INewMall = {
mall_name: "",
description: "",
mall_address: "",
mall_distance: 0,
offers_count: 0,
image_url: "",
is_bookmarked: true,
rating: 0,
soft_delete: true
soft_delete: true,
offers_count: 0,

advertisement: [
{
adv_type: true,
createdBy: string,
createdOn: string,
image: string,
createdBy: "",
createdOn: "2021-10-26T12:19:53.071Z",
image: "",
soft_delete: true,
type: string,
updatedBy: string,
updatedOn: string,
type: "",
updatedBy: "",
updatedOn: "2021-10-26T12:19:53.071Z"
}
],
outlet: [
{
description: string,
image_url: string,
description: "",
image_url: "",
is_bookmarked: true,
outlet_Gst: number,
outlet_id: number,
outlet_name: string,
outlet_timing: string,
outlet_type: string,
rating: number
outlet_Gst: 0,
outlet_id: 0,
outlet_name: "",
outlet_timing: "2021-10-26T12:19:53.071Z",
outlet_type: "",
rating: 0
}
],
} = {
mall_name: "",
description: "",
mall_address: "",
mall_distance: 0,
image_url: "",
}

updateMall: IUpdateMall = {
advertisement: [
{
adv_id: 0,
adv_type: true,
createdBy: '',
createdOn: "2021-11-26T15:00:17.506Z",
image: '',
soft_delete: true,
type: '',
updatedBy: '',
updatedOn: "2021-11-26T15:00:17.506Z"
}
],
description: '',
image_url: '',
is_bookmarked: true,
rating: 0,
soft_delete: true,
mall_address: '',
mall_id: 0,
mall_distance: 0,
mall_name: '',
offers_count: 0,
outlet: [
{
description: '',
events: [
{
active: true,
createdBy: '',
createdOn: "2021-11-26T15:00:17.506Z",
date_of_event: "2021-11-26T15:00:17.506Z",
event_id: '',
event_title: '',
event_type: '',
is_holiday: true,
soft_delete: true,
updatedBy: '',
updatedOn: "2021-11-26T15:00:17.506Z"
}
],
image_url: '',
is_bookmarked: true,
menuitems: [
{
image_url: '',
is_available: true,
is_vegetarian: true,
item_categories: [
{
categoryId: 0,
categoryName: '',
categoryType: ''
}
],
item_discount: 0,
item_price: 0,
menu_item_name: '',
menuitem_id: 0,
outlet: {
description: '',
events: [
{
active: true,
createdBy: '',
createdOn: "2021-11-26T15:00:17.506Z",
date_of_event: "2021-11-26T15:00:17.506Z",
event_id: '',
event_title: '',
event_type: '',
is_holiday: true,
soft_delete: true,
updatedBy: '',
updatedOn: "2021-11-26T15:00:17.506Z"
}
],
image_url: '',
is_bookmarked: true,
item_categories: [
{
categoryId: 0,
categoryName: '',
categoryType: ''
}
],
offers: [
{
dateActiveFrom: "2021-11-26T15:00:17.506Z",
dateActiveTo: "2021-11-26T15:00:17.506Z",
offerSummary: '',
offer_precentage: 0,
offer_price: 0,
offersCode: '',
offersImage: '',
offersMaxcount: '',
offersTitle: '',
offersType: '',
offers_id: 0,
outlet: {
description: '',
events: [
{
active: true,
createdBy: '',
createdOn: "2021-11-26T15:00:17.506Z",
date_of_event: "2021-11-26T15:00:17.506Z",
event_id: '',
event_title: '',
event_type: '',
is_holiday: true,
soft_delete: true,
updatedBy: '',
updatedOn: "2021-11-26T15:00:17.506Z"
}
],
image_url: '',
is_bookmarked: true,
is_online: true,
item_categories: [
{
categoryId: 0,
categoryName: '',
categoryType: ''
}
],
menuitems: [
null
],
offers: [
null
],
outlet_Gst: 0,
outlet_id: 0,
outlet_name: '',
outlet_timing: "2021-11-26T15:00:17.506Z",
outlet_type: '',
rating: 0,
schedules: [
{
close_timing: "2021-11-26T15:00:17.506Z",
holidays: '',
open_timing: "2021-11-26T15:00:17.506Z",
outlet: {
outlet_id: 0
},
schedule_id: 0
}
]
},
timeActiveTo: {
signerCertPath: {
certificates: [
{
encoded: '',
publicKey: {
algorithm: '',
encoded: '',
format: ''
},
type: ''
}
],
encoded: '',
encodings: {},
type: ''
},
timestamp: "2021-11-26T15:00:17.506Z"
},
timeActveFrom: {
signerCertPath: {
certificates: [
{
encoded: '',
publicKey: {
algorithm: '',
encoded: '',
format: ''
},
type: ''
}
],
encoded: '',
encodings: {},
type: ''
},
timestamp: "2021-11-26T15:00:17.506Z"
}
}
],
outlet_Gst: 0,
outlet_id: 0,
outlet_name: '',
outlet_timing: "2021-11-26T15:00:17.506Z",
outlet_type: '',
rating: 0
},
rating: 0,
soft_delete: true,
wait_duration: {
date: 0,
day: 0,
hours: 0,
minutes: 0,
month: 0,
seconds: 0,
time: 0,
timezoneOffset: 0,
year: 0
}
}
],
outlet_Gst: 0,
outlet_id: 0,
outlet_name: '',
outlet_timing: "2021-11-26T15:00:17.506Z",
outlet_type: '',
rating: 0
}
],
rating: 0,
soft_delete: true
}

advertisement: [
{
adv_type: true,
createdBy: "",
createdOn: "2021-10-26T12:19:53.071Z",
image: "",
soft_delete: true,
type: "",
updatedBy: "",
updatedOn: "2021-10-26T12:19:53.071Z"
}
],
outlet: [
{
description: "",
image_url: "",
is_bookmarked: true,
outlet_Gst: 0,
outlet_id: 0,
outlet_name: "",
outlet_timing: "2021-10-26T12:19:53.071Z",
outlet_type: "",
rating: 0
}
],
}

currentTime: any = new Date()

@@ -137,8 +327,10 @@ export class MallsComponent implements OnInit {
console.log(this.newMall)
}

selectedMall(mall: any){
selectedMall(mall: any) {
this.updateMallModal = !this.updateMallModal
console.log(mall)

}
}


+ 258
- 0
src/app/admin/malls/malls.ts 파일 보기

@@ -0,0 +1,258 @@
export type INewMall = {
mall_name: string,
mall_address: string,
description: string,
image_url: string,
mall_distance: 0,
offers_count: 0,
is_bookmarked: true,
rating: 0,
soft_delete: true
advertisement: [
{
adv_type: true,
createdBy: string,
createdOn: string,
image: string,
soft_delete: true,
type: string,
updatedBy: string,
updatedOn: string,
}
],
outlet: [
{
description: string,
image_url: string,
is_bookmarked: true,
outlet_Gst: number,
outlet_id: number,
outlet_name: string,
outlet_timing: string,
outlet_type: string,
rating: number
}
],
}

export type IUpdateMall = {
advertisement: [
{
adv_id: 0,
adv_type: true,
createdBy: string,
createdOn: "2021-11-26T15:00:17.506Z",
image: string,
soft_delete: true,
type: string,
updatedBy: string,
updatedOn: "2021-11-26T15:00:17.506Z"
}
],
description: string,
image_url: string,
is_bookmarked: true,
mall_address: string,
mall_id: 0,
mall_distance: 0,
mall_name: string,
offers_count: 0,
outlet: [
{
description: string,
events: [
{
active: true,
createdBy: string,
createdOn: "2021-11-26T15:00:17.506Z",
date_of_event: "2021-11-26T15:00:17.506Z",
event_id: string,
event_title: string,
event_type: string,
is_holiday: true,
soft_delete: true,
updatedBy: string,
updatedOn: "2021-11-26T15:00:17.506Z"
}
],
image_url: string,
is_bookmarked: true,
menuitems: [
{
image_url: string,
is_available: true,
is_vegetarian: true,
item_categories: [
{
categoryId: 0,
categoryName: string,
categoryType: string
}
],
item_discount: 0,
item_price: 0,
menu_item_name: string,
menuitem_id: 0,
outlet: {
description: string,
events: [
{
active: true,
createdBy: string,
createdOn: "2021-11-26T15:00:17.506Z",
date_of_event: "2021-11-26T15:00:17.506Z",
event_id: string,
event_title: string,
event_type: string,
is_holiday: true,
soft_delete: true,
updatedBy: string,
updatedOn: "2021-11-26T15:00:17.506Z"
}
],
image_url: string,
is_bookmarked: true,
item_categories: [
{
categoryId: 0,
categoryName: string,
categoryType: string
}
],
offers: [
{
dateActiveFrom: "2021-11-26T15:00:17.506Z",
dateActiveTo: "2021-11-26T15:00:17.506Z",
offerSummary: string,
offer_precentage: 0,
offer_price: 0,
offersCode: string,
offersImage: string,
offersMaxcount: string,
offersTitle: string,
offersType: string,
offers_id: 0,
outlet: {
description: string,
events: [
{
active: true,
createdBy: string,
createdOn: "2021-11-26T15:00:17.506Z",
date_of_event: "2021-11-26T15:00:17.506Z",
event_id: string,
event_title: string,
event_type: string,
is_holiday: true,
soft_delete: true,
updatedBy: string,
updatedOn: "2021-11-26T15:00:17.506Z"
}
],
image_url: string,
is_bookmarked: true,
is_online: true,
item_categories: [
{
categoryId: 0,
categoryName: string,
categoryType: string
}
],
menuitems: [
null
],
offers: [
null
],
outlet_Gst: 0,
outlet_id: 0,
outlet_name: string,
outlet_timing: "2021-11-26T15:00:17.506Z",
outlet_type: string,
rating: 0,
schedules: [
{
close_timing: "2021-11-26T15:00:17.506Z",
holidays: string,
open_timing: "2021-11-26T15:00:17.506Z",
outlet: {
outlet_id: 0
},
schedule_id: 0
}
]
},
timeActiveTo: {
signerCertPath: {
certificates: [
{
encoded: string,
publicKey: {
algorithm: string,
encoded: string,
format: string
},
type: string
}
],
encoded: string,
encodings: {},
type: string
},
timestamp: "2021-11-26T15:00:17.506Z"
},
timeActveFrom: {
signerCertPath: {
certificates: [
{
encoded: string,
publicKey: {
algorithm: string,
encoded: string,
format: string
},
type: string
}
],
encoded: string,
encodings: {},
type: string
},
timestamp: "2021-11-26T15:00:17.506Z"
}
}
],
outlet_Gst: 0,
outlet_id: 0,
outlet_name: string,
outlet_timing: "2021-11-26T15:00:17.506Z",
outlet_type: string,
rating: 0
},
rating: 0,
soft_delete: true,
wait_duration: {
date: 0,
day: 0,
hours: 0,
minutes: 0,
month: 0,
seconds: 0,
time: 0,
timezoneOffset: 0,
year: 0
}
}
],
outlet_Gst: 0,
outlet_id: 0,
outlet_name: string,
outlet_timing: "2021-11-26T15:00:17.506Z",
outlet_type: string,
rating: 0
}
],
rating: 0,
soft_delete: true
}

+ 4
- 3
src/app/admin/vendors/vendors.component.html 파일 보기

@@ -29,6 +29,7 @@
<span>Type: {{vendor.vendorType}}</span>
<span>Ph: {{vendor.vendorOfficeNo}} Mob: {{vendor.vendorMobile}} </span>
</div>
<img src="../../../assets/visibility.svg" class="viewsvg" (click)='selectedVendor(vendor, outlet)'>
<img src="../../../assets/expand.svg" [ngClass]="{'active': showOutlets === true}" (click)="showOutlets = !showOutlets" class="viewsvg">
</div>

@@ -42,10 +43,10 @@
</div>
<div>
<span>Id: {{outlet.outlet_id}}</span>
<span>Rating: {{outlet.rating}}</span>
<span> MenuItems: {{outlet.menuitems.length}}</span>
<span>Rating: {{outlet.rating}}<img src="../../../assets/star.svg"></span>
<span> MenuItems: {{outlet.menuitems.length}}<img src="../../../assets/outlet.svg"> </span>
</div>
<img src="../../../assets/visibility.svg" class="viewsvg" (click)='selectedOutlet(outlet)'>
<img src="../../../assets/visibility.svg" class="viewsvg" (click)='selectedOutlet(vendor, outlet)'>
</li>
</div>
</li>


+ 8
- 156
src/app/admin/vendors/vendors.component.scss 파일 보기

@@ -1,3 +1,7 @@
.card{
z-index: 0;
}

.card_header {
div {
display: flex;
@@ -247,163 +251,11 @@
position: absolute;
width: 100%;
height: 100%;
background: var(--grey);
left: 0;
transform: scaleY(107%);
border-radius: 10px;
filter: brightness(170%);
transform: scaleY(105%) scaleX(97%);
border: 2px solid var(--grey);
box-shadow: 0 0 10px 1.5px var(--grey);
filter: brightness(125%);
}
}



.popUp {
position: fixed;
width: 100%;
height: 100%;
background-color: rgb(0, 0, 0, 0.5);
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
.popup-box {
width: 400px;
padding: 0 15px;
background: white;
border-radius: 10px;
height: 60vh;
overflow: auto;
border: 10px solid white;

.input-list {
list-style: none;
padding: 0;

h4{
display: block;
font-size: 18px;
color: dimgrey;
font-weight: 500;
margin-left: -5px;
position: sticky;
top: 0;
z-index: 1;
height: 30px;

&:before{
content: '';
width: 100%;
position: absolute;
height: 100%;
background-color: white;
z-index: -1;
transform: scale(105%);
}
}
}

.action-buttons{
position: relative;
display: flex;
justify-content: center;
align-items: center;
margin: 10px;
position: sticky;
bottom: 0;
z-index: 1;
height: 50px;


&:before{
content: '';
position: absolute;
width: 100%;
height: 100%;
background-color: white;
z-index: -1;
transform: scale(115%);
}
}

.mallDetails, .addDetails, .outletdistance{
position: relative;
margin-top: 20px;
margin-bottom: 30px;
&:before{
content: '';
position: absolute;
width: 100%;
height: 100%;
background-color: gainsboro;
border-radius: 7px;
transform: scale(105%);
filter: brightness(105%);
}
}

button{
margin: 0 20px;
width: 100px;
text-align: center;
&.cancel{
background-color: white;
border: 2px solid var(--brand-blue);
color: var(--brand-blue);
}

&.disable {
cursor: not-allowed;
filter: grayscale(1);
}
}

li {
text-align: left;
margin: 10px 0;
position: relative;

label {
display: block;
font-size: 14px;
color: dimgrey;
font-weight: 500;
}

img {
width: 100px;
height: 100px;
border-radius: 10px;
box-shadow: 0px 0px 5px var(--grey);
margin: 0 auto;
display: block;
}

input {
width: 100%;
display: block;
height: 40px;
border-radius: 5px;
border: 2px solid var(--grey);
margin-top: 10px;
padding: 0 10px;
font-size: 16px;

&:focus {
border-color: var(--brand-blue);
}
}

.toggle {
margin: 0;
margin-top: 10px;
cursor: pointer;
}
}
}
}

+ 14
- 3
src/app/admin/vendors/vendors.component.ts 파일 보기

@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { VendorService } from 'src/app/services/vendor.service';

@Component({
@@ -8,7 +9,10 @@ import { VendorService } from 'src/app/services/vendor.service';
})
export class VendorsComponent implements OnInit {

constructor(private vendorService: VendorService) { }
constructor(
private vendorService: VendorService,
private router: Router
) { }

vendors: any;
showOutlets: boolean = false;
@@ -26,8 +30,15 @@ export class VendorsComponent implements OnInit {
})
}

selectedOutlet(outlet: any){
console.log(outlet)
selectedOutlet(vendor: any, outlet: any) {
localStorage.vendor_info = JSON.stringify(vendor)
localStorage.outlet_info = JSON.stringify(outlet)
this.router.navigate(['/shop-details'])
}

selectedVendor(vendor:any, outlet: any){
localStorage.vendor_info = JSON.stringify(vendor)
this.router.navigate(['/outlets'])
}

}

+ 29
- 11
src/app/dashboard/dashboard.component.ts 파일 보기

@@ -4,12 +4,12 @@ import { OrderService } from '../services/order.service';
import * as moment from 'moment';

@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent implements OnInit {
filterOptions: Array<IFilterOption> = [{
filterOptions: Array<IFilterOption> = [{
name: 'Yesterday',
id: 'yesterday'
}, {
@@ -23,24 +23,42 @@ export class DashboardComponent implements OnInit {
profile_type: string;
profile_info: any;

constructor(
constructor(
private orderService: OrderService
) { }

ngOnInit() {
ngOnInit() {
this.calculateOrders();
console.log(this.profile_info)
}

calculateOrders() {
this.profile_type = localStorage.current_login_type;
if (this.profile_type === 'ROLE_VENDOR') {
this.profile_info = JSON.parse(localStorage.outlet_info);

this.orderService.getOrdersForOutlet(this.profile_info.outlet_id).then((data) => {
this.orderList = data;

for (let i = 0; i < this.orderList.length; i += 1) {
if (!this.orderList[i].orderstatus) {
this.orderList[i].orderstatus = {
orderStatus: "",
orderstatus_id: 6
}
}
}
}, () => {
alert("Error getting the orders");
});

} else if (this.profile_type === 'ROLE_ADMIN') {
this.profile_info = JSON.parse(localStorage.outlet_info);

this.orderService.getOrdersForOutlet(this.profile_info.outlet_id).then((data) => {
this.orderList = data;

for (let i = 0; i < this.orderList.length; i += 1) {
if (!this.orderList[i].orderstatus) {
this.orderList[i].orderstatus = {
@@ -58,7 +76,7 @@ export class DashboardComponent implements OnInit {

this.orderService.getOrdersForOutlet(this.profile_info.outlet_id).then((data) => {
this.orderList = data;
for (let i = 0; i < this.orderList.length; i += 1) {
if (!this.orderList[i].orderstatus) {
this.orderList[i].orderstatus = {
@@ -73,14 +91,14 @@ export class DashboardComponent implements OnInit {

}
}

getFormattedDate(date: any, format: string) {
return moment(date).format(format);
}

getFilteredOrders(type: 'pending' | 'delivered' | 'confirmed') {
switch(type) {
switch (type) {
case 'pending':
return this.orderList.filter((order) => {
return order.orderstatus.orderstatus_id === 6;


+ 10
- 4
src/app/login/login.component.html 파일 보기

@@ -6,12 +6,18 @@

<div class="input-holder">
<label> Username </label>
<input type="text" placeholder="Enter username" [(ngModel)]="credentials.username">
<select [(ngModel)]="credentials.username">
<option *ngFor="let username of login_username" [value]="username"> {{ username }} </option>
</select>
<!-- <input type="text" placeholder="Enter username" [(ngModel)]="credentials.username"> -->
</div>

<div class="input-holder">
<label> Password </label>
<input type="password" placeholder="Enter Password" [(ngModel)]="credentials.password">
<select [(ngModel)]="credentials.password">
<option *ngFor="let password of login_password" [value]="password"> {{ password }} </option>
</select>
<!-- <input type=" password" placeholder="Enter Password" [(ngModel)]="credentials.password"> -->
</div>

<div class="input-holder">
@@ -21,10 +27,10 @@
</select>
</div>

<button class="rect-button" (click)="requestAuthentication()"> Login </button>
<button class="rect-button" (click)="requestAuthentication()"> Login </button>

<p *ngIf="errorMessage" class="error"> {{ errorMessage }} </p>

</section>

</div>
</div>

+ 5
- 3
src/app/login/login.component.ts 파일 보기

@@ -18,7 +18,9 @@ export class LoginComponent implements OnInit {
// admin123 admin@123


login_types = ['ROLE_VENDOR', 'ROLE_OUTLET', 'ROLE_ADMIN'];
login_types = ['ROLE_OUTLET', 'ROLE_VENDOR', 'ROLE_ADMIN'];
login_username = ['suresh', 'ramsesrh', 'admin123']
login_password = ['123456789', '123456789', 'admin@123']

errorMessage: string = '';

@@ -45,7 +47,6 @@ export class LoginComponent implements OnInit {
localStorage.admin_info = JSON.stringify(data['Admin Info'])
} else {
localStorage.outlet_info = JSON.stringify(data['Outlet Info']);
this.router.navigate(['shop-details']);
}

if (this.credentials.login_type === 'ROLE_VENDOR') {
@@ -54,9 +55,10 @@ export class LoginComponent implements OnInit {
} if (this.credentials.login_type === 'ROLE_ADMIN') {
console.log("Logging as Admin")
this.router.navigate(['/admin']);
} else {
} if (this.credentials.login_type === 'ROLE_OUTLET'){
console.log("Logging as Outlet")
this.router.navigate(['shop-details']);

}

}, (err: any) => {


+ 33
- 27
src/app/menu-items/menu-items.component.ts 파일 보기

@@ -2,12 +2,12 @@ import { Component, OnInit } from '@angular/core';
import { ItemService } from '../services/item.service';

@Component({
selector: 'app-menu-items',
templateUrl: './menu-items.component.html',
styleUrls: ['./menu-items.component.scss']
selector: 'app-menu-items',
templateUrl: './menu-items.component.html',
styleUrls: ['./menu-items.component.scss']
})
export class MenuItemsComponent implements OnInit {
productAvailable: boolean = false;
productAvailable: boolean = false;
profile_type: string = '';
profile_info: any;
searchTerm: string = '';
@@ -27,33 +27,35 @@ export class MenuItemsComponent implements OnInit {
soft_delete: boolean,
wait_duration: string,
} = {
image_url: '',
is_available: false,
is_vegetarian: true,
item_categories: [],
item_discount: null,
item_price: null,
menu_item_name: '',
rating: 3,
soft_delete: false,
wait_duration:"00:30:00"
};
constructor(
image_url: '',
is_available: false,
is_vegetarian: true,
item_categories: [],
item_discount: null,
item_price: null,
menu_item_name: '',
rating: 3,
soft_delete: false,
wait_duration: "00:30:00"
};
constructor(
private itemService: ItemService
) { }

ngOnInit() {
ngOnInit() {
this.profile_type = localStorage.current_login_type;

if (this.profile_type === 'ROLE_VENDOR') {
this.profile_info = JSON.parse(localStorage.outlet_info);
} else if (this.profile_type === 'ROLE_OUTLET') {
this.profile_info = JSON.parse(localStorage.outlet_info);
} else if (this.profile_type === 'ROLE_ADMIN') {
this.profile_info = JSON.parse(localStorage.outlet_info);
}

console.log(this.profile_info);
this.menuItems = JSON.parse(JSON.stringify(this.profile_info.menuitems));

console.log(this.menuItems);
@@ -62,11 +64,13 @@ export class MenuItemsComponent implements OnInit {
updateItem(menuItem) {
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 === 'ROLE_VENDOR') {
localStorage.vendor_info = JSON.stringify(this.profile_info);
} else if (this.profile_type === 'ROLE_OUTLET') {
localStorage.outlet_info = JSON.stringify(this.profile_info);
} else if (this.profile_type === 'ROLE_ADMIN') {
localStorage.outlet_info = JSON.stringify(this.profile_info);
}

}, (err) => {
@@ -74,12 +78,12 @@ export class MenuItemsComponent implements OnInit {
alert("Failed to update");
});
}
searchItems() {
this.menuItems = this.profile_info.menuitems.filter((item) => {
return item.menuitem_id.toString().toLowerCase().includes(this.searchTerm.toString().toLowerCase()) ||
item.menu_item_name.toString().toLowerCase().includes(this.searchTerm.toString().toLowerCase()) ||
item.item_price.toString().toLowerCase().includes(this.searchTerm.toString().toLowerCase());
item.menu_item_name.toString().toLowerCase().includes(this.searchTerm.toString().toLowerCase()) ||
item.item_price.toString().toLowerCase().includes(this.searchTerm.toString().toLowerCase());
});
}

@@ -92,11 +96,13 @@ export class MenuItemsComponent implements OnInit {
localStorage.vendor_info = JSON.stringify(this.profile_info);
} else if (this.profile_type === 'ROLE_OUTLET') {
localStorage.outlet_info = JSON.stringify(this.profile_info);
} else if (this.profile_type === 'ROLE_ADMIN') {
localStorage.outlet_info = JSON.stringify(this.profile_info);
}


this.showAddItemModal = false;
this.newItem = {
image_url: '',
is_available: false,
@@ -106,10 +112,10 @@ export class MenuItemsComponent implements OnInit {
item_price: null,
menu_item_name: '',
rating: 3,
soft_delete: false,
wait_duration:"00:30:00"
soft_delete: false,
wait_duration: "00:30:00"
};
}, (err) => {
alert("Failed to create item");
})


+ 49
- 25
src/app/orders/orders.component.ts 파일 보기

@@ -3,12 +3,12 @@ import { OrderService } from '../services/order.service';
import * as moment from 'moment';

@Component({
selector: 'app-orders',
templateUrl: './orders.component.html',
styleUrls: ['./orders.component.scss']
selector: 'app-orders',
templateUrl: './orders.component.html',
styleUrls: ['./orders.component.scss']
})
export class OrdersComponent implements OnInit {
showRejectionPopup: boolean = false;
showRejectionPopup: boolean = false;
orderList: any = [];
tempOrderList: any = [];
orderStatus: any = [];
@@ -18,22 +18,22 @@ export class OrdersComponent implements OnInit {
orderStatus: string,
orderstatus_id: number
} = {
orderStatus: 'All',
orderstatus_id: 0
};
orderStatus: 'All',
orderstatus_id: 0
};

@Input() params: any;
profile_type: any;
profile_info: any;

constructor(
constructor(
private orderService: OrderService
) { }

ngOnInit() {
ngOnInit() {
if (this.params) {
try {
switch(this.params) {
switch (this.params) {
case 'pending': this.filterOption = {
orderStatus: 'Pending',
orderstatus_id: 6
@@ -62,12 +62,12 @@ export class OrdersComponent implements OnInit {
};
}
}
this.calculateOrders();
}


calculateOrders() {
this.profile_type = localStorage.current_login_type;

@@ -93,13 +93,13 @@ export class OrdersComponent implements OnInit {
orderStatus: 'Ready',
}];
});
if (this.profile_type === 'ROLE_VENDOR') {
this.profile_info = JSON.parse(localStorage.vendor_info);

this.orderService.getOrders().then((data) => {
this.orderList = data;
for (let i = 0; i < this.orderList.length; i += 1) {
if (!this.orderList[i].orderstatus) {
this.orderList[i].orderstatus = {
@@ -108,7 +108,29 @@ export class OrdersComponent implements OnInit {
}
}
}

this.tempOrderList = JSON.parse(JSON.stringify(this.orderList));
}, () => {
alert("Error getting the orders");
});


}
if (this.profile_type === 'ROLE_ADMIN') {
this.profile_info = JSON.parse(localStorage.vendor_info);

this.orderService.getOrders().then((data) => {
this.orderList = data;

for (let i = 0; i < this.orderList.length; i += 1) {
if (!this.orderList[i].orderstatus) {
this.orderList[i].orderstatus = {
orderStatus: "",
orderstatus_id: 6
}
}
}

this.tempOrderList = JSON.parse(JSON.stringify(this.orderList));
}, () => {
alert("Error getting the orders");
@@ -120,7 +142,7 @@ export class OrdersComponent implements OnInit {

this.orderService.getOrdersForOutlet(this.profile_info.outlet_id).then((data) => {
this.orderList = data;
for (let i = 0; i < this.orderList.length; i += 1) {
if (!this.orderList[i].orderstatus) {
this.orderList[i].orderstatus = {
@@ -154,18 +176,19 @@ export class OrdersComponent implements OnInit {

getOrderInUsercartFormat(orderedlist: any) {
let compiledOrderedList: any = [];
console.log(orderedlist)

for (let i = 0; i < orderedlist.length; i += 1) {
compiledOrderedList.push({
mall_id: orderedlist[i].mall_id,
outlet_id: orderedlist[i].outlet_id,
menuitem_id: orderedlist[i].menuitems.menuitem_id,
orderedlist_id: orderedlist[i].orderedlist_id,
mall: [{ mall_id: orderedlist[i].mall_id }],
menuitems: [{ menuitem_id: orderedlist[i].menuitems.menuitem_id }],
outlet: [{ outlet_id: orderedlist[i].outlet_id }],
quantity: orderedlist[i].quantity,
pickup_time: moment().add(moment.duration(orderedlist[i].menuitems.wait_duration).asMinutes(), 'minutes').format(),
take_away: true,
order_status: null,
take_away: false,
order_status: true,
total_price: orderedlist[i].total_price,
soft_delete: false,
});
}

@@ -174,9 +197,10 @@ export class OrdersComponent implements OnInit {

updateOrder(order) {
let tempOrder = order;
tempOrder.orderedlist = this.getOrderInUsercartFormat(order.orderedlist);

console.log(tempOrder)
this.orderService.updateOrder(tempOrder).then((data) => {
console.log(data);
}, (err) => {
@@ -195,7 +219,7 @@ export class OrdersComponent implements OnInit {
}
}

searchOrders() {
searchOrders() {
this.tempOrderList = this.orderList.filter((order: any) => {
return order.orders_id.toString().toLowerCase().includes(this.searchTerm.toLowerCase());
});


+ 4
- 2
src/app/schedules/schedules.component.ts 파일 보기

@@ -73,6 +73,8 @@ export class SchedulesComponent implements OnInit {
this.profile_info = JSON.parse(localStorage.vendor_info);
} else if (this.profile_type === 'ROLE_OUTLET') {
this.profile_info = JSON.parse(localStorage.outlet_info);
} else if (this.profile_type === 'ROLE_ADMIN') {
this.profile_info = JSON.parse(localStorage.outlet_info);
}

console.log(this.profile_info);
@@ -148,10 +150,10 @@ export class SchedulesComponent implements OnInit {
this.selectedHolidays = this.selectedDatesForSchedule.map(selectedDates => this.getTodayString(selectedDates.toString()))
this.outletTiming.holidays = JSON.stringify(this.selectedHolidays)
console.log(this.outletTiming)
this.outletService.addOutletSchedules(this.outletTiming, this.profile_info.outlet_id).then((data) => {
console.log(data)
}, err=>{
}, err => {
console.log("Unable to Update Holidays")
})
}


+ 12
- 11
src/app/widgets-holder/widgets-holder.component.ts 파일 보기

@@ -3,27 +3,27 @@ import { Router } from '@angular/router';
import { ActivatedRoute } from '@angular/router';

@Component({
selector: 'app-widgets-holder',
templateUrl: './widgets-holder.component.html',
styleUrls: ['./widgets-holder.component.scss']
selector: 'app-widgets-holder',
templateUrl: './widgets-holder.component.html',
styleUrls: ['./widgets-holder.component.scss']
})
export class WidgetsHolderComponent implements OnInit {
selected_nav: {
selected_nav: {
name: string,
params: any
} = {
name: 'dashboard',
params: ''
};
name: 'dashboard',
params: ''
};
profile_info: any;
profile_type: string;

constructor(
constructor(
private router: Router,
private activatedRoute: ActivatedRoute
) { }

ngOnInit() {
ngOnInit() {
this.activatedRoute.params.subscribe((params) => {
if (params.params) {
this.selected_nav = {
@@ -41,12 +41,13 @@ export class WidgetsHolderComponent implements OnInit {
this.profile_info = JSON.parse(localStorage.outlet_info);
} else if (this.profile_type === 'ROLE_OUTLET') {
this.profile_info = JSON.parse(localStorage.outlet_info);
} else if (this.profile_type === 'ROLE_ADMIN') {
this.profile_info = JSON.parse(localStorage.outlet_info);
} else {
this.router.navigate(['/login']);
}

console.log(this.profile_info)
}
}

logout() {
localStorage.clear();


불러오는 중...
취소
저장