Commit e34368fe by Adarsh K

Merge branch 'muhsin' into 'master'

Muhsin See merge request !56
parents 5fb85ba7 6abb0eb2
......@@ -46,81 +46,36 @@
padding: 0px;
font-weight: 800;
}
ul {
margin: 0px;
padding: 0px;
padding-top: 30px;
li {
list-style: none;
margin-bottom: 15px;
p {
margin: 0px;
padding: 0px;
color: rgba(176, 174, 199, 1);
padding-top: 5px;
padding-bottom: 5px;
}
.styled-checkbox {
position: absolute; // take it out of document flow
opacity: 0; // hide it
&+label {
position: relative;
cursor: pointer;
padding: 0;
input {
width: 100%;
}
// Box.
&+label:before {
content: '';
margin-right: 10px;
display: inline-block;
vertical-align: text-top;
width: 20px;
height: 20px;
border-radius: 50%;
background: white;
border: 1px solid rgba(215, 213, 228, 1);
}
&:checked+label:before {
background: #29285b;
}
// Disabled state label.
&:disabled+label {
color: #b8b8b8;
cursor: auto;
}
// Disabled box.
&:disabled+label:before {
box-shadow: none;
background: #ddd;
}
// Checkmark. Could be replaced with an image
&:checked+label:after {
content: '';
position: absolute;
left: 6px;
top: 10px;
background: white;
width: 2px;
height: 2px;
box-shadow: 2px 0 0 white, 4px 0 0 white, 4px -2px 0 white, 4px -4px 0 white, 4px -6px 0 white, 4px -8px 0 white;
transform: rotate(45deg);
}
}
}
height: 45px;
border: 1px solid #e1e0eb;
border-radius: 4px;
padding-left: 10px;
padding-right: 10px;
margin-bottom: 20px;
}
.add_btn {
width: 100%;
height: 45px;
background-color: #29285b;
color: #fff;
border-radius: 4px;
}
}
.styled-checkbox {
position: absolute; // take it out of document flow
opacity: 0; // hide it
&+label {
& + label {
position: relative;
cursor: pointer;
padding: 0;
}
// Box.
&+label:before {
& + label:before {
content: '';
margin-right: 10px;
display: inline-block;
......@@ -133,21 +88,21 @@
}
// Box hover
// Box checked
&:checked+label:before {
&:checked + label:before {
background: #29285b;
}
// Disabled state label.
&:disabled+label {
&:disabled + label {
color: #b8b8b8;
cursor: auto;
}
// Disabled box.
&:disabled+label:before {
&:disabled + label:before {
box-shadow: none;
background: #ddd;
}
// Checkmark. Could be replaced with an image
&:checked+label:after {
&:checked + label:after {
content: '';
position: absolute;
left: 6px;
......@@ -155,7 +110,8 @@
background: white;
width: 2px;
height: 2px;
box-shadow: 2px 0 0 white, 4px 0 0 white, 4px -2px 0 white, 4px -4px 0 white, 4px -6px 0 white, 4px -8px 0 white;
box-shadow: 2px 0 0 white, 4px 0 0 white, 4px -2px 0 white, 4px -4px 0 white,
4px -6px 0 white, 4px -8px 0 white;
transform: rotate(45deg);
}
}
......@@ -82,11 +82,11 @@
width: 20px;
}
}
}
.ar-span {
color: rgba(206, 153, 76, 1);
margin-left: 10px;
}
}
p {
margin: 0px;
padding: 0px;
......@@ -162,8 +162,8 @@
text-transform: uppercase;
}
.btn-cancel {
border: 1px solid #29285B;
background-color: #29285B;
border: 1px solid #29285b;
background-color: #29285b;
}
.btn-logout {
background-color: #fff;
......
import { Injectable } from "@angular/core";
import { User, Signup, Address } from "./services/user";
import { auth } from "firebase/app";
import { Router, ActivatedRoute } from "@angular/router";
import { AngularFireAuth } from "@angular/fire/auth";
import { Injectable } from '@angular/core';
import { User, Signup, Address } from './services/user';
import { auth } from 'firebase/app';
import { Router, ActivatedRoute } from '@angular/router';
import { AngularFireAuth } from '@angular/fire/auth';
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import { ServiceService } from "./../config/service.service";
import { SubjectService } from "./../config/subject.service";
import { GooglePlus } from "@ionic-native/google-plus/ngx";
import { take } from "rxjs/operators";
import { from } from "rxjs";
} from '@angular/fire/firestore';
import { ServiceService } from './../config/service.service';
import { SubjectService } from './../config/subject.service';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
import { take } from 'rxjs/operators';
import { from } from 'rxjs';
@Injectable({
providedIn: "root"
providedIn: 'root'
})
export class AuthService {
loader: boolean;
......@@ -30,33 +30,33 @@ export class AuthService {
this.loader = true;
this.type = 1;
this.afAuth.authState.subscribe(user => {
console.log("here");
console.log('here');
console.log(user);
if (user) {
this.subjectService.sendLoginData(false);
this.userData = user;
console.log(this.userData);
this.service.set("user", JSON.stringify(this.userData));
this.service.set('user', JSON.stringify(this.userData));
this.SetUserData(user);
this.loader = false;
if (this.type === 1) {
this.router.navigateByUrl("home");
this.router.navigateByUrl('home');
} else {
this.router.navigateByUrl("verification");
this.router.navigateByUrl('verification');
}
} else {
console.log("here too");
console.log('here too');
this.loader = false;
this.subjectService.sendLoginData(true);
this.service.set("user", null);
JSON.parse(localStorage.getItem("user"));
this.router.navigateByUrl("login");
this.service.set('user', null);
JSON.parse(localStorage.getItem('user'));
this.router.navigateByUrl('login');
}
});
}
get isLoggedIn(): boolean {
const user = JSON.parse(localStorage.getItem("user"));
const user = JSON.parse(localStorage.getItem('user'));
return user !== null && user.emailVerified !== false ? true : false;
}
userData: any;
......@@ -70,21 +70,21 @@ export class AuthService {
return this.afAuth.auth
.signInWithEmailAndPassword(email, password)
.then(result => {
console.log("success");
console.log('success');
document.body.scrollTop = document.documentElement.scrollTop = 0;
this.SetUserData(result.user);
})
.catch(error => {
this.loader = false;
this.service.showToast(error.message, "bottom", "my-error", 1000);
this.service.showToast(error.message, 'bottom', 'my-error', 1000);
});
}
public async verify(otp: string) {
this.loader = true;
const custRef: AngularFirestoreCollection<any> = this.afs.collection(
"customers",
ref => ref.where("otp", "==", otp).where("uid", "==", this.userData.uid)
'customers',
ref => ref.where('otp', '==', otp).where('uid', '==', this.userData.uid)
);
custRef
.valueChanges()
......@@ -92,18 +92,18 @@ export class AuthService {
.subscribe((value: User[]) => {
if (value.length > 0) {
this.afs
.collection("customers")
.collection('customers')
.doc(this.userData.uid)
.update({ otp: "", phoneVerified: true });
this.service.set("type", 1);
.update({ otp: '', phoneVerified: true });
this.service.set('type', 1);
this.loader = false;
this.router.navigateByUrl("nearby");
this.router.navigateByUrl('nearby');
} else {
this.loader = false;
this.service.showToast(
"Please input valid OTP",
"bottom",
"my-error",
'Please input valid OTP',
'bottom',
'my-error',
1000
);
}
......@@ -112,7 +112,7 @@ export class AuthService {
profilePic(pic) {
this.afs
.collection("customers")
.collection('customers')
.doc(this.userData.uid)
.update({ profilePhoto: pic });
}
......@@ -123,7 +123,7 @@ export class AuthService {
this.afAuth.auth
.signInWithPopup(new auth.GoogleAuthProvider())
.then(result => {
console.log("success");
console.log('success');
console.log(result.additionalUserInfo.isNewUser);
if (
result.additionalUserInfo &&
......@@ -150,11 +150,11 @@ export class AuthService {
.signInWithPopup(new auth.FacebookAuthProvider())
.then(result => {
this.loader = false;
console.log("success");
console.log('success');
console.log(result);
})
.catch(err => {
this.service.showToast(err.message, "bottom", "my-error", 1000);
this.service.showToast(err.message, 'bottom', 'my-error', 1000);
});
} catch (error) {
This.loader = false;
......@@ -181,7 +181,7 @@ export class AuthService {
loginType: value.loginType
};
this.loggedUser = userData;
this.service.set("userData", JSON.stringify(this.loggedUser));
this.service.set('userData', JSON.stringify(this.loggedUser));
this.subjectService.sendUserData(JSON.stringify(this.loggedUser));
console.log(this.loggedUser);
});
......@@ -191,9 +191,9 @@ export class AuthService {
this.loader = true;
return this.afAuth.auth.signOut().then(() => {
this.subjectService.sendLoginData(true);
this.service.remove("user");
this.service.remove('user');
this.loader = false;
console.log("logout");
console.log('logout');
});
}
......@@ -201,9 +201,9 @@ export class AuthService {
this.type = 2;
console.log(userData.user);
const currencyData = {
currId: "123",
currName: "Australian dollar",
symbol: "A$"
currId: '123',
currName: 'Australian dollar',
symbol: 'A$'
};
const otp = Math.floor(1000 + Math.random() * 9000);
userData = userData.user;
......@@ -223,11 +223,11 @@ export class AuthService {
this.userPostData = postData;
console.log(postData);
this.afs
.collection("customers")
.collection('customers')
.doc(userData.uid)
.set(postData)
.then(() => {
console.log("successs");
console.log('successs');
});
}
......@@ -242,15 +242,15 @@ export class AuthService {
console.log(result.user);
this.afAuth.auth.currentUser.sendEmailVerification();
const currencyData = {
currId: "123",
currName: "Australian dollar",
symbol: "A$"
currId: '123',
currName: 'Australian dollar',
symbol: 'A$'
};
const custData = result.user;
const postData: User = {
uid: custData.uid,
status: true,
profilePhoto: "",
profilePhoto: '',
phoneVerified: false,
phone: userData.phone,
name: userData.name,
......@@ -263,11 +263,11 @@ export class AuthService {
this.userPostData = postData;
console.log(postData);
this.afs
.collection("customers")
.collection('customers')
.doc(custData.uid)
.set(postData)
.then(() => {
console.log("successs");
console.log('successs');
});
this.loader = false;
})
......@@ -282,7 +282,7 @@ export class AuthService {
console.log(this.userData.uid);
this.loader = true;
this.afs
.collection("address")
.collection('address')
.add({
uid: this.userData.uid
})
......@@ -306,13 +306,13 @@ export class AuthService {
const neworderId = docRef.id;
console.log(addrData);
this.afs
.collection("address")
.collection('address')
.doc(neworderId)
.set(addrData)
.then(() => {
console.log("Address add Successfully");
this.service.set("user", JSON.stringify(this.userData));
this.router.navigateByUrl("home");
console.log('Address add Successfully');
this.service.set('user', JSON.stringify(this.userData));
this.router.navigateByUrl('home');
document.body.scrollTop = document.documentElement.scrollTop = 0;
})
.catch(err => {
......
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