Files
Gainsight/Custom_Templates/customer_templates/Harri - New User/second-login.html.liquid
2023-12-18 17:01:20 -05:00

341 lines
9.0 KiB
Plaintext

{% assign group_count = 0 %}
{% assign groups = current_person.groups %}
{% for item in groups %}
{% assign group_count = group_count | plus: 1 %}
{% if group_count >= 2 and item.id contains 'd8b83557-aad1-4a4e-85ee-ddbde5d1e507'%}
<script>
document.addEventListener('DOMContentLoaded', function() {
setTimeout(function() {
if (window.location.pathname == '/app/second-login') {
window.location.replace('/app');
}
}, 1000);
});
</script>
{% endif %}
{% endfor %}
{% include "header" %}
<main class="np-main np-box-container">
<div class="np-box">
<div class="np-box-content-container">
<form id="register-form" class="np-form np-box-content" novalidate>
<div class="np-form-title text-center"> Welcome! </div>
<div class="np-form-subtitle"> Please choose the option that best matches your current role to enroll in the
appropriate learning path. </div>
{% form_authenticity_token %}
<div class="np-form-field">
<label class="np-input-label" for="learner_role">
</label>
<select
class="np-input"
type="text"
name="learner[role]"
id="learner_role"
required
>
<option class="default-option" disabled selected id="default-option">Your role</option>
<option value="General Manager">General Manager</option>
<option value="Kitchen Manager">Kitchen Manager</option>
<option value="People Manager">People Manager</option>
<option value="Guest Services Manager">Guest Services Manager</option>
<option value="Swing/Shift Manager">Swing/Shift Manager</option>
<option value="Manager Trainees">Manager Trainees</option>
<option value="Supervisor">Supervisor</option>
<option value="Supervisor/Role Assigment">Supervisor w/Role Assignment</option>
<option value="Org Admin">Org Admin/Back Office Admin</option>
<option value="Owner Operator">Owner/Operator</option>
<option value="Crew Trainer">Crew Trainer</option>
<option value="Corporate/Field Staff">McDonalds Corporate/Field Staff</option>
</select>
</div>
<div class="np-form-subtitle">Please provide your store number</div>
<div class="np-form-field">
<label class="np-input-label" for="store_number">
</label>
<input
class="np-input"
type="text"
name="store[number]"
id="store_number"
placeholder="Store Number(NSN)"
required
>
</div>
</form>
<button id="send_button" class="np-button np-button-big np-button-large-font np-form-action">
Update Information
</button>
</div>
</div>
</main>
{% include "footer" %}
<style>
@media (min-width: 1440px) {
#password-too-short-alert {
position: absolute;
right: 25.5%;
bottom: 23%;
color: salmon;
font-size: 13px;
}
#passwords-dont-match-alert {
position: absolute;
right: 23%;
bottom: 14.5%;
color: salmon;
font-size: 13px;
}
}
@media (min-width: 769px) and (max-width: 1024px) {
#password-too-short-alert {
position: absolute;
right: 24%;
bottom: 23%;
color: salmon;
font-size: 13px;
}
#passwords-dont-match-alert {
position: absolute;
right: 21.5%;
bottom: 14.5%;
color: salmon;
font-size: 13px;
}
}
@media (min-width: 426px) and (max-width: 768px) {
.np-box-content-container {
align-items: center;
}
}
@media (min-width: 376px) and (max-width: 425px) {
.np-input {
padding: 0 0.75rem;
}
}
@media (min-width: 326px) and (max-width: 375px) {
.np-input {
padding: 0 0.75rem;
}
}
@media (max-width: 325px) {
.np-input {
padding: 0 0.75rem;
}
}
.np-main {
margin: 25px 0;
}
.np-box {
display: flex;
flex-direction: row;
width: unset !important;
box-shadow: none;
}
.np-box-container {
height: unset !important;
background: none;
}
.hero-image-left-desktop {
width: 60%;
}
.hero-image-left-mobile {
width: 100%;
display: none;
}
.np-box-content-container {
margin-top: 0;
margin-bottom: 0;
padding: 2rem;
display: flex;
flex-direction: column;
}
.np-form-subtitle {
margin-bottom: 1.25rem;
}
.np-input {
background-color: #FFF6F0;
border: none;
border-radius: 4px;
}
.np-input::placeholder {
color: #6F7277;
font-size: 16px;
}
#default-option {
color: #6F7277;
font-size: 16px;
}
.selection-option {
font-family: Inter;
}
.body {
height: 100%;
}
#learner_role {
color: #1B1C1D;
text-align: left;
}
@media only screen and (min-width: 1190px) {
.hero-image-left-desktop {
min-width: 60%;
}
}
@media only screen and (max-width: 768px) {
.np-box-content-container {
padding: 2rem 2rem 2.25rem;
}
.hero-image-left-desktop {
display: none;
}
.hero-image-left-mobile {
display: block;
}
.np-box {
flex-direction: column;
margin: 0;
}
.np-main {
margin: 0;
}
.np-box-content-container {
margin-left: 0;
}
}
#send_button {
pointer-events: none;
background: #6F7277;
}
.loader {
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid #00bf8f;
border-bottom: 16px solid #00bf8f;
width: 120px;
height: 120px;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<style>
.np-box-container {
background: none;
}
</style>
<script>
function checkIfInputsExist (){
window.setTimeout(function(){
if ($("#store_number")[0].value.length > 0 && $("#learner_role")[0].value != "Your Role") {
$("#send_button").css("background-color","#de352a");
$("#send_button").css("pointer-events","auto");
}
else {
$("#send_button").css("background-color","#6F7277");
$("#send_button").css("pointer-events","none");
}
}, 500)
}
document.addEventListener('keydown', checkIfInputsExist);
document.getElementById("learner_role").addEventListener('change', checkIfInputsExist);
document.getElementById("send_button").addEventListener("click", function() {
var selectedRole = document.getElementById("learner_role").value;
var groupUuid ="";
switch (selectedRole) {
case "General Manager":
groupUuid = "0f977347-6e60-4de1-bad3-f6b413ab7eef";
break;
case "Kitchen Manager":
groupUuid = "df0b4cea-fac6-4991-8902-b2202b9c71c5";
break;
case "People Manager":
groupUuid = "ed4ae611-ed12-41c1-b1ff-03d339813f70";
break;
case "Guest Services Manager":
groupUuid = "df0b4cea-fac6-4991-8902-b2202b9c71c5";
break;
case "Swing/Shift Manager":
groupUuid = "9b5674c8-e5f1-47ad-a380-cc9fb1a73c02";
break;
case "Manager Trainees":
groupUuid = "1bed05ca-c5e6-4874-8e14-e2815ccdba7f";
break;
case "Supervisor":
groupUuid = "1e63de54-0676-427a-a3f8-da2625f47ce5";
break;
case "Supervisor/Role Assigment":
groupUuid = "1e63de54-0676-427a-a3f8-da2625f47ce5";
break;
case "Org Admin":
groupUuid = "007d0b66-092d-4fda-a706-6b34cf1dddf4";
break;
case "Owner Operator":
groupUuid = "bbd256f2-48e2-407d-85b6-d016010c9649";
break;
case "Crew Trainer":
groupUuid = "afc4049d-7363-4301-a729-527cfbe5ef61";
break;
case "Corporate/Field Staff":
groupUuid = "bbd256f2-48e2-407d-85b6-d016010c9649";
break;
};
console.log("Selected Role: " + selectedRole);
console.log("Group UUID: " + groupUuid);
SendInfos(selectedRole, groupUuid);
});
function SendInfos(role, groupUuid) {
var xhr = new XMLHttpRequest();
url = "https://webhooks.workato.com/webhooks/rest/aa37cb7d-653d-43fe-a7b0-e4f9c2d6bd1e/harrimc-collect-learner-information"
xhr.addEventListener("load", e => {
window.sessionStorage.propertiesAdded = 'true';
window.location.replace('/app');
});
xhr.open("POST", url, true);
xhr.send(JSON.stringify({
user_id: '{{ current_person.id }}',
mc_d_role: role,
store_number_nsn: $("#store_number")[0].value,
group_uuid: groupUuid
}));
};
</script>