diff --git a/src/app/admin/malls/malls.component.html b/src/app/admin/malls/malls.component.html
index 968dbe8..9213c9a 100644
--- a/src/app/admin/malls/malls.component.html
+++ b/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
+ newMall.outlet[0].outlet_name.length && newMall.outlet[0].image_url.length) === 0'>Add Mall
+
+
+
+
+
diff --git a/src/app/admin/malls/malls.component.ts b/src/app/admin/malls/malls.component.ts
index 473871b..fd7f626 100644
--- a/src/app/admin/malls/malls.component.ts
+++ b/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)
+
}
}
diff --git a/src/app/admin/malls/malls.ts b/src/app/admin/malls/malls.ts
new file mode 100644
index 0000000..5a172dd
--- /dev/null
+++ b/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
+}
\ No newline at end of file
diff --git a/src/app/admin/vendors/vendors.component.html b/src/app/admin/vendors/vendors.component.html
index 0bdc254..46a6a4c 100644
--- a/src/app/admin/vendors/vendors.component.html
+++ b/src/app/admin/vendors/vendors.component.html
@@ -29,6 +29,7 @@
Type: {{vendor.vendorType}}
Ph: {{vendor.vendorOfficeNo}} Mob: {{vendor.vendorMobile}}
+
@@ -42,10 +43,10 @@
Id: {{outlet.outlet_id}}
-
Rating: {{outlet.rating}}
-
MenuItems: {{outlet.menuitems.length}}
+
Rating: {{outlet.rating}}
+
MenuItems: {{outlet.menuitems.length}}
-
+
diff --git a/src/app/admin/vendors/vendors.component.scss b/src/app/admin/vendors/vendors.component.scss
index 92bec54..dd69c7e 100644
--- a/src/app/admin/vendors/vendors.component.scss
+++ b/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;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/app/admin/vendors/vendors.component.ts b/src/app/admin/vendors/vendors.component.ts
index 3f90f67..9d6cc8d 100644
--- a/src/app/admin/vendors/vendors.component.ts
+++ b/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'])
}
}
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts
index 405ffb9..8064e53 100644
--- a/src/app/dashboard/dashboard.component.ts
+++ b/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 = [{
+ filterOptions: Array = [{
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;
diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html
index 48b93f8..71f86de 100644
--- a/src/app/login/login.component.html
+++ b/src/app/login/login.component.html
@@ -6,12 +6,18 @@
-
+
+
-
+
+
@@ -21,10 +27,10 @@
-
+
{{ errorMessage }}
-
+
\ No newline at end of file
diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts
index 7b35d61..4d69751 100644
--- a/src/app/login/login.component.ts
+++ b/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) => {
diff --git a/src/app/menu-items/menu-items.component.ts b/src/app/menu-items/menu-items.component.ts
index 8af8b62..8101960 100644
--- a/src/app/menu-items/menu-items.component.ts
+++ b/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");
})
diff --git a/src/app/orders/orders.component.ts b/src/app/orders/orders.component.ts
index 02a79eb..d353b83 100644
--- a/src/app/orders/orders.component.ts
+++ b/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());
});
diff --git a/src/app/schedules/schedules.component.ts b/src/app/schedules/schedules.component.ts
index 1696181..e97ff4a 100644
--- a/src/app/schedules/schedules.component.ts
+++ b/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")
})
}
diff --git a/src/app/widgets-holder/widgets-holder.component.ts b/src/app/widgets-holder/widgets-holder.component.ts
index f60d9f2..326f261 100644
--- a/src/app/widgets-holder/widgets-holder.component.ts
+++ b/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();