Commit ac26230f by Jansa Jose

vin audit

parent 34890a48
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
<td> <td>
<div class="floatLeft"> <div class="floatLeft">
<div class="btn-group btn-group-justified"> <div class="btn-group btn-group-justified">
<button class="btn btn-default btn-sm">{{bookData.status === '1' ? 'Accepted' : 'Pending'}}</button> <button class="{{bookData.status === '1' ? 'btn btn-success btn-sm' : 'btn btn-primary btn-sm'}}btn btn-primary btn-sm">{{bookData.status === '1' ? 'Accepted' : 'Pending'}}</button>
<button (click)="cnfCancelBook(bookData.booking_id)" class="btn btn-danger btn-sm">Cancel</button> <button (click)="cnfCancelBook(bookData.booking_id)" class="btn btn-danger btn-sm">Cancel</button>
</div> </div>
</div> </div>
...@@ -277,8 +277,8 @@ ...@@ -277,8 +277,8 @@
<td>{{mechdata.custom_amount > 0 ?mechdata.custom_amount:mechdata.mechanic_amount}}</td> <td>{{mechdata.custom_amount > 0 ?mechdata.custom_amount:mechdata.mechanic_amount}}</td>
<td> <td>
<div class="btn-group btn-group-justified"> <div class="btn-group btn-group-justified">
<button class="btn btn-default btn-sm" *ngIf="bookData.status == '1' && !mechdata.custom_service_quote">Accepted</button> <button class="btn btn-success 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-info 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-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> <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> </div>
...@@ -450,7 +450,7 @@ ...@@ -450,7 +450,7 @@
<select (change)="get_model($event.target.value)" class="vehicle_input_select" placeholder="Choose Make" <select (change)="get_model($event.target.value)" class="vehicle_input_select" placeholder="Choose Make"
formControlName="maker" [ngClass]="{'input_error': !vehicleDetailsAddForm.controls['maker'].valid && vehicleDetailsFormSubmitClick}"> formControlName="maker" [ngClass]="{'input_error': !vehicleDetailsAddForm.controls['maker'].valid && vehicleDetailsFormSubmitClick}">
<option value="" class="hide">MAKE</option> <option value="" class="hide">MAKE</option>
<option *ngFor="let car_date of carSearchJsonData; let key = index" value="{{key}}">{{car_date.brand}}</option> <option *ngFor="let car_date of carBrands; let key = index" value="{{car_date.veh_brand_id}}">{{car_date.maker}}</option>
</select> </select>
</div> </div>
</div> </div>
...@@ -459,7 +459,7 @@ ...@@ -459,7 +459,7 @@
<select class="vehicle_input_select" placeholder="Choose Model" formControlName="modelName" <select class="vehicle_input_select" placeholder="Choose Model" formControlName="modelName"
[ngClass]="{'input_error': !vehicleDetailsAddForm.controls['modelName'].valid && vehicleDetailsFormSubmitClick}"> [ngClass]="{'input_error': !vehicleDetailsAddForm.controls['modelName'].valid && vehicleDetailsFormSubmitClick}">
<option value="" class="hide">MODEL</option> <option value="" class="hide">MODEL</option>
<option *ngFor="let car_models of carModel">{{car_models}}</option> <option *ngFor="let car_models of carModel">{{car_models.model}}</option>
</select> </select>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
......
...@@ -718,7 +718,7 @@ ...@@ -718,7 +718,7 @@
padding: 30px; padding: 30px;
padding-top: 50px; padding-top: 50px;
position: relative; position: relative;
top: 85px; top: 15px;
.login_modal_inner { .login_modal_inner {
width: 90%; width: 90%;
margin: 0 auto; margin: 0 auto;
...@@ -820,7 +820,7 @@ ...@@ -820,7 +820,7 @@
} }
} }
.active{ .active{
background-color: #f2f2f2; background-color: #b9b9b9;
padding:8px; padding:8px;
padding-left: 15px; padding-left: 15px;
border-radius: 8px; border-radius: 8px;
......
...@@ -44,32 +44,33 @@ export class DashboardComponent implements OnInit { ...@@ -44,32 +44,33 @@ export class DashboardComponent implements OnInit {
successBookDtls: any; successBookDtls: any;
profileEditResp: any; profileEditResp: any;
autocompleteVin: any; autocompleteVin: any;
carSearchJsonData: any; carBrands: any;
selBrand: string = '';
autocompleteDetails: any; autocompleteDetails: any;
optionalDescription: string; optionalDescription: string;
editProfileSubmitClick: boolean; editProfileSubmitClick: boolean;
vehicleVinAddForm; vehicleVinAddForm;
vehicleVinFormSubmitClick; vehicleVinFormSubmitClick;
vehicleDetailsAddForm; vehicleDetailsAddForm;
vehicleDetailsFormSubmitClick; vehicleDetailsFormSubmitClick;
//Default Map Location //Default Map Location
lat: number = 51.678418; lat: number = 51.678418;
lng: number = 7.809007; lng: number = 7.809007;
wizardData: any; wizardData: any;
//Vehicle Details: TAB 2 //Vehicle Details: TAB 2
vehicleDataForm; vehicleDataForm;
vehicleDataFormSubmit; vehicleDataFormSubmit;
//Service Details: TAB 3 //Service Details: TAB 3
issuesData: any; issuesData: any;
defIssuesData: any[] = new Array(); defIssuesData: any[] = new Array();
selectedIssues: any[] = new Array(); selectedIssues: any[] = new Array();
//Quote Page //Quote Page
step: number; step: number;
today: any = new Date(); today: any = new Date();
...@@ -88,13 +89,13 @@ export class DashboardComponent implements OnInit { ...@@ -88,13 +89,13 @@ export class DashboardComponent implements OnInit {
googlesearchLocError: boolean; googlesearchLocError: boolean;
scheduleMechanic: any; scheduleMechanic: any;
optionalImges: any = new Array({1:false,2:false,3:false,4:false}); optionalImges: any = new Array({1:false,2:false,3:false,4:false});
imageDisp1: any; imageDisp1: any;
imageDisp2: any; imageDisp2: any;
imageDisp3: any; imageDisp3: any;
imageDisp4: any; imageDisp4: any;
//minRoute:any; //minRoute:any;
@ViewChild("closeWizard") public closeWizardRef: ElementRef; @ViewChild("closeWizard") public closeWizardRef: ElementRef;
@ViewChild("confirmModal") public confirmModalRef: ElementRef; @ViewChild("confirmModal") public confirmModalRef: ElementRef;
@ViewChild("googleLocVin") public googleLocVinRef: ElementRef; @ViewChild("googleLocVin") public googleLocVinRef: ElementRef;
...@@ -109,835 +110,852 @@ export class DashboardComponent implements OnInit { ...@@ -109,835 +110,852 @@ export class DashboardComponent implements OnInit {
@ViewChild("appointmentTab") public appointmentTabRef: ElementRef; @ViewChild("appointmentTab") public appointmentTabRef: ElementRef;
@ViewChild("serviceHistoryTab") public serviceHistoryTabRef: ElementRef; @ViewChild("serviceHistoryTab") public serviceHistoryTabRef: ElementRef;
@ViewChild("closeVehicleAddForm") public closeVehicleAddFormRef: ElementRef; @ViewChild("closeVehicleAddForm") public closeVehicleAddFormRef: ElementRef;
public scrollbarOptions = { axis: 'y', theme: 'minimal-dark' }; public scrollbarOptions = { axis: 'y', theme: 'minimal-dark' };
constructor(private router : Router, constructor(private router : Router,
public ngZone : NgZone, public ngZone : NgZone,
private route : ActivatedRoute, private route : ActivatedRoute,
public mapsAPILoader : MapsAPILoader, public mapsAPILoader : MapsAPILoader,
public errorMsg : ValidationService, public errorMsg : ValidationService,
public webService : WebService, public webService : WebService,
public subjectService : SubjectService) { public subjectService : SubjectService) {
this.step = 0; this.step = 0;
this.currDate = new Date(); this.currDate = new Date();
this.nextDate = new Date(); this.nextDate = new Date();
this.issuesData = false; this.issuesData = false;
this.loader = false; this.loader = false;
this.errMessage = false; this.errMessage = false;
this.vehDetails = false; this.vehDetails = false;
this.serverUrl = apiConfig; this.serverUrl = apiConfig;
this.imageServer = ImageStorage; this.imageServer = ImageStorage;
this.searchLocError = false; this.searchLocError = false;
this.showLeftArrow = false; this.showLeftArrow = false;
this.showRightArrow = true; this.showRightArrow = true;
this.scheduleDateInit = false; this.scheduleDateInit = false;
this.googlesearchLocError = false; this.googlesearchLocError = false;
this.editProfileSubmitClick = false; this.editProfileSubmitClick = false;
this.scheduleMechanic = false; this.scheduleMechanic = false;
this.optionalDescription = ''; this.optionalDescription = '';
this.vehicleDetailsFormSubmitClick = false; this.vehicleDetailsFormSubmitClick = false;
} }
ngOnInit() { ngOnInit() {
this.tab = 'active'; this.tab = 'active';
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
let payStatus = params['status']; let payStatus = params['status'];
let activeTab = params['tab']; let activeTab = params['tab'];
if(payStatus && payStatus !=''){ if(payStatus && payStatus !=''){
if(payStatus == 'success') if(payStatus == 'success')
this.successModelRef.nativeElement.click(); this.successModelRef.nativeElement.click();
if(payStatus == 'failure') if(payStatus == 'failure')
this.failureModelRef.nativeElement.click(); this.failureModelRef.nativeElement.click();
}
if(activeTab && activeTab !=''){
if(activeTab == 'service'){
this.serviceHistoryTabRef.nativeElement.click();
} }
if(activeTab == 'appointment'){
this.appointmentTabRef.nativeElement.click(); if(activeTab && activeTab !=''){
if(activeTab == 'service'){
this.serviceHistoryTabRef.nativeElement.click();
}
if(activeTab == 'appointment'){
this.appointmentTabRef.nativeElement.click();
}
} }
}
});
this.vehicleVinAddForm = new FormGroup({
vin: new FormControl('', [Validators.required]),
location: new FormControl('', [Validators.required])
});
this.vehicleDetailsAddForm = new FormGroup({
maker: new FormControl('', [Validators.required]),
location: new FormControl('', [Validators.required]),
modelYear: new FormControl('', [Validators.required]),
modelName: new FormControl('', [Validators.required])
});
this.webService.get_stored_json('car-list.json').subscribe((response: any) => {
this.carSearchJsonData = response;
});
this.subjectService.getLoginData().subscribe(loginData => {
this.loginDetails = JSON.parse(this.webService.getLocalStorageItem('userData'));
if(this.loginDetails){
this.imageUrl = ImageStorage+this.loginDetails.profile_image;
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\ _ - ' \/]+$")])
});
this.getCustVehDetails();
this.getCustBookDetails();
} else {
this.router.navigate(['index']);
}
});
let currentYear = Number((new Date()).getFullYear());
let startingYear = currentYear - 50;
for (let date = currentYear ; date >= startingYear ; date --) {
this.modelDates.push(date);
}
this.mapsAPILoader.load().then(() => {
this.autocompleteVin = new google.maps.places.Autocomplete(this.googleLocVinRef.nativeElement, {
types: ["address"]
}); });
this.autocompleteDetails = new google.maps.places.Autocomplete(this.googleLocDetailsRef.nativeElement, {
types: ["address"] this.vehicleVinAddForm = new FormGroup({
vin: new FormControl('', [Validators.required]),
location: new FormControl('', [Validators.required])
}); });
this.cfautocomplete = new google.maps.places.Autocomplete(this.newGoogleLocRef.nativeElement, {
types: ["address"] this.vehicleDetailsAddForm = new FormGroup({
maker: new FormControl('', [Validators.required]),
location: new FormControl('', [Validators.required]),
modelYear: new FormControl('', [Validators.required]),
modelName: new FormControl('', [Validators.required])
}); });
});
this.nextDate.setDate(this.nextDate.getDate() + 1); this.getVehicleBrand();
$('.modal-backdrop').remove(); this.subjectService.getLoginData().subscribe(loginData => {
$('body').attr('class',''); this.loginDetails = JSON.parse(this.webService.getLocalStorageItem('userData'));
$('body').attr('style','');
} if(this.loginDetails){
this.imageUrl = ImageStorage+this.loginDetails.profile_image;
getCustBookDetails(){ this.editProfile = new FormGroup({
this.loader = true; email: new FormControl(this.loginDetails.email, [Validators.required, Validators.maxLength(50), Validators.pattern('^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$')]),
this.webService.post_data('getCustBookDetails', {'customer_id':this.loginDetails.customer_id}).subscribe(response => { phone: new FormControl(this.loginDetails.phone, [Validators.required, Validators.maxLength(15), Validators.pattern("^[0-9\ ( ) + , - ]+$")]),
if ( response.status == '1' && response.bookData != 'undefined' && response.bookData != undefined && response.bookData != 'null' && response.bookData != null ) { address: new FormControl(this.loginDetails.address, [Validators.required, Validators.maxLength(250)]),
let bookings = response.bookData; password: new FormControl('', [Validators.maxLength(16), Validators.minLength(6)]),
console.log(bookings); cpassword: new FormControl('', [Validators.maxLength(16), Validators.minLength(6)]),
let successBooking: any[] = new Array(); last_name: new FormControl(this.loginDetails.last_name, [Validators.required, Validators.maxLength(50), Validators.pattern("^[a-zA-Z\ _ - ' \/]+$")]),
let bookingDetails: any[] = new Array(); first_name: new FormControl(this.loginDetails.first_name, [Validators.required, Validators.maxLength(50), Validators.pattern("^[a-zA-Z\ _ - ' \/]+$")])
});
bookings.forEach(function (book) { this.getCustVehDetails();
if(book.status == 0 || book.status == 1 || book.status == 6){ this.getCustBookDetails();
successBooking.push(book);
} else {
bookingDetails.push(book);
}
});
if(successBooking.length > 0){
this.successBookDtls = successBooking;
} else {
this.successBookDtls = false;
}
if(bookingDetails.length > 0){
this.bookingDetails = bookingDetails;
} else { } else {
this.bookingDetails = false; this.router.navigate(['index']);
} }
});
let currentYear = Number((new Date()).getFullYear());
let startingYear = currentYear - 50;
for (let date = currentYear ; date >= startingYear ; date --) {
this.modelDates.push(date);
} }
this.loader = false;
}); this.mapsAPILoader.load().then(() => {
} this.autocompleteVin = new google.maps.places.Autocomplete(this.googleLocVinRef.nativeElement, {
types: ["address"]
getCustVehDetails(){ });
this.loader = true; this.autocompleteDetails = new google.maps.places.Autocomplete(this.googleLocDetailsRef.nativeElement, {
this.webService.post_data('customerVechiles', {'customer_id':this.loginDetails.customer_id}).subscribe(response => { types: ["address"]
if ( response.status == '1' && response.vehData != '' && response.vehData != 'undefined' && response.vehData != undefined && response.vehData != 'null' && response.vehData != null ) { });
this.vehDetails = response.vehData; this.cfautocomplete = new google.maps.places.Autocomplete(this.newGoogleLocRef.nativeElement, {
} else { types: ["address"]
this.vehDetails = false; });
} });
this.loader = false; this.nextDate.setDate(this.nextDate.getDate() + 1);
});
} $('.modal-backdrop').remove();
$('body').attr('class','');
get_model(event) { $('body').attr('style','');
this.carModel = this.carSearchJsonData[event].models; }
}
setIssueSelected(event){
let issue_id = event.target.attributes.issue_id.value;
let sub_issue_id = event.target.attributes.sub_issue_id.value;
const thisObj = this; getVehicleBrand(){
let index = thisObj.selectedIssues.findIndex(x => x.sub_issue_id == sub_issue_id); this.webService.get_data('getVehicleBrand').subscribe(response => {
if(index > -1){ if(response.status == 'success'){
thisObj.selectedIssues.splice(index, 1); this.carBrands = response.data;
} else {
thisObj.issuesData.forEach(function (issData) {
if(issData.issue_id == issue_id){
issData.sub_categories.forEach(function (subIssData) {
if(subIssData.issue_cat_id == sub_issue_id){
let issue = issData.issue,
issue_image = issData.issue_image,
issue_category = subIssData.issue_category,
issue_cat_image = subIssData.issue_cat_image,
default_service_fee = subIssData.default_service_fee,
default_description = subIssData.default_description;
thisObj.selectedIssues.push({issue_id,sub_issue_id,issue,issue_image,issue_category,issue_cat_image,default_service_fee,default_description});
}
});
} }
}); });
} }
this.calculateEstimate();
}
calculateEstimate(){
const thisObj = this;
thisObj.estimatedPrice = 0;
thisObj.selectedIssues.forEach(function (selIssues) {
thisObj.estimatedPrice = thisObj.estimatedPrice + Number(selIssues.default_service_fee);
});
}
get_newlocaion(lastLoc){ get_model(brand_id) {
this.cfautocomplete.addListener("place_changed", () => { const thisObj = this;
this.ngZone.run(() => { thisObj.carBrands.forEach(function (brandData,index) {
let places: google.maps.places.PlaceResult = this.cfautocomplete.getPlace(); if(brandData.veh_brand_id == brand_id){
if (places == undefined || places == null || places === undefined || places === null || thisObj.selBrand = brandData.maker;
places.geometry == undefined || places.geometry == null || places.geometry === undefined || places.geometry === null ||
places.formatted_address == undefined || places.formatted_address == null || places.formatted_address === undefined || places.formatted_address === null) {
this.googlesearchLocError = true;
return;
} }
this.wizardData['pickup_data'] = {
'disp_loc':places.name,
'pickup_loc':places.formatted_address,
'pickup_lat':places.geometry.location.lat(),
'pickup_lng':places.geometry.location.lng()
};
this.googlesearchLocError = false;
this.lat = places.geometry.location.lat();
this.lng = places.geometry.location.lng();
}); });
})
}
get_newdate(lastdate){
this.wizardData['vechile_info']['lastMaintanceDate']=formatDate(lastdate,'MM/dd/yyyy','en');
}
get_newmilage(event){
this.wizardData['vechile_info']['milage']=event;
}
get_newmaintanence_date(newdate){
this.wizardData['vechile_info']['maintanenceInterval']=newdate.target.value;
}
removeSelectedItem(issue_id,sub_issue_id){
let index = this.selectedIssues.findIndex(x => x.sub_issue_id == sub_issue_id);
if(index > -1){
this.selectedIssues.splice(index, 1);
$('[id="issue_'+issue_id+'_'+sub_issue_id+'"]').prop('checked', false);
}
if(this.selectedIssues.length == 0){
this.goTostep1Ref.nativeElement.click();
}
this.calculateEstimate();
}
submitProfileEdit(data){ this.webService.post_data('getVehicleModel',{'vehBrand_id':brand_id}).subscribe(response => {
if(this.editProfile.invalid){ if(response.status == 'success'){
return false; this.carModel = response.data;
}
});
} }
const This = this;
this.loader = true; getCustBookDetails(){
data.customer_id = this.loginDetails.customer_id; this.loader = true;
this.webService.post_data('getCustBookDetails', {'customer_id':this.loginDetails.customer_id}).subscribe(response => {
let formData: FormData = new FormData(); if ( response.status == '1' && response.bookData != 'undefined' && response.bookData != undefined && response.bookData != 'null' && response.bookData != null ) {
formData.append('data', JSON.stringify(data)); let bookings = response.bookData;
console.log(bookings);
if(this.profile_image && this.profile_image != '' && this.profile_image != undefined && this.profile_image != 'undefined' && this.profile_image != null && this.profile_image != 'null'){ let successBooking: any[] = new Array();
formData.append('profile_image', this.profile_image); let bookingDetails: any[] = new Array();
bookings.forEach(function (book) {
if(book.status == 0 || book.status == 1 || book.status == 6){
successBooking.push(book);
} else {
bookingDetails.push(book);
}
});
if(successBooking.length > 0){
this.successBookDtls = successBooking;
} else {
this.successBookDtls = false;
}
if(bookingDetails.length > 0){
this.bookingDetails = bookingDetails;
} else {
this.bookingDetails = false;
}
}
this.loader = false;
});
} }
this.webService.multipart_post('edit_customer_profile', formData).subscribe(response => { getCustVehDetails(){
if ( response.status == '1') { this.loader = true;
const userData = this.webService.getLocalStorageItem('userData'); this.webService.post_data('customerVechiles', {'customer_id':this.loginDetails.customer_id}).subscribe(response => {
this.webService.removeLocalStorageItem(userData); if ( response.status == '1' && response.vehData != '' && response.vehData != 'undefined' && response.vehData != undefined && response.vehData != 'null' && response.vehData != null ) {
this.vehDetails = response.vehData;
let ret_profile_image = (response.profile_image && response.profile_image != undefined && response.profile_image != 'undefined' && response.profile_image != null && response.profile_image != 'null')?response.profile_image:this.loginDetails.profile_image; } else {
this.imageUrl = ImageStorage+ret_profile_image; this.vehDetails = false;
}
let newUserData = {"customer_id":this.loginDetails.customer_id,
"phone":data.phone,
"email":data.email,
"address":data.address,
"last_name":data.last_name,
"first_name":data.first_name,
"profile_image":ret_profile_image,
"status":"1"}
this.webService.setLocalStorageItem('userData', JSON.stringify(newUserData));
response.status = 'success';
this.profileEditResp = response;
this.loader = false; this.loader = false;
});
}
setIssueSelected(event){
let issue_id = event.target.attributes.issue_id.value;
let sub_issue_id = event.target.attributes.sub_issue_id.value;
const thisObj = this;
let index = thisObj.selectedIssues.findIndex(x => x.sub_issue_id == sub_issue_id);
if(index > -1){
thisObj.selectedIssues.splice(index, 1);
} else { } else {
response.status = 'error'; thisObj.issuesData.forEach(function (issData) {
response.message = (response.message == '')?this.errorMsg.errorList.req_failure:response.message; if(issData.issue_id == issue_id){
issData.sub_categories.forEach(function (subIssData) {
this.profileEditResp = response; if(subIssData.issue_cat_id == sub_issue_id){
this.loader = false; let issue = issData.issue,
issue_image = issData.issue_image,
issue_category = subIssData.issue_category,
issue_cat_image = subIssData.issue_cat_image,
default_service_fee = subIssData.default_service_fee,
default_description = subIssData.default_description;
thisObj.selectedIssues.push({issue_id,sub_issue_id,issue,issue_image,issue_category,issue_cat_image,default_service_fee,default_description});
}
});
}
});
} }
},error => { this.calculateEstimate();
this.loader = false;
this.profileEditResp = {'status':'error','message':this.errorMsg.errorList.req_failure};
},() => {
setTimeout( function() {
This.profileEditResp = false;
}, 2000)
});
}
vehicleDetailsFormSubmit(vehicleData){
if(this.vehicleDetailsAddForm.invalid){
this.vehicleDetailsFormSubmitClick = true;
return false;
} }
let location;
this.vehicleDetailsFormSubmitClick = false; calculateEstimate(){
vehicleData.car_maker = this.carSearchJsonData[vehicleData['maker']]['brand']; const thisObj = this;
this.ngZone.run(() => { thisObj.estimatedPrice = 0;
let place: google.maps.places.PlaceResult = this.autocompleteDetails.getPlace(); thisObj.selectedIssues.forEach(function (selIssues) {
if (place == undefined || place == null || place === undefined || place === null || thisObj.estimatedPrice = thisObj.estimatedPrice + Number(selIssues.default_service_fee);
place.geometry == undefined || place.geometry == null || place.geometry === undefined || place.geometry === null || });
place.formatted_address == undefined || place.formatted_address == null || place.formatted_address === undefined || place.formatted_address === null) {
this.searchLocError = true;
return;
}
location = {'location':place.formatted_address,
'location_lat':place.geometry.location.lat(),
'location_lng':place.geometry.location.lng()
};
});
this.addCustomerCar(1,vehicleData,location);
}
vehicleVinFormSubmit(vehicleData){
if(this.vehicleVinAddForm.invalid){
this.vehicleVinFormSubmitClick = true;
return false;
} }
let location; get_newlocaion(lastLoc){
this.vehicleVinFormSubmitClick = false; this.cfautocomplete.addListener("place_changed", () => {
this.ngZone.run(() => { this.ngZone.run(() => {
let place: google.maps.places.PlaceResult = this.autocompleteVin.getPlace(); let places: google.maps.places.PlaceResult = this.cfautocomplete.getPlace();
if (place == undefined || place == null || place === undefined || place === null || if (places == undefined || places == null || places === undefined || places === null ||
place.geometry == undefined || place.geometry == null || place.geometry === undefined || place.geometry === null || places.geometry == undefined || places.geometry == null || places.geometry === undefined || places.geometry === null ||
place.formatted_address == undefined || place.formatted_address == null || place.formatted_address === undefined || place.formatted_address === null) { places.formatted_address == undefined || places.formatted_address == null || places.formatted_address === undefined || places.formatted_address === null) {
this.searchLocError = true; this.googlesearchLocError = true;
return; return;
}
this.wizardData['pickup_data'] = {
'disp_loc':places.name,
'pickup_loc':places.formatted_address,
'pickup_lat':places.geometry.location.lat(),
'pickup_lng':places.geometry.location.lng()
};
this.googlesearchLocError = false;
this.lat = places.geometry.location.lat();
this.lng = places.geometry.location.lng();
});
})
} }
location = {'location':place.formatted_address, get_newdate(lastdate){
'location_lat':place.geometry.location.lat(), this.wizardData['vechile_info']['lastMaintanceDate']=formatDate(lastdate,'MM/dd/yyyy','en');
'location_lng':place.geometry.location.lng()
};
});
this.addCustomerCar(2,vehicleData,location);
}
addCustomerCar(type,vehicleData,location){
this.loader = true;
let postData = {'type':type,'customer_id':this.loginDetails.customer_id,'vehicleData':vehicleData,'location':location};
this.webService.post_data('addCustomerCar',postData).subscribe(response => {
if ( response.status == '1' ) {
this.getCustVehDetails();
this.closeVehicleAddFormRef.nativeElement.click();
this.resetVehicleForm();
this.loader = false;
} else {
this.loader = false;
this.errMessage = {'errMsg':response.message}
    setTimeout (() => {
         this.errMessage = false;
      }, 2000);
} }
});
} get_newmilage(event){
this.wizardData['vechile_info']['milage']=event;
deleteCustomerCar(params){
this.loader = true;
this.webService.post_data('deleteCustomerCar', params).subscribe(response => {
if ( response.status == '1' ) {
this.getCustVehDetails();
this.loader = false;
} }
});
} get_newmaintanence_date(newdate){
this.wizardData['vechile_info']['maintanenceInterval']=newdate.target.value;
optImgUpload(image_id,event){
let reader = new FileReader();
let optionalImg: any = event.target.files[0];
reader.onloadend = () => {
switch (image_id){
case 1:
this.optionalImges[1] = {'file':event.target.files[0],'file_url':reader.result};
break;
case 2:
this.optionalImges[2] = {'file':event.target.files[0],'file_url':reader.result};
break;
case 3:
this.optionalImges[3] = {'file':event.target.files[0],'file_url':reader.result};
break;
case 4:
this.optionalImges[4] = {'file':event.target.files[0],'file_url':reader.result};
break;
} }
}
reader.readAsDataURL(optionalImg); removeSelectedItem(issue_id,sub_issue_id){
} let index = this.selectedIssues.findIndex(x => x.sub_issue_id == sub_issue_id);
if(index > -1){
imageUpload(e) { this.selectedIssues.splice(index, 1);
let reader = new FileReader();
this.profile_image = e.target.files[0]; $('[id="issue_'+issue_id+'_'+sub_issue_id+'"]').prop('checked', false);
reader.onloadend = () => { }
this.imageUrl = reader.result; if(this.selectedIssues.length == 0){
} this.goTostep1Ref.nativeElement.click();
reader.readAsDataURL(this.profile_image); }
} this.calculateEstimate();
resetVehicleForm(){
this.vehicleVinAddForm.reset();
this.vehicleDetailsAddForm.reset({
maker: '', modelYear: '', modelName: '', location: ''
});
}
routeToIndex(){
this.router.navigate(["index"]);
}
bookVechile(customer_veh_id){
this.loader = true;
const thisObj = this;
thisObj.vehDetails.forEach(function (vehData) {
if(vehData.customer_veh_id == customer_veh_id){
thisObj.wizardData = {'pickup_data':
{'pickup_loc':vehData.car_location,
'pickup_lat':vehData.car_loc_lat,
'pickup_lng':vehData.car_loc_lng
}
};
thisObj.wizardData['vechile_info'] = {'trim':'','milage':'','emgine':'',
'maker':vehData.car_maker,
'modelName':vehData.car_model,
'modelYear':vehData.car_model_year,
'maintanenceInterval':vehData.maintanence_interval,
'lastMaintanceDate':vehData.last_maintenance_date
};
thisObj.wizardData['customer_vehicle_id'] = vehData.customer_veh_id;
} }
});
this.getIssueData(); submitProfileEdit(data){
} if(this.editProfile.invalid){
return false;
getIssueData(){ }
const This = this; const This = this;
this.loader = true; this.loader = true;
this.webService.get_data('getGeneralIssues').subscribe(response => { data.customer_id = this.loginDetails.customer_id;
if(response.status == '1'){
this.issuesData = response.issue_data; let formData: FormData = new FormData();
this.defIssuesData = this.issuesData; formData.append('data', JSON.stringify(data));
this.loader = false;
} else { if(this.profile_image && this.profile_image != '' && this.profile_image != undefined && this.profile_image != 'undefined' && this.profile_image != null && this.profile_image != 'null'){
this.loader = false; formData.append('profile_image', this.profile_image);
return false; }
this.webService.multipart_post('edit_customer_profile', formData).subscribe(response => {
if ( response.status == '1') {
const userData = this.webService.getLocalStorageItem('userData');
this.webService.removeLocalStorageItem(userData);
let ret_profile_image = (response.profile_image && response.profile_image != undefined && response.profile_image != 'undefined' && response.profile_image != null && response.profile_image != 'null')?response.profile_image:this.loginDetails.profile_image;
this.imageUrl = ImageStorage+ret_profile_image;
let newUserData = {"customer_id":this.loginDetails.customer_id,
"phone":data.phone,
"email":data.email,
"address":data.address,
"last_name":data.last_name,
"first_name":data.first_name,
"profile_image":ret_profile_image,
"status":"1"}
this.webService.setLocalStorageItem('userData', JSON.stringify(newUserData));
response.status = 'success';
this.profileEditResp = response;
this.loader = false;
} else {
response.status = 'error';
response.message = (response.message == '')?this.errorMsg.errorList.req_failure:response.message;
this.profileEditResp = response;
this.loader = false;
}
},error => {
this.loader = false;
this.profileEditResp = {'status':'error','message':this.errorMsg.errorList.req_failure};
},() => {
setTimeout( function() {
This.profileEditResp = false;
}, 2000)
});
} }
},error => {
this.loader = false; vehicleDetailsFormSubmit(vehicleData){
return false; if(this.vehicleDetailsAddForm.invalid){
}); this.vehicleDetailsFormSubmitClick = true;
} return false;
}
searchIssues(event){ let location;
if(event.target.value == '' || event.target.value == 'undefined' || event.target.value == undefined || event.target.value == 'null' || event.target.value == null ){ this.vehicleDetailsFormSubmitClick = false;
this.issuesData = this.defIssuesData; vehicleData.car_maker = this.selBrand;
} else { this.ngZone.run(() => {
const thisObj = this; let place: google.maps.places.PlaceResult = this.autocompleteDetails.getPlace();
let subCatArr: any; if (place == undefined || place == null || place === undefined || place === null ||
let data: any[] = new Array(); place.geometry == undefined || place.geometry == null || place.geometry === undefined || place.geometry === null ||
let serRegExp = new RegExp(event.target.value,"gi"); place.formatted_address == undefined || place.formatted_address == null || place.formatted_address === undefined || place.formatted_address === null) {
this.searchLocError = true;
thisObj.defIssuesData.forEach(function (issues,index) { return;
let issueCat = issues.issue;
if(issueCat.search(serRegExp) != -1){
data.push(thisObj.defIssuesData[index]);
} else {
subCatArr = issues.sub_categories;
subCatArr.forEach(function (issues_cat) {
let sub_issue_cat = issues_cat.issue_category;
if(sub_issue_cat.search(serRegExp) != -1){
data.push(thisObj.defIssuesData[index]);
} }
});
location = {'location':place.formatted_address,
'location_lat':place.geometry.location.lat(),
'location_lng':place.geometry.location.lng()
};
});
this.addCustomerCar(1,vehicleData,location);
}
vehicleVinFormSubmit(vehicleData){
if(this.vehicleVinAddForm.invalid){
this.vehicleVinFormSubmitClick = true;
return false;
} }
});
this.issuesData = (data.length > 0)?data:false; let location;
this.vehicleVinFormSubmitClick = false;
this.ngZone.run(() => {
let place: google.maps.places.PlaceResult = this.autocompleteVin.getPlace();
if (place == undefined || place == null || place === undefined || place === null ||
place.geometry == undefined || place.geometry == null || place.geometry === undefined || place.geometry === null ||
place.formatted_address == undefined || place.formatted_address == null || place.formatted_address === undefined || place.formatted_address === null) {
this.searchLocError = true;
return;
}
location = {'location':place.formatted_address,
'location_lat':place.geometry.location.lat(),
'location_lng':place.geometry.location.lng()
};
});
this.addCustomerCar(2,vehicleData,location);
}
addCustomerCar(type,vehicleData,location){
this.loader = true;
let postData = {'type':type,'customer_id':this.loginDetails.customer_id,'vehicleData':vehicleData,'location':location};
this.webService.post_data('addCustomerCar',postData).subscribe(response => {
if ( response.status == '1' ) {
this.getCustVehDetails();
this.closeVehicleAddFormRef.nativeElement.click();
this.resetVehicleForm();
this.loader = false;
} else {
this.loader = false;
this.errMessage = {'errMsg':response.message}
    setTimeout (() => {
         this.errMessage = false;
      }, 2000);
}
});
}
deleteCustomerCar(params){
this.loader = true;
this.webService.post_data('deleteCustomerCar', params).subscribe(response => {
if ( response.status == '1' ) {
this.getCustVehDetails();
this.loader = false;
}
});
}
optImgUpload(image_id,event){
let reader = new FileReader();
let optionalImg: any = event.target.files[0];
reader.onloadend = () => {
switch (image_id){
case 1:
this.optionalImges[1] = {'file':event.target.files[0],'file_url':reader.result};
break;
case 2:
this.optionalImges[2] = {'file':event.target.files[0],'file_url':reader.result};
break;
case 3:
this.optionalImges[3] = {'file':event.target.files[0],'file_url':reader.result};
break;
case 4:
this.optionalImges[4] = {'file':event.target.files[0],'file_url':reader.result};
break;
}
}
reader.readAsDataURL(optionalImg);
}
imageUpload(e) {
let reader = new FileReader();
this.profile_image = e.target.files[0];
reader.onloadend = () => {
this.imageUrl = reader.result;
}
reader.readAsDataURL(this.profile_image);
}
resetVehicleForm(){
this.vehicleVinAddForm.reset();
this.vehicleDetailsAddForm.reset({
maker: '', modelYear: '', modelName: '', location: ''
});
}
routeToIndex(){
this.router.navigate(["index"]);
}
bookVechile(customer_veh_id){
this.loader = true;
const thisObj = this;
thisObj.vehDetails.forEach(function (vehData) {
if(vehData.customer_veh_id == customer_veh_id){
thisObj.wizardData = {'pickup_data':
{'pickup_loc':vehData.car_location,
'pickup_lat':vehData.car_loc_lat,
'pickup_lng':vehData.car_loc_lng
}
};
thisObj.wizardData['vechile_info'] = {'trim':'','milage':'','emgine':'',
'maker':vehData.car_maker,
'modelName':vehData.car_model,
'modelYear':vehData.car_model_year,
'maintanenceInterval':vehData.maintanence_interval,
'lastMaintanceDate':vehData.last_maintenance_date
};
thisObj.wizardData['customer_vehicle_id'] = vehData.customer_veh_id;
} }
});
this.getIssueData();
}
setTimeout(()=>{ getIssueData(){
this.selectedIssues.forEach(function (issues) { const This = this;
$('[id="issue_'+issues.issue_id+'_'+issues.sub_issue_id+'"]').prop('checked', true); this.loader = true;
}); this.webService.get_data('getGeneralIssues').subscribe(response => {
},500); if(response.status == '1'){
} this.issuesData = response.issue_data;
this.defIssuesData = this.issuesData;
// searchIssues(event){ this.loader = false;
// if(event.target.value == '' || event.target.value == 'undefined' || event.target.value == undefined || event.target.value == 'null' || event.target.value == null ){ } else {
// this.issuesData = this.defIssuesData; this.loader = false;
// } else { return false;
// const thisObj = this;
// let data: any[] = new Array();
// let serRegExp = new RegExp(event.target.value,"gi");
// thisObj.defIssuesData.forEach(function (issues,index) {
// let issueCat = issues.issue;
// let subIssueCat =issues.sub_categories;
// if(issueCat.search(serRegExp) != -1){
// thisObj.defIssuesData['exception'] = '0';
// data.push(thisObj.defIssuesData[index]);
// }else {
// issues.sub_categories.forEach(function (issues_cat_1,index_1) {
// let subIssueCat = issues_cat_1.issue_category;
// if(subIssueCat.search(serRegExp) != -1){
// thisObj.defIssuesData['exception'] = '1';
// data.push(thisObj.defIssuesData[index]);
// // console.log(thisObj.defIssuesData[index].sub_categories[index_1])
// }
// })
// }
// });
// console.log(thisObj.defIssuesData);
// this.issuesData = (data.length > 0)?data:false;
// }
// setTimeout(()=>{
// this.selectedIssues.forEach(function (issues) {
// $('[id="issue_'+issues.issue_id+'_'+issues.sub_issue_id+'"]').prop('checked', true);
// });
// },500);
// }
jumpToStep3(){
if(this.selectedIssues.length != 0){
this.step3nextRef.nativeElement.click();
} }
} },error => {
this.loader = false;
return false;
});
}
getQuote(){ searchIssues(event){
if(event.target.value == '' || event.target.value == 'undefined' || event.target.value == undefined || event.target.value == 'null' || event.target.value == null ){
this.issuesData = this.defIssuesData;
} else {
const thisObj = this; const thisObj = this;
this.loader = true; let subCatArr: any;
let data: any[] = new Array();
let selSubIssues: any[] = new Array(); let serRegExp = new RegExp(event.target.value,"gi");
thisObj.selectedIssues.forEach(function (selIssues) {
selSubIssues.push(selIssues.sub_issue_id); thisObj.defIssuesData.forEach(function (issues,index) {
}); let issueCat = issues.issue;
let searchData = {'pickup_data':this.wizardData.pickup_data,'sub_issues':selSubIssues} if(issueCat.search(serRegExp) != -1){
this.webService.post_data('getNearByMechanics',searchData).subscribe(response => { data.push(thisObj.defIssuesData[index]);
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.loader = false;
} else { } else {
this.loader = false; subCatArr = issues.sub_categories;
return false; subCatArr.forEach(function (issues_cat) {
let sub_issue_cat = issues_cat.issue_category;
if(sub_issue_cat.search(serRegExp) != -1){
data.push(thisObj.defIssuesData[index]);
}
});
} }
},error => {
this.loader = false;
return false;
}); });
this.issuesData = (data.length > 0)?data:false;
} }
setTimeout(()=>{
this.selectedIssues.forEach(function (issues) {
$('[id="issue_'+issues.issue_id+'_'+issues.sub_issue_id+'"]').prop('checked', true);
});
},500);
}
onMouseOver(infoWindow, gm) { // searchIssues(event){
if (gm.lastOpen != null) { // if(event.target.value == '' || event.target.value == 'undefined' || event.target.value == undefined || event.target.value == 'null' || event.target.value == null ){
gm.lastOpen.close(); // this.issuesData = this.defIssuesData;
} // } else {
gm.lastOpen = infoWindow; // const thisObj = this;
infoWindow.open(); // let data: any[] = new Array();
} // let serRegExp = new RegExp(event.target.value,"gi");
// thisObj.defIssuesData.forEach(function (issues,index) {
onMouseOut(gm){ // let issueCat = issues.issue;
if (gm.lastOpen != null) { // let subIssueCat =issues.sub_categories;
gm.lastOpen.close(); // if(issueCat.search(serRegExp) != -1){
} // thisObj.defIssuesData['exception'] = '0';
// data.push(thisObj.defIssuesData[index]);
// }else {
// issues.sub_categories.forEach(function (issues_cat_1,index_1) {
// let subIssueCat = issues_cat_1.issue_category;
// if(subIssueCat.search(serRegExp) != -1){
// thisObj.defIssuesData['exception'] = '1';
// data.push(thisObj.defIssuesData[index]);
// // console.log(thisObj.defIssuesData[index].sub_categories[index_1])
// }
// })
// }
// });
// console.log(thisObj.defIssuesData);
// this.issuesData = (data.length > 0)?data:false;
// }
// setTimeout(()=>{
// this.selectedIssues.forEach(function (issues) {
// $('[id="issue_'+issues.issue_id+'_'+issues.sub_issue_id+'"]').prop('checked', true);
// });
// },500);
// }
jumpToStep3(){
if(this.selectedIssues.length != 0){
this.step3nextRef.nativeElement.click();
} }
}
next(event) { getQuote(){
if(this.dateStep > 30){ const thisObj = this;
this.showLeftArrow = true; this.loader = true;
this.showRightArrow = false;
let selSubIssues: any[] = new Array();
thisObj.selectedIssues.forEach(function (selIssues) {
selSubIssues.push(selIssues.sub_issue_id);
});
let searchData = {'pickup_data':this.wizardData.pickup_data,'sub_issues':selSubIssues}
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)));
this.loader = false;
} else {
this.loader = false;
return false; return false;
} }
this.showLeftArrow = true; },error => {
this.showRightArrow = true; this.loader = false;
this.dateSection = new Array(); return false;
this.nextDate.setDate(this.nextDate.getDate() + 1); });
this.currDate.setDate(this.currDate.getDate() + 1); }
this.dateSection[0] = new Date(this.currDate);
this.dateSection[1] = new Date(this.nextDate);
this.dateStep += 1;
}
prev(event) { onMouseOver(infoWindow, gm) {
if(this.dateStep <= 0){ if (gm.lastOpen != null) {
this.showLeftArrow = false; gm.lastOpen.close();
this.showRightArrow = true;
return false;
}
this.showLeftArrow = true;
this.showRightArrow = true;
this.dateSection = new Array();
this.nextDate.setDate(this.nextDate.getDate() - 1);
this.currDate.setDate(this.currDate.getDate() - 1);
this.dateSection[0] = new Date(this.currDate);
this.dateSection[1] = new Date(this.nextDate);
this.dateStep -= 1;
} }
gm.lastOpen = infoWindow;
infoWindow.open();
}
getSchedule(time,index){ onMouseOut(gm){
this.wizardData['schedule_date'] = {'date':this.formatDate(this.dateSection[index]),'time':time}; if (gm.lastOpen != null) {
gm.lastOpen.close();
} }
}
formatDate(date) { next(event) {
const d = new Date(date); if(this.dateStep > 30){
let day = '' + d.getDate(); this.showLeftArrow = true;
let month = ''+(d.getMonth()+1); this.showRightArrow = false;
const year = d.getFullYear(); return false;
if (day.length < 2) { day = '0'+day; } }
if (month.length < 2) { month = '0'+month; } this.showLeftArrow = true;
return [year,month,day].join('-'); this.showRightArrow = true;
} this.dateSection = new Array();
this.nextDate.setDate(this.nextDate.getDate() + 1);
this.currDate.setDate(this.currDate.getDate() + 1);
this.dateSection[0] = new Date(this.currDate);
this.dateSection[1] = new Date(this.nextDate);
this.dateStep += 1;
}
scheduleNow(mechanic_id,cost){ prev(event) {
this.wizardData['mechanic_id'] = mechanic_id+':'+cost; if(this.dateStep <= 0){
this.showLeftArrow = false;
this.showRightArrow = true;
return false;
}
this.showLeftArrow = true;
this.showRightArrow = true;
this.dateSection = new Array();
this.nextDate.setDate(this.nextDate.getDate() - 1);
this.currDate.setDate(this.currDate.getDate() - 1);
this.dateSection[0] = new Date(this.currDate);
this.dateSection[1] = new Date(this.nextDate);
this.dateStep -= 1;
}
if(!this.loginDetails){ getSchedule(time,index){
this.routeToIndex(); this.wizardData['schedule_date'] = {'date':this.formatDate(this.dateSection[index]),'time':time};
} }
this.loader = true;
this.wizardData['cost'] = cost; formatDate(date) {
this.wizardData['multiple'] ='0'; const d = new Date(date);
this.confirmBooking(); let day = '' + d.getDate();
} let month = ''+(d.getMonth()+1);
const year = d.getFullYear();
if (day.length < 2) { day = '0'+day; }
if (month.length < 2) { month = '0'+month; }
return [year,month,day].join('-');
}
scheduleMultipleRequest(){ scheduleNow(mechanic_id,cost){
if(!this.loginDetails){ this.wizardData['mechanic_id'] = mechanic_id+':'+cost;
this.routeToIndex();
} if(!this.loginDetails){
let coma = ''; this.routeToIndex();
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();
} }
this.loader = true;
this.wizardData['cost'] = cost;
this.wizardData['multiple'] ='0';
this.confirmBooking();
}
confirmBooking(){ scheduleMultipleRequest(){
this.wizardData['customer_id'] = this.loginDetails.customer_id; if(!this.loginDetails){
this.wizardData['selected_issues'] = this.selectedIssues; this.routeToIndex();
this.wizardData['optionalDescription'] = this.optionalDescription; }
let coma = '';
let formData: FormData = new FormData(); const thisObj = this;
formData.append('data', JSON.stringify(this.wizardData)); this.mechanics = '';
this.selMechanics.forEach(function (mechanic_data) {
this.optionalImges.forEach(function (imgData,index) { thisObj.mechanics += coma+mechanic_data.mechanic_id+':'+mechanic_data.amount;
if(!imgData){ coma = ',';
return true; })
} this.wizardData['mechanic_id'] = thisObj.mechanics;
formData.append("optFile_" + (index), imgData.file); this.wizardData['cost'] = this.estimatedPrice;
}); this.wizardData['multiple'] ='1';
this.confirmBooking();
}
this.webService.multipart_post('scheduleNow', formData).subscribe(response => { confirmBooking(){
this.wizardData['customer_id'] = this.loginDetails.customer_id;
this.wizardData['selected_issues'] = this.selectedIssues;
this.wizardData['optionalDescription'] = this.optionalDescription;
let formData: FormData = new FormData();
formData.append('data', JSON.stringify(this.wizardData));
this.optionalImges.forEach(function (imgData,index) {
if(!imgData){
return true;
}
formData.append("optFile_" + (index), imgData.file);
});
this.webService.multipart_post('scheduleNow', formData).subscribe(response => {
// this.webService.post_data('scheduleNow',this.wizardData).subscribe(response => { // this.webService.post_data('scheduleNow',this.wizardData).subscribe(response => {
if(response.status == '1'){ if(response.status == '1'){
this.closeWizardRef.nativeElement.click(); this.closeWizardRef.nativeElement.click();
this.closeQuoteWizardRef.nativeElement.click(); this.closeQuoteWizardRef.nativeElement.click();
this.goTostep1Ref.nativeElement.click(); this.goTostep1Ref.nativeElement.click();
this.selectedIssues = []; this.selectedIssues = [];
this.appointmentTabRef.nativeElement.click(); this.appointmentTabRef.nativeElement.click();
this.getCustBookDetails(); this.getCustBookDetails();
} else { } else {
this.loader = false;
return false;
}
},error => {
this.loader = false; this.loader = false;
return false; return false;
});
}
resetQuoteWizard(){
this.selectedIssues = [];
this.scheduleMechanic = false;
this.scheduleDateInit = false;
this.goTostep1Ref.nativeElement.click();
this.optionalImges[1] = false;
this.optionalImges[2] = false;
this.optionalImges[3] = false;
this.optionalImges[4] = false;
this.optionalDescription = '';
}
showCustQuote(booking_id,mechanic_id,type){
if(!booking_id || !mechanic_id){
return false;
} }
this.loader = true; },error => {
const thisObj= this;
if(type == '2'){
thisObj.successBookDtls = this.bookingDetails;
}
thisObj.successBookDtls.forEach(function (data,index) {
if(data.booking_id == booking_id){
// let bookdata = data;
data.mechanic_data.forEach(function (mechdata,mechindex) {
if(mechdata.mechanic_id == mechanic_id){
let mechdatadetails = mechdata;
thisObj.mechCustQuote = mechdatadetails.custom_service_quote;
}
})
}
});
this.loader = false; this.loader = false;
} return false;
});
}
cancelBooking(booking: any){ resetQuoteWizard(){
let bookingId: number; this.selectedIssues = [];
if(!booking.bookingId){ this.scheduleMechanic = false;
return false; this.scheduleDateInit = false;
} this.goTostep1Ref.nativeElement.click();
bookingId = booking.bookingId;
this.optionalImges[1] = false;
this.optionalImges[2] = false;
this.optionalImges[3] = false;
this.optionalImges[4] = false;
this.optionalDescription = '';
}
this.loader = true; showCustQuote(booking_id,mechanic_id,type){
this.webService.post_data('cancelBooking', {'customer_id':this.loginDetails.customer_id,'booking_id':bookingId}).subscribe(response => { if(!booking_id || !mechanic_id){
if ( response.status == '1' ) { return false;
this.getCustBookDetails();
this.loader = false;
}
});
} }
this.loader = true;
mechanicQuoteAccept(event,booking_id,mechanic_id){ const thisObj= this;
if(!booking_id || !mechanic_id){
return false; if(type == '2'){
thisObj.successBookDtls = this.bookingDetails;
}
thisObj.successBookDtls.forEach(function (data,index) {
if(data.booking_id == booking_id){
// let bookdata = data;
data.mechanic_data.forEach(function (mechdata,mechindex) {
if(mechdata.mechanic_id == mechanic_id){
let mechdatadetails = mechdata;
thisObj.mechCustQuote = mechdatadetails.custom_service_quote;
}
})
} }
});
this.loader = false;
}
let amount = event.target.attributes.bookAmount.value; cancelBooking(booking: any){
this.showConfirmPopUp('acceptQuote',{bookingId:booking_id,mechanicId:mechanic_id,amount:amount}); let bookingId: number;
if(!booking.bookingId){
return false;
} }
bookingId = booking.bookingId;
cnfCancelBook(booking_id){
if(!booking_id){ this.loader = true;
return false; this.webService.post_data('cancelBooking', {'customer_id':this.loginDetails.customer_id,'booking_id':bookingId}).subscribe(response => {
if ( response.status == '1' ) {
this.getCustBookDetails();
this.loader = false;
} }
this.showConfirmPopUp('cancelBooking',{bookingId:booking_id}); });
} }
cnfdeleteCustomerCar(customer_id,vehicle_id){ mechanicQuoteAccept(event,booking_id,mechanic_id){
if(!customer_id || !vehicle_id){ if(!booking_id || !mechanic_id){
return false; return false;
}
this.showConfirmPopUp('deleteCustomerCar',{'customer_id':customer_id,'customer_veh_id':vehicle_id});
} }
let amount = event.target.attributes.bookAmount.value;
this.showConfirmPopUp('acceptQuote',{bookingId:booking_id,mechanicId:mechanic_id,amount:amount});
}
showConfirmPopUp(fn_name: string, param: any){ cnfCancelBook(booking_id){
if(fn_name === ''){ if(!booking_id){
return false; return false;
}
if(param){
param = JSON.stringify(param);
}
this.confirmParam = param;
this.confirmCallBak = fn_name;
this.confirmModalRef.nativeElement.click();
} }
this.showConfirmPopUp('cancelBooking',{bookingId:booking_id});
}
confirmCallBack(fn_name: string,param: string){ cnfdeleteCustomerCar(customer_id,vehicle_id){
if(fn_name === '' || !this[fn_name]){ if(!customer_id || !vehicle_id){
return false; return false;
}
if(param !== ''){
param = JSON.parse(param);
this[fn_name](param);
} else {
this[fn_name]();
}
} }
this.showConfirmPopUp('deleteCustomerCar',{'customer_id':customer_id,'customer_veh_id':vehicle_id});
}
acceptQuote(param: any){ showConfirmPopUp(fn_name: string, param: any){
this.webService.post_data('acceptMechanicQuote',param).subscribe(response => { if(fn_name === ''){
if(response.status == 'success'){ return false;
document.location.href = this.serverUrl+'payNow/'+response.data; }
if(param){
param = JSON.stringify(param);
}
this.confirmParam = param;
this.confirmCallBak = fn_name;
this.confirmModalRef.nativeElement.click();
}
// this.getCustBookDetails(); confirmCallBack(fn_name: string,param: string){
} if(fn_name === '' || !this[fn_name]){
}) return false;
}
if(param !== ''){
param = JSON.parse(param);
this[fn_name](param);
} else {
this[fn_name]();
} }
}
checkboxChange(index,mechanic_id,event,estimate){ acceptQuote(param: any){
if (event.target.checked) { this.webService.post_data('acceptMechanicQuote',param).subscribe(response => {
this.selMechanics.push({id:index,mechanic_id:mechanic_id,amount:estimate}); if(response.status == 'success'){
} else { document.location.href = this.serverUrl+'payNow/'+response.data;
let id = this.selMechanics.findIndex(x => x.id == index);
if (id != -1) {
this.selMechanics.splice(id, 1);
} // this.getCustBookDetails();
} }
} })
}
scrollToTop(id){ checkboxChange(index,mechanic_id,event,estimate){
$('#'+id).stop().animate({scrollTop: 0}, 800); 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){ scrollToTop(id){
$('#'+id).stop().animate({scrollTop: $('#'+id)[0].scrollHeight}, 1500); $('#'+id).stop().animate({scrollTop: 0}, 800);
} }
scrollToBottom(id){
$('#'+id).stop().animate({scrollTop: $('#'+id)[0].scrollHeight}, 1500);
}
tab_swap(type) { this.tab = type; } tab_swap(type) { this.tab = type; }
} }
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
<div class="col-md-6"> <div class="col-md-6">
<select (change)="get_model($event.target.value)" formControlName="maker" [ngClass]="{'input_error': !vehicleDataForm.controls['maker'].valid && vehicleDataFormSubmit}"> <select (change)="get_model($event.target.value)" formControlName="maker" [ngClass]="{'input_error': !vehicleDataForm.controls['maker'].valid && vehicleDataFormSubmit}">
<option value="" class="hide">MAKE</option> <option value="" class="hide">MAKE</option>
<option *ngFor="let car_date of carSearchJsonData; let key = index" value="{{car_date.veh_brand_id}}">{{car_date.maker}}</option> <option *ngFor="let car_date of carBrands; let key = index" value="{{car_date.veh_brand_id}}">{{car_date.maker}}</option>
</select> </select>
</div> </div>
</div> </div>
......
...@@ -395,7 +395,7 @@ ...@@ -395,7 +395,7 @@
padding: 30px; padding: 30px;
padding-top: 50px; padding-top: 50px;
position: relative; position: relative;
top: 85px; top:15px;
.login_modal_inner { .login_modal_inner {
width: 90%; width: 90%;
margin: 0 auto; margin: 0 auto;
...@@ -498,7 +498,7 @@ ...@@ -498,7 +498,7 @@
} }
} }
.active{ .active{
background-color: #f2f2f2; background-color: #b9b9b9;
padding:8px; padding:8px;
padding-left: 15px; padding-left: 15px;
border-radius: 8px; border-radius: 8px;
......
...@@ -80,8 +80,9 @@ export class IndexComponent implements OnInit { ...@@ -80,8 +80,9 @@ export class IndexComponent implements OnInit {
scheduleMechanic: any; scheduleMechanic: any;
carModel: any; carModel: any;
carBrands: any;
selBrand: string = '';
modelDates: number[] = new Array(); modelDates: number[] = new Array();
carSearchJsonData: any;
optionalImges: any = new Array({1:false,2:false,3:false,4:false}); optionalImges: any = new Array({1:false,2:false,3:false,4:false});
optionalDescription: string; optionalDescription: string;
...@@ -117,10 +118,7 @@ export class IndexComponent implements OnInit { ...@@ -117,10 +118,7 @@ export class IndexComponent implements OnInit {
modelYear: new FormControl('', [Validators.required]), modelYear: new FormControl('', [Validators.required]),
modelName: new FormControl('', [Validators.required]) modelName: new FormControl('', [Validators.required])
}); });
// this.webService.get_stored_json('car-list.json').subscribe((response: any) => {
// this.carSearchJsonData = response;
// });
this.getVehicleBrand(); this.getVehicleBrand();
let currentYear = Number((new Date()).getFullYear()); let currentYear = Number((new Date()).getFullYear());
...@@ -156,20 +154,30 @@ export class IndexComponent implements OnInit { ...@@ -156,20 +154,30 @@ export class IndexComponent implements OnInit {
} }
getVehicleBrand(){ getVehicleBrand(){
this.loader=true;
this.webService.get_data('getVehicleBrand').subscribe(response => { this.webService.get_data('getVehicleBrand').subscribe(response => {
if(response.status == 'success'){ if(response.status == 'success'){
this.carSearchJsonData = response.data; this.carBrands = response.data;
} }
this.loader = false;
}); });
} }
get_model(event) { get_model(brand_id) {
this.webService.post_data('getVehicleModel',{'vehBrand_id':event}).subscribe(response => { this.loader = true;
const thisObj = this;
thisObj.carBrands.forEach(function (brandData,index) {
if(brandData.veh_brand_id == brand_id){
thisObj.selBrand = brandData.maker;
}
});
this.webService.post_data('getVehicleModel',{'vehBrand_id':brand_id}).subscribe(response => {
if(response.status == 'success'){ if(response.status == 'success'){
this.carModel = response.data; this.carModel = response.data;
} }
this.loader = false;
}); });
// this.carModel = this.carSearchJsonData[event].models;
} }
getVehicleLoc(lastLoc){ getVehicleLoc(lastLoc){
...@@ -209,12 +217,12 @@ export class IndexComponent implements OnInit { ...@@ -209,12 +217,12 @@ export class IndexComponent implements OnInit {
} }
this.wizardData['vechile_info'] = {'trim':vehicleData['trim'], this.wizardData['vechile_info'] = {'trim':vehicleData['trim'],
'lastMaintanceDate':(vehicleData['last_date'])?(formatDate(vehicleData['last_date'],'MM/dd/yyyy','en')):'', 'lastMaintanceDate':(vehicleData['last_date'])?(formatDate(vehicleData['last_date'],'MM/dd/yyyy','en')):'',
'maker':this.carSearchJsonData[vehicleData['maker']]['brand'], 'maker':this.selBrand,
'milage':vehicleData['milage'],'emgine':vehicleData['emgine'], 'milage':vehicleData['milage'],'emgine':vehicleData['emgine'],
'modelName':vehicleData['modelName'],'modelYear':vehicleData['modelYear'], 'modelName':vehicleData['modelName'],'modelYear':vehicleData['modelYear'],
'maintanenceInterval':vehicleData['maintanence_interval'] 'maintanenceInterval':vehicleData['maintanence_interval']
} }
//console.log(this.wizardData['vechile_info']) console.log(this.wizardData['vechile_info'])
this.vehicleDataFormSubmit = false; this.vehicleDataFormSubmit = false;
} }
......
...@@ -43,7 +43,11 @@ ...@@ -43,7 +43,11 @@
</li> </li>
</ul> </ul>
<ng-template #noCart> <ng-template #noCart>
No Data Found <div class="cmn_nodata">
<img src="../../../assets/images/no_result.png">
<p>No Data Found</p>
</div>
</ng-template> </ng-template>
</div> </div>
</div> </div>
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
padding: 10px; padding: 10px;
img{ img{
height: 180px; height: 180px;
width: auto; max-width: 100%;
} }
} }
h5{ h5{
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
</app-searchbar> </app-searchbar>
<div class="loader_overlay" *ngIf="loader"></div> <div class="loader_overlay" *ngIf="loader"></div>
<div class="myorder_wrapper"> <div class="myorder_wrapper">
<ul *ngIf="bookedData" infiniteScroll [infiniteScrollDistance]="2" [infiniteScrollThrottle]="50" (scrolled)="onScroll()" [scrollWindow]="false" style="max-height: 700px; overflow: scroll"> <ul *ngIf="bookedData;else noOrders" infiniteScroll [infiniteScrollDistance]="2" [infiniteScrollThrottle]="50" (scrolled)="onScroll()" [scrollWindow]="false" style="max-height: 700px; overflow: scroll">
<li *ngFor="let book of bookedData"> <li *ngFor="let book of bookedData">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
...@@ -45,6 +45,13 @@ ...@@ -45,6 +45,13 @@
</div> </div>
</li> </li>
</ul> </ul>
<ng-template #noOrders>
<div class="cmn_nodata">
<img src="../../../assets/images/no_result.png">
<p>No Data Found</p>
</div>
</ng-template>
</div> </div>
</div> </div>
<div class="bottom_product_list"> <div class="bottom_product_list">
......
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
padding: 10px; padding: 10px;
img{ img{
height: 180px; height: 180px;
width: auto; max-width: 100%;
} }
} }
h5{ h5{
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
<div class="product_details"> <div class="product_details">
<h1>{{productDetails.product_name}}</h1> <h1>{{productDetails.product_name}}</h1>
<h2>{{productDetails.short_description}}</h2> <h2>{{productDetails.short_description}}</h2>
<h2>Brand : </h2><h4>{{productDetails.brand_name}}</h4> <h2><strong>Brand : </strong>{{productDetails.brand_name}}</h2>
<div *ngIf="productDetails.part_id"><h2>Part ID : </h2><h4>{{productDetails.part_id}}</h4></div> <div *ngIf="productDetails.part_id">
<h2><strong>Part ID : </strong>{{productDetails.part_id}}</h2></div>
<h3>$ {{productDetails.amount}}</h3> <h3>$ {{productDetails.amount}}</h3>
<div class="rating_div" *ngIf="productDetails.rating"> <div class="rating_div" *ngIf="productDetails.rating">
<fieldset class="rating prevent-click"> <fieldset class="rating prevent-click">
......
...@@ -852,3 +852,19 @@ bs-datepicker-container{ ...@@ -852,3 +852,19 @@ bs-datepicker-container{
padding-bottom: 50px; padding-bottom: 50px;
} }
.cmn_nodata{
text-align: center;
padding-top:10%;
padding-bottom: 10%;
img{
width: 200px;
margin-bottom:50px;
}
p{
text-align: center;
color: #a8a8a8;
font-size: 24px;
font-weight: 300;
}
}
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