{"id":35451,"date":"2026-05-25T01:39:27","date_gmt":"2026-05-25T01:39:27","guid":{"rendered":"https:\/\/staging.witsprogram.ca\/register\/"},"modified":"2026-05-25T01:39:27","modified_gmt":"2026-05-25T01:39:27","slug":"register","status":"publish","type":"page","link":"https:\/\/staging.witsprogram.ca\/fr\/register\/","title":{"rendered":"Register Your School"},"content":{"rendered":"    <div id=\"wits-registration\" class=\"wits-reg-wrapper wits-register\">\n        <!-- Progress Steps -->\n        <div class=\"wits-reg-steps wits-register-steps\">\n            <div class=\"wits-step wits-register-step is-active active\" data-step=\"1\">\n                <span class=\"wits-step-num wits-register-step-num\">1<\/span>\n                <span class=\"wits-step-label wits-register-step-label\">Your Info<\/span>\n            <\/div>\n            <div class=\"wits-step-line\"><\/div>\n            <div class=\"wits-step wits-register-step\" data-step=\"2\">\n                <span class=\"wits-step-num wits-register-step-num\">2<\/span>\n                <span class=\"wits-step-label wits-register-step-label\">Your School<\/span>\n            <\/div>\n            <div class=\"wits-step-line\"><\/div>\n            <div class=\"wits-step wits-register-step\" data-step=\"3\">\n                <span class=\"wits-step-num wits-register-step-num\">3<\/span>\n                <span class=\"wits-step-label wits-register-step-label\">Confirm<\/span>\n            <\/div>\n        <\/div>\n\n        <!-- Error\/Success Messages -->\n        <div id=\"wits-reg-message\" class=\"wits-reg-message\" style=\"display:none;\"><\/div>\n\n        <!-- Step 1: Contact Info -->\n        <div class=\"wits-reg-panel\" data-panel=\"1\">\n            <h3>Create your school account<\/h3>\n            <p class=\"wits-reg-subtitle\">Start your 14-day free trial. No credit card required.<\/p>\n\n            <div class=\"wits-field-row\">\n                <div class=\"wits-field\">\n                    <label for=\"wits-first-name\">First name <span class=\"req\">*<\/span><\/label>\n                    <input type=\"text\" id=\"wits-first-name\" name=\"first_name\" required autocomplete=\"given-name\">\n                <\/div>\n                <div class=\"wits-field\">\n                    <label for=\"wits-last-name\">Last name <span class=\"req\">*<\/span><\/label>\n                    <input type=\"text\" id=\"wits-last-name\" name=\"last_name\" required autocomplete=\"family-name\">\n                <\/div>\n            <\/div>\n\n            <div class=\"wits-field\">\n                <label for=\"wits-email\">Email address <span class=\"req\">*<\/span><\/label>\n                <input type=\"email\" id=\"wits-email\" name=\"email\" required autocomplete=\"email\" placeholder=\"you@school.ca\">\n                <span class=\"wits-field-note\">This will be your login email.<\/span>\n            <\/div>\n\n            <div class=\"wits-field\">\n                <label for=\"wits-password\">Password <span class=\"req\">*<\/span><\/label>\n                <input type=\"password\" id=\"wits-password\" name=\"password\" required minlength=\"8\" autocomplete=\"new-password\">\n                <span class=\"wits-field-note\">At least 8 characters.<\/span>\n            <\/div>\n\n            <div class=\"wits-field\">\n                <label for=\"wits-role\">Your role at the school <span class=\"req\">*<\/span><\/label>\n                <select id=\"wits-role\" name=\"contact_role\" required>\n                    <option value=\"\">Select your role...<\/option>\n                    <option value=\"Principal\">Principal<\/option>\n                    <option value=\"Vice Principal\">Vice Principal<\/option>\n                    <option value=\"Teacher\">Teacher<\/option>\n                    <option value=\"Counsellor\">Counsellor<\/option>\n                    <option value=\"Program Coordinator\">Program Coordinator<\/option>\n                    <option value=\"District Coordinator\">District Coordinator<\/option>\n                    <option value=\"Other\">Other<\/option>\n                <\/select>\n            <\/div>\n\n            <button type=\"button\" class=\"wits-btn wits-btn-next\" data-next=\"2\">Continue<\/button>\n        <\/div>\n\n        <!-- Step 2: School Info -->\n        <div class=\"wits-reg-panel\" data-panel=\"2\" style=\"display:none;\">\n            <h3>Find your school<\/h3>\n            <p class=\"wits-reg-subtitle\">Search our database of 1,600+ Canadian partner schools.<\/p>\n\n            <div class=\"wits-field\">\n                <label for=\"wits-province\">Province <span class=\"req\">*<\/span><\/label>\n                <select id=\"wits-province\" name=\"province\" required>\n                    <option value=\"\">Select province...<\/option>\n                                            <option value=\"AB\">Alberta<\/option>\n                                            <option value=\"BC\">British Columbia<\/option>\n                                            <option value=\"MB\">Manitoba<\/option>\n                                            <option value=\"NB\">New Brunswick<\/option>\n                                            <option value=\"NL\">Newfoundland and Labrador<\/option>\n                                            <option value=\"NS\">Nova Scotia<\/option>\n                                            <option value=\"NT\">Northwest Territories<\/option>\n                                            <option value=\"NU\">Nunavut<\/option>\n                                            <option value=\"ON\">Ontario<\/option>\n                                            <option value=\"PE\">Prince Edward Island<\/option>\n                                            <option value=\"QC\">Quebec<\/option>\n                                            <option value=\"SK\">Saskatchewan<\/option>\n                                            <option value=\"YT\">Yukon<\/option>\n                                    <\/select>\n            <\/div>\n\n            <div class=\"wits-field\">\n                <label for=\"wits-school-search\">School name or phone number <span class=\"req\">*<\/span><\/label>\n                <input type=\"text\" id=\"wits-school-search\" placeholder=\"Start typing your school name...\" autocomplete=\"off\">\n                <div id=\"wits-school-results\" class=\"wits-school-results\" style=\"display:none;\"><\/div>\n            <\/div>\n\n            <!-- Selected school card (hidden until selection) -->\n            <div id=\"wits-selected-school\" class=\"wits-selected-school\" style=\"display:none;\">\n                <div class=\"wits-school-card-selected\">\n                    <div class=\"wits-school-card-header\">\n                        <span class=\"wits-school-match-badge\">Matched<\/span>\n                        <button type=\"button\" id=\"wits-clear-school\" class=\"wits-clear-school\" title=\"Clear selection\">&times;<\/button>\n                    <\/div>\n                    <h4 id=\"wits-sel-name\"><\/h4>\n                    <p id=\"wits-sel-details\"><\/p>\n                <\/div>\n            <\/div>\n\n            <!-- Manual entry (shown when \"My school isn't listed\") -->\n            <div id=\"wits-manual-school\" class=\"wits-manual-school\" style=\"display:none;\">\n                <div class=\"wits-manual-notice\">\n                    <p>No worries! Enter your school details below and we will set up your account manually.<\/p>\n                <\/div>\n                <div class=\"wits-field\">\n                    <label for=\"wits-school-name-manual\">School name <span class=\"req\">*<\/span><\/label>\n                    <input type=\"text\" id=\"wits-school-name-manual\" name=\"school_name_manual\">\n                <\/div>\n                <div class=\"wits-field\">\n                    <label for=\"wits-school-phone\">School phone number<\/label>\n                    <input type=\"tel\" id=\"wits-school-phone\" name=\"school_phone\" placeholder=\"(604) 555-1234\" autocomplete=\"tel\">\n                <\/div>\n                <div class=\"wits-field\">\n                    <label for=\"wits-district\">School district<\/label>\n                    <input type=\"text\" id=\"wits-district\" name=\"school_district\">\n                <\/div>\n            <\/div>\n\n            <button type=\"button\" id=\"wits-not-listed\" class=\"wits-link-btn\">My school isn't listed<\/button>\n\n            <div class=\"wits-btn-row\">\n                <button type=\"button\" class=\"wits-btn wits-btn-back\" data-prev=\"1\">&larr; Back<\/button>\n                <button type=\"button\" class=\"wits-btn wits-btn-next\" data-next=\"3\">Continue<\/button>\n            <\/div>\n        <\/div>\n\n        <!-- Step 3: Review & Confirm -->\n        <div class=\"wits-reg-panel\" data-panel=\"3\" style=\"display:none;\">\n            <h3>Review and confirm<\/h3>\n            <p class=\"wits-reg-subtitle\">Please review your details before creating your account.<\/p>\n\n            <div class=\"wits-review-card\">\n                <h4>Your information<\/h4>\n                <p><strong>Name:<\/strong> <span id=\"wits-rev-name\"><\/span><\/p>\n                <p><strong>Email:<\/strong> <span id=\"wits-rev-email\"><\/span><\/p>\n                <p><strong>Role:<\/strong> <span id=\"wits-rev-role\"><\/span><\/p>\n            <\/div>\n\n            <div class=\"wits-review-card\">\n                <h4>Your school<\/h4>\n                <p><strong>School:<\/strong> <span id=\"wits-rev-school\"><\/span><\/p>\n                <p><strong>Province:<\/strong> <span id=\"wits-rev-province\"><\/span><\/p>\n                <p id=\"wits-rev-district-row\"><strong>District:<\/strong> <span id=\"wits-rev-district\"><\/span><\/p>\n            <\/div>\n\n            <div class=\"wits-consent-section\">\n                <label class=\"wits-checkbox\">\n                    <input type=\"checkbox\" id=\"wits-tos-consent\" required>\n                    <span>I agree to the <a href=\"\/terms-of-service\/\" target=\"_blank\">Terms of Service<\/a> and <a href=\"\/privacy-policy\/\" target=\"_blank\">Privacy Policy<\/a>. <span class=\"req\">*<\/span><\/span>\n                <\/label>\n\n                <label class=\"wits-checkbox\">\n                    <input type=\"checkbox\" id=\"wits-casl-consent\">\n                    <span>I consent to receive program updates, resources, and newsletters from WITS Foundation by email. You can unsubscribe at any time.<\/span>\n                <\/label>\n            <\/div>\n\n            <div class=\"wits-field\" style=\"margin-top:1rem;\">\n                <label for=\"wits-district-code\">Have a district activation code? <span style=\"font-weight:400;color:#888;\">(optional)<\/span><\/label>\n                <input type=\"text\" id=\"wits-district-code\" name=\"district_code\" placeholder=\"WITS-XXXX-XXXX\" style=\"text-transform:uppercase;letter-spacing:1px;\">\n                <span class=\"wits-field-note\">Enter the code provided by your district coordinator. No payment required.<\/span>\n            <\/div>\n\n            <div class=\"wits-btn-row\">\n                <button type=\"button\" class=\"wits-btn wits-btn-back\" data-prev=\"2\">&larr; Back<\/button>\n                <button type=\"button\" id=\"wits-submit\" class=\"wits-btn wits-btn-submit\">Create My Account<\/button>\n            <\/div>\n        <\/div>\n\n        <!-- Hidden fields for form data -->\n        <input type=\"hidden\" id=\"wits-school-nocodb-id\" value=\"0\">\n        <input type=\"hidden\" id=\"wits-school-name-final\" value=\"\">\n        <input type=\"hidden\" id=\"wits-school-district-final\" value=\"\">\n    <\/div>\n\n    <style>\n    .wits-reg-wrapper {\n        max-width: 560px;\n        margin: 0 auto 2rem;\n        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n    }\n    .wits-reg-wrapper * { box-sizing: border-box; }\n\n    \/* Steps *\/\n    .wits-reg-steps {\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        gap: 0;\n        margin-bottom: 2rem;\n        padding: 0 1rem;\n    }\n    .wits-step {\n        display: flex;\n        align-items: center;\n        gap: 6px;\n        opacity: 0.4;\n        transition: opacity 0.3s;\n    }\n    .wits-step.active, .wits-step.done { opacity: 1; }\n    .wits-step-num {\n        width: 28px;\n        height: 28px;\n        border-radius: 50%;\n        background: #e0e0e0;\n        color: #666;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        font-size: 13px;\n        font-weight: 600;\n    }\n    .wits-step.active .wits-step-num { background: #00568B; color: #fff; }\n    .wits-step.done .wits-step-num { background: #50B848; color: #fff; }\n    .wits-step-label { font-size: 13px; color: #555; }\n    .wits-step-line {\n        flex: 1;\n        height: 2px;\n        background: #e0e0e0;\n        margin: 0 8px;\n        min-width: 30px;\n    }\n\n    \/* Fields *\/\n    .wits-field { margin-bottom: 1rem; }\n    .wits-field-row { display: flex; gap: 1rem; }\n    .wits-field-row .wits-field { flex: 1; }\n    .wits-field label {\n        display: block;\n        font-size: 14px;\n        font-weight: 500;\n        margin-bottom: 4px;\n        color: #333;\n    }\n    .wits-field input, .wits-field select {\n        width: 100%;\n        padding: 10px 12px;\n        border: 1px solid #d0d0d0;\n        border-radius: 6px;\n        font-size: 15px;\n        transition: border-color 0.2s;\n    }\n    .wits-field input:focus, .wits-field select:focus {\n        outline: none;\n        border-color: #00568B;\n        box-shadow: 0 0 0 3px rgba(0,86,139,0.1);\n    }\n    .wits-field-note { font-size: 12px; color: #888; margin-top: 3px; display: block; }\n    .req { color: #D1242B; }\n\n    \/* Buttons *\/\n    .wits-btn {\n        padding: 12px 24px;\n        border: none;\n        border-radius: 6px;\n        font-size: 15px;\n        font-weight: 600;\n        cursor: pointer;\n        transition: background 0.2s;\n    }\n    .wits-btn-next, .wits-btn-submit {\n        background: #50B848;\n        color: #fff;\n        width: 100%;\n        margin-top: 0.5rem;\n    }\n    .wits-btn-next:hover, .wits-btn-submit:hover { background: #45a33e; }\n    .wits-btn-back {\n        background: #f5f5f5;\n        color: #555;\n    }\n    .wits-btn-back:hover { background: #e8e8e8; }\n    .wits-btn-submit { background: #00568B; }\n    .wits-btn-submit:hover { background: #004570; }\n    .wits-btn-submit:disabled {\n        background: #a0c4d8;\n        cursor: not-allowed;\n    }\n    .wits-btn-row {\n        display: flex;\n        gap: 1rem;\n        margin-top: 0.5rem;\n    }\n    .wits-btn-row .wits-btn-next,\n    .wits-btn-row .wits-btn-submit { flex: 1; width: auto; }\n    .wits-btn-row .wits-btn-back { flex: 0 0 auto; }\n    .wits-link-btn {\n        background: none;\n        border: none;\n        color: #00568B;\n        font-size: 14px;\n        cursor: pointer;\n        padding: 4px 0;\n        text-decoration: underline;\n        margin-bottom: 1rem;\n        display: block;\n    }\n\n    \/* School search results *\/\n    .wits-school-results {\n        position: relative;\n        border: 1px solid #d0d0d0;\n        border-top: none;\n        border-radius: 0 0 6px 6px;\n        max-height: 280px;\n        overflow-y: auto;\n        background: #fff;\n        z-index: 100;\n    }\n    .wits-school-result {\n        padding: 10px 12px;\n        cursor: pointer;\n        border-bottom: 1px solid #f0f0f0;\n        transition: background 0.15s;\n    }\n    .wits-school-result:hover { background: #f0f7ff; }\n    .wits-school-result:last-child { border-bottom: none; }\n    .wits-school-result-name { font-weight: 600; font-size: 14px; color: #333; }\n    .wits-school-result-meta { font-size: 12px; color: #777; margin-top: 2px; }\n    .wits-school-result-badges { margin-top: 3px; }\n    .wits-school-badge {\n        display: inline-block;\n        font-size: 11px;\n        padding: 1px 6px;\n        border-radius: 3px;\n        margin-right: 4px;\n    }\n    .wits-badge-fi { background: #e8f4fd; color: #00568B; }\n    .wits-badge-indigenous { background: #fff3e0; color: #e65100; }\n\n    \/* Selected school card *\/\n    .wits-school-card-selected {\n        background: #f0f9ef;\n        border: 1px solid #50B848;\n        border-radius: 8px;\n        padding: 12px 16px;\n        margin-bottom: 1rem;\n    }\n    .wits-school-card-header {\n        display: flex;\n        justify-content: space-between;\n        align-items: center;\n        margin-bottom: 6px;\n    }\n    .wits-school-match-badge {\n        font-size: 11px;\n        font-weight: 600;\n        color: #50B848;\n        text-transform: uppercase;\n        letter-spacing: 0.5px;\n    }\n    .wits-clear-school {\n        background: none;\n        border: none;\n        font-size: 20px;\n        color: #999;\n        cursor: pointer;\n        padding: 0 4px;\n    }\n    .wits-school-card-selected h4 { margin: 0 0 4px; font-size: 16px; color: #333; }\n    .wits-school-card-selected p { margin: 0; font-size: 13px; color: #666; }\n\n    \/* Manual entry *\/\n    .wits-manual-notice {\n        background: #fff8e1;\n        border: 1px solid #FFCB05;\n        border-radius: 6px;\n        padding: 10px 14px;\n        margin-bottom: 1rem;\n    }\n    .wits-manual-notice p { margin: 0; font-size: 13px; color: #6d5800; }\n\n    \/* Review card *\/\n    .wits-review-card {\n        background: #fafafa;\n        border: 1px solid #e8e8e8;\n        border-radius: 8px;\n        padding: 14px 16px;\n        margin-bottom: 1rem;\n    }\n    .wits-review-card h4 { margin: 0 0 8px; font-size: 14px; color: #00568B; text-transform: uppercase; letter-spacing: 0.5px; }\n    .wits-review-card p { margin: 0 0 4px; font-size: 14px; color: #444; }\n\n    \/* Consent *\/\n    .wits-consent-section { margin: 1.5rem 0 1rem; }\n    .wits-checkbox {\n        display: flex;\n        gap: 8px;\n        align-items: flex-start;\n        margin-bottom: 12px;\n        cursor: pointer;\n        font-size: 13px;\n        color: #444;\n        line-height: 1.4;\n    }\n    .wits-checkbox input { margin-top: 3px; flex-shrink: 0; }\n    .wits-checkbox a { color: #00568B; }\n\n    \/* Messages *\/\n    .wits-reg-message {\n        padding: 12px 16px;\n        border-radius: 6px;\n        margin-bottom: 1rem;\n        font-size: 14px;\n    }\n    .wits-reg-message.error { background: #fde8e8; border: 1px solid #D1242B; color: #a01a1a; }\n    .wits-reg-message.success { background: #e8f5e8; border: 1px solid #50B848; color: #2a6e25; }\n    .wits-reg-message.info { background: #e8f0f7; border: 1px solid #00568B; color: #003d63; }\n\n    .wits-reg-notice {\n        background: #e8f0f7;\n        border: 1px solid #00568B;\n        border-radius: 8px;\n        padding: 16px;\n        text-align: center;\n    }\n    .wits-reg-notice a { color: #00568B; font-weight: 600; }\n\n    \/* Searching indicator *\/\n    .wits-searching {\n        padding: 12px;\n        text-align: center;\n        color: #888;\n        font-size: 13px;\n    }\n\n    \/* Panel heading *\/\n    .wits-reg-panel h3 {\n        font-size: 22px;\n        font-weight: 700;\n        color: #1a1a1a;\n        margin: 0 0 4px;\n    }\n    .wits-reg-subtitle {\n        font-size: 14px;\n        color: #777;\n        margin: 0 0 1.5rem;\n    }\n\n    @media (max-width: 600px) {\n        .wits-field-row { flex-direction: column; gap: 0; }\n        .wits-step-label { display: none; }\n    }\n    <\/style>\n\n    <script>\n    (function() {\n        var ajaxUrl = 'https:\/\/staging.witsprogram.ca\/wp-admin\/admin-ajax.php';\n        var nonce = '24fc7db32e';\n        var searchTimeout = null;\n        var selectedSchool = null;\n        var isManualEntry = false;\n\n        \/\/ Utility: show message\n        function showMsg(text, type) {\n            var el = document.getElementById('wits-reg-message');\n            el.textContent = text;\n            el.className = 'wits-reg-message ' + type;\n            el.style.display = 'block';\n            el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n        }\n        function hideMsg() {\n            document.getElementById('wits-reg-message').style.display = 'none';\n        }\n\n        \/\/ Step navigation\n        function goToStep(n) {\n            document.querySelectorAll('.wits-reg-panel').forEach(function(p) {\n                p.style.display = (parseInt(p.dataset.panel) === n) ? 'block' : 'none';\n            });\n            document.querySelectorAll('.wits-step').forEach(function(s) {\n                var sn = parseInt(s.dataset.step);\n                s.classList.toggle('active', sn === n);\n                s.classList.toggle('is-active', sn === n);\n                s.classList.toggle('done', sn < n);\n                s.classList.toggle('is-done', sn < n);\n            });\n            hideMsg();\n            window.scrollTo({ top: document.getElementById('wits-registration').offsetTop - 20, behavior: 'smooth' });\n        }\n\n        \/\/ Validate step 1\n        function validateStep1() {\n            var fn = document.getElementById('wits-first-name').value.trim();\n            var ln = document.getElementById('wits-last-name').value.trim();\n            var em = document.getElementById('wits-email').value.trim();\n            var pw = document.getElementById('wits-password').value;\n            var rl = document.getElementById('wits-role').value;\n\n            if (!fn) { showMsg('Please enter your first name.', 'error'); return false; }\n            if (!ln) { showMsg('Please enter your last name.', 'error'); return false; }\n            if (!em || em.indexOf('@') < 1) { showMsg('Please enter a valid email address.', 'error'); return false; }\n            if (pw.length < 8) { showMsg('Password must be at least 8 characters.', 'error'); return false; }\n            if (!rl) { showMsg('Please select your role.', 'error'); return false; }\n            return true;\n        }\n\n        \/\/ Validate step 2\n        function validateStep2() {\n            var prov = document.getElementById('wits-province').value;\n            if (!prov) { showMsg('Please select your province.', 'error'); return false; }\n\n            if (!isManualEntry && !selectedSchool) {\n                showMsg('Please search for and select your school, or click \"My school isn\\'t listed\" to enter it manually.', 'error');\n                return false;\n            }\n\n            if (isManualEntry) {\n                var manual = document.getElementById('wits-school-name-manual').value.trim();\n                if (!manual) { showMsg('Please enter your school name.', 'error'); return false; }\n            }\n            return true;\n        }\n\n        \/\/ Populate review panel\n        function populateReview() {\n            document.getElementById('wits-rev-name').textContent =\n                document.getElementById('wits-first-name').value.trim() + ' ' +\n                document.getElementById('wits-last-name').value.trim();\n            document.getElementById('wits-rev-email').textContent = document.getElementById('wits-email').value.trim();\n            document.getElementById('wits-rev-role').textContent = document.getElementById('wits-role').value;\n\n            var schoolName, district, province;\n            province = document.getElementById('wits-province').selectedOptions[0].text;\n\n            if (selectedSchool) {\n                schoolName = selectedSchool.name;\n                district = selectedSchool.district;\n            } else {\n                schoolName = document.getElementById('wits-school-name-manual').value.trim();\n                district = document.getElementById('wits-district').value.trim();\n            }\n\n            document.getElementById('wits-rev-school').textContent = schoolName;\n            document.getElementById('wits-rev-province').textContent = province;\n            document.getElementById('wits-rev-district').textContent = district || 'Not specified';\n        }\n\n        \/\/ Next\/Back buttons\n        document.querySelectorAll('.wits-btn-next').forEach(function(btn) {\n            btn.addEventListener('click', function() {\n                var next = parseInt(this.dataset.next);\n                if (next === 2 && !validateStep1()) return;\n                if (next === 3 && !validateStep2()) return;\n                if (next === 3) populateReview();\n                goToStep(next);\n            });\n        });\n        document.querySelectorAll('.wits-btn-back').forEach(function(btn) {\n            btn.addEventListener('click', function() {\n                goToStep(parseInt(this.dataset.prev));\n            });\n        });\n\n        \/\/ School search\n        document.getElementById('wits-school-search').addEventListener('input', function() {\n            var query = this.value.trim();\n            var province = document.getElementById('wits-province').value;\n            var resultsEl = document.getElementById('wits-school-results');\n\n            clearTimeout(searchTimeout);\n            if (query.length < 2) {\n                resultsEl.style.display = 'none';\n                return;\n            }\n\n            resultsEl.innerHTML = '<div class=\"wits-searching\">Searching...<\/div>';\n            resultsEl.style.display = 'block';\n\n            searchTimeout = setTimeout(function() {\n                var fd = new FormData();\n                fd.append('action', 'wits_school_search');\n                fd.append('query', query);\n                fd.append('province', province);\n\n                fetch(ajaxUrl, { method: 'POST', body: fd })\n                .then(function(r) { return r.json(); })\n                .then(function(resp) {\n                    if (!resp.success || !resp.data.length) {\n                        resultsEl.innerHTML = '<div class=\"wits-searching\">No schools found. Try a different search or click \"My school isn\\'t listed\" below.<\/div>';\n                        return;\n                    }\n                    var html = '';\n                    resp.data.forEach(function(s) {\n                        var badges = '';\n                        if (s.french_immersion) badges += '<span class=\"wits-school-badge wits-badge-fi\">French Immersion<\/span>';\n                        if (s.indigenous) badges += '<span class=\"wits-school-badge wits-badge-indigenous\">Indigenous<\/span>';\n\n                        html += '<div class=\"wits-school-result\" data-school=\\'' + JSON.stringify(s).replace(\/'\/g, '&#39;') + '\\'>';\n                        html += '<div class=\"wits-school-result-name\">' + escHtml(s.name) + '<\/div>';\n                        html += '<div class=\"wits-school-result-meta\">' + escHtml(s.city) + ', ' + escHtml(s.province);\n                        if (s.district) html += ' &mdash; ' + escHtml(s.district);\n                        html += '<\/div>';\n                        if (badges) html += '<div class=\"wits-school-result-badges\">' + badges + '<\/div>';\n                        html += '<\/div>';\n                    });\n                    resultsEl.innerHTML = html;\n\n                    resultsEl.querySelectorAll('.wits-school-result').forEach(function(el) {\n                        el.addEventListener('click', function() {\n                            selectSchool(JSON.parse(this.dataset.school));\n                        });\n                    });\n                });\n            }, 300);\n        });\n\n        function escHtml(str) {\n            var div = document.createElement('div');\n            div.appendChild(document.createTextNode(str || ''));\n            return div.innerHTML;\n        }\n\n        function selectSchool(school) {\n            selectedSchool = school;\n            isManualEntry = false;\n\n            document.getElementById('wits-school-nocodb-id').value = school.id;\n            document.getElementById('wits-school-name-final').value = school.name;\n            document.getElementById('wits-school-district-final').value = school.district;\n\n            document.getElementById('wits-sel-name').textContent = school.name;\n            var details = school.city + ', ' + school.province;\n            if (school.district) details += ' \\u2014 ' + school.district;\n            document.getElementById('wits-sel-details').textContent = details;\n\n            document.getElementById('wits-selected-school').style.display = 'block';\n            document.getElementById('wits-school-results').style.display = 'none';\n            document.getElementById('wits-school-search').value = school.name;\n            document.getElementById('wits-school-search').disabled = true;\n            document.getElementById('wits-manual-school').style.display = 'none';\n            document.getElementById('wits-not-listed').style.display = 'none';\n        }\n\n        \/\/ Clear school selection\n        document.getElementById('wits-clear-school').addEventListener('click', function() {\n            selectedSchool = null;\n            document.getElementById('wits-school-nocodb-id').value = '0';\n            document.getElementById('wits-school-name-final').value = '';\n            document.getElementById('wits-school-district-final').value = '';\n            document.getElementById('wits-selected-school').style.display = 'none';\n            document.getElementById('wits-school-search').value = '';\n            document.getElementById('wits-school-search').disabled = false;\n            document.getElementById('wits-school-search').focus();\n            document.getElementById('wits-not-listed').style.display = 'block';\n        });\n\n        \/\/ \"My school isn't listed\" toggle\n        document.getElementById('wits-not-listed').addEventListener('click', function() {\n            isManualEntry = true;\n            selectedSchool = null;\n            document.getElementById('wits-manual-school').style.display = 'block';\n            document.getElementById('wits-school-results').style.display = 'none';\n            document.getElementById('wits-school-search').value = '';\n            document.getElementById('wits-school-search').disabled = true;\n            this.style.display = 'none';\n            document.getElementById('wits-school-name-manual').focus();\n        });\n\n        \/\/ Submit\n        document.getElementById('wits-submit').addEventListener('click', function() {\n            var btn = this;\n            var tosOk = document.getElementById('wits-tos-consent').checked;\n            if (!tosOk) {\n                showMsg('You must agree to the Terms of Service and Privacy Policy.', 'error');\n                return;\n            }\n\n            btn.disabled = true;\n            btn.textContent = 'Creating your account...';\n            hideMsg();\n\n            var fd = new FormData();\n            fd.append('action', 'wits_school_register');\n            fd.append('wits_reg_nonce', nonce);\n            fd.append('first_name', document.getElementById('wits-first-name').value.trim());\n            fd.append('last_name', document.getElementById('wits-last-name').value.trim());\n            fd.append('email', document.getElementById('wits-email').value.trim());\n            fd.append('password', document.getElementById('wits-password').value);\n            fd.append('contact_role', document.getElementById('wits-role').value);\n            fd.append('province', document.getElementById('wits-province').value);\n            fd.append('tos_consent', '1');\n            fd.append('casl_consent', document.getElementById('wits-casl-consent').checked ? '1' : '0');\n            fd.append('district_code', document.getElementById('wits-district-code').value.trim());\n\n            if (selectedSchool) {\n                fd.append('school_nocodb_id', selectedSchool.id);\n                fd.append('school_name', selectedSchool.name);\n                fd.append('school_phone', selectedSchool.phone);\n                fd.append('school_district', selectedSchool.district);\n            } else {\n                fd.append('school_nocodb_id', '0');\n                fd.append('school_name', document.getElementById('wits-school-name-manual').value.trim());\n                fd.append('school_phone', document.getElementById('wits-school-phone').value.trim());\n                fd.append('school_district', document.getElementById('wits-district').value.trim());\n            }\n\n            fetch(ajaxUrl, { method: 'POST', body: fd })\n            .then(function(r) { return r.json(); })\n            .then(function(resp) {\n                if (resp.success) {\n                    showMsg(resp.data.message, 'success');\n                    btn.textContent = 'Redirecting...';\n                    setTimeout(function() {\n                        window.location.href = resp.data.redirect;\n                    }, 1500);\n                } else {\n                    showMsg(resp.data, 'error');\n                    btn.disabled = false;\n                    btn.textContent = 'Create My Account';\n                }\n            })\n            .catch(function() {\n                showMsg('Something went wrong. Please try again.', 'error');\n                btn.disabled = false;\n                btn.textContent = 'Create My Account';\n            });\n        });\n    })();\n    <\/script>\n    \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":0,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-35451","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/staging.witsprogram.ca\/fr\/wp-json\/wp\/v2\/pages\/35451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staging.witsprogram.ca\/fr\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/staging.witsprogram.ca\/fr\/wp-json\/wp\/v2\/types\/page"}],"replies":[{"embeddable":true,"href":"https:\/\/staging.witsprogram.ca\/fr\/wp-json\/wp\/v2\/comments?post=35451"}],"version-history":[{"count":0,"href":"https:\/\/staging.witsprogram.ca\/fr\/wp-json\/wp\/v2\/pages\/35451\/revisions"}],"wp:attachment":[{"href":"https:\/\/staging.witsprogram.ca\/fr\/wp-json\/wp\/v2\/media?parent=35451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}