Commit ff6a66f3 by Jansa Jose

dc

parent d3677ac3
......@@ -26,7 +26,7 @@ import { ForgotComponent } from './forgot/forgot.component';
HttpClientModule,
MalihuScrollbarModule.forRoot()
],
providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
......@@ -21,7 +21,7 @@
</a>
</li>
<li class="nav-item">
<a class="nav-link appointment" data-toggle="tab" href="#appointment">Appointments
<a class="nav-link appointment" data-toggle="tab" href="#appointment" #appointmentTab>Appointments
<div class="notification" *ngIf="successBookDtls">{{ successBookDtls?.length || '0' }}</div>
</a>
</li>
......@@ -244,8 +244,7 @@
<td>{{i+1}}</td>
<td>{{bookData.scheduled_date+' '+bookData.scheduled_time}}</td>
<td>{{bookData.car_name}}</td>
<td>{{(bookData.is_multiple ==='0')? bookData.mechanic_data[0].first_name+' '+bookData.mechanic_data[0].last_name : bookData.mechanic_data.length+' Requests'}}</td>
<!-- <td>{{bookData.cost}}</td> -->
<td>{{(bookData.is_multiple === '0')? bookData.mechanic_data[0].first_name+' '+bookData.mechanic_data[0].last_name : bookData.mechanic_data.length+' Requests'}}</td>
<td>
<div class="floatLeft">
<div class="btn-group btn-group-justified">
......@@ -275,11 +274,12 @@
<td>{{mechdata.phone}}</td>
<td>{{mechdata.rating > 0?mechdata.rating+'/5':''}}</td>
<td>{{mechdata.location}}</td>
<td>{{mechdata.custom_amount > 0 ?mechdata.custom_amount:bookData.cost}}</td>
<td>{{mechdata.custom_amount > 0 ?mechdata.custom_amount:mechdata.mechanic_amount}}</td>
<td>
<div class="btn-group btn-group-justified">
<button class="btn btn-default btn-sm" *ngIf="mechdata.status =='0'">Waiting for Approval</button>
<button class="btn btn-success btn-sm" *ngIf="mechdata.status =='1' && bookData.status != '1'" (click)="mechanicQuoteAccept(bookData.booking_id,mechdata.mechanic_id)">Accept</button>
<button class="btn btn-default btn-sm" *ngIf="bookData.status == '1' && !mechdata.custom_service_quote">Accepted</button>
<button class="btn btn-default btn-sm" *ngIf="mechdata.status == '0'">Waiting for Approval</button>
<button class="btn btn-success btn-sm" [attr.bookAmount]="mechdata.custom_amount > 0 ?mechdata.custom_amount:mechdata.mechanic_amount" *ngIf="mechdata.status == '1' && bookData.status != '1'" (click)="mechanicQuoteAccept($event,bookData.booking_id,mechdata.mechanic_id)">Accept</button>
<button class="btn btn-info btn-sm" (click)="showCustQuote(bookData.booking_id,mechdata.mechanic_id,1)" data-toggle="modal" data-target="#quote" *ngIf="mechdata.status =='1' && mechdata.custom_service_quote">View Quote</button>
</div>
</td>
......@@ -387,7 +387,7 @@
<td>{{mechdata.phone}}</td>
<td>{{mechdata.rating > 0?mechdata.rating+'/5':''}}</td>
<td>{{mechdata.location}}</td>
<td>{{mechdata.custom_amount > 0 ?mechdata.custom_amount:bookData.cost}}</td>
<td>{{mechdata.custom_amount > 0 ?mechdata.custom_amount:mechdata.mechanic_amount}}</td>
<td>
<div class="btn-group btn-group-justified">
<button class="btn btn-info btn-sm" (click)="showCustQuote(bookData.booking_id,mechdata.mechanic_id,2)" data-toggle="modal" data-target="#quote" *ngIf="mechdata.status =='1' && mechdata.custom_service_quote">View Quote</button>
......@@ -750,7 +750,7 @@
<div class="modal" id="quotes">
<div class="modal-dialog modal-full">
<div class="modal-content login_modal_wrapper" malihu-scrollbar [scrollbarOptions]="scrollbarOptions">
<div #closeQuoteWizard class="modal_close" data-dismiss="modal" (click)="scheduleDateInit = false; scheduleMechanic = false">
<div #closeQuoteWizard class="modal_close" data-dismiss="modal" (click)="scheduleDateInit = false; scheduleMechanic = false; selMechanics = [];">
&times;
</div>
<div class="modal-body">
......@@ -799,8 +799,8 @@
</div>
<div class="mechanic_detail relative">
<div class="custom_checkbox_stack">
<input class="custom_checkbox" id="custom_checkbox-1" type="checkbox" value="value1">
<label for="custom_checkbox-1"></label>
<input class="custom_checkbox" [attr.id]="'custom_checkbox-1'+i" (click)="checkboxChange(i,mechanic.mechanic_id,$event,mechanic.estimate)" type="checkbox" value="value1">
<label [attr.for]="'custom_checkbox-1'+i"></label>
</div>
<h4>{{mechanic.display_name}}</h4>
<div *ngIf="mechanic.shop_id != 0; else mechanicDetails">
......@@ -815,8 +815,8 @@
<p>{{mechanic.distance | number:'1.2-2'}} miles away from you</p>
</ng-template>
<button (click)="scheduleNow(mechanic.mechanic_id,mechanic.estimate)"
[ngClass]="{'book_now':scheduleDateInit == true && scheduleMechanic == mechanic.mechanic_id,
'book_now_disabled':scheduleDateInit == false || (scheduleDateInit == true && scheduleMechanic != mechanic.mechanic_id)}">
[ngClass]="{'book_now':scheduleDateInit == true && scheduleMechanic == mechanic.mechanic_id && selMechanics.length <= 0,
'book_now_disabled':scheduleDateInit == false || (scheduleDateInit == true && scheduleMechanic != mechanic.mechanic_id) || selMechanics.length > 0}">
{{loginDetails ? 'Book now' : 'Login and Continue' }}
</button>
</div>
......@@ -891,7 +891,7 @@
<div class="clear"></div>
<p>Estimated Price : <strong>{{estimatedPrice}}</strong></p>
<div class="clear"></div>
<button class="request_all_btn">Request All</button>
<button class="request_all_btn" *ngIf="selMechanics.length > 0 && scheduleDateInit == true" (click)="scheduleMultipleRequest()">Request All</button>
</div>
<div class="service_map">
<agm-map #gm [latitude]="lat" [longitude]="lng" [fitBounds]="true">
......@@ -965,6 +965,7 @@
<!-- BOOKING-QUOTE-MODAL-ENDS -->
<!-- BOOKING-SUCCESS-MODAL-STARTS -->
<button #successModel class="hide" data-toggle="modal" data-target="#success"></button>
<div class="modal" id="success">
<div class="modal-dialog modal-full">
<div class="modal-content login_modal_wrapper">
......@@ -991,6 +992,8 @@
<!-- BOOKING-SUCCESS-MODAL-ENDS -->
<!-- BOOKING-FAILURE-MODAL-STARTS -->
<button #failureModel class="hide" data-toggle="modal" data-target="#failure"></button>
<div class="modal" id="failure">
<div class="modal-dialog modal-full">
<div class="modal-content login_modal_wrapper">
......
......@@ -6,6 +6,7 @@ import { WebService } from './../../provider/web.service';
import { MapsAPILoader } from '@agm/core';
import { SubjectService } from './../../provider/subject.service';
import { google } from '@google/maps';
import { apiConfig } from '../../../environments/server.config';
import { ImageStorage } from '../../../environments/server.config';
import { formatDate } from '@angular/common';
......@@ -28,9 +29,11 @@ export class DashboardComponent implements OnInit {
errMessage: any;
modelDates: number[] = new Array();
monthArray: any[] = new Array(12);
mechanics: string = '';
editProfile;
loginDetails: any;
selectedFile: File;
selMechanics: any[] = new Array();
profile_image: any;
mechCustQuote: number[] = new Array();
confirmParam: string = '';
......@@ -73,8 +76,8 @@ export class DashboardComponent implements OnInit {
currDate: any;
nextDate: any;
dateStep: number = 0;
activeTab: any;
dateSection: any[] = new Array();
serverUrl: string;
imageServer: string;
mechanicData: any;
autoSchedule: boolean;
......@@ -96,11 +99,14 @@ export class DashboardComponent implements OnInit {
@ViewChild("confirmModal") public confirmModalRef: ElementRef;
@ViewChild("googleLocVin") public googleLocVinRef: ElementRef;
@ViewChild("goTostep1") public goTostep1Ref: ElementRef;
@ViewChild("failureModel") public failureModelRef: ElementRef;
@ViewChild("successModel") public successModelRef: ElementRef;
@ViewChild("step2nextBtn") public step2nextRef: ElementRef;
@ViewChild("step3nextBtn") public step3nextRef: ElementRef;
@ViewChild("closeQuoteWizard") closeQuoteWizardRef: ElementRef;
@ViewChild("googleLocDetails") public googleLocDetailsRef: ElementRef;
@ViewChild("newGoogleLocSearch") public newGoogleLocRef: ElementRef;
@ViewChild("appointmentTab") public appointmentTabRef: ElementRef;
@ViewChild("serviceHistoryTab") public serviceHistoryTabRef: ElementRef;
@ViewChild("closeVehicleAddForm") public closeVehicleAddFormRef: ElementRef;
......@@ -118,15 +124,15 @@ export class DashboardComponent implements OnInit {
this.nextDate = new Date();
this.issuesData = false;
this.loader = false;
this.activeTab = 'profile';
this.errMessage = false;
this.vehDetails = false;
this.serverUrl = apiConfig;
this.imageServer = ImageStorage;
this.searchLocError = false;
this.showLeftArrow = false;
this.showRightArrow = true;
this.scheduleDateInit = false;
this.googlesearchLocError = false;
this.googlesearchLocError = false;
this.editProfileSubmitClick = false;
this.scheduleMechanic = false;
this.optionalDescription = '';
......@@ -137,10 +143,23 @@ export class DashboardComponent implements OnInit {
this.tab = 'active';
this.route.queryParams.subscribe(params => {
this.activeTab = params['tab'];
let payStatus = params['status'];
let activeTab = params['tab'];
if(payStatus && payStatus !=''){
if(payStatus == 'success')
this.successModelRef.nativeElement.click();
if(payStatus == 'failure')
this.failureModelRef.nativeElement.click();
}
if(this.activeTab == 'service'){
this.serviceHistoryTabRef.nativeElement.click();
if(activeTab && activeTab !=''){
if(activeTab == 'service'){
this.serviceHistoryTabRef.nativeElement.click();
}
if(activeTab == 'appointment'){
this.appointmentTabRef.nativeElement.click();
}
}
});
......@@ -210,7 +229,7 @@ export class DashboardComponent implements OnInit {
this.webService.post_data('getCustBookDetails', {'customer_id':this.loginDetails.customer_id}).subscribe(response => {
if ( response.status == '1' && response.bookData != 'undefined' && response.bookData != undefined && response.bookData != 'null' && response.bookData != null ) {
let bookings = response.bookData;
console.log(bookings)
console.log(bookings);
let successBooking: any[] = new Array();
let bookingDetails: any[] = new Array();
......@@ -648,7 +667,6 @@ export class DashboardComponent implements OnInit {
this.webService.post_data('getNearByMechanics',searchData).subscribe(response => {
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)));
......@@ -732,6 +750,24 @@ export class DashboardComponent implements OnInit {
this.loader = true;
this.wizardData['cost'] = cost;
this.wizardData['multiple'] ='0';
this.confirmBooking();
}
scheduleMultipleRequest(){
if(!this.loginDetails){
this.routeToIndex();
}
let coma = '';
const thisObj = this;
this.mechanics = '';
this.selMechanics.forEach(function (mechanic_data) {
thisObj.mechanics += coma+mechanic_data.mechanic_id+':'+mechanic_data.amount;
coma = ',';
})
this.wizardData['mechanic_id'] = thisObj.mechanics;
this.wizardData['cost'] = this.estimatedPrice;
this.wizardData['multiple'] ='1';
this.confirmBooking();
}
......@@ -825,12 +861,13 @@ export class DashboardComponent implements OnInit {
});
}
mechanicQuoteAccept(booking_id,mechanic_id){
mechanicQuoteAccept(event,booking_id,mechanic_id){
if(!booking_id || !mechanic_id){
return false;
}
this.showConfirmPopUp('acceptQuote',{bookingId:booking_id,mechanicId:mechanic_id});
let amount = event.target.attributes.bookAmount.value;
this.showConfirmPopUp('acceptQuote',{bookingId:booking_id,mechanicId:mechanic_id,amount:amount});
}
cnfCancelBook(booking_id){
......@@ -874,11 +911,26 @@ export class DashboardComponent implements OnInit {
acceptQuote(param: any){
this.webService.post_data('acceptMechanicQuote',param).subscribe(response => {
if(response.status == 'success'){
this.getCustBookDetails();
document.location.href = this.serverUrl+'payNow/'+response.data;
// this.getCustBookDetails();
}
})
}
checkboxChange(index,mechanic_id,event,estimate){
if (event.target.checked) {
this.selMechanics.push({id:index,mechanic_id:mechanic_id,amount:estimate});
} else {
let id = this.selMechanics.findIndex(x => x.id == index);
if (id != -1) {
this.selMechanics.splice(id, 1);
}
}
}
scrollToTop(id){
$('#'+id).stop().animate({scrollTop: 0}, 800);
}
......
......@@ -489,7 +489,7 @@
<div class="modal" id="quotes">
<div class="modal-dialog modal-full">
<div class="modal-content login_modal_wrapper" malihu-scrollbar [scrollbarOptions]="scrollbarOptions">
<div #closeQuoteWizard class="modal_close" data-dismiss="modal" (click)="scheduleDateInit = false; scheduleMechanic = false">
<div #closeQuoteWizard class="modal_close" data-dismiss="modal" (click)="scheduleDateInit = false; scheduleMechanic = false; selMechanics = [];">
&times;
</div>
<div class="modal-body">
......@@ -537,8 +537,8 @@
</div>
<div class="mechanic_detail relative">
<div class="custom_checkbox_stack">
<input class="custom_checkbox" id="custom_checkbox-1" type="checkbox" value="value1">
<label for="custom_checkbox-1"></label>
<input class="custom_checkbox" [attr.id]="'custom_checkbox-1'+i" (click)="checkboxChange(i,mechanic.mechanic_id,$event,mechanic.estimate)" type="checkbox" value="value1">
<label [attr.for]="'custom_checkbox-1'+i"></label>
</div>
<h4>{{mechanic.display_name}}</h4>
......@@ -553,8 +553,8 @@
<h6>{{mechanic.phone}}</h6>
<p>{{mechanic.distance | number:'1.2-2' }} miles away from you</p>
</ng-template>
<button (click)="scheduleNow(mechanic.mechanic_id,mechanic.estimate)" [ngClass]="{'book_now':scheduleDateInit == true && scheduleMechanic == mechanic.mechanic_id,
'book_now_disabled':scheduleDateInit == false || (scheduleDateInit == true && scheduleMechanic != mechanic.mechanic_id)}">
<button (click)="scheduleNow(mechanic.mechanic_id,mechanic.estimate)" [ngClass]="{'book_now':scheduleDateInit == true && scheduleMechanic == mechanic.mechanic_id && selMechanics.length <= 0,
'book_now_disabled':scheduleDateInit == false || (scheduleDateInit == true && scheduleMechanic != mechanic.mechanic_id) || selMechanics.length > 0}">
{{loginDetails ? 'Book now' : 'Login and Continue' }}
</button>
</div>
......@@ -629,7 +629,7 @@
<div class="clear"></div>
<p>Estimated Price : <strong>{{estimatedPrice}}</strong></p>
<div class="clear"></div>
<button class="request_all_btn">Request All</button>
<button class="request_all_btn" *ngIf="selMechanics.length > 0 && scheduleDateInit == true" (click)="scheduleMultipleRequest()">Request All</button>
</div>
<div class="service_map">
<agm-map #gm [latitude]="lat" [longitude]="lng" [fitBounds]="true">
......
......@@ -68,7 +68,9 @@ export class IndexComponent implements OnInit {
currDate: any;
nextDate: any;
dateStep: number = 0;
mechanics: string = '';
dateSection: any[] = new Array();
selMechanics: any[] = new Array();
imageServer: string;
mechanicData: any;
autoSchedule: boolean;
......@@ -456,6 +458,25 @@ export class IndexComponent implements OnInit {
this.confirmBooking();
}
scheduleMultipleRequest(){
if(!this.loginDetails){
this.autoSchedule = true;
this.loginModalRef.nativeElement.click();
return false;
}
let coma = '';
const thisObj = this;
this.mechanics = '';
this.selMechanics.forEach(function (mechanic_data) {
thisObj.mechanics += coma+mechanic_data.mechanic_id+':'+mechanic_data.amount;
coma = ',';
})
this.wizardData['mechanic_id'] = thisObj.mechanics;
this.wizardData['cost'] = this.estimatedPrice;
this.wizardData['multiple'] ='1';
this.confirmBooking();
}
confirmBooking(){
this.wizardData['customer_id'] = this.loginDetails.customer_id;
this.wizardData['selected_issues'] = this.selectedIssues;
......@@ -526,6 +547,17 @@ export class IndexComponent implements OnInit {
reader.readAsDataURL(optionalImg);
}
checkboxChange(index,mechanic_id,event,estimate){
if (event.target.checked) {
this.selMechanics.push({id:index,mechanic_id:mechanic_id,amount:estimate});
} else {
let id = this.selMechanics.findIndex(x => x.id == index);
if (id != -1) {
this.selMechanics.splice(id, 1);
}
}
}
scrollToBottom(id){
$('#'+id).stop().animate({scrollTop: $('#'+id)[0].scrollHeight}, 1500);
}
......
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