[ad_1]
.then(data => {
if(data.message === ‘success’) {
this.trackingId = data.id;
// if entry step is 4 update feasibility and proposalSelected
if(step === 4 && this.selectedVorschlag) {
this.updateTracker(this.activeContent, {feasibilityScore: this.selectedVorschlag.machbarkeit, proposalSelected: true});
}
}
})
.catch(error => {
console.error(‘Error:’, error);
});
},
initPasst() {
const passtDialog = qs(‘#passt-configure’);
this.today = new Date().toISOString().split(‘T’)[0];
passtDialog.addEventListener(‘opening’, async event => {
if (!this.debugMode && $store.passtStore.selectedVorschlag && $store.passtStore.requestId && $store.passtStore.passtUserData) {
this.selectedVorschlag = $store.passtStore.selectedVorschlag;
this.passtData = {
‘requestId’: $store.passtStore.requestId,
}
this.passtForm = {
einkommenNetto: $store.passtStore.passtUserData.einkommenNetto,
geburtsdatum__jahr: $store.passtStore.passtUserData.geburtsdatum__jahr,
eigenKapital: $store.passtStore.passtUserData.eigenKapital,
beschaeftigtSeit: $store.passtStore.passtUserData.beschaeftigtSeit,
beschaeftigungsArt: $store.passtStore.passtUserData.beschaeftigungsArt,
sonstigeEinnahmen: $store.passtStore.passtUserData.sonstigeEinnahmen,
}
this.activeContent = 4;
// if user has default zipcode we want to preflight ampr
this.handleZipcodeChange();
this.createTracker(4);
} else {
this.createTracker(1);
}
});
passtDialog.addEventListener(‘closed’, async event => {
this.activeContent = 1;
this.isRegisterPage = false;
this.passtData = {};
this.amprPreflightSuccessfull = false;
this.totalVorschlaege = 0;
this.selectedVorschlag = null;
this.showNoVorschlagError = false;
this.currentZipcode = null;
this.allZipcodes = {};
this.leadConsumer = {};
this.password = ”;
this.trackingId = null;
this.passwordError = false;
this.newsletterChecked = false;
this.isSendingRegister = false;
this.hasAccount = false;
this.zipcodeError = false;
this.zipcodeFocused = false;
this.createLeadLoading = false;
this.amprForm = initAmprForm();
});
},
getFormData(formId) {
const form = document.getElementById(formId);
const formData = new FormData(form);
return Object.fromEntries(formData.entries());
},
isAllNumbers(string) {
return /^d+$/.test(string);
},
handleZipcodeChange() {
// reset error flag
this.zipcodeError = false;
if (this.amprForm.zipcode.length === 0) {
this.currentZipcode = null;
return;
}
// handle valid zipcode
if (this.amprForm.zipcode.length === 5 && this.isAllNumbers(this.amprForm.zipcode)) {
if (!this.allZipcodes[this.amprForm.zipcode]) {
this.currentZipcode = this.amprForm.zipcode;
this.allZipcodes[this.amprForm.zipcode] = {fetching: true, error: false, success: false, data: {} };
this.callPreflightAMPR(this.currentZipcode);
} else {
this.currentZipcode = this.amprForm.zipcode;
}
return;
}
// handle invalid zipcode
this.zipcodeError = true;
this.currentZipcode = null;
},
callPreflightAMPR(currentZipcode) {
const requestData = {
‘zipcode’: currentZipcode
};
const url=”/finanzierung/ampr/273237/preflight/”;
const csrfToken = ‘uogVqTP0QMoivJoODnDSgi5dJZjJh4JNtp7fZVQdyX1P8HMFeAJUW0k4x59XcYJ1’;
fetch(url, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
‘X-CSRFToken’: csrfToken,
},
body: JSON.stringify(requestData)
})
.then(response => {
const status = response.status;
return response.json().then(data => ({ status, data }));
})
.then(({ status, data }) => {
if (status === 200) {
this.updateTracker(this.activeContent, {agbShown: true});
success = true;
if (data && data.leadConsumers && data.leadConsumers.length > 0)
{
this.leadConsumer = data.leadConsumers[0]
} else {
success = false;
}
this.allZipcodes[currentZipcode] = {
fetching: false,
error: !success,
success: success,
data: data,
};
} else {
this.allZipcodes[currentZipcode] = {
fetching: false,
error: true,
success: false,
data: {},
};
// show error message
}
})
.catch(error => {
console.error(‘Error:’, error);
this.allZipcodes[currentZipcode] = {
fetching: false,
error: true,
success: false,
data: {},
};
this.changeActiveContent(9, 1);
});
},
callCreateLeadAMPR: async function() {
const amprFormId = ‘amprForm’;
const form = document.getElementById(amprFormId);
if (form.checkValidity()) {
if (this.selectedVorschlag && this.leadConsumer) {
this.createLeadLoading = true;
if(!$store.passtStore.selectedVorschlag) {
$store.passtStore.selectedVorschlag = this.selectedVorschlag;
}
const postData = this.getFormData(amprFormId);
postData.agb = this.amprForm.agb;
postData.requestId = this.passtData.requestId;
if (this.passtModus === ‘full’ || this.passtModus === ‘no-passt-results’) {
postData.vorschlag = this.selectedVorschlag;
postData.userData = this.getFormData(‘passtForm’);
}
postData.leadConsumer = this.leadConsumer;
postData.passtMode = this.passtModus;
const url=”/finanzierung/ampr/273237/create-lead/”;
const csrfToken = ‘uogVqTP0QMoivJoODnDSgi5dJZjJh4JNtp7fZVQdyX1P8HMFeAJUW0k4x59XcYJ1’;
fetch(url, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
‘X-CSRFToken’: csrfToken,
},
body: JSON.stringify(postData),
})
.then(response => {
if (response.ok) {
return response.json();
} else {
throw new Error(‘Error: ‘ + response.status);
}
})
.then(data => {
this.createLeadLoading = false;
this.isRegisterPage = true;
this.changeActiveContent(6);
})
.catch(error => {
console.error(‘Error:’, error);
this.createLeadLoading = false;
this.changeActiveContent(9, 1);
});
} else {
this.createLeadLoading = false;
this.changeActiveContent(9, 1);
}
} else {
form.reportValidity();
}
},
registerFormSubmit() {
return function(event) {
event.preventDefault();
if (this.password.length < 8) {
this.passwordError = true;
return;
}
const url=”/api/register/”;
const csrfToken = ‘uogVqTP0QMoivJoODnDSgi5dJZjJh4JNtp7fZVQdyX1P8HMFeAJUW0k4x59XcYJ1’;
const userData = {
email: this.amprForm.contactEmail,
password: this.password,
newsletter: this.newsletterChecked,
phone: this.amprForm.phonenumber,
firstname: this.amprForm.firstname,
lastname: this.amprForm.lastname,
signup_source: ‘AMPR_FORM’,
};
this.passwordError = false;
this.isSendingRegister = true;
const options = {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
‘X-CSRFToken’: csrfToken
},
body: JSON.stringify(userData),
};
fetch(url, options)
.then(response => response.json())
.then(data => {
this.isSendingRegister = false;
if (data.status === ‘ok’) {
this.changeActiveContent(7);
} else {
this.hasAccount = true;
}
})
.catch((error) => {
this.isSendingRegister = false;
console.error(‘Error:’, error);
});
}
},
changeActiveContent: async function(index, errorId=0) {
this.errorId = errorId;
this.updateTracker(index);
if (this.passtModus === ‘no-passt-results’ && [3].includes(index)) {
this.selectedVorschlag = this.passtData.vorschlaege_all[0];
await this.changeActiveContent(index + 1);
this.handleZipcodeChange();
return;
}
if (this.passtModus === ‘no-passt’ && [1, 2, 3, 4].includes(index)) {
await this.changeActiveContent(index + 1);
return;
}
if (this.activeContent === 1) {
// reset selection
this.passtData = {};
this.selectedVorschlag = null;
this.passtState = {
loading: false,
error: false,
success: false,
};
// validate form
const form = document.getElementById(‘passtForm’);
if (form.checkValidity()) {
this.activeContent = index;
this.passtState.loading = true;
const data = this.getFormData(‘passtForm’);
this.passtData = await getFinancialProposals(‘273237’, data);
this.passtMaxPriceData = await getMaximumPurchasePriceData(‘273237’, data);
this.passtState.loading = false;
if (this.passtData && this.passtMaxPriceData) {
// update passtStore
$store.passtStore.requestId = this.passtData.requestId;
$store.passtStore.passtUserData = data;
if (this.passtData.vorschlaege) {
$store.passtStore.selectedVorschlag = this.passtData.vorschlaege;
}
this.updateTracker(this.activeContent, {
feasibilityScore: this.passtData.vorschlaege.machbarkeit,
maxPurchasePrice: this.passtMaxPriceData.maximumPurchasePrice === 0 ? this.passtMaxPriceData.maximumPurchasePrice : (parseInt(this.passtMaxPriceData.maximumPurchasePrice) + parseInt(data.eigenKapital || 0))
});
this.passtState.success = true;
} else {
this.passtState.error = true;
this.activeContent = 9;
}
} else {
form.reportValidity();
}
} else if (this.activeContent === 2) {
this.totalVorschlaege = this.passtData.vorschlaege_all.length;
this.activeContent = index;
} else if (this.activeContent === 3) {
if (this.selectedVorschlag) {
this.showNoVorschlagError = false;
// tigger zipcode handler
this.handleZipcodeChange();
this.activeContent = index;
} else {
this.showNoVorschlagError = true;
}
} else {
this.activeContent = index;
}
},
}”
class=”w-full”
x-init=”initPasst”
>
Determine your financing chance
Get a realistic assessment of the affordability and the monthly costs for the properties that have caught your interest.
Create your free OM account now
Thank you for your registration!
Fill out the following information and determine your financing chance.
Maximum purchase price
Based on the data you provided, financing proposals can be found up to the displayed purchase price.
Unfortunately, we were unable to determine a maximum purchase price. If you increase your equity, we can offer you financing proposals.
Affordability
We are pleased to inform you that financing proposals have been found for this property.
Unfortunately, we were unable to find any financing proposals for this property.
Please select a financing option.
Please select a financing option first.
Your individual financing proposal:
Just one more step! Please fill out the following contact information.
Request successfully submitted
Thank you, the financial advisor will contact you immediately.
Request successfully submitted
Thank you, the financial advisor will contact you immediately.
Um die Registrierung abzuschließen ist es nötig, Ihre E-Mail-Adresse zu überprüfen. Wir haben Ihnen soeben eine E-Mail dafür zugeschickt.
Bitte rufen Sie Ihre E-Mails ab und klicken Sie in der Mail auf den Bestätigungs-Button. Anschließend können Sie
sofort mit dem Veröffentlichen Ihrer Immobilienanzeige beginnen.
Noch keine E-Mail angekommen?
Die E-Mail kommt normalerweise innerhalb weniger Sekunden an, nur in Ausnahmefällen kann es bis zu 10 Minuten dauern. Schauen Sie bitte auch in
Ihrem Spam-Ordner nach, manchmal kommt es vor, dass die Mail dort landet.
Es kommt keine Mail an, oder es gibt sonstige Probleme?
Kein Problem! Gerne helfen wir Ihnen persönlich weiter. Rufen Sie uns einfach an unter (0 40) 781 0206 10.
Oops, something went wrong.
Please try again.
No results found
Unfortunately, no financing options could be found.
[ad_2]
Source link