Page tree

SKIP TO CONTENT   |  SUPPORT YOUR HOSPITAL   |   PAY YOUR BILLS  |  TEXT SIZE    

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Content Layer
padding0px 5vw
id2105071924


Content Column
width70.0%
id2105071925


Content Block
id2105071925
HTML
<script>
AJS.$('.formmail').ready(function(){

    const selfScreeningForm = AJS.$(this).find('.formmail > form');
    const allRadioButtons = selfScreeningForm.find('.aui-group.radio-group>.aui-item>.radio');
    const allQuestionBlocks = selfScreeningForm.find('.aui-group.radio-group');
    const screeningResultDiv = selfScreeningForm.find('#screening-result');
    const msgBox = {
        self: AJS.$('#msg-box'),
        title:AJS.$('#msg-box>div.msg-box-overlay>div.msg-box-title'),
        body:AJS.$('#msg-box>div.msg-box-overlay>div.msg-box-body'),
        action:{
            continue: AJS.$('#msg-box>div.msg-box-overlay>div.msg-box-action>div#msg-box-action-continue'),
            cancel:AJS.$('#msg-box>div.msg-box-overlay>div.msg-box-action>div#msg-box-action-cancel')
        },
        for:null  
    };
    const color={
        green: '#28a745',
        red:'#dc3545',
        blue:'#007bff'
    }
    const usernameField = selfScreeningForm.find('input[name=username]');
    const startScreeningBtn = selfScreeningForm.find('#start-screening-btn');
    var showingQuestionIndex = 0;
    const showBanner = false;
    const questionIndexArray = (showBanner)?[4,7,10,13]:[3,6,9,12];
    const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);

///////////////////////////////////////////////END OF DECLARATIONS/////////////////////////////////

    usernameField.focus()

    function addBanner(){

        let banner = AJS.$('<div/>');
        banner.text("*** Questions have been updated ***")
        .css({
            "display": 'block',
            'border': '5px solid red',
            'font-size': '2rem',
            'color': 'red',
            'text-align': 'center',
            'width': '70%',
            'margin': '1% auto',
            'padding': '1%',
            'text-transform': 'uppercase',
            'font-weight': '600'
        })

        selfScreeningForm.find("#username-box").after(banner);

    }

    function submitScreening(date){

        let device = (isMobile)? 'mobile':'kiosk';
        selfScreeningForm.find('input[name=dateTime]').attr('value',date);
        selfScreeningForm.find('input[name=deviceType').attr('value',device);
        selfScreeningForm.find('input[type="button"][value="Submit"]').trigger('click');
    }

    function showResult(result,dateTime){

        selfScreeningForm.children().eq(questionIndexArray[0]).css('display','none');
        selfScreeningForm.children().eq(questionIndexArray[1]).css('display','none');
        selfScreeningForm.children().eq(questionIndexArray[2]).css('display','none');
        selfScreeningForm.children().eq(questionIndexArray[3]).css('display','none');
        screeningResultDiv.empty();
        let title=AJS.$("<p/>"),msg=AJS.$("<p/>"),dt=AJS.$("<p/>").text(dateTime.toString().split(" GMT")[0]);
        let bg = null;
        if(result === "pass"){
            title.text("ENTRY ALLOWED");
			msg.text("Proceed to perform hand hygiene and maskingdon uponmask entryand & Temp check at your designated stationeye protection.");
            bg = color.green;
        }else{
            title.text("ENTRY DENIED");
            msg.text("Please return home and contact Occupational Health at ext: 2327");
            bg = color.red;
        }
        title.css({ "font-size":"3rem", "font-weight": "bold", "color":"white", "padding":"2%" });
        msg.css({ "font-size":"1.5rem", "font-weight":"regular", "color":"white", "border":"solid 1px white", "padding":"1%" });
        dt.css({"background-color":"rgba(255,255,255,0.5)","padding":"1%","font-size":"2rem","font-weight":"600"});
        AJS.$(allQuestionBlocks[showingQuestionIndex]).css('display','none');
        screeningResultDiv.append(dt).append(title).append(msg);
        screeningResultDiv.css({"background-color":bg,"display":"block"});
        submitScreening(dateTime);
        showingQuestionIndex = 0;

        if( isMobile ) {
            //do not reload when on phone.
        }else{
            setTimeout(function(){
                location.reload();
            },5000)
        }
    }

    function showQuestion(questionIndex){

        // if(questionIndex != 0){
        //     selfScreeningForm.children()
        //         .eq(questionIndexArray[questionIndex-1])
        //         .css('display','none');
        // }
		if(questionIndexArray[2] === questionIndexArray[questionIndex]){
			questionIndex = 3;
		}
        selfScreeningForm.children()
            .eq(questionIndexArray[questionIndex])
            .css('display','inherit');

    }

    function usernameValidation(currentUsername){
        // let whiteSpaces = /\s/;
        // let allLowerCase = /[a-z]/;
        // let whusername = /wh-/;
        let characterLenTest = function(){
            return (currentUsername.length > 3);
        }

        if(currentUsername && characterLenTest()){
            return true;
        }
        return false;
    }

    function restartScreening(){
        screeningResultDiv.empty(); // empty out the result screen;
        screeningResultDiv.css('display','none'); // hide the result screen
        selfScreeningForm.find('input[type=radio]').removeAttr('checked'); // remove any selections in the form
        allQuestionBlocks.css('display','none'); //hide all question blocks
    }

    function startScreening(username){

        if(usernameValidation(username)){

            //hide anything that's empty

            if(showBanner){
                addBanner();
            }
            restartScreening();
            showQuestion(showingQuestionIndex);
            usernameField.css('display','none');
            selfScreeningForm.find('#username-box > div:nth-child(2)').css('display','none');
            startScreeningBtn.css("display","none");

            // console.log("-----------------------------------------------------");
            // console.log(selfScreeningForm.children());
            // console.log("-----------------------------------------------------");
        }else{
            msgBox.title.html('<p>Required!</p>');
            msgBox.body.html('<ul><li>Name field cannot be emtpy</li><li>Should include your first and last name</li><li>You can also use wh-lastandfirstname</li></ul>');
            msgBox.for = 'warning';
            msgBox.self.css('display','inherit');
        }
        
    }

    ////////////////////////////////////////////////////////// FUNCTION DEFINITION END /////////////////////////////////////////////////

    allRadioButtons.on('click',function(event){
        let thisBtn = AJS.$(this);
        let thisRadioInput = thisBtn.find('input');
        let isChecked = thisRadioInput.attr('checked');
        if(!isChecked) thisRadioInput.attr('checked',true);

        if(thisRadioInput.attr('value') === 'yes'){
            showResult('fail',new Date());
        }else if(thisBtn.children(':first').attr('id').split('-')[1] == '4'){
            showResult('pass',new Date());
        }else{
            let tmpIndex = (parseInt(thisBtn.find('input').attr('id').split('-')[1]));
            console.log(tmpIndex);
            showQuestion(tmpIndex);
        }

        thisBtn.parent().parent().css("display","none")
    });

    startScreeningBtn.on('click',function(){
        let username = usernameField.attr('value');
        startScreening(username);
    })

    msgBox.action.continue.on('click',function(){
        msgBox.self.css('display','none');
        if(msgBox.for === 'username check'){
            restartScreening();
            showQuestion(showingQuestionIndex);
            usernameField.css('display','none');
            selfScreeningForm.find('#username-box > div:nth-child(2)').css('display','none');
            startScreeningBtn.css("display","none");
        }
    })

    msgBox.action.cancel.on('click',function(){
        msgBox.self.css('display','none');
    })

});//end of ready
</script>
HTML Wrap
idmsg-box
classmsg-box
HTML Wrap
classmsg-box-overlay
HTML Wrap
classmsg-box-title


