Commit 2e8a234a by Tobin

daily commit

parent 3123a4e6
......@@ -18,9 +18,6 @@
<a class="nav-link vehicle" data-toggle="tab" href="#vehicle">My Vehicle</a>
</li>
<li class="nav-item">
<a class="nav-link estimate" data-toggle="tab" href="#estimate">Estimates</a>
</li>
<li class="nav-item">
<a class="nav-link appointment" data-toggle="tab" href="#appointment">Appointments</a>
</li>
<li class="nav-item">
......@@ -39,120 +36,109 @@
<section class="dashboard_tab_content">
<div class="container-fluid">
<div class="tab-content">
<div class="loader_overlay" *ngIf="loader"></div>
<div class="tab-pane container active" id="profile">
<div class="row">
<div class="col-md-7">
<div class="row line_row">
<div class="col-md-12">
<h3>Personal Information</h3>
<hr>
<form [formGroup]="editProfile" (ngSubmit)="submitProfileEdit(editProfile.value)">
<div class="row">
<div class="col-md-7">
<div class="row line_row">
<div class="col-md-12">
<h3>Personal Information</h3>
<hr>
</div>
</div>
</div>
<div class="row line_row">
<div class="col-md-12">
<p>Profile Picture</p>
<div class="profile_pic">
<div class="edit">
<input type="file">
<div class="row line_row">
<div class="col-md-12">
<p>Profile Picture</p>
<div class="profile_pic">
<div class="edit">
<input type="file">
</div>
</div>
</div>
</div>
</div>
<div class="row line_row">
<div class="col-md-6">
<p>First Name</p>
<input class="text_input" placeholder="" type="text">
</div>
<div class="col-md-6">
<p>Last Name</p>
<input class="text_input" placeholder="" type="text">
</div>
</div>
<div class="row line_row">
<div class="col-md-6">
<p>Email</p>
<input class="text_input" placeholder="" type="text">
</div>
<div class="col-md-6">
<p>Zip Code</p>
<input class="text_input" placeholder="" type="text">
</div>
</div>
<p>Contact Details</p>
<div class="row line_row">
<div class="col-md-6">
<input class="text_input" placeholder="House Name" type="text">
</div>
<div class="col-md-6">
<input class="text_input" placeholder="Street name" type="text">
</div>
</div>
<div class="row line_row">
<div class="col-md-6">
<input class="text_input" placeholder="State" type="text">
</div>
<div class="col-md-6">
<input class="text_input" placeholder="Region" type="text">
</div>
</div>
<div class="row line_row">
<div class="col-md-6">
<input class="text_input" placeholder="Country" type="text">
</div>
<div class="col-md-6">
<input class="text_input" placeholder="Phone Number" type="number">
</div>
</div>
<div class="row line_row">
<div class="col-md-12">
<h3>Login Information</h3>
<hr>
</div>
</div>
<div class="row line_row">
<div class="col-md-6">
<p>User Name</p>
<input class="text_input" placeholder="" type="text">
</div>
<div class="col-md-6">
<p>Email Address</p>
<input class="text_input" placeholder="" type="mail">
<div class="row line_row">
<div class="col-md-6">
<p>First Name</p>
<input class="text_input" placeholder="" type="text" formControlName="first_name"
[ngClass]="{'input_error': !editProfile.controls['first_name'].valid && (editProfile.controls['first_name'].dirty || editProfile.controls['first_name'].touched || editProfileSubmitClick),
'input_success': editProfile.controls['first_name'].touched && editProfile.controls['first_name'].valid}"
(click)="editProfileSubmitClick = false">
</div>
<div class="col-md-6">
<p>Last Name</p>
<input class="text_input" placeholder="" type="text" formControlName="last_name"
[ngClass]="{'input_error': !editProfile.controls['last_name'].valid && (editProfile.controls['last_name'].dirty || editProfile.controls['last_name'].touched || editProfileSubmitClick),
'input_success': editProfile.controls['last_name'].touched && editProfile.controls['last_name'].valid}"
(click)="editProfileSubmitClick = false">
</div>
</div>
</div>
<div class="row line_row">
<div class="col-md-12">
<h3>Change Password</h3>
<hr>
<div class="row line_row">
<div class="col-md-6">
<p>Phone</p>
<input class="text_input" placeholder="" type="text" formControlName="phone"
[ngClass]="{'input_error': !editProfile.controls['phone'].valid && (editProfile.controls['phone'].dirty || editProfile.controls['phone'].touched || editProfileSubmitClick),
'input_success': editProfile.controls['phone'].touched && editProfile.controls['phone'].valid}"
(click)="editProfileSubmitClick = false">
</div>
<div class="col-md-6"></div>
</div>
<p>Addess</p>
<div class="row line_row">
<div class="col-md-12">
<textarea class="text_input address_height" placeholder="" type="text" formControlName="address"
[ngClass]="{'input_error': !editProfile.controls['address'].valid && (editProfile.controls['address'].dirty || editProfile.controls['address'].touched || editProfileSubmitClick),
'input_success': editProfile.controls['address'].touched && editProfile.controls['address'].valid}"
(click)="editProfileSubmitClick = false"></textarea>
</div>
</div>
</div>
<div class="row line_row">
<div class="col-md-6">
<p>Current Password</p>
<input class="text_input" placeholder="" type="password">
<div class="row line_row">
<div class="col-md-12">
<h3>Login Information</h3>
<hr>
</div>
</div>
<div class="col-md-6">
<p>New Password</p>
<input class="text_input" placeholder="" type="password">
<div class="row line_row">
<div class="col-md-6">
<p>Email Address ( Username )</p>
<input class="text_input" placeholder="" type="mail" formControlName="email"
[ngClass]="{'input_error': !editProfile.controls['email'].valid && (editProfile.controls['email'].dirty || editProfile.controls['email'].touched || editProfileSubmitClick),
'input_success': editProfile.controls['email'].touched && editProfile.controls['email'].valid}"
(click)="editProfileSubmitClick = false">
</div>
</div>
</div>
<div class="row line_row">
<div class="col-md-6">
<p>Confirm new Password</p>
<input class="text_input" placeholder="" type="password">
<div class="row line_row">
<div class="col-md-12">
<h3>Change Password</h3>
<hr>
</div>
</div>
<div class="col-md-6">
<div class="row line_row">
<div class="col-md-6">
<p>New Password</p>
<input class="text_input" placeholder="" type="password" formControlName="password"
[ngClass]="{'input_error': !editProfile.controls['password'].valid && editProfile.controls['password'].value != '',
'input_success': editProfile.controls['password'].valid && editProfile.controls['password'].value != ''}"
(click)="editProfileSubmitClick = false">
</div>
<div class="col-md-6">
<p>Confirm new Password</p>
<input class="text_input" placeholder="" type="password" formControlName="cpassword"
[ngClass]="{'input_error': !editProfile.controls['cpassword'].valid || (editProfile.controls['password'].value != editProfile.controls['cpassword'].value),
'input_success': editProfile.controls['password'].value != '' && editProfile.controls['cpassword'].valid && (editProfile.controls['password'].value == editProfile.controls['cpassword'].value)}"
(click)="editProfileSubmitClick = false">
</div>
<div class="col-md-6"> </div>
</div>
</div>
<div class="row line_row">
<div class="col-md-12">
<button class="save_btn">Save</button>
<div class="row line_row">
<div class="col-md-12">
<button type="submit" class="save_btn">Save</button>
</div>
</div>
</div>
<div class="col-md-5"></div>
</div>
<div class="col-md-5"></div>
</div>
</form>
</div>
<div class="tab-pane container fade" id="vehicle">
<div class="row">
......@@ -208,10 +194,6 @@
<button type="button" class="btn btn-secondary btn-sm" data-toggle="modal" data-target="#editvehicle">Edit</button>
<button type="button" class="btn btn-danger btn-sm">Delete</button>
</div>
<!-- <button class="book">Book Now</button>
<button class="edit" data-toggle="modal" data-target="#editvehicle"></button>
<button class="delete"></button>
<div class="clear"></div>-->
</div>
</li>
<li>
......@@ -248,10 +230,6 @@
<button type="button" class="btn btn-secondary btn-sm" data-toggle="modal" data-target="#editvehicle">Edit</button>
<button type="button" class="btn btn-danger btn-sm">Delete</button>
</div>
<!-- <button class="book">Book Now</button>
<button class="edit" data-toggle="modal" data-target="#editvehicle"></button>
<button class="delete"></button>
<div class="clear"></div>-->
</div>
</li>
<li>
......@@ -288,10 +266,6 @@
<button type="button" class="btn btn-secondary btn-sm" data-toggle="modal" data-target="#editvehicle">Edit</button>
<button type="button" class="btn btn-danger btn-sm">Delete</button>
</div>
<!-- <button class="book">Book Now</button>
<button class="edit" data-toggle="modal" data-target="#editvehicle"></button>
<button class="delete"></button>
<div class="clear"></div>-->
</div>
</li>
<li>
......
......@@ -537,4 +537,8 @@
}
}
}
}
.address_height {
height: 65px !important;
}
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { FormGroup, FormControl, Validators, ValidationErrors } from '@angular/forms';
import { ValidationService } from './../../provider/validation.service';
import { WebService } from './../../provider/web.service';
import { SubjectService } from './../../provider/subject.service';
import { ImageStorage } from '../../../environments/server.config';
@Component({
selector: 'app-dashboard',
......@@ -7,11 +12,76 @@ import { Router, ActivatedRoute } from '@angular/router';
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent implements OnInit {
tab: any;
constructor(private router : Router) { }
loader: boolean;
editProfile;
user_name: string;
loginDetails: any;
loginResponse: any;
editProfileSubmitClick: boolean;
constructor(private router : Router,
private route : ActivatedRoute,
public errorMsg : ValidationService,
public webService : WebService,
public subjectService : SubjectService) {
this.loader = false;
this.editProfileSubmitClick = false;
}
ngOnInit() {
this.loginResponse.status = "success";
this.loginResponse.message = "message";
this.tab = 'active';
this.subjectService.getLoginData().subscribe(loginData => {
this.loginDetails = JSON.parse(this.webService.getLocalStorageItem('userData'));
if(this.loginDetails){
console.log(this.loginDetails);
this.editProfile = new FormGroup({
email: new FormControl(this.loginDetails.email, [Validators.required, Validators.maxLength(50), Validators.pattern('^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$')]),
phone: new FormControl(this.loginDetails.phone, [Validators.required, Validators.maxLength(15), Validators.pattern("^[0-9\ ( ) + , - ]+$")]),
address: new FormControl(this.loginDetails.address, [Validators.required, Validators.maxLength(250)]),
password: new FormControl('', [Validators.maxLength(16), Validators.minLength(6)]),
cpassword: new FormControl('', [Validators.maxLength(16), Validators.minLength(6)]),
last_name: new FormControl(this.loginDetails.last_name, [Validators.required, Validators.maxLength(50), Validators.pattern("^[a-zA-Z\ _ - ' \/]+$")]),
first_name: new FormControl(this.loginDetails.first_name, [Validators.required, Validators.maxLength(50), Validators.pattern("^[a-zA-Z\ _ - ' \/]+$")])
});
} else {
this.router.navigate(['index']);
}
});
}
submitProfileEdit(data){
if(this.editProfile.invalid){
return false;
}
const This = this;
this.loader = true;
let funcName = 'edit_customer_profile';
this.webService.post_data(funcName, data).subscribe(response => {
this.loader = false;
if ( response.status == '1') {
this.webService.setLocalStorageItem('userData', JSON.stringify(response.data));
this.subjectService.sendLoginData('logged_in');
this.editProfile.nativeElement.click();
} else {
response.status = 'error';
response.message = (response.message == '')?this.errorMsg.errorList.req_failure:response.message;
this.editProfile = response;
}
},error => {
this.editProfile = {'status':'error','message':this.errorMsg.errorList.req_failure};
},() => {
// setTimeout( function() {
// This.loginResponse = false;
// }, 2000)
});
}
routeToIndex(){
......
......@@ -243,7 +243,7 @@
<div class="modal" id="wizard">
<div class="modal-dialog modal-full">
<div class="modal-content login_modal_wrapper">
<div class="modal_close" data-dismiss="modal" (click)="resetWizard()">
<div #closeWizard class="modal_close" data-dismiss="modal" (click)="resetWizard()">
&times;
</div>
<div class="modal-body">
......@@ -413,7 +413,7 @@
<div class="col-md-12 textCenter">
<button *ngIf="!loginDetails" (click)="resetForm()" class="wizard_signin" type="button" data-toggle="modal" data-target="#login">SIGN IN</button>
<button (click)="getQuote()" class="wizard_quotes" type="button" data-toggle="modal" data-target="#quotes">VIEW SERVICE QUOTE</button>
<input type="hidden" #indexLoginModal data-toggle="modal" data-target="#quotes">
<input type="hidden" #indexLoginModal data-toggle="modal" data-target="#login">
</div>
</div>
</wizard-step>
......@@ -433,7 +433,7 @@
<div class="modal" id="quotes">
<div class="modal-dialog modal-full">
<div class="modal-content login_modal_wrapper">
<div class="modal_close" data-dismiss="modal">
<div #closeQuoteWizard class="modal_close" data-dismiss="modal">
&times;
</div>
<div class="modal-body">
......@@ -488,7 +488,11 @@
<h6>{{mechanic.phone}}</h6>
</ng-template>
<button class="view_profile">View Profile</button>
<button #bookNow class="book_now" (click)="scheduleNow()">Book now</button>
<button (click)="scheduleNow(mechanic.mechanic_id)"
[ngClass]="{'book_now':scheduleDateInit == true,
'book_now_disabled':scheduleDateInit == false}">
{{loginDetails ? 'Book now' : 'Login and Continue' }}
</button>
</div>
<div class="clear"></div>
</div>
......
......@@ -896,6 +896,23 @@
outline: none;
}
}
.book_now_disabled{
border: 1px solid #808080;
color: #808080;
background: transparent;
margin: 5px;
padding-left: 15px;
padding-right: 15px;
border-radius: 20px;
height: 35px;
font-size: 14px;
&:focus {
outline: none;
}
pointer-events: none;
cursor: default;
text-decoration: none;
}
}
}
}
......
......@@ -34,12 +34,13 @@ export class IndexComponent implements OnInit {
//Basic Location Search: TAB 1
autocomplete: any;
searchLocError: boolean;
@ViewChild("bookNow") public bookNowRef: ElementRef;
@ViewChild("goTostep1") public goTostep1Ref: ElementRef;
@ViewChild("closeWizard") public closeWizardRef: ElementRef;
@ViewChild("step2nextBtn") public step2nextRef: ElementRef;
@ViewChild("step3nextBtn") public step3nextRef: ElementRef;
@ViewChild("googleLocSearch") public searchElementRef: ElementRef;
@ViewChild("indexLoginModal") loginModalRef: ElementRef;
@ViewChild("closeQuoteWizard") closeQuoteWizardRef: ElementRef;
//Vehicle Details: TAB 2
vehicleDataForm;
......@@ -52,16 +53,18 @@ export class IndexComponent implements OnInit {
//Quote Page
today: any = new Date();
currDate: any;
nextDate: any;
dateStep: number = 0;
dateSection: any[] = new Array();
imageServer: string;
mechanicData: any;
currDate: any;
nextDate: any;
autoSchedule: boolean;
scheduleDateInit: boolean;
carModel: any;
carSearchJsonData: any;
modelDates: number[] = new Array();
carSearchJsonData: any;
constructor(
private router : Router,
......@@ -69,12 +72,14 @@ export class IndexComponent implements OnInit {
public webService : WebService,
public mapsAPILoader : MapsAPILoader,
public subjectService : SubjectService) {
this.autoSchedule = false;
this.imageServer = ImageStorage;
this.currDate = new Date();
this.nextDate = new Date();
this.loginDetails = false;
this.searchLocError = false;
this.scheduleDateInit = false;
this.vehicleDataFormSubmit = false;
this.currDate = new Date();
this.nextDate = new Date();
}
ngOnInit() {
......@@ -97,6 +102,10 @@ export class IndexComponent implements OnInit {
this.subjectService.getLoginData().subscribe(loginData => {
this.loginDetails = JSON.parse(this.webService.getLocalStorageItem('userData'));
if(this.loginDetails && this.autoSchedule){
this.confirmBooking();
}
});
this.mapsAPILoader.load().then(() => {
......@@ -287,6 +296,7 @@ export class IndexComponent implements OnInit {
}
getSchedule(time,index){
this.scheduleDateInit = true;
this.wizardData['schedule_date'] = {'date':this.formatDate(this.dateSection[index]),'time':time};
}
......@@ -300,25 +310,32 @@ export class IndexComponent implements OnInit {
return [year,month,day].join('-');
}
scheduleNow(){
scheduleNow(mechanic_id){
this.wizardData['mechanic_id'] = mechanic_id;
if(!this.loginDetails){
this.autoSchedule = true;
this.loginModalRef.nativeElement.click();
return false;
}
this.loader = true;
this.confirmBooking();
}
confirmBooking(){
this.wizardData['customer_id'] = this.loginDetails.customer_id;
this.webService.post_data('scheduleNow',this.wizardData).subscribe(response => {
this.loader = false;
if(response.status == '1'){
this.mechanicData = response.mechanic_data;
this.dateSection.push(new Date(this.today.setDate(this.today.getDate())));
this.dateSection.push(new Date(this.today.setDate(this.today.getDate() + 1)));
this.closeWizardRef.nativeElement.click();
this.closeQuoteWizardRef.nativeElement.click();
this.router.navigate(['../dashboard']);
} else {
return false;
}
},error => {
this.loader = false;
return false;
});
}
......
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