Commit 0e2d189c by Tobin

dc

parent 23d4475a
......@@ -111,6 +111,10 @@
}
}
}
.service-align-center{
padding-left: 0px !important;
text-align: center;
}
.container-fluid {
width: calc(100% - 15%);
.tab-content {
......
......@@ -51,6 +51,7 @@ export class IndexComponent implements OnInit {
//Service Details: TAB 3
loader: boolean;
issuesData: any;
defIssuesData: any[] = new Array();
selectedIssues: any[] = new Array();
//Quote Page
......@@ -63,12 +64,17 @@ export class IndexComponent implements OnInit {
imageServer: string;
mechanicData: any;
autoSchedule: boolean;
showLeftArrow: boolean;
showRightArrow: boolean;
estimatedPrice: number;
scheduleDateInit: boolean;
scheduleMechanic: any;
carModel: any;
modelDates: number[] = new Array();
carSearchJsonData: any;
optionalImges: any = new Array({1:false,2:false,3:false,4:false});
optionalDescription: string;
constructor(
private router : Router,
......@@ -77,13 +83,18 @@ export class IndexComponent implements OnInit {
public mapsAPILoader : MapsAPILoader,
public subjectService : SubjectService) {
this.step = 0;
this.issuesData = false;
this.autoSchedule = false;
this.imageServer = ImageStorage;
this.currDate = new Date();
this.nextDate = new Date();
this.loginDetails = false;
this.searchLocError = false;
this.showLeftArrow = false;
this.showRightArrow = true;
this.scheduleDateInit = false;
this.scheduleMechanic = false;
this.optionalDescription = '';
this.vehicleDataFormSubmit = false;
}
......@@ -176,17 +187,43 @@ export class IndexComponent implements OnInit {
this.webService.get_data('getGeneralIssues').subscribe(response => {
if(response.status == '1'){
this.issuesData = response.issue_data;
this.defIssuesData = this.issuesData;
this.loader = false;
} else {
this.loader = false;
return false;
}
this.loader = false;
},error => {
this.loader = false;
return false;
});
}
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;
let data: any[] = new Array();
let serRegExp = new RegExp(event.target.value,"gi");
thisObj.defIssuesData.forEach(function (issues,index) {
let issueCat = issues.issue;
if(issueCat.search(serRegExp) != -1){
data.push(thisObj.defIssuesData[index]);
}
});
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);
}
setIssueSelected(event){
let issue_id = event.target.attributes.issue_id.value;
let sub_issue_id = event.target.attributes.sub_issue_id.value;
......@@ -239,11 +276,19 @@ export class IndexComponent implements OnInit {
resetQuoteWizard(){
this.jumpToStep0();
this.vehicleDataForm.reset();
this.searchElementRef.nativeElement.value = '';
this.selectedIssues = [];
this.scheduleDateInit = false;
this.vehicleDataForm.reset({
trim: '', milage: '', emgine: '', maker: '', modelYear: '', modelName: ''
});
this.optionalImges[1] = false;
this.optionalImges[2] = false;
this.optionalImges[3] = false;
this.optionalImges[4] = false;
this.optionalDescription = '';
}
getQuote(){
......@@ -257,17 +302,19 @@ export class IndexComponent implements OnInit {
let searchData = {'pickup_data':this.wizardData.pickup_data,'sub_issues':selSubIssues}
this.webService.post_data('getNearByMechanics',searchData).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.loader = false;
} else {
this.loader = false;
return false;
}
},error => {
this.loader = false;
return false;
});
}
......@@ -288,8 +335,12 @@ export class IndexComponent implements OnInit {
next(event) {
if(this.dateStep > 30){
this.showLeftArrow = true;
this.showRightArrow = false;
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);
......@@ -300,8 +351,12 @@ export class IndexComponent implements OnInit {
prev(event) {
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);
......@@ -311,7 +366,6 @@ export class IndexComponent implements OnInit {
}
getSchedule(time,index){
this.scheduleDateInit = true;
this.wizardData['schedule_date'] = {'date':this.formatDate(this.dateSection[index]),'time':time};
}
......@@ -325,7 +379,7 @@ export class IndexComponent implements OnInit {
return [year,month,day].join('-');
}
scheduleNow(mechanic_id){
scheduleNow(mechanic_id,cost){
this.wizardData['mechanic_id'] = mechanic_id;
if(!this.loginDetails){
......@@ -334,6 +388,8 @@ export class IndexComponent implements OnInit {
return false;
}
this.loader = true;
this.wizardData['cost'] = cost;
this.confirmBooking();
}
......@@ -342,12 +398,13 @@ export class IndexComponent implements OnInit {
this.wizardData['selected_issues'] = this.selectedIssues;
this.webService.post_data('scheduleNow',this.wizardData).subscribe(response => {
this.loader = false;
if(response.status == '1'){
this.closeWizardRef.nativeElement.click();
this.closeQuoteWizardRef.nativeElement.click();
this.router.navigate(['../dashboard']);
this.router.navigate(['../dashboard'],{queryParams: {tab: 'service'}});
this.loader = false;
} else {
this.loader = false;
return false;
}
},error => {
......@@ -357,22 +414,47 @@ export class IndexComponent implements OnInit {
}
jumpToStep0(){
this.goTostepRef.nativeElement.click();
this.goTostep0Ref.nativeElement.click();
}
jumpToStep1(){
if(!this.vehicleDataForm.invalid){
this.goTostepRef.nativeElement.click();
this.goTostep1Ref.nativeElement.click();
}
}
jumpToStep2(){
if(this.selectedIssues.length > 0){
this.goTostepRef.nativeElement.click();
this.goTostep2Ref.nativeElement.click();
}
}
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);
}
scrollToBottom(id){
$('#'+id).stop().animate({scrollTop: $('#'+id)[0].scrollHeight}, 1500);
}
featuredOnLoad() {return ''; }
carouselTileLoad(){ return ''; }
......
......@@ -465,3 +465,18 @@ section.module.parallax {
.error{
border:2px solid red !important;
}
.prevent-click {
pointer-events: none;
cursor: default;
text-decoration: none;
color: black;
}
.hide {
display:none !important;
}
.invisible{
opacity: 0 !important;
}
\ No newline at end of file
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