HTML Wrap
classmsg-box-body


HTML Wrap
classmsg-box-action
HTML Wrap
idmsg-box-action-cancel

Cancel

HTML Wrap
idmsg-box-action-continue

Continue

Forms
captchafalse
hideSubmitButtonfalse
generatedUUID339aac2564f95428-722c219b-490c4c29-8f94b580-304688b9fd69f06432e8aaf1
destinationself-screening-test
includeDestinationsfalse
receiptfalse
submitButtonTextSubmit
allowSubmitAsAnonymousfalse
username-boxINLINEINLINE

Self Screening*

INLINE

Extra Largeself-screen-username-fieldEnter First & Last Nameusernametrue

start-screening-btnstart-screening-btnINLINE

Start Screening

falsefalseNo_question_1noquestion-1yestrueYes2Do you have a fever, cough, shortness of breath, runny nose, nasal congestion, difficulty swallowing, sore throat, headache, muscle aches, loss of smell/taste, abdominal pain, nausea/vomiting or diarrhea?false

falsefalseNonoquestion-2yestrueYes2Have you travelled outside of the Province in the past 14 days?false

falsefalseNonoquestion-3yestrueYes2Outside the hospital, have you been in close contact with a sick person who has travelled outside of Ontario?false

falsefalseNolast-questionnoquestion-4yestrueYes2Outside the hospital, have you been in close contact with a person who is a confirmed or probable case of COVID-19?false


ss-dateTimeINLINE

dateTime

screening-resultINLINE




Content Column
width30%
id2105082548


Content Block
id2105082549

Excerpt Include
Working Here
Working Here
nopaneltrue


Content Block
id2105088147

Content by Label
showLabelsfalse
showSpacefalse
sorttitle
titleRelated Pages
cqllabel in ("human-resources","volunteer") and type = "page"



...