Updated blacklane, chubb and anthology's templates. Some small script updates. Todos.
This commit is contained in:
BIN
Custom_Templates/customer_templates/Blacklane-Chauffeurs/.DS_Store
vendored
Normal file
BIN
Custom_Templates/customer_templates/Blacklane-Chauffeurs/.DS_Store
vendored
Normal file
Binary file not shown.
@ -1,13 +1,28 @@
|
||||
<script>
|
||||
let jsDate = new Date();
|
||||
let jsFormattedDate = jsDate.getFullYear() + ("0" + (jsDate.getMonth() + 1)).slice(-2) + ("0" + jsDate.getDate()).slice(-2);
|
||||
let liquidFormattedDate = '{{ "now" | date: "%Y-%m-%d" }}';
|
||||
let personCreateDate = '{{ current_person.created_at }}'.split(" ")[0]
|
||||
if (personCreateDate == liquidFormattedDate) {
|
||||
if (localStorage.getItem('learnerCompletedAdditionalInfo') == null) {
|
||||
window.location.href = '/app/sign-up-follow-up'
|
||||
}
|
||||
}
|
||||
{% assign groups = "24109c21-3801-4f71-90a0-43e90de4ab3a, ef141d93-8556-478a-81a2-0da18c8390ec, 28cb22cf-6ac0-4f6c-852d-7ad77ab046cb" | split: ", " %}
|
||||
let groupedUser = false;
|
||||
{% if current_person.groups.any? %}
|
||||
{% for group in current_person.groups %}
|
||||
{% for gid in groups %}
|
||||
{% if group.id == gid %}
|
||||
groupedUser = true;
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if groupedUser == false %}
|
||||
window.location.href = '/app/sign-up-follow-up'
|
||||
{% endif %}
|
||||
// let jsDate = new Date();
|
||||
// let jsFormattedDate = jsDate.getFullYear() + ("0" + (jsDate.getMonth() + 1)).slice(-2) + ("0" + jsDate.getDate()).slice(-2);
|
||||
// let liquidFormattedDate = '{{ "now" | date: "%Y-%m-%d" }}';
|
||||
// let personCreateDate = '{{ current_person.created_at }}'.split(" ")[0]
|
||||
// if (personCreateDate == liquidFormattedDate) {
|
||||
// if (localStorage.getItem('learnerCompletedAdditionalInfo') == null) {
|
||||
// window.location.href = '/app/sign-up-follow-up'
|
||||
// }
|
||||
// }
|
||||
</script>
|
||||
|
||||
<header class="np-header np-header-color">
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
type="text"
|
||||
name="first_name"
|
||||
id="learner_first_name"
|
||||
value="{{ form.first_name | escape }}"
|
||||
value="{{ form.first_name }}"
|
||||
/>
|
||||
</div>
|
||||
<div class="np-form-field">
|
||||
@ -32,7 +32,7 @@
|
||||
type="text"
|
||||
name="last_name"
|
||||
id="learner_last_name"
|
||||
value="{{ form.last_name | escape }}"
|
||||
value="{{ form.last_name }}"
|
||||
/>
|
||||
</div>
|
||||
<div class="np-form-field">
|
||||
@ -44,73 +44,16 @@
|
||||
type="text"
|
||||
name="email"
|
||||
id="learner_email"
|
||||
value="{{ form.email | escape }}"
|
||||
value="{{ form.email }}"
|
||||
/>
|
||||
</div>
|
||||
<div class="np-form-field">
|
||||
<label class="np-input-label">
|
||||
Region
|
||||
</label>
|
||||
<select
|
||||
class="sign-up-region np-input"
|
||||
type="text"
|
||||
name="group-dropdown"
|
||||
id="sign-up-group-dropdown"
|
||||
required >
|
||||
<option class="info-group-option" value="APAC/EMEA">
|
||||
APAC/EMEA
|
||||
</option>
|
||||
<option class="info-group-option" value="AMERICAS">
|
||||
Americas
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<input
|
||||
type="submit"
|
||||
name="commit"
|
||||
value="{% t shared.enter %}"
|
||||
class="np-button np-button-big np-form-action"
|
||||
<button class="addtl-button" onclick="submitData()"></button>
|
||||
/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script>
|
||||
|
||||
let submitData = async () => {
|
||||
//if(
|
||||
// ($(".sign-up-region")[0].value.length > 0)
|
||||
// ){
|
||||
|
||||
function webhookCaller(){
|
||||
return new Promise(function(res, rej) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
url = "https://webhooks.workato.com/webhooks/rest/a36b1f7c-07c7-48ff-bc0f-cb3777d02c81/blacklane-new-driver-region-seg";
|
||||
|
||||
xhr.addEventListener("load", e => {
|
||||
window.location.replace('/app/');
|
||||
//window.location.replace('/app');
|
||||
});
|
||||
xhr.open("POST", url, true);
|
||||
xhr.send(JSON.stringify({
|
||||
email: '{{ current_person.email }}',
|
||||
name: "{{ current_person.first_name }} {{ current_person.last_name }}",
|
||||
user_id: '{{ current_person.id }}',
|
||||
user_region: $(".sign-up-region")[0].value,
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
try {
|
||||
await webhookCaller()
|
||||
.then((res) => {
|
||||
window.location.replace('/app/dashboard')
|
||||
})
|
||||
} catch(err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user