Some notes and file clean up. JJSV Templates
This commit is contained in:
@ -1,11 +1,107 @@
|
||||
{% if current_person.signed_in? %}
|
||||
{% unless current_person.properties.additional_user_info_complete %}
|
||||
{% unless current_person.email contains "+preview" %}
|
||||
{% unless current_person.email contains "+preview" %}
|
||||
{% if current_person.properties.additional_user_info_complete == false %}
|
||||
<script>
|
||||
console.log('user not completed additional info - redirect to additional signup')
|
||||
window.location.replace('/app/sign-up-cont')
|
||||
|
||||
if (localStorage.getItem('learnerCompletedSecondaryRegistration') != null) {
|
||||
const secondaryInfoStored = localStorage.getItem("learnerCompletedSecondaryRegistration")
|
||||
const learnerCompany = localStorage.getItem("learnerCompany")
|
||||
const learnerCity = localStorage.getItem("learnerCity")
|
||||
const learnerState = localStorage.getItem("learnerState")
|
||||
const learnerCountry = localStorage.getItem("learnerCountry")
|
||||
const learnerRole = localStorage.getItem("learnerRole")
|
||||
const learnerSpecialty = localStorage.getItem("learnerSpecialty")
|
||||
|
||||
if ( learnerCompany != null && learnerCity != null && learnerState != null && learnerCountry != null && learnerRole != null && learnerSpecialty != null ) {
|
||||
let userData = {
|
||||
learner_uuid: '{{current_person.id}}',
|
||||
company: learnerCompany,
|
||||
city: learnerCity,
|
||||
state: learnerState,
|
||||
country: learnerCountry,
|
||||
role: learnerRole,
|
||||
specialty: learnerSpecialty,
|
||||
}
|
||||
rerunAdditionalLearnerInfoWorkflow(userData)
|
||||
}
|
||||
} else {
|
||||
window.location.replace('/app/sign-up-cont')
|
||||
}
|
||||
|
||||
function rerunAdditionalLearnerInfoWorkflow(data) {
|
||||
console.log("re-running workflow with data: ", data)
|
||||
|
||||
$.ajax({
|
||||
url: "https://www.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/additional-learner-info",
|
||||
data: JSON.stringify(data),
|
||||
method: 'POST',
|
||||
success: function(res){
|
||||
console.log(res)
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error posting to workato!", error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endunless %}
|
||||
{% elsif current_person.properties.additional_user_info_complete == true %}
|
||||
<script>
|
||||
console.log("property is set, can delete local storage")
|
||||
localStorage.removeItem("learnerCompletedSecondaryRegistration")
|
||||
localStorage.removeItem("learnerCompany")
|
||||
localStorage.removeItem("learnerCity")
|
||||
localStorage.removeItem("learnerState")
|
||||
localStorage.removeItem("learnerCountry")
|
||||
localStorage.removeItem("learnerRole")
|
||||
localStorage.removeItem("learnerSpecialty")
|
||||
</script>
|
||||
{% else %}
|
||||
<script>
|
||||
console.log("custom prop doesn't exist")
|
||||
|
||||
if (localStorage.getItem('learnerCompletedSecondaryRegistration') != null) {
|
||||
const secondaryInfoStored = localStorage.getItem("learnerCompletedSecondaryRegistration")
|
||||
const learnerCompany = localStorage.getItem("learnerCompany")
|
||||
const learnerCity = localStorage.getItem("learnerCity")
|
||||
const learnerState = localStorage.getItem("learnerState")
|
||||
const learnerCountry = localStorage.getItem("learnerCountry")
|
||||
const learnerRole = localStorage.getItem("learnerRole")
|
||||
const learnerSpecialty = localStorage.getItem("learnerSpecialty")
|
||||
|
||||
if ( learnerCompany != null && learnerCity != null && learnerState != null && learnerCountry != null && learnerRole != null && learnerSpecialty != null ) {
|
||||
let userData = {
|
||||
learner_uuid: '{{current_person.id}}',
|
||||
company: learnerCompany,
|
||||
city: learnerCity,
|
||||
state: learnerState,
|
||||
country: learnerCountry,
|
||||
role: learnerRole,
|
||||
specialty: learnerSpecialty,
|
||||
}
|
||||
rerunAdditionalLearnerInfoWorkflow(userData)
|
||||
}
|
||||
} else {
|
||||
window.location.replace('/app/sign-up-cont')
|
||||
}
|
||||
|
||||
function rerunAdditionalLearnerInfoWorkflow(data) {
|
||||
console.log("re-running workflow with data: ", data)
|
||||
|
||||
$.ajax({
|
||||
url: "https://www.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/additional-learner-info",
|
||||
data: JSON.stringify(data),
|
||||
method: 'POST',
|
||||
success: function(res){
|
||||
console.log(res)
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error posting to workato!", error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user