Commit 6f5ef209 by Adarsh K

Merge branch 'master' into adarsh

parents ede6baa1 97cdb621
...@@ -99,7 +99,8 @@ const routes: Routes = [ ...@@ -99,7 +99,8 @@ const routes: Routes = [
{ path: 'feedback', loadChildren: './feedback/feedback.module#FeedbackPageModule' }, { path: 'feedback', loadChildren: './feedback/feedback.module#FeedbackPageModule' },
{ path: 'address', loadChildren: './address/address.module#AddressPageModule' }, { path: 'address', loadChildren: './address/address.module#AddressPageModule' },
{ path: 'success', loadChildren: './success/success.module#SuccessPageModule' }, { path: 'success', loadChildren: './success/success.module#SuccessPageModule' },
{ path: 'failed', loadChildren: './failed/failed.module#FailedPageModule' } { path: 'failed', loadChildren: './failed/failed.module#FailedPageModule' },
{ path: 'preference', loadChildren: './preference/preference.module#PreferencePageModule' }
]; ];
@NgModule({ @NgModule({
......
...@@ -111,7 +111,8 @@ export class AppComponent { ...@@ -111,7 +111,8 @@ export class AppComponent {
'address', 'address',
'forgot', 'forgot',
'feedback', 'feedback',
'wishlist' 'wishlist',
'preference'
]; ];
const currentUrl = this.router.url.split('/'); const currentUrl = this.router.url.split('/');
const index = restrictedUrl.findIndex(x => x === currentUrl[1]); const index = restrictedUrl.findIndex(x => x === currentUrl[1]);
......
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from "@angular/core";
import { IonSlides } from '@ionic/angular'; import { IonSlides } from "@ionic/angular";
import { Location } from '@angular/common'; import { Location } from "@angular/common";
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from "@angular/router";
import { CartsService } from './../../config/cart.service'; import { CartsService } from "./../../config/cart.service";
import { OrdersService } from './../../config/order.service'; import { OrdersService } from "./../../config/order.service";
import { ModalController } from '@ionic/angular'; import { ModalController } from "@ionic/angular";
import { DeliverypopPage } from '../deliverypop/deliverypop.page'; import { DeliverypopPage } from "../deliverypop/deliverypop.page";
import { ServiceService } from './../../config/service.service'; import { ServiceService } from "./../../config/service.service";
import { AddressService } from './../../config/address.service'; import { AddressService } from "./../../config/address.service";
import { AddressList } from './../../config/services/address'; import { AddressList } from "./../../config/services/address";
import { trigger, transition, animate, style } from '@angular/animations'; import { trigger, transition, animate, style } from "@angular/animations";
import { zip } from 'rxjs'; import { zip } from "rxjs";
@Component({ @Component({
selector: 'app-cart', selector: "app-cart",
templateUrl: './cart.page.html', templateUrl: "./cart.page.html",
styleUrls: ['./cart.page.scss'], styleUrls: ["./cart.page.scss"],
animations: [ animations: [
trigger('slideInOut', [ trigger("slideInOut", [
transition(':enter', [ transition(":enter", [
style({ transform: 'translateY(100%)' }), style({ transform: "translateY(100%)" }),
animate('200ms ease-in', style({ transform: 'translateY(0%)' })) animate("200ms ease-in", style({ transform: "translateY(0%)" }))
]), ]),
transition(':leave', [ transition(":leave", [
animate('200ms ease-out', style({ transform: 'translateY(100%)' })) animate("200ms ease-out", style({ transform: "translateY(100%)" }))
]) ])
]) ])
] ]
...@@ -37,6 +37,7 @@ export class CartPage implements OnInit { ...@@ -37,6 +37,7 @@ export class CartPage implements OnInit {
loader = false; loader = false;
custId: any; custId: any;
custAddress: AddressList; custAddress: AddressList;
deliveryTime: any;
cartwizard = { cartwizard = {
initialSlide: 0, initialSlide: 0,
speed: 1000, speed: 1000,
...@@ -61,7 +62,7 @@ export class CartPage implements OnInit { ...@@ -61,7 +62,7 @@ export class CartPage implements OnInit {
public service: ServiceService, public service: ServiceService,
public addressService: AddressService public addressService: AddressService
) { ) {
console.log('cart loaded'); console.log("cart loaded");
this.bookDate = this.formatDate(); this.bookDate = this.formatDate();
this.currentIndex = 0; this.currentIndex = 0;
this.count = 1; this.count = 1;
...@@ -72,7 +73,7 @@ export class CartPage implements OnInit { ...@@ -72,7 +73,7 @@ export class CartPage implements OnInit {
this.discount = 0; this.discount = 0;
// this.cartService.cartList(); // this.cartService.cartList();
this.loader = true; this.loader = true;
const users = this.service.get('user').then(data => { const users = this.service.get("user").then(data => {
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
this.custId = data.uid; this.custId = data.uid;
...@@ -90,7 +91,7 @@ export class CartPage implements OnInit { ...@@ -90,7 +91,7 @@ export class CartPage implements OnInit {
} }
ionViewWillEnter() { ionViewWillEnter() {
const users = this.service.get('user').then(data => { const users = this.service.get("user").then(data => {
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
this.cartService.cartList(); this.cartService.cartList();
...@@ -182,7 +183,7 @@ export class CartPage implements OnInit { ...@@ -182,7 +183,7 @@ export class CartPage implements OnInit {
const state = this.orderService const state = this.orderService
.checkOut(this.cartService.carts, otherCharges) .checkOut(this.cartService.carts, otherCharges)
.then(data => { .then(data => {
console.log('ready for slide'); console.log("ready for slide");
const timeStamp = Math.floor(Date.now() / 1000); const timeStamp = Math.floor(Date.now() / 1000);
this.timeinterval = setInterval(() => { this.timeinterval = setInterval(() => {
This.getDeliveryTime(timeStamp); This.getDeliveryTime(timeStamp);
...@@ -190,7 +191,7 @@ export class CartPage implements OnInit { ...@@ -190,7 +191,7 @@ export class CartPage implements OnInit {
this.slides.slideNext(); this.slides.slideNext();
}); });
} else { } else {
alert('Please choose delivery location'); alert("Please choose delivery location");
} }
} else { } else {
this.slides.slideNext(); this.slides.slideNext();
...@@ -203,9 +204,9 @@ export class CartPage implements OnInit { ...@@ -203,9 +204,9 @@ export class CartPage implements OnInit {
console.log(endDate); console.log(endDate);
endDate.setHours(endDate.getHours() + 1); endDate.setHours(endDate.getHours() + 1);
const t = this.getTimeRemaining(endDate, new Date()); const t = this.getTimeRemaining(endDate, new Date());
const minutes = t.minutes < 10 ? '0' + t.minutes : t.minutes; const minutes = t.minutes < 10 ? "0" + t.minutes : t.minutes;
const seconds = t.seconds < 10 ? '0' + t.seconds : t.seconds; const seconds = t.seconds < 10 ? "0" + t.seconds : t.seconds;
this.deliveryTime = minutes + ' : ' + seconds; this.deliveryTime = minutes + " : " + seconds;
if (t.t <= 0) { if (t.t <= 0) {
clearInterval(this.timeinterval); clearInterval(this.timeinterval);
} }
...@@ -285,33 +286,33 @@ export class CartPage implements OnInit { ...@@ -285,33 +286,33 @@ export class CartPage implements OnInit {
formatDate() { formatDate() {
const date = new Date(); const date = new Date();
const months = [ const months = [
'Jan', "Jan",
'Feb', "Feb",
'Mar', "Mar",
'Apr', "Apr",
'May', "May",
'June', "June",
'July', "July",
'Aug', "Aug",
'Sep', "Sep",
'Oct', "Oct",
'Nov', "Nov",
'Dec' "Dec"
]; ];
let hours = date.getHours(); let hours = date.getHours();
const minutes = date.getMinutes(); const minutes = date.getMinutes();
const ampm = hours >= 12 ? 'PM' : 'AM'; const ampm = hours >= 12 ? "PM" : "AM";
hours = hours % 12; hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12' hours = hours ? hours : 12; // the hour '0' should be '12'
const newminutes = minutes < 10 ? '0' + minutes : minutes; const newminutes = minutes < 10 ? "0" + minutes : minutes;
const strTime = hours + ':' + newminutes + ' ' + ampm; const strTime = hours + ":" + newminutes + " " + ampm;
return ( return (
months[date.getMonth()] + months[date.getMonth()] +
' ' + " " +
date.getDate() + date.getDate() +
',' + "," +
date.getFullYear() + date.getFullYear() +
' ' + " " +
strTime strTime
); );
} }
......
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { PreferencePage } from './preference.page';
const routes: Routes = [
{
path: '',
component: PreferencePage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [PreferencePage]
})
export class PreferencePageModule {}
<div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="goBack()">
<img src="../assets/Group17_2.png" />
</button>
<div class="nav_title floatLeft">
<h4>Preference</h4>
</div>
<div class="clear"></div>
</div>
<ion-content>
<div class="preference-wrapper">
<div class="pref-wrap-two">
<ion-grid>
<ion-row *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0">
<ion-col size="6" *ngFor="let categories of categoriesService.activecategories">
<div class="preference-box">
<input type="checkbox" class="preference" />
<img [src]="categories.catImage" onerror="this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'">
<h1>{{categories.catName}}</h1>
</div>
</ion-col>
</ion-row>
</ion-grid>
</div>
<div class="bottom-button">
<button class="show-btn" (click)="goToPage('nearby')">
Continue
</button>
<span>SKIP</span>
</div>
</div>
</ion-content>
\ No newline at end of file
.preference-wrapper {
padding: 20px 20px 110px 20px;
.bottom-button {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
padding: 20px;
text-align: center;
z-index: 2;
button {
width: 100%;
background-color: #29285b;
color: #fff;
border-radius: 8px;
height: 45px;
font-size: 16px;
text-transform: uppercase;
}
span {
text-transform: uppercase;
font-size: 16px;
text-align: center;
margin-top: 10px;
display: inline-block;
font-weight: 600;
}
}
.pref-wrap-two {
.preference-box {
width: 100%;
position: relative;
img {
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
object-fit: cover;
}
h1 {
color: #fff;
position: absolute;
bottom: 0px;
left: 14px;
font-size: 14px;
text-transform: uppercase;
z-index: 2;
}
.preference {
-webkit-appearance: none;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
width: 100%;
height: 90px;
padding: 17px;
outline: none;
-webkit-transition: all 0.6s ease-in-out;
transition: all 0.6s ease-in-out;
position: relative;
display: block;
z-index: 9;
}
&:before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
background-color: rgba(0, 0, 0, 0.46);
z-index: 1;
}
}
.preference:checked {
&:before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
background-color: rgba(41, 40, 91, 0.52);
z-index: 9;
}
}
}
}
\ No newline at end of file
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PreferencePage } from './preference.page';
describe('PreferencePage', () => {
let component: PreferencePage;
let fixture: ComponentFixture<PreferencePage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PreferencePage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PreferencePage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from "@angular/core";
import { CategoriesService } from "./../../config/category.service";
import { ServiceService } from "./../../config/service.service";
@Component({
selector: "app-preference",
templateUrl: "./preference.page.html",
styleUrls: ["./preference.page.scss"]
})
export class PreferencePage implements OnInit {
constructor(
private categoriesService: CategoriesService,
private service: ServiceService
) {}
ngOnInit() {}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment