diff --git a/package-lock.json b/package-lock.json
index 7010c3e..6f2698d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10618,8 +10618,7 @@
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
- "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==",
- "dev": true
+ "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"validate-npm-package-license": {
"version": "3.0.4",
diff --git a/package.json b/package.json
index 214e046..03adf31 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
"core-js": "^2.5.4",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
+ "uuid": "^3.3.2",
"zone.js": "~0.9.1"
},
"devDependencies": {
@@ -81,4 +82,4 @@
"android"
]
}
-}
\ No newline at end of file
+}
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 1e88503..96988e0 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -8,6 +8,7 @@ const routes: Routes = [
{ path: 'malls', loadChildren: './malls/malls.module#MallsPageModule' },
{ path: 'mall-details', loadChildren: './mall-details/mall-details.module#MallDetailsPageModule' },
{ path: 'outlet-details', loadChildren: './outlet-details/outlet-details.module#OutletDetailsPageModule' },
+ { path: 'cart', loadChildren: './cart/cart.module#CartPageModule' },
];
@NgModule({
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 59466e6..21344f3 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -19,8 +19,8 @@
-
+
+
diff --git a/src/app/cart/cart.page.scss b/src/app/cart/cart.page.scss
new file mode 100644
index 0000000..40b6ad6
--- /dev/null
+++ b/src/app/cart/cart.page.scss
@@ -0,0 +1,49 @@
+.header-bar {
+ background-image: url('../../assets/custom/background-5.svg');
+ background-size: cover;
+ background-repeat: no-repeat;
+ background-position: left top;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 15px;
+ height: 75px;
+ z-index: 2;
+ top: 0;
+ left: 0;
+ width: 100%;
+ position: sticky;
+ box-shadow: 0px 3px 5px var(--brand-grey);
+ margin-bottom: 20px;
+
+ .heading-holder {
+ display: flex;
+ align-items: center;
+ }
+
+ button, a {
+ background-color: white;
+ color: var(--brand-blue);
+ font-size: 18px;
+ padding: 5px;
+ border-radius: 50%;
+ height: 30px;
+ width: 30px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+
+ &.active {
+ color: white;
+ background-color: var(--brand-blue);
+ }
+ }
+
+ h3 {
+ font-size: 16px;
+ color: white;
+ letter-spacing: 0.5px;
+ margin-left: 10px;
+ font-weight: 600;
+ }
+}
diff --git a/src/app/cart/cart.page.spec.ts b/src/app/cart/cart.page.spec.ts
new file mode 100644
index 0000000..a3f08a6
--- /dev/null
+++ b/src/app/cart/cart.page.spec.ts
@@ -0,0 +1,27 @@
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { CartPage } from './cart.page';
+
+describe('CartPage', () => {
+ let component: CartPage;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ CartPage ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(CartPage);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/cart/cart.page.ts b/src/app/cart/cart.page.ts
new file mode 100644
index 0000000..9c4387e
--- /dev/null
+++ b/src/app/cart/cart.page.ts
@@ -0,0 +1,22 @@
+import { Component, OnInit } from '@angular/core';
+import { Location } from '@angular/common';
+
+@Component({
+ selector: 'app-cart',
+ templateUrl: './cart.page.html',
+ styleUrls: ['./cart.page.scss'],
+})
+export class CartPage implements OnInit {
+
+ constructor(
+ private location: Location
+ ) { }
+
+ ngOnInit() {
+ }
+
+ back() {
+ this.location.back();
+ }
+
+}
diff --git a/src/app/mall-details/mall-details.page.html b/src/app/mall-details/mall-details.page.html
index cdb1421..ece069e 100644
--- a/src/app/mall-details/mall-details.page.html
+++ b/src/app/mall-details/mall-details.page.html
@@ -62,7 +62,7 @@
-
@@ -81,8 +81,8 @@
- Food
- Shopping
+ Food
+ Shopping
Offers: {{ outlet.offers.length }}
@@ -91,7 +91,7 @@
-
+
@@ -109,8 +109,8 @@
- Food
- Shopping
+ Food
+ Shopping
Offers: {{ outlet.offers.length }}
diff --git a/src/app/mocks/malls.ts b/src/app/mocks/malls.ts
new file mode 100644
index 0000000..5da74a5
--- /dev/null
+++ b/src/app/mocks/malls.ts
@@ -0,0 +1,76 @@
+import Offer from '../models/offer';
+import { OUTLETS } from './outlets';
+
+export const MALLS = [{
+ id: '0001',
+ name: 'Gopalan Arcade Mall',
+ address: 'Mysore Road, Bangalore',
+ is_bookmarked: true,
+ is_archived: false,
+ image_url: 'https://www.gopalanmall.com/images/mall-arcade-01.jpg',
+ description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
+ outlets: OUTLETS,
+ offer_collection: [{
+ name: 'Food',
+ offers: [new Offer({
+ name: 'McDonalds Offer',
+ description: 'Get 25% offer on you first meal',
+ coupon_code: 'MCD25F',
+ })]
+ }, {
+ name: 'Shopping',
+ offers: []
+ }],
+ rating: 4.1,
+ distance: 2,
+ location: {
+ latitude: 12.903903292,
+ longitude: 34.940349039
+ }
+},
+{
+ id: '0002',
+ name: 'Gopalan Cinemas',
+ address: 'Kenchana Halli',
+ is_bookmarked: false,
+ is_archived: false,
+ image_url: 'https://www.gopalanmall.com/images/mall-arcade-01.jpg',
+ description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
+ outlets: [],
+ offer_collection: [{
+ name: 'Food',
+ offers: []
+ }, {
+ name: 'Shopping',
+ offers: []
+ }],
+ rating: 4.5,
+ distance: 2,
+ location: {
+ latitude: 12.903903292,
+ longitude: 34.940349039
+ }
+},
+{
+ id: '0003',
+ name: 'Gopalan Mall',
+ address: 'Mysore Road, Bangalore',
+ is_bookmarked: false,
+ is_archived: false,
+ image_url: 'https://www.gopalanmall.com/images/mall-arcade-01.jpg',
+ description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
+ outlets: [],
+ offer_collection: [{
+ name: 'Food',
+ offers: []
+ }, {
+ name: 'Shopping',
+ offers: []
+ }],
+ rating: 4.3,
+ distance: 2,
+ location: {
+ latitude: 12.903903292,
+ longitude: 34.940349039
+ }
+}];
diff --git a/src/app/mocks/menu-items.ts b/src/app/mocks/menu-items.ts
new file mode 100644
index 0000000..3c8e531
--- /dev/null
+++ b/src/app/mocks/menu-items.ts
@@ -0,0 +1,71 @@
+import MenuItem from '../models/menu-item';
+
+export const MENU_ITEMS_1 = [new MenuItem({
+ id: '0001',
+ name: 'McSpicy Paneer',
+ image_url: 'https://www.mcdonalds.com.my/images/nasi_lemak/burger/burger.jpg?id=bb965dd67df3afa52033',
+ description: 'the patties are very unique and is prepared mainly with mashed potatoes and green peas. the flagship mcaloo tikki recipe from McDonalds involves a special sauce which is basically a combination of tomato sauce and mayonnaise. aloo tikki burger recipe.',
+ is_vegeterian: true,
+ wait_duration: 10,
+ price: 90,
+ discount: 10,
+ rating: 4,
+ tags: ['burger', 'breakfast']
+}), new MenuItem({
+ id: '0002',
+ name: 'McAloo Tikki',
+ image_url: 'https://www.mcdonalds.com.my/images/nasi_lemak/burger/burger.jpg?id=bb965dd67df3afa52033',
+ description: 'the patties are very unique and is prepared mainly with mashed potatoes and green peas. the flagship mcaloo tikki recipe from McDonalds involves a special sauce which is basically a combination of tomato sauce and mayonnaise. aloo tikki burger recipe.',
+ is_vegeterian: true,
+ wait_duration: 13,
+ price: 120,
+ discount: 50,
+ rating: 4.0,
+ tags: ['spicy', 'dinner']
+}), new MenuItem({
+ id: '0003',
+ name: 'McPork',
+ image_url: 'https://www.mcdonalds.com.my/images/nasi_lemak/burger/burger.jpg?id=bb965dd67df3afa52033',
+ description: 'the patties are very unique and is prepared mainly with mashed potatoes and green peas. the flagship mcaloo tikki recipe from McDonalds involves a special sauce which is basically a combination of tomato sauce and mayonnaise. aloo tikki burger recipe.',
+ is_vegeterian: false,
+ wait_duration: 20,
+ price: 300,
+ discount: 5,
+ rating: 4.9,
+ tags: ['spicy', 'dinner', 'pork']
+})];
+
+export const MENU_ITEMS_2 = [new MenuItem({
+ id: '0001',
+ name: 'Margherita Pizza',
+ image_url: 'https://www.cafecoffeeday.com/thelounge/images/ccd-lounge-pizzas-side-1.jpg',
+ description: 'Cheese pizza topped with tomato sauce, garlic sauce and fresh basil.',
+ is_vegeterian: true,
+ wait_duration: 25,
+ price: 150,
+ discount: 0,
+ rating: 3.5,
+ tags: ['pizza', 'hot']
+}), new MenuItem({
+ id: '0002',
+ name: 'Espresso Shot',
+ image_url: 'https://www.cafecoffeeday.com/thelounge/images/ccd-lounge-classic-hot-bottom.jpg',
+ description: 'Coffee at its simplest best. Without milk, served with cold water on the side. We call it a simple big-shot.',
+ is_vegeterian: true,
+ wait_duration: 5,
+ price: 80,
+ discount: 0,
+ rating: 4.5,
+ tags: ['hot', 'beverage']
+}), new MenuItem({
+ id: '0003',
+ name: 'The Coffee Gola',
+ image_url: 'https://www.cafecoffeeday.com/thelounge/images/ccd-lounge-Coffetini-Easel-side.jpg',
+ description: 'The perfect blend of coffee, almonds and a rich vanilla gola. Sure to give you an exotic kulfi experience.',
+ is_vegeterian: true,
+ wait_duration: 15,
+ price: 200,
+ discount: 10,
+ rating: 4.9,
+ tags: ['cold', 'beverage']
+})];
diff --git a/src/app/mocks/outlets.ts b/src/app/mocks/outlets.ts
new file mode 100644
index 0000000..1e4e546
--- /dev/null
+++ b/src/app/mocks/outlets.ts
@@ -0,0 +1,42 @@
+import Outlet, { OutletType } from '../models/outlet';
+import Offer from '../models/offer';
+import { MENU_ITEMS_1, MENU_ITEMS_2 } from './menu-items';
+
+export const OUTLETS = [new Outlet({
+ id: '0001',
+ image_url: 'https://images.markets.businessinsider.com/image/5a74835585cdd489228b47be-900/shutterstock643079686.jpg',
+ name: 'McDonalds',
+ description: 'Veg / Non-Veg Food Restaurant',
+ tags: ['dinner', 'spicy', 'breakfast', 'pork'],
+ menu_items: MENU_ITEMS_1,
+ offers: [new Offer({
+ name: 'McDonalds Offer',
+ description: 'Get 25% offer on you first meal',
+ coupon_code: 'MCD25F',
+ })],
+ outlet_type: OutletType.FOOD,
+ is_bookmarked: false,
+ rating: 3.5,
+}), new Outlet({
+ id: '0002',
+ image_url: 'https://pbs.twimg.com/profile_images/354890582/symbol.jpg',
+ name: 'Shopper\'s stop',
+ description: 'Clothing store',
+ offers: [],
+ tags: [],
+ menu_items: [],
+ outlet_type: OutletType.SHOP,
+ is_bookmarked: true,
+ rating: 4.8,
+}), new Outlet({
+ id: '0003',
+ image_url: 'https://www.mbarendezvous.com/images/top-stories-img/bannerimage_1463407053.jpg',
+ name: 'Cafe Coffee Day',
+ description: 'Veg / Non-Veg Cafe',
+ tags: ['hot', 'cold', 'pizza', 'beverage'],
+ menu_items: MENU_ITEMS_2,
+ offers: [],
+ outlet_type: OutletType.FOOD,
+ is_bookmarked: false,
+ rating: 4,
+})];
diff --git a/src/app/models/cart-item.ts b/src/app/models/cart-item.ts
new file mode 100644
index 0000000..c1abc57
--- /dev/null
+++ b/src/app/models/cart-item.ts
@@ -0,0 +1,44 @@
+class CartItem {
+ menu_item_id: string;
+ quantity: number;
+ pickup_time: Date;
+ outlet_id: string;
+ mall_id: string;
+ is_parcel: boolean;
+ total_price: number;
+
+ constructor(initializationObject: any) {
+ if (!initializationObject.hasOwnProperty('menu_item_id')) {
+ throw new Error('Missing Menu item ID');
+ }
+
+ if (!initializationObject.hasOwnProperty('quantity')) {
+ throw new Error('Missing quantity');
+ }
+
+ if (!initializationObject.hasOwnProperty('pickup_time')) {
+ throw new Error('Missing Pickup time');
+ }
+
+ if (!initializationObject.hasOwnProperty('outlet_id')) {
+ throw new Error('Missing Outlet ID');
+ }
+
+ if (!initializationObject.hasOwnProperty('mall_id')) {
+ throw new Error('Missing Mall ID');
+ }
+
+ if (!initializationObject.hasOwnProperty('is_parcel')) {
+ throw new Error('Missing Parcel Flag');
+ }
+ this.menu_item_id = initializationObject.menu_item_id;
+ this.quantity = initializationObject.quantity;
+ this.pickup_time = initializationObject.pickup_time;
+ this.outlet_id = initializationObject.outlet_id;
+ this.mall_id = initializationObject.mall_id;
+ this.is_parcel = initializationObject.is_parcel;
+ this.total_price = initializationObject.total_price;
+ }
+}
+
+export default CartItem;
diff --git a/src/app/models/menu-item.ts b/src/app/models/menu-item.ts
new file mode 100644
index 0000000..c8dc338
--- /dev/null
+++ b/src/app/models/menu-item.ts
@@ -0,0 +1,58 @@
+export class MenuItem {
+ id: string;
+ name: string;
+ image_url?: string;
+ description: string;
+ is_vegeterian: boolean;
+ wait_duration: number;
+ price: number;
+ discount: number;
+ rating: number;
+ tags: Array;
+
+ constructor(initializationObject: any) {
+ if (!initializationObject.hasOwnProperty('id')) {
+ throw new Error('Missing id')
+ }
+ if (!initializationObject.hasOwnProperty('name')) {
+ throw new Error('Missing name')
+ }
+ if (!initializationObject.hasOwnProperty('description')) {
+ throw new Error('Missing description')
+ }
+ if (!initializationObject.hasOwnProperty('is_vegeterian')) {
+ throw new Error('Missing is_vegeterian')
+ }
+ if (!initializationObject.hasOwnProperty('wait_duration')) {
+ throw new Error('Missing wait_duration')
+ }
+ if (!initializationObject.hasOwnProperty('price')) {
+ throw new Error('Missing price')
+ }
+ if (!initializationObject.hasOwnProperty('discount')) {
+ throw new Error('Missing discount')
+ }
+ if (!initializationObject.hasOwnProperty('rating')) {
+ throw new Error('Missing rating')
+ }
+ if (!initializationObject.hasOwnProperty('tags')) {
+ throw new Error('Missing tags')
+ }
+
+ this.id = initializationObject.id;
+ this.name = initializationObject.name;
+ this.description = initializationObject.description;
+ this.is_vegeterian = initializationObject.is_vegeterian;
+ this.wait_duration = initializationObject.wait_duration;
+ this.price = initializationObject.price;
+ this.discount = initializationObject.discount;
+ this.rating = initializationObject.rating;
+ this.tags = initializationObject.tags;
+
+ if (initializationObject.hasOwnProperty('image_url')) {
+ this.image_url = initializationObject.image_url;
+ }
+ }
+};
+
+export default MenuItem;
diff --git a/src/app/models/offer.ts b/src/app/models/offer.ts
index bfb46a9..627fff0 100644
--- a/src/app/models/offer.ts
+++ b/src/app/models/offer.ts
@@ -1,7 +1,8 @@
-export class Offer {
+class Offer {
name: string;
description: string;
coupon_code: string;
+ image_url?: string;
constructor(initializationObject: any) {
@@ -21,9 +22,15 @@ export class Offer {
this.name = initializationObject.name;
this.description = initializationObject.description;
this.coupon_code = initializationObject.coupon_code;
+
+ if (initializationObject.hasOwnProperty('image_url')) {
+ this.image_url = initializationObject.image_url;
+ }
}
}
+export default Offer;
+
export type OfferCollection = {
name: string,
offers: Array,
diff --git a/src/app/models/outlet.ts b/src/app/models/outlet.ts
new file mode 100644
index 0000000..43675f4
--- /dev/null
+++ b/src/app/models/outlet.ts
@@ -0,0 +1,74 @@
+import Offer from './offer';
+import MenuItem from './menu-item';
+
+export enum OutletType {
+ FOOD = 'FOOD',
+ SHOP = 'SHOP',
+};
+
+class Outlet {
+ id: string;
+ image_url?: string;
+ name: string;
+ description: string;
+ offers: Array;
+ tags: Array;
+ menu_items: Array