{"id":1324,"date":"2026-09-13T21:47:49","date_gmt":"2026-09-13T21:47:49","guid":{"rendered":"https:\/\/tshepohopefs.co.za\/?page_id=1324"},"modified":"2026-09-17T07:58:32","modified_gmt":"2026-09-17T07:58:32","slug":"funeral-services-products","status":"publish","type":"page","link":"https:\/\/tshepohopefs.co.za\/?page_id=1324","title":{"rendered":"funeral-services-products"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1324\" class=\"elementor elementor-1324\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-5d52b08 e-flex e-con-boxed e-con e-parent\" data-id=\"5d52b08\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-d17749d elementor-widget elementor-widget-html\" data-id=\"d17749d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t<script src=\"https:\/\/js.paystack.co\/v1\/inline.js\"><\/script>\r\n\r\n<style>\r\n:root{\r\n    --th-orange:#f36c12;\r\n    --th-gold:#f5a623;\r\n    --th-black:#171412;\r\n    --th-cream:#fff8f1;\r\n    --th-soft:#f7f4f1;\r\n    --th-white:#fff;\r\n    --th-text:#25211f;\r\n    --th-muted:#68615d;\r\n    --th-border:#e8dfd8;\r\n    --th-danger:#a62222;\r\n    --th-success:#176734;\r\n    --th-radius:16px;\r\n    --th-shadow:0 16px 45px rgba(41,27,17,.11);\r\n    --th-max:1120px;\r\n}\r\n\r\n.tfa-page,\r\n.tfa-page *{\r\n    box-sizing:border-box;\r\n}\r\n\r\n.tfa-page{\r\n    overflow:hidden;\r\n    margin:0;\r\n    background:#fff;\r\n    color:var(--th-text);\r\n    font-family:Inter,Arial,Helvetica,sans-serif;\r\n    font-size:16px;\r\n    line-height:1.6;\r\n}\r\n\r\n.tfa-container{\r\n    width:min(92%,var(--th-max));\r\n    margin:auto;\r\n}\r\n\r\n.tfa-hero{\r\n    background:linear-gradient(120deg,#171412,#5d2b0b);\r\n    color:#fff;\r\n}\r\n\r\n.tfa-hero-inner{\r\n    padding:65px 0;\r\n}\r\n\r\n.tfa-eyebrow{\r\n    color:var(--th-gold);\r\n    font-size:12px;\r\n    font-weight:900;\r\n    letter-spacing:.14em;\r\n    text-transform:uppercase;\r\n}\r\n\r\n.tfa-title{\r\n    max-width:780px;\r\n    margin:13px 0 16px;\r\n    font-size:clamp(39px,5vw,62px);\r\n    line-height:1.05;\r\n    letter-spacing:-.04em;\r\n}\r\n\r\n.tfa-title span{\r\n    color:var(--th-gold);\r\n}\r\n\r\n.tfa-hero p{\r\n    max-width:760px;\r\n    margin:0;\r\n    color:rgba(255,255,255,.76);\r\n    font-size:18px;\r\n}\r\n\r\n.tfa-section{\r\n    padding:70px 0;\r\n    background:var(--th-soft);\r\n}\r\n\r\n.tfa-form{\r\n    overflow:hidden;\r\n    border:1px solid var(--th-border);\r\n    border-radius:var(--th-radius);\r\n    background:#fff;\r\n    box-shadow:var(--th-shadow);\r\n}\r\n\r\n.tfa-block{\r\n    padding:34px;\r\n    border-bottom:1px solid var(--th-border);\r\n}\r\n\r\n.tfa-block-head{\r\n    display:flex;\r\n    align-items:flex-start;\r\n    gap:14px;\r\n    margin-bottom:25px;\r\n}\r\n\r\n.tfa-no{\r\n    flex:0 0 36px;\r\n    width:36px;\r\n    height:36px;\r\n    display:grid;\r\n    place-items:center;\r\n    border-radius:50%;\r\n    background:var(--th-orange);\r\n    color:#fff;\r\n    font-weight:900;\r\n}\r\n\r\n.tfa-block h2{\r\n    margin:0;\r\n    color:var(--th-black);\r\n    font-size:23px;\r\n}\r\n\r\n.tfa-block-head p{\r\n    margin:3px 0 0;\r\n    color:var(--th-muted);\r\n    font-size:13px;\r\n}\r\n\r\n.tfa-grid{\r\n    display:grid;\r\n    grid-template-columns:repeat(2,1fr);\r\n    gap:17px;\r\n}\r\n\r\n.tfa-full{\r\n    grid-column:1\/-1;\r\n}\r\n\r\n.tfa-label{\r\n    display:block;\r\n    margin-bottom:6px;\r\n    color:var(--th-black);\r\n    font-size:13px;\r\n    font-weight:800;\r\n}\r\n\r\n.tfa-input,\r\n.tfa-select{\r\n    width:100%;\r\n    min-height:49px;\r\n    padding:11px 13px;\r\n    border:1px solid #d7ccc4;\r\n    border-radius:9px;\r\n    background:#fff;\r\n    color:var(--th-text);\r\n    font:inherit;\r\n    font-size:15px;\r\n}\r\n\r\n.tfa-input:focus,\r\n.tfa-select:focus{\r\n    outline:3px solid rgba(243,108,18,.14);\r\n    border-color:var(--th-orange);\r\n}\r\n\r\n.tfa-input[readonly]{\r\n    background:#f4f2f0;\r\n    color:#5e5854;\r\n}\r\n\r\n.tfa-help{\r\n    display:block;\r\n    margin-top:5px;\r\n    color:var(--th-muted);\r\n    font-size:11px;\r\n}\r\n\r\n.tfa-rule{\r\n    padding:16px;\r\n    border-left:4px solid var(--th-orange);\r\n    border-radius:9px;\r\n    background:var(--th-cream);\r\n    color:var(--th-muted);\r\n    font-size:13px;\r\n}\r\n\r\n.tfa-rule strong{\r\n    color:var(--th-black);\r\n}\r\n\r\n.tfa-btn{\r\n    display:inline-flex;\r\n    align-items:center;\r\n    justify-content:center;\r\n    min-height:46px;\r\n    padding:0 19px;\r\n    border:2px solid transparent;\r\n    border-radius:9px;\r\n    font:inherit;\r\n    font-size:14px;\r\n    font-weight:850;\r\n    cursor:pointer;\r\n}\r\n\r\n.tfa-btn:disabled{\r\n    opacity:.55;\r\n    cursor:not-allowed;\r\n}\r\n\r\n.tfa-btn-orange{\r\n    background:var(--th-orange);\r\n    color:#fff;\r\n}\r\n\r\n.tfa-btn-dark{\r\n    background:var(--th-black);\r\n    color:#fff;\r\n}\r\n\r\n.tfa-btn-light{\r\n    border-color:var(--th-border);\r\n    background:#fff;\r\n    color:var(--th-black);\r\n}\r\n\r\n.tfa-application-body.is-locked{\r\n    display:none;\r\n}\r\n\r\n.tfa-agent-status{\r\n    padding:13px 15px;\r\n    border-radius:9px;\r\n    background:#f0ece8;\r\n    color:var(--th-muted);\r\n    font-size:13px;\r\n    font-weight:800;\r\n}\r\n\r\n.tfa-agent-status.is-ready{\r\n    background:#e9f7ee;\r\n    color:var(--th-success);\r\n}\r\n\r\n.tfa-agent-status.is-error{\r\n    background:#fff0f0;\r\n    color:var(--th-danger);\r\n}\r\n\r\n.tfa-pricing{\r\n    grid-column:1\/-1;\r\n    overflow:hidden;\r\n    border:1px solid var(--th-border);\r\n    border-radius:12px;\r\n    background:#fff;\r\n}\r\n\r\n.tfa-pricing-head{\r\n    display:flex;\r\n    justify-content:space-between;\r\n    align-items:center;\r\n    gap:15px;\r\n    padding:16px 18px;\r\n    background:var(--th-black);\r\n    color:#fff;\r\n}\r\n\r\n.tfa-draft-badge{\r\n    padding:5px 9px;\r\n    border-radius:999px;\r\n    background:var(--th-gold);\r\n    color:var(--th-black);\r\n    font-size:10px;\r\n    font-weight:950;\r\n    text-transform:uppercase;\r\n}\r\n\r\n.tfa-rate-groups{\r\n    padding:18px;\r\n}\r\n\r\n.tfa-rate-scroll{\r\n    overflow-x:auto;\r\n}\r\n\r\n.tfa-rate-table{\r\n    width:100%;\r\n    min-width:610px;\r\n    border-collapse:collapse;\r\n}\r\n\r\n.tfa-rate-table th,\r\n.tfa-rate-table td{\r\n    padding:11px;\r\n    border:1px solid var(--th-border);\r\n    text-align:left;\r\n    font-size:12px;\r\n}\r\n\r\n.tfa-rate-table th{\r\n    background:var(--th-soft);\r\n    color:var(--th-black);\r\n    font-weight:900;\r\n    text-transform:uppercase;\r\n}\r\n\r\n.tfa-rate-price{\r\n    color:var(--th-orange);\r\n    font-size:15px;\r\n    font-weight:950;\r\n}\r\n\r\n.tfa-rate-btn{\r\n    min-height:34px;\r\n    padding:0 12px;\r\n    border:0;\r\n    border-radius:7px;\r\n    background:var(--th-orange);\r\n    color:#fff;\r\n    font:inherit;\r\n    font-size:11px;\r\n    font-weight:900;\r\n    cursor:pointer;\r\n}\r\n\r\n.tfa-rate-empty{\r\n    padding:20px;\r\n    border:1px dashed #cfc1b7;\r\n    border-radius:9px;\r\n    color:var(--th-muted);\r\n    text-align:center;\r\n    font-size:13px;\r\n}\r\n\r\n.tfa-premium-card{\r\n    display:flex;\r\n    justify-content:space-between;\r\n    align-items:center;\r\n    gap:15px;\r\n    padding:17px 19px;\r\n    border:2px solid var(--th-orange);\r\n    border-radius:11px;\r\n    background:var(--th-cream);\r\n}\r\n\r\n.tfa-premium-card strong{\r\n    color:var(--th-black);\r\n}\r\n\r\n.tfa-premium-card span{\r\n    color:var(--th-orange);\r\n    font-size:27px;\r\n    font-weight:900;\r\n}\r\n\r\n.tfa-members-head{\r\n    display:flex;\r\n    justify-content:space-between;\r\n    align-items:center;\r\n    gap:15px;\r\n    margin-bottom:17px;\r\n}\r\n\r\n.tfa-members-head h3{\r\n    margin:0;\r\n    font-size:18px;\r\n}\r\n\r\n.tfa-member-list{\r\n    display:grid;\r\n    gap:13px;\r\n}\r\n\r\n.tfa-member{\r\n    position:relative;\r\n    padding:20px;\r\n    border:1px solid var(--th-border);\r\n    border-radius:12px;\r\n    background:var(--th-soft);\r\n}\r\n\r\n.tfa-member-title{\r\n    margin:0 0 14px;\r\n    font-size:14px;\r\n    font-weight:900;\r\n}\r\n\r\n.tfa-member-grid{\r\n    display:grid;\r\n    grid-template-columns:1.2fr .9fr 1fr;\r\n    gap:13px;\r\n}\r\n\r\n.tfa-remove{\r\n    position:absolute;\r\n    top:13px;\r\n    right:13px;\r\n    border:0;\r\n    background:none;\r\n    color:var(--th-danger);\r\n    font-size:12px;\r\n    font-weight:850;\r\n    cursor:pointer;\r\n}\r\n\r\n.tfa-empty{\r\n    padding:22px;\r\n    border:1px dashed #cfc1b7;\r\n    border-radius:11px;\r\n    color:var(--th-muted);\r\n    text-align:center;\r\n    font-size:13px;\r\n}\r\n\r\n.tfa-payment-status{\r\n    padding:16px 18px;\r\n    border-left:4px solid var(--th-orange);\r\n    border-radius:9px;\r\n    background:#f4f2f0;\r\n    color:var(--th-muted);\r\n    font-size:13px;\r\n}\r\n\r\n.tfa-payment-status strong{\r\n    color:var(--th-black);\r\n}\r\n\r\n.tfa-payment-options{\r\n    grid-column:1\/-1;\r\n    display:grid;\r\n    grid-template-columns:repeat(3,1fr);\r\n    gap:14px;\r\n}\r\n\r\n.tfa-payment-option{\r\n    padding:17px;\r\n    border:1px solid var(--th-border);\r\n    border-radius:11px;\r\n    background:var(--th-soft);\r\n}\r\n\r\n.tfa-payment-option strong{\r\n    display:block;\r\n    margin-bottom:4px;\r\n    color:var(--th-black);\r\n    font-size:14px;\r\n}\r\n\r\n.tfa-payment-option span{\r\n    display:block;\r\n    color:var(--th-muted);\r\n    font-size:12px;\r\n}\r\n\r\n.tfa-consent{\r\n    display:flex;\r\n    gap:11px;\r\n    align-items:flex-start;\r\n    color:var(--th-muted);\r\n    font-size:12px;\r\n}\r\n\r\n.tfa-consent input{\r\n    margin-top:4px;\r\n}\r\n\r\n.tfa-signature-wrap{\r\n    overflow:hidden;\r\n    border:1px solid #d7ccc4;\r\n    border-radius:10px;\r\n    background:#fff;\r\n}\r\n\r\n.tfa-signature{\r\n    display:block;\r\n    width:100%;\r\n    height:190px;\r\n    cursor:crosshair;\r\n    touch-action:none;\r\n}\r\n\r\n.tfa-signature-actions{\r\n    display:flex;\r\n    justify-content:space-between;\r\n    align-items:center;\r\n    gap:15px;\r\n    margin-top:10px;\r\n}\r\n\r\n.tfa-message{\r\n    display:none;\r\n    margin:20px 34px;\r\n    padding:15px;\r\n    border-radius:9px;\r\n    background:#fff0f0;\r\n    color:var(--th-danger);\r\n    font-size:13px;\r\n    font-weight:700;\r\n}\r\n\r\n.tfa-submit{\r\n    display:flex;\r\n    justify-content:space-between;\r\n    align-items:center;\r\n    gap:20px;\r\n    padding:30px 34px;\r\n    background:var(--th-black);\r\n    color:#fff;\r\n}\r\n\r\n.tfa-submit p{\r\n    max-width:650px;\r\n    margin:0;\r\n    color:rgba(255,255,255,.65);\r\n    font-size:12px;\r\n}\r\n\r\n.tfa-success{\r\n    display:none;\r\n    padding:35px;\r\n    border:1px solid var(--th-border);\r\n    border-radius:var(--th-radius);\r\n    background:#fff;\r\n    box-shadow:var(--th-shadow);\r\n}\r\n\r\n.tfa-success h2{\r\n    margin:0 0 10px;\r\n    color:var(--th-success);\r\n}\r\n\r\n.tfa-summary{\r\n    display:grid;\r\n    grid-template-columns:repeat(3,1fr);\r\n    gap:13px;\r\n    margin-top:22px;\r\n}\r\n\r\n.tfa-summary-item{\r\n    padding:17px;\r\n    border-radius:10px;\r\n    background:var(--th-soft);\r\n}\r\n\r\n.tfa-summary-item strong{\r\n    display:block;\r\n    font-size:11px;\r\n    text-transform:uppercase;\r\n}\r\n\r\n.tfa-summary-item span{\r\n    display:block;\r\n    margin-top:5px;\r\n    color:var(--th-orange);\r\n    font-size:17px;\r\n    font-weight:900;\r\n}\r\n\r\n@media(max-width:760px){\r\n    .tfa-page{\r\n        font-size:17px;\r\n    }\r\n\r\n    .tfa-hero-inner{\r\n        padding:52px 0;\r\n    }\r\n\r\n    .tfa-title{\r\n        font-size:40px;\r\n    }\r\n\r\n    .tfa-section{\r\n        padding:45px 0;\r\n    }\r\n\r\n    .tfa-block{\r\n        padding:25px;\r\n    }\r\n\r\n    .tfa-grid,\r\n    .tfa-member-grid,\r\n    .tfa-summary,\r\n    .tfa-payment-options{\r\n        grid-template-columns:1fr;\r\n    }\r\n\r\n    .tfa-full{\r\n        grid-column:auto;\r\n    }\r\n\r\n    .tfa-members-head,\r\n    .tfa-submit,\r\n    .tfa-signature-actions,\r\n    .tfa-premium-card{\r\n        align-items:stretch;\r\n        flex-direction:column;\r\n    }\r\n\r\n    .tfa-btn{\r\n        width:100%;\r\n    }\r\n}\r\n<\/style>\r\n\r\n<div class=\"tfa-page\">\r\n\r\n    <section class=\"tfa-hero\">\r\n        <div class=\"tfa-container tfa-hero-inner\">\r\n\r\n            <span class=\"tfa-eyebrow\">\r\n                Tshepo Hope Funerals\r\n            <\/span>\r\n\r\n            <h1 class=\"tfa-title\">\r\n                Funeral Services\r\n                <span>Application<\/span>\r\n            <\/h1>\r\n\r\n            <p>\r\n                Complete this application with the assistance of an\r\n                authorised Tshepo Hope sales agent.\r\n            <\/p>\r\n\r\n        <\/div>\r\n    <\/section>\r\n\r\n    <section class=\"tfa-section\">\r\n        <div class=\"tfa-container\">\r\n\r\n            <form\r\n                class=\"tfa-form\"\r\n                id=\"tfa_form\"\r\n                action=\"https:\/\/hook.eu1.make.com\/y01s6v6jfx4kdn2vkiepjcrn0r7bgk1j\"\r\n                method=\"post\"\r\n                enctype=\"multipart\/form-data\">\r\n\r\n                <input type=\"hidden\" name=\"source_system\" value=\"tshepohope_elementor\">\r\n\r\n                <input type=\"hidden\" name=\"journey\" value=\"tshepo_funeral_product_sale\">\r\n\r\n                <input type=\"hidden\" name=\"x_studio_request_type\" value=\"new_application\">\r\n\r\n                <input type=\"hidden\" name=\"x_studio_application_status\" value=\"submitted\">\r\n\r\n                <input type=\"hidden\" name=\"x_name\" id=\"tfa_reference\">\r\n\r\n                <input type=\"hidden\" name=\"x_studio_application_date\" id=\"tfa_date\">\r\n\r\n                <input type=\"hidden\" name=\"x_studio_sales_channel\" value=\"representative_assisted\">\r\n\r\n                <input type=\"hidden\" name=\"x_studio_main_member_age\" id=\"tfa_age\">\r\n\r\n                <input type=\"hidden\" name=\"x_studio_product_name\" id=\"tfa_product_name\">\r\n\r\n                <input type=\"hidden\" name=\"x_studio_cover_type\" id=\"tfa_cover_type\">\r\n\r\n                <input type=\"hidden\" name=\"x_studio_product_option\" id=\"tfa_product_option\">\r\n\r\n                <input\r\n                    type=\"hidden\"\r\n                    name=\"x_studio_number_of_additional_members\"\r\n                    id=\"tfa_member_count\"\r\n                    value=\"0\">\r\n\r\n                <input\r\n                    type=\"hidden\"\r\n                    name=\"covered_members_json\"\r\n                    id=\"tfa_members_json\"\r\n                    value=\"[]\">\r\n\r\n                <input\r\n                    type=\"hidden\"\r\n                    name=\"x_studio_payment_status\"\r\n                    id=\"tfa_payment_status\"\r\n                    value=\"pending\">\r\n\r\n                <input\r\n                    type=\"hidden\"\r\n                    name=\"x_studio_payment_reference_status\"\r\n                    id=\"tfa_payment_reference_status\">\r\n\r\n                <input\r\n                    type=\"hidden\"\r\n                    name=\"x_studio_paystack_reference\"\r\n                    id=\"tfa_paystack_reference\">\r\n\r\n                <!-- STEP 1 -->\r\n\r\n                <div class=\"tfa-block\">\r\n\r\n                    <div class=\"tfa-block-head\">\r\n                        <span class=\"tfa-no\">1<\/span>\r\n\r\n                        <div>\r\n                            <h2>Agent authentication<\/h2>\r\n                            <p>\r\n                                Confirm the agent against the RepEasy\r\n                                representative register.\r\n                            <\/p>\r\n                        <\/div>\r\n                    <\/div>\r\n\r\n                    <div class=\"tfa-grid\">\r\n\r\n                        <div>\r\n                            <label class=\"tfa-label\" for=\"tfa_agent_cell\">\r\n                                Agent cellphone number *\r\n                            <\/label>\r\n\r\n                            <input\r\n                                class=\"tfa-input\"\r\n                                id=\"tfa_agent_cell\"\r\n                                name=\"x_studio_representative_cellphone\"\r\n                                type=\"tel\"\r\n                                placeholder=\"Example: 082 123 4567\"\r\n                                required>\r\n                        <\/div>\r\n\r\n                        <div>\r\n                            <label class=\"tfa-label\" for=\"tfa_agent_reference\">\r\n                                RepEasy agent reference\r\n                            <\/label>\r\n\r\n                            <input\r\n                                class=\"tfa-input\"\r\n                                id=\"tfa_agent_reference\"\r\n                                name=\"x_studio_representative_name\"\r\n                                type=\"text\"\r\n                                readonly\r\n                                placeholder=\"Populated after authentication\">\r\n                        <\/div>\r\n\r\n                        <input type=\"hidden\" name=\"agent_source\" value=\"Tshepo Hope\">\r\n\r\n                        <div class=\"tfa-full\">\r\n\r\n                            <button\r\n                                class=\"tfa-btn tfa-btn-dark\"\r\n                                id=\"tfa_auth_agent\"\r\n                                type=\"button\">\r\n                                Authenticate With RepEasy\r\n                            <\/button>\r\n\r\n                        <\/div>\r\n\r\n                        <div\r\n                            class=\"tfa-full tfa-agent-status\"\r\n                            id=\"tfa_auth_status\">\r\n                            Enter the agent\u2019s cellphone number to continue.\r\n                        <\/div>\r\n\r\n                    <\/div>\r\n                <\/div>\r\n\r\n                <div\r\n                    class=\"tfa-application-body is-locked\"\r\n                    id=\"tfa_application_body\">\r\n\r\n                    <!-- STEP 2 -->\r\n\r\n                    <div class=\"tfa-block\">\r\n\r\n                        <div class=\"tfa-block-head\">\r\n                            <span class=\"tfa-no\">2<\/span>\r\n\r\n                            <div>\r\n                                <h2>Oldest person and quote<\/h2>\r\n                                <p>\r\n                                    The oldest covered person determines\r\n                                    the available plan and premium.\r\n                                <\/p>\r\n                            <\/div>\r\n                        <\/div>\r\n\r\n                        <div class=\"tfa-grid\">\r\n\r\n                            <div class=\"tfa-full\">\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_oldest_id\">\r\n                                    Oldest covered person\u2019s SA ID number *\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_oldest_id\"\r\n                                    name=\"x_studio_oldest_member_id_number\"\r\n                                    type=\"text\"\r\n                                    inputmode=\"numeric\"\r\n                                    minlength=\"13\"\r\n                                    maxlength=\"13\"\r\n                                    required>\r\n\r\n                                <span class=\"tfa-help\">\r\n                                    Enter all 13 digits. The date of birth\r\n                                    and age will be calculated automatically.\r\n                                <\/span>\r\n\r\n                            <\/div>\r\n\r\n                            <input\r\n                                type=\"hidden\"\r\n                                id=\"tfa_oldest_dob\"\r\n                                name=\"x_studio_oldest_member_date_of_birth\">\r\n\r\n                            <div\r\n                                class=\"tfa-full tfa-rule\"\r\n                                id=\"tfa_age_result\">\r\n                                <strong>Enter a valid ID number<\/strong>\r\n                                to display eligible plans.\r\n                            <\/div>\r\n\r\n                            <div class=\"tfa-pricing\">\r\n\r\n                                <div class=\"tfa-pricing-head\">\r\n                                    <strong>Available plans<\/strong>\r\n\r\n                                    <span class=\"tfa-draft-badge\">\r\n                                        Monthly premium\r\n                                    <\/span>\r\n                                <\/div>\r\n\r\n                                <div\r\n                                    class=\"tfa-rate-groups\"\r\n                                    id=\"tfa_rate_groups\">\r\n\r\n                                    <div class=\"tfa-rate-empty\">\r\n                                        Eligible plans will appear here.\r\n                                    <\/div>\r\n\r\n                                <\/div>\r\n                            <\/div>\r\n\r\n                            <div>\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_age_band\">\r\n                                    Age band *\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_age_band\"\r\n                                    name=\"x_studio_age_band\"\r\n                                    type=\"text\"\r\n                                    readonly\r\n                                    required>\r\n\r\n                            <\/div>\r\n\r\n                            <div>\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_premium\">\r\n                                    Monthly premium (R) *\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_premium\"\r\n                                    name=\"x_studio_monthly_premium\"\r\n                                    type=\"number\"\r\n                                    readonly\r\n                                    required>\r\n\r\n                            <\/div>\r\n\r\n                            <div class=\"tfa-full tfa-premium-card\">\r\n\r\n                                <strong>\r\n                                    Selected monthly premium\r\n                                <\/strong>\r\n\r\n                                <span id=\"tfa_premium_display\">\r\n                                    R0.00\r\n                                <\/span>\r\n\r\n                            <\/div>\r\n\r\n                            <div\r\n                                class=\"tfa-full tfa-rule\"\r\n                                id=\"tfa_plan_rule\">\r\n                                <strong>Select a plan<\/strong>\r\n                                to continue.\r\n                            <\/div>\r\n\r\n                        <\/div>\r\n                    <\/div>\r\n\r\n                    <!-- STEP 3 -->\r\n\r\n                    <div class=\"tfa-block\">\r\n\r\n                        <div class=\"tfa-block-head\">\r\n                            <span class=\"tfa-no\">3<\/span>\r\n\r\n                            <div>\r\n                                <h2>Main member details<\/h2>\r\n                                <p>\r\n                                    Capture the person applying for the\r\n                                    selected funeral service plan.\r\n                                <\/p>\r\n                            <\/div>\r\n                        <\/div>\r\n\r\n                        <div class=\"tfa-grid\">\r\n\r\n                            <div class=\"tfa-full\">\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_full_name\">\r\n                                    Full name *\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_full_name\"\r\n                                    name=\"x_studio_main_member_full_name\"\r\n                                    type=\"text\"\r\n                                    autocomplete=\"name\"\r\n                                    required>\r\n\r\n                            <\/div>\r\n\r\n                            <div>\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_id\">\r\n                                    South African ID number *\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_id\"\r\n                                    name=\"x_studio_main_member_id_number\"\r\n                                    type=\"text\"\r\n                                    inputmode=\"numeric\"\r\n                                    minlength=\"13\"\r\n                                    maxlength=\"13\"\r\n                                    required>\r\n\r\n                            <\/div>\r\n\r\n                            <input\r\n                                type=\"hidden\"\r\n                                id=\"tfa_main_dob\"\r\n                                name=\"x_studio_main_member_date_of_birth\">\r\n\r\n                            <div>\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_cell\">\r\n                                    Cellphone number *\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_cell\"\r\n                                    name=\"x_studio_main_member_cellphone\"\r\n                                    type=\"tel\"\r\n                                    autocomplete=\"tel\"\r\n                                    required>\r\n\r\n                            <\/div>\r\n\r\n                            <div>\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_email\">\r\n                                    Email address\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_email\"\r\n                                    name=\"x_studio_main_member_email\"\r\n                                    type=\"email\"\r\n                                    autocomplete=\"email\">\r\n\r\n                                <span class=\"tfa-help\">\r\n                                    Required only when Online Payment\r\n                                    is selected.\r\n                                <\/span>\r\n\r\n                            <\/div>\r\n\r\n                            <div>\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_id_copy\">\r\n                                    Upload main member ID copy *\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_id_copy\"\r\n                                    name=\"x_studio_main_member_id_copy\"\r\n                                    type=\"file\"\r\n                                    accept=\"image\/jpeg,image\/png,application\/pdf\"\r\n                                    required>\r\n\r\n                            <\/div>\r\n\r\n                            <div class=\"tfa-full\">\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_street\">\r\n                                    Street address *\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_street\"\r\n                                    name=\"x_studio_street_address\"\r\n                                    type=\"text\"\r\n                                    autocomplete=\"street-address\"\r\n                                    required>\r\n\r\n                            <\/div>\r\n\r\n                            <div>\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_city\">\r\n                                    City or town *\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_city\"\r\n                                    name=\"x_studio_city\"\r\n                                    type=\"text\"\r\n                                    required>\r\n\r\n                            <\/div>\r\n\r\n                            <div>\r\n\r\n                                <label class=\"tfa-label\" for=\"tfa_postal\">\r\n                                    Postal code *\r\n                                <\/label>\r\n\r\n                                <input\r\n                                    class=\"tfa-input\"\r\n                                    id=\"tfa_postal\"\r\n                                    name=\"x_studio_postal_code\"\r\n                                    type=\"text\"\r\n                                    inputmode=\"numeric\"\r\n                                    required>\r\n\r\n                            <\/div>\r\n\r\n                        <\/div>\r\n                    <\/div>\r\n\r\n                    <!-- STEP 4 -->\r\n\r\n                    <div\r\n                        class=\"tfa-block\"\r\n                        id=\"tfa_members_block\">\r\n\r\n                        <div class=\"tfa-block-head\">\r\n                            <span class=\"tfa-no\">4<\/span>\r\n\r\n                            <div>\r\n                                <h2>Additional covered members<\/h2>\r\n                                <p>\r\n                                    Do not repeat the main member here.\r\n                                <\/p>\r\n                            <\/div>\r\n                        <\/div>\r\n\r\n                        <div class=\"tfa-members-head\">\r\n\r\n                            <h3 id=\"tfa_member_limit\">\r\n                                Select a plan first\r\n                            <\/h3>\r\n\r\n                            <button\r\n                                class=\"tfa-btn tfa-btn-light\"\r\n                                id=\"tfa_add_member\"\r\n                                type=\"button\"\r\n                                disabled>\r\n                                Add Member\r\n                            <\/button>\r\n\r\n                        <\/div>\r\n\r\n                        <div\r\n                            class=\"tfa-member-list\"\r\n                            id=\"tfa_member_list\">\r\n                        <\/div>\r\n\r\n                        <div\r\n                            class=\"tfa-empty\"\r\n                            id=\"tfa_empty\">\r\n                            No additional members added.\r\n                        <\/div>\r\n\r\n                    <\/div>\r\n\r\n                    <!-- STEP 5 -->\r\n\r\n                    <div class=\"tfa-block\">\r\n\r\n                        <div class=\"tfa-block-head\">\r\n                            <span class=\"tfa-no\">5<\/span>\r\n\r\n                            <div>\r\n                                <h2>Payment information<\/h2>\r\n                                <p>\r\n                                    Select how the customer would like\r\n                                    to pay the premium.\r\n                                <\/p>\r\n                            <\/div>\r\n                        <\/div>\r\n\r\n                        <div class=\"tfa-grid\">\r\n\r\n                            <div class=\"tfa-payment-options\">\r\n\r\n                                <div class=\"tfa-payment-option\">\r\n                                    <strong>Online Payment<\/strong>\r\n                                    <span>\r\n                                        Pay securely online as part\r\n                                        of this application.\r\n                                    <\/span>\r\n                                <\/div>\r\n\r\n                                <div class=\"tfa-payment-option\">\r\n                                    <strong>EasyPay<\/strong>\r\n                                    <span>\r\n                                        The EasyPay number will be\r\n                                        provided on the policy schedule.\r\n                                    <\/span>\r\n                                <\/div>\r\n\r\n                                <div class=\"tfa-payment-option\">\r\n                                    <strong>Tshepo Hope Branch<\/strong>\r\n                                    <span>\r\n                                        Pay at a participating\r\n                                        Tshepo Hope Funerals branch.\r\n                                    <\/span>\r\n                                <\/div>\r\n\r\n                            <\/div>\r\n\r\n                            <div class=\"tfa-full\">\r\n\r\n                                <label\r\n                                    class=\"tfa-label\"\r\n                                    for=\"tfa_payment\">\r\n                                    Payment method *\r\n                                <\/label>\r\n\r\n                                <select\r\n                                    class=\"tfa-select\"\r\n                                    id=\"tfa_payment\"\r\n                                    name=\"x_studio_payment_method\"\r\n                                    required>\r\n\r\n                                    <option value=\"\">\r\n                                        Select payment method\r\n                                    <\/option>\r\n\r\n                                    <option value=\"immediate_card_payment\">\r\n                                        Online Payment\r\n                                    <\/option>\r\n\r\n                                    <option value=\"easypay\">\r\n                                        EasyPay\r\n                                    <\/option>\r\n\r\n                                    <option value=\"branch_payment\">\r\n                                        Pay at Tshepo Hope Branch\r\n                                    <\/option>\r\n\r\n                                <\/select>\r\n                            <\/div>\r\n\r\n                            <div\r\n                                class=\"tfa-full tfa-payment-status\"\r\n                                id=\"tfa_payment_note\">\r\n\r\n                                <strong>Select a payment method<\/strong>\r\n                                to see the next step.\r\n\r\n                            <\/div>\r\n\r\n                        <\/div>\r\n                    <\/div>\r\n\r\n                    <!-- STEP 6 -->\r\n\r\n                    <div class=\"tfa-block\">\r\n\r\n                        <div class=\"tfa-block-head\">\r\n                            <span class=\"tfa-no\">6<\/span>\r\n\r\n                            <div>\r\n                                <h2>\r\n                                    Declaration, consent and signature\r\n                                <\/h2>\r\n\r\n                                <p>\r\n                                    Confirm the information and ask the\r\n                                    applicant to sign.\r\n                                <\/p>\r\n                            <\/div>\r\n                        <\/div>\r\n\r\n                        <div class=\"tfa-grid\">\r\n\r\n                            <label class=\"tfa-consent tfa-full\">\r\n\r\n                                <input\r\n                                    type=\"checkbox\"\r\n                                    name=\"information_confirmation\"\r\n                                    value=\"yes\"\r\n                                    required>\r\n\r\n                                <span>\r\n                                    I confirm that the information supplied\r\n                                    is true and complete to the best of my\r\n                                    knowledge.\r\n                                <\/span>\r\n\r\n                            <\/label>\r\n\r\n                            <label class=\"tfa-consent tfa-full\">\r\n\r\n                                <input\r\n                                    type=\"checkbox\"\r\n                                    name=\"processing_consent\"\r\n                                    value=\"yes\"\r\n                                    required>\r\n\r\n                                <span>\r\n                                    I consent to Tshepo Hope Funerals and\r\n                                    its authorised service providers\r\n                                    processing this information for the\r\n                                    application, payment and fulfilment\r\n                                    process.\r\n                                <\/span>\r\n\r\n                            <\/label>\r\n\r\n                            <div class=\"tfa-full\">\r\n\r\n                                <label class=\"tfa-label\">\r\n                                    Applicant signature *\r\n                                <\/label>\r\n\r\n                                <div class=\"tfa-signature-wrap\">\r\n                                    <canvas\r\n                                        id=\"tfa_signature_canvas\"\r\n                                        class=\"tfa-signature\">\r\n                                    <\/canvas>\r\n                                <\/div>\r\n\r\n                                <div class=\"tfa-signature-actions\">\r\n\r\n                                    <span class=\"tfa-help\">\r\n                                        Sign using a finger, mouse or stylus.\r\n                                    <\/span>\r\n\r\n                                    <button\r\n                                        class=\"tfa-btn tfa-btn-light\"\r\n                                        id=\"tfa_clear_signature\"\r\n                                        type=\"button\">\r\n                                        Clear Signature\r\n                                    <\/button>\r\n\r\n                                <\/div>\r\n\r\n                                <input\r\n                                    type=\"hidden\"\r\n                                    name=\"x_studio_signature\"\r\n                                    id=\"tfa_signature_data\">\r\n\r\n                            <\/div>\r\n                        <\/div>\r\n                    <\/div>\r\n\r\n                <\/div>\r\n\r\n                <div\r\n                    class=\"tfa-message\"\r\n                    id=\"tfa_error\">\r\n                <\/div>\r\n\r\n                <div class=\"tfa-submit\">\r\n\r\n                    <p>\r\n                        Submit the customer\u2019s application for processing.\r\n                        Premiums may be paid securely online, using the\r\n                        EasyPay number provided on the policy schedule,\r\n                        or at a participating Tshepo Hope Funerals branch.\r\n                        Final acceptance and commencement remain subject\r\n                        to processing and applicable terms.\r\n                    <\/p>\r\n\r\n                    <button\r\n                        class=\"tfa-btn tfa-btn-orange\"\r\n                        id=\"tfa_submit\"\r\n                        type=\"submit\">\r\n                        Submit Application\r\n                    <\/button>\r\n\r\n                <\/div>\r\n\r\n            <\/form>\r\n\r\n            <div\r\n                class=\"tfa-success\"\r\n                id=\"tfa_success\">\r\n\r\n                <h2>Application submitted successfully<\/h2>\r\n\r\n                <p id=\"tfa_success_message\">\r\n                    The application has been sent to Tshepo Hope\r\n                    Funerals.\r\n                <\/p>\r\n\r\n                <div class=\"tfa-summary\">\r\n\r\n                    <div class=\"tfa-summary-item\">\r\n                        <strong>Application reference<\/strong>\r\n                        <span id=\"tfa_success_reference\">\u2014<\/span>\r\n                    <\/div>\r\n\r\n                    <div class=\"tfa-summary-item\">\r\n                        <strong>Agent<\/strong>\r\n                        <span id=\"tfa_success_agent\">\u2014<\/span>\r\n                    <\/div>\r\n\r\n                    <div class=\"tfa-summary-item\">\r\n                        <strong>Applicant<\/strong>\r\n                        <span id=\"tfa_success_applicant\">\u2014<\/span>\r\n                    <\/div>\r\n\r\n                <\/div>\r\n\r\n            <\/div>\r\n\r\n        <\/div>\r\n    <\/section>\r\n<\/div>\r\n\r\n<script>\r\n(function () {\r\n\r\n    var applicationWebhook =\r\n        'https:\/\/hook.eu1.make.com\/y01s6v6jfx4kdn2vkiepjcrn0r7bgk1j';\r\n\r\n    var agentWebhook =\r\n        'https:\/\/hook.eu1.make.com\/veq2k6odqqt279vne3nbevf5wo78c81n';\r\n\r\n    var paystackPublicKey =\r\n        'pk_live_fffba5ce6008098fab0a4e93f4796b59ddae034b';\r\n\r\n    var form =\r\n        document.getElementById('tfa_form');\r\n\r\n    var applicationBody =\r\n        document.getElementById('tfa_application_body');\r\n\r\n    var authButton =\r\n        document.getElementById('tfa_auth_agent');\r\n\r\n    var authStatus =\r\n        document.getElementById('tfa_auth_status');\r\n\r\n    var agentCell =\r\n        document.getElementById('tfa_agent_cell');\r\n\r\n    var agentReference =\r\n        document.getElementById('tfa_agent_reference');\r\n\r\n    var oldestId =\r\n        document.getElementById('tfa_oldest_id');\r\n\r\n    var ageResult =\r\n        document.getElementById('tfa_age_result');\r\n\r\n    var ageBand =\r\n        document.getElementById('tfa_age_band');\r\n\r\n    var rateGroups =\r\n        document.getElementById('tfa_rate_groups');\r\n\r\n    var premium =\r\n        document.getElementById('tfa_premium');\r\n\r\n    var premiumDisplay =\r\n        document.getElementById('tfa_premium_display');\r\n\r\n    var planRule =\r\n        document.getElementById('tfa_plan_rule');\r\n\r\n    var memberList =\r\n        document.getElementById('tfa_member_list');\r\n\r\n    var memberLimit =\r\n        document.getElementById('tfa_member_limit');\r\n\r\n    var memberEmpty =\r\n        document.getElementById('tfa_empty');\r\n\r\n    var addMemberButton =\r\n        document.getElementById('tfa_add_member');\r\n\r\n    var payment =\r\n        document.getElementById('tfa_payment');\r\n\r\n    var paymentNote =\r\n        document.getElementById('tfa_payment_note');\r\n\r\n    var errorBox =\r\n        document.getElementById('tfa_error');\r\n\r\n    var submitButton =\r\n        document.getElementById('tfa_submit');\r\n\r\n    var successPanel =\r\n        document.getElementById('tfa_success');\r\n\r\n    var canvas =\r\n        document.getElementById('tfa_signature_canvas');\r\n\r\n    var context =\r\n        canvas.getContext('2d');\r\n\r\n    var authenticated = false;\r\n    var selectedPlan = null;\r\n    var memberIndex = 0;\r\n    var drawing = false;\r\n    var signed = false;\r\n    var cardPaymentApproved = false;\r\n    var paymentOpening = false;\r\n\r\n    var rates = {\r\n\r\n        under65: [\r\n            ['single','Coffin',90],\r\n            ['single','3T Coffin',110],\r\n            ['single','Casket',140],\r\n            ['single','Dome',170],\r\n            ['family','Coffin',140],\r\n            ['family','3T Coffin',180],\r\n            ['family','Casket',220],\r\n            ['family','Dome',300],\r\n            ['combo','Coffin',220]\r\n        ],\r\n\r\n        age65to74: [\r\n            ['single','Coffin',110],\r\n            ['single','3T Coffin',130],\r\n            ['single','Casket',160],\r\n            ['single','Dome',190],\r\n            ['family','Coffin',180],\r\n            ['family','3T Coffin',220],\r\n            ['family','Casket',300],\r\n            ['family','Dome',370],\r\n            ['combo','Coffin',270]\r\n        ],\r\n\r\n        pensioner: [\r\n            ['pensioner','Coffin',230]\r\n        ]\r\n\r\n    };\r\n\r\n    function setApplicationIdentity() {\r\n\r\n        var now = new Date();\r\n\r\n        function pad(value) {\r\n            return String(value).padStart(2,'0');\r\n        }\r\n\r\n        var date =\r\n            now.getFullYear() + '-' +\r\n            pad(now.getMonth() + 1) + '-' +\r\n            pad(now.getDate());\r\n\r\n        var time =\r\n            pad(now.getHours()) +\r\n            pad(now.getMinutes()) +\r\n            pad(now.getSeconds());\r\n\r\n        var random =\r\n            Math.random()\r\n                .toString(36)\r\n                .slice(2,6)\r\n                .toUpperCase();\r\n\r\n        document.getElementById(\r\n            'tfa_date'\r\n        ).value = date;\r\n\r\n        document.getElementById(\r\n            'tfa_reference'\r\n        ).value =\r\n            'THAPP-' +\r\n            date.replace(\/-\/g,'') +\r\n            '-' +\r\n            time +\r\n            '-' +\r\n            random;\r\n    }\r\n\r\n    function ageFromDate(value) {\r\n\r\n        if (!value) {\r\n            return null;\r\n        }\r\n\r\n        var birth =\r\n            new Date(value + 'T00:00:00');\r\n\r\n        var today =\r\n            new Date();\r\n\r\n        if (birth > today) {\r\n            return null;\r\n        }\r\n\r\n        var age =\r\n            today.getFullYear() -\r\n            birth.getFullYear();\r\n\r\n        var monthDifference =\r\n            today.getMonth() -\r\n            birth.getMonth();\r\n\r\n        if (\r\n            monthDifference < 0 ||\r\n            (\r\n                monthDifference === 0 &&\r\n                today.getDate() < birth.getDate()\r\n            )\r\n        ) {\r\n            age--;\r\n        }\r\n\r\n        return age;\r\n    }\r\n\r\n    function idDetails(value) {\r\n\r\n        var id =\r\n            String(value || '')\r\n                .replace(\/\\D\/g,'');\r\n\r\n        if (!\/^\\d{13}$\/.test(id)) {\r\n            return null;\r\n        }\r\n\r\n        var yearPart =\r\n            Number(id.slice(0,2));\r\n\r\n        var month =\r\n            Number(id.slice(2,4));\r\n\r\n        var day =\r\n            Number(id.slice(4,6));\r\n\r\n        var today =\r\n            new Date();\r\n\r\n        var year =\r\n            2000 + yearPart;\r\n\r\n        var birth =\r\n            new Date(year,month - 1,day);\r\n\r\n        if (birth > today) {\r\n\r\n            year =\r\n                1900 + yearPart;\r\n\r\n            birth =\r\n                new Date(\r\n                    year,\r\n                    month - 1,\r\n                    day\r\n                );\r\n        }\r\n\r\n        if (\r\n            birth.getFullYear() !== year ||\r\n            birth.getMonth() !== month - 1 ||\r\n            birth.getDate() !== day\r\n        ) {\r\n            return null;\r\n        }\r\n\r\n        var oddTotal = 0;\r\n\r\n        for (\r\n            var i = 0;\r\n            i < 12;\r\n            i += 2\r\n        ) {\r\n            oddTotal += Number(id[i]);\r\n        }\r\n\r\n        var evenNumber =\r\n            Number(\r\n                id[1] +\r\n                id[3] +\r\n                id[5] +\r\n                id[7] +\r\n                id[9] +\r\n                id[11]\r\n            ) * 2;\r\n\r\n        var evenDigits =\r\n            String(evenNumber);\r\n\r\n        var evenTotal = 0;\r\n\r\n        for (\r\n            var j = 0;\r\n            j < evenDigits.length;\r\n            j++\r\n        ) {\r\n            evenTotal +=\r\n                Number(evenDigits[j]);\r\n        }\r\n\r\n        if (\r\n            (\r\n                oddTotal +\r\n                evenTotal +\r\n                Number(id[12])\r\n            ) % 10 !== 0\r\n        ) {\r\n            return null;\r\n        }\r\n\r\n        var dob =\r\n            year + '-' +\r\n            String(month).padStart(2,'0') +\r\n            '-' +\r\n            String(day).padStart(2,'0');\r\n\r\n        return {\r\n            id:id,\r\n            dob:dob,\r\n            age:ageFromDate(dob)\r\n        };\r\n    }\r\n\r\n    function ageBandKey(age) {\r\n\r\n        if (age < 18) {\r\n            return 'ineligible';\r\n        }\r\n\r\n        if (age < 65) {\r\n            return 'under65';\r\n        }\r\n\r\n        if (age < 75) {\r\n            return 'age65to74';\r\n        }\r\n\r\n        if (age < 85) {\r\n            return 'pensioner';\r\n        }\r\n\r\n        return 'ineligible';\r\n    }\r\n\r\n    function ageBandLabel(key) {\r\n\r\n        if (key === 'under65') {\r\n            return '18\u201364';\r\n        }\r\n\r\n        if (key === 'age65to74') {\r\n            return '65\u201374';\r\n        }\r\n\r\n        if (key === 'pensioner') {\r\n            return 'Pensioner Plan: 75\u201384';\r\n        }\r\n\r\n        return 'Not eligible';\r\n    }\r\n\r\n    function coverLabel(type) {\r\n\r\n        if (type === 'single') {\r\n            return 'Single Burial';\r\n        }\r\n\r\n        if (type === 'family') {\r\n            return 'Family Burial';\r\n        }\r\n\r\n        if (type === 'combo') {\r\n            return 'Combo Burial';\r\n        }\r\n\r\n        return 'Pensioner Plan';\r\n    }\r\n\r\n    function clearSelectedPlan() {\r\n\r\n        selectedPlan = null;\r\n\r\n        premium.value = '';\r\n\r\n        premiumDisplay.textContent =\r\n            'R0.00';\r\n\r\n        document.getElementById(\r\n            'tfa_product_name'\r\n        ).value = '';\r\n\r\n        document.getElementById(\r\n            'tfa_cover_type'\r\n        ).value = '';\r\n\r\n        document.getElementById(\r\n            'tfa_product_option'\r\n        ).value = '';\r\n\r\n        planRule.innerHTML =\r\n            '<strong>Select a plan<\/strong> to continue.';\r\n\r\n        memberList.innerHTML = '';\r\n\r\n        updateMemberControls();\r\n    }\r\n\r\n    function renderRates() {\r\n\r\n        clearSelectedPlan();\r\n\r\n        var details =\r\n            idDetails(oldestId.value);\r\n\r\n        if (!details) {\r\n\r\n            ageBand.value = '';\r\n\r\n            document.getElementById(\r\n                'tfa_oldest_dob'\r\n            ).value = '';\r\n\r\n            ageResult.innerHTML =\r\n                '<strong>Enter a valid 13-digit ' +\r\n                'South African ID number<\/strong> ' +\r\n                'to display eligible plans.';\r\n\r\n            rateGroups.innerHTML =\r\n                '<div class=\"tfa-rate-empty\">' +\r\n                'Eligible plans will appear here.' +\r\n                '<\/div>';\r\n\r\n            return;\r\n        }\r\n\r\n        oldestId.value =\r\n            details.id;\r\n\r\n        document.getElementById(\r\n            'tfa_oldest_dob'\r\n        ).value =\r\n            details.dob;\r\n\r\n        document.getElementById(\r\n            'tfa_age'\r\n        ).value =\r\n            details.age;\r\n\r\n        var key =\r\n            ageBandKey(details.age);\r\n\r\n        ageBand.value =\r\n            ageBandLabel(key);\r\n\r\n        if (key === 'ineligible') {\r\n\r\n            ageResult.innerHTML =\r\n                '<strong>Age ' +\r\n                details.age +\r\n                ': no available plan<\/strong><br>' +\r\n                'The current entry-age range is 18 to 84.';\r\n\r\n            rateGroups.innerHTML =\r\n                '<div class=\"tfa-rate-empty\">' +\r\n                '<strong>No plan available.<\/strong>' +\r\n                '<\/div>';\r\n\r\n            return;\r\n        }\r\n\r\n        var availableRates =\r\n            rates[key];\r\n\r\n        ageResult.innerHTML =\r\n            '<strong>Age ' +\r\n            details.age +\r\n            ': ' +\r\n            ageBandLabel(key) +\r\n            '<\/strong><br>' +\r\n            (\r\n                key === 'pensioner'\r\n                    ? 'Only the Pensioner Plan is available.'\r\n                    : 'The appropriate Burial Cover options are shown below.'\r\n            );\r\n\r\n        rateGroups.dataset.key =\r\n            key;\r\n\r\n        rateGroups.innerHTML =\r\n            '<div class=\"tfa-rate-scroll\">' +\r\n            '<table class=\"tfa-rate-table\">' +\r\n            '<thead>' +\r\n            '<tr>' +\r\n            '<th>Plan<\/th>' +\r\n            '<th>Service option<\/th>' +\r\n            '<th>Monthly premium<\/th>' +\r\n            '<th>Action<\/th>' +\r\n            '<\/tr>' +\r\n            '<\/thead>' +\r\n            '<tbody>' +\r\n\r\n            availableRates.map(\r\n                function (rate,index) {\r\n\r\n                    return (\r\n                        '<tr>' +\r\n                        '<td>' +\r\n                        coverLabel(rate[0]) +\r\n                        '<\/td>' +\r\n                        '<td>' +\r\n                        rate[1] +\r\n                        '<\/td>' +\r\n                        '<td class=\"tfa-rate-price\">' +\r\n                        'R' +\r\n                        Number(rate[2]).toFixed(2) +\r\n                        '<\/td>' +\r\n                        '<td>' +\r\n                        '<button ' +\r\n                        'class=\"tfa-rate-btn\" ' +\r\n                        'type=\"button\" ' +\r\n                        'data-rate=\"' +\r\n                        index +\r\n                        '\">' +\r\n                        'Select Rate' +\r\n                        '<\/button>' +\r\n                        '<\/td>' +\r\n                        '<\/tr>'\r\n                    );\r\n                }\r\n            ).join('') +\r\n\r\n            '<\/tbody>' +\r\n            '<\/table>' +\r\n            '<\/div>';\r\n    }\r\n\r\n    function selectRate(index) {\r\n\r\n        var key =\r\n            rateGroups.dataset.key;\r\n\r\n        var rate =\r\n            rates[key][index];\r\n\r\n        selectedPlan = {\r\n            type:rate[0],\r\n            option:rate[1],\r\n            premium:rate[2]\r\n        };\r\n\r\n        premium.value =\r\n            Number(rate[2]).toFixed(2);\r\n\r\n        premiumDisplay.textContent =\r\n            'R' +\r\n            Number(rate[2]).toFixed(2);\r\n\r\n        document.getElementById(\r\n            'tfa_product_name'\r\n        ).value =\r\n            rate[0] === 'pensioner'\r\n                ? 'Pensioner Plan'\r\n                : 'Burial Cover';\r\n\r\n        document.getElementById(\r\n            'tfa_cover_type'\r\n        ).value =\r\n            rate[0];\r\n\r\n        document.getElementById(\r\n            'tfa_product_option'\r\n        ).value =\r\n            rate[1];\r\n\r\n        var description =\r\n            'Main member only.';\r\n\r\n        if (rate[0] === 'family') {\r\n\r\n            description =\r\n                'Main member, one spouse and up to six children.';\r\n        }\r\n\r\n        if (rate[0] === 'combo') {\r\n\r\n            description =\r\n                'Main member plus up to nine additional members. ' +\r\n                'The premium remains unchanged when fewer than ' +\r\n                'nine members are included.';\r\n        }\r\n\r\n        planRule.innerHTML =\r\n            '<strong>' +\r\n            coverLabel(rate[0]) +\r\n            ' \u2013 ' +\r\n            rate[1] +\r\n            '<\/strong><br>' +\r\n            description;\r\n\r\n        memberList.innerHTML = '';\r\n\r\n        updateMemberControls();\r\n\r\n        premium.scrollIntoView({\r\n            behavior:'smooth',\r\n            block:'center'\r\n        });\r\n    }\r\n\r\n    function maximumMembers() {\r\n\r\n        if (!selectedPlan) {\r\n            return 0;\r\n        }\r\n\r\n        if (selectedPlan.type === 'combo') {\r\n            return 9;\r\n        }\r\n\r\n        if (selectedPlan.type === 'family') {\r\n            return 7;\r\n        }\r\n\r\n        return 0;\r\n    }\r\n\r\n    function updateMemberControls() {\r\n\r\n        var maximum =\r\n            maximumMembers();\r\n\r\n        var count =\r\n            memberList.children.length;\r\n\r\n        memberLimit.textContent =\r\n            maximum\r\n                ? count +\r\n                  ' of ' +\r\n                  maximum +\r\n                  ' additional members added'\r\n                : 'No additional members permitted';\r\n\r\n        addMemberButton.disabled =\r\n            !maximum ||\r\n            count >= maximum;\r\n\r\n        memberEmpty.style.display =\r\n            count\r\n                ? 'none'\r\n                : 'block';\r\n\r\n        document.getElementById(\r\n            'tfa_member_count'\r\n        ).value =\r\n            count;\r\n    }\r\n\r\n    function relationshipOptions() {\r\n\r\n        if (\r\n            selectedPlan &&\r\n            selectedPlan.type === 'family'\r\n        ) {\r\n\r\n            return (\r\n                '<option value=\"\">Select<\/option>' +\r\n                '<option value=\"spouse\">Spouse<\/option>' +\r\n                '<option value=\"child\">Child<\/option>'\r\n            );\r\n        }\r\n\r\n        return (\r\n            '<option value=\"\">Select<\/option>' +\r\n            '<option value=\"spouse\">Spouse<\/option>' +\r\n            '<option value=\"child\">Child<\/option>' +\r\n            '<option value=\"parent\">Parent<\/option>' +\r\n            '<option value=\"parent_in_law\">Parent-in-law<\/option>' +\r\n            '<option value=\"sibling\">Brother or sister<\/option>' +\r\n            '<option value=\"grandparent\">Grandparent<\/option>' +\r\n            '<option value=\"grandchild\">Grandchild<\/option>' +\r\n            '<option value=\"extended_family\">Extended family<\/option>'\r\n        );\r\n    }\r\n\r\n    function addMember() {\r\n\r\n        if (\r\n            !selectedPlan ||\r\n            memberList.children.length >=\r\n                maximumMembers()\r\n        ) {\r\n            return;\r\n        }\r\n\r\n        memberIndex++;\r\n\r\n        var member =\r\n            document.createElement('div');\r\n\r\n        member.className =\r\n            'tfa-member';\r\n\r\n        member.innerHTML =\r\n            '<button class=\"tfa-remove\" type=\"button\">' +\r\n            'Remove' +\r\n            '<\/button>' +\r\n\r\n            '<div class=\"tfa-member-title\">' +\r\n            'Additional Member ' +\r\n            memberIndex +\r\n            '<\/div>' +\r\n\r\n            '<div class=\"tfa-member-grid\">' +\r\n\r\n            '<div>' +\r\n            '<label class=\"tfa-label\">Full name *<\/label>' +\r\n            '<input class=\"tfa-input member-name\" required>' +\r\n            '<\/div>' +\r\n\r\n            '<div>' +\r\n            '<label class=\"tfa-label\">Relationship *<\/label>' +\r\n            '<select class=\"tfa-select member-relationship\" required>' +\r\n            relationshipOptions() +\r\n            '<\/select>' +\r\n            '<\/div>' +\r\n\r\n            '<div>' +\r\n            '<label class=\"tfa-label\">SA ID number *<\/label>' +\r\n            '<input ' +\r\n            'class=\"tfa-input member-id\" ' +\r\n            'type=\"text\" ' +\r\n            'inputmode=\"numeric\" ' +\r\n            'minlength=\"13\" ' +\r\n            'maxlength=\"13\" ' +\r\n            'required>' +\r\n            '<\/div>' +\r\n\r\n            '<\/div>';\r\n\r\n        member.querySelector(\r\n            '.tfa-remove'\r\n        ).addEventListener(\r\n            'click',\r\n            function () {\r\n\r\n                member.remove();\r\n\r\n                updateMemberControls();\r\n            }\r\n        );\r\n\r\n        memberList.appendChild(member);\r\n\r\n        updateMemberControls();\r\n    }\r\n\r\n    function serializeMembers() {\r\n\r\n        var members = [];\r\n        var spouseCount = 0;\r\n        var childCount = 0;\r\n\r\n        memberList.querySelectorAll(\r\n            '.tfa-member'\r\n        ).forEach(\r\n            function (member) {\r\n\r\n                var relationship =\r\n                    member.querySelector(\r\n                        '.member-relationship'\r\n                    ).value;\r\n\r\n                var name =\r\n                    member.querySelector(\r\n                        '.member-name'\r\n                    ).value.trim();\r\n\r\n                if (!name) {\r\n\r\n                    throw new Error(\r\n                        'Enter the full name for every additional member.'\r\n                    );\r\n                }\r\n\r\n                if (!relationship) {\r\n\r\n                    throw new Error(\r\n                        'Select the relationship for every additional member.'\r\n                    );\r\n                }\r\n\r\n                var details =\r\n                    idDetails(\r\n                        member.querySelector(\r\n                            '.member-id'\r\n                        ).value\r\n                    );\r\n\r\n                if (!details) {\r\n\r\n                    throw new Error(\r\n                        'Enter a valid South African ID number ' +\r\n                        'for every additional member.'\r\n                    );\r\n                }\r\n\r\n                if (\r\n                    relationship ===\r\n                    'spouse'\r\n                ) {\r\n                    spouseCount++;\r\n                }\r\n\r\n                if (\r\n                    relationship ===\r\n                    'child'\r\n                ) {\r\n                    childCount++;\r\n                }\r\n\r\n                members.push({\r\n\r\n                    full_name:name,\r\n\r\n                    relationship:\r\n                        relationship,\r\n\r\n                    id_number:\r\n                        details.id,\r\n\r\n                    date_of_birth:\r\n                        details.dob,\r\n\r\n                    age:\r\n                        details.age\r\n                });\r\n            }\r\n        );\r\n\r\n        if (\r\n            selectedPlan.type === 'family' &&\r\n            spouseCount > 1\r\n        ) {\r\n\r\n            throw new Error(\r\n                'Family Cover allows only one spouse.'\r\n            );\r\n        }\r\n\r\n        if (\r\n            selectedPlan.type === 'family' &&\r\n            childCount > 6\r\n        ) {\r\n\r\n            throw new Error(\r\n                'Family Cover allows up to six children.'\r\n            );\r\n        }\r\n\r\n        if (\r\n            selectedPlan.type === 'combo' &&\r\n            members.length > 9\r\n        ) {\r\n\r\n            throw new Error(\r\n                'Combo Cover allows up to nine additional members.'\r\n            );\r\n        }\r\n\r\n        document.getElementById(\r\n            'tfa_members_json'\r\n        ).value =\r\n            JSON.stringify(members);\r\n\r\n        document.getElementById(\r\n            'tfa_member_count'\r\n        ).value =\r\n            members.length;\r\n\r\n        return members;\r\n    }\r\n\r\n    function showPaymentFields() {\r\n\r\n        var method =\r\n            payment.value;\r\n\r\n        cardPaymentApproved =\r\n            false;\r\n\r\n        document.getElementById(\r\n            'tfa_payment_status'\r\n        ).value =\r\n            'pending';\r\n\r\n        document.getElementById(\r\n            'tfa_paystack_reference'\r\n        ).value =\r\n            '';\r\n\r\n        var referenceStatus =\r\n            document.getElementById(\r\n                'tfa_payment_reference_status'\r\n            );\r\n\r\n        if (\r\n            method ===\r\n            'immediate_card_payment'\r\n        ) {\r\n\r\n            referenceStatus.value =\r\n                'pending_paystack';\r\n\r\n            paymentNote.innerHTML =\r\n                '<strong>Online Payment:<\/strong> ' +\r\n                'The customer will be taken to secure online ' +\r\n                'payment after the application has been validated.';\r\n\r\n        } else if (\r\n            method === 'easypay'\r\n        ) {\r\n\r\n            referenceStatus.value =\r\n                'pending_easypay';\r\n\r\n            paymentNote.innerHTML =\r\n                '<strong>EasyPay:<\/strong> ' +\r\n                'The EasyPay number will be provided on the ' +\r\n                'policy schedule once the application has ' +\r\n                'been processed.';\r\n\r\n        } else if (\r\n            method ===\r\n            'branch_payment'\r\n        ) {\r\n\r\n            referenceStatus.value =\r\n                'pending_branch_payment';\r\n\r\n            paymentNote.innerHTML =\r\n                '<strong>Tshepo Hope Branch:<\/strong> ' +\r\n                'The customer may pay the premium at a ' +\r\n                'participating Tshepo Hope Funerals branch.';\r\n\r\n        } else {\r\n\r\n            referenceStatus.value =\r\n                '';\r\n\r\n            paymentNote.innerHTML =\r\n                '<strong>Select a payment method<\/strong> ' +\r\n                'to see the next step.';\r\n        }\r\n    }\r\n\r\n    function validateApplication() {\r\n\r\n        if (!authenticated) {\r\n\r\n            throw new Error(\r\n                'Authenticate the agent before submitting.'\r\n            );\r\n        }\r\n\r\n        if (!selectedPlan) {\r\n\r\n            throw new Error(\r\n                'Select an eligible plan and premium.'\r\n            );\r\n        }\r\n\r\n        if (!payment.value) {\r\n\r\n            throw new Error(\r\n                'Select a payment method.'\r\n            );\r\n        }\r\n\r\n        var oldest =\r\n            idDetails(\r\n                oldestId.value\r\n            );\r\n\r\n        var main =\r\n            idDetails(\r\n                document.getElementById(\r\n                    'tfa_id'\r\n                ).value\r\n            );\r\n\r\n        if (!oldest) {\r\n\r\n            throw new Error(\r\n                'Enter a valid ID number for the oldest person.'\r\n            );\r\n        }\r\n\r\n        if (!main) {\r\n\r\n            throw new Error(\r\n                'Enter a valid ID number for the main member.'\r\n            );\r\n        }\r\n\r\n        document.getElementById(\r\n            'tfa_main_dob'\r\n        ).value =\r\n            main.dob;\r\n\r\n        var members =\r\n            serializeMembers();\r\n\r\n        var capturedAges =\r\n            [main.age].concat(\r\n                members.map(\r\n                    function (member) {\r\n                        return member.age;\r\n                    }\r\n                )\r\n            );\r\n\r\n        if (\r\n            capturedAges.some(\r\n                function (age) {\r\n                    return age > oldest.age;\r\n                }\r\n            )\r\n        ) {\r\n\r\n            throw new Error(\r\n                'A captured member is older than the person used ' +\r\n                'for the quote. Correct the oldest person\u2019s ID ' +\r\n                'and select the appropriate premium.'\r\n            );\r\n        }\r\n\r\n        if (!signed) {\r\n\r\n            throw new Error(\r\n                'Please ask the applicant to sign before submitting.'\r\n            );\r\n        }\r\n\r\n        document.getElementById(\r\n            'tfa_signature_data'\r\n        ).value =\r\n            canvas.toDataURL(\r\n                'image\/png'\r\n            );\r\n\r\n        return {\r\n            oldest:oldest,\r\n            main:main,\r\n            members:members\r\n        };\r\n    }\r\n\r\n    function displayError(message) {\r\n\r\n        errorBox.textContent =\r\n            message ||\r\n            'The application could not be processed.';\r\n\r\n        errorBox.style.display =\r\n            'block';\r\n\r\n        errorBox.scrollIntoView({\r\n            behavior:'smooth',\r\n            block:'center'\r\n        });\r\n    }\r\n\r\n    async function submitToMake() {\r\n\r\n        submitButton.disabled =\r\n            true;\r\n\r\n        submitButton.textContent =\r\n            'Submitting\u2026';\r\n\r\n        try {\r\n\r\n            var payload =\r\n                new FormData(form);\r\n\r\n            await fetch(\r\n                applicationWebhook,\r\n                {\r\n                    method:'POST',\r\n                    body:payload,\r\n                    mode:'no-cors'\r\n                }\r\n            );\r\n\r\n            if (\r\n                payment.value ===\r\n                'immediate_card_payment'\r\n            ) {\r\n\r\n                window.location.href =\r\n                    '\/payment-success\/?ref=' +\r\n                    encodeURIComponent(\r\n                        document.getElementById(\r\n                            'tfa_paystack_reference'\r\n                        ).value\r\n                    );\r\n\r\n                return;\r\n            }\r\n\r\n            document.getElementById(\r\n                'tfa_success_reference'\r\n            ).textContent =\r\n                document.getElementById(\r\n                    'tfa_reference'\r\n                ).value;\r\n\r\n            document.getElementById(\r\n                'tfa_success_agent'\r\n            ).textContent =\r\n                agentReference.value;\r\n\r\n            document.getElementById(\r\n                'tfa_success_applicant'\r\n            ).textContent =\r\n                document.getElementById(\r\n                    'tfa_full_name'\r\n                ).value.trim();\r\n\r\n            if (\r\n                payment.value ===\r\n                'easypay'\r\n            ) {\r\n\r\n                document.getElementById(\r\n                    'tfa_success_message'\r\n                ).textContent =\r\n                    'The application has been submitted successfully. ' +\r\n                    'The EasyPay number will be provided on the ' +\r\n                    'policy schedule once the application has ' +\r\n                    'been processed.';\r\n\r\n            } else if (\r\n                payment.value ===\r\n                'branch_payment'\r\n            ) {\r\n\r\n                document.getElementById(\r\n                    'tfa_success_message'\r\n                ).textContent =\r\n                    'The application has been submitted successfully. ' +\r\n                    'The customer may make payment at a participating ' +\r\n                    'Tshepo Hope Funerals branch.';\r\n\r\n            } else {\r\n\r\n                document.getElementById(\r\n                    'tfa_success_message'\r\n                ).textContent =\r\n                    'The application has been submitted successfully.';\r\n            }\r\n\r\n            form.style.display =\r\n                'none';\r\n\r\n            successPanel.style.display =\r\n                'block';\r\n\r\n            successPanel.scrollIntoView({\r\n                behavior:'smooth',\r\n                block:'start'\r\n            });\r\n\r\n        } catch (error) {\r\n\r\n            submitButton.disabled =\r\n                false;\r\n\r\n            submitButton.textContent =\r\n                'Submit Application';\r\n\r\n            throw new Error(\r\n                'The application could not be submitted. ' +\r\n                'Please check the connection and try again.'\r\n            );\r\n        }\r\n    }\r\n\r\n    function openPaystack() {\r\n\r\n        if (paymentOpening) {\r\n            return;\r\n        }\r\n\r\n        var amount =\r\n            Number(\r\n                premium.value || 0\r\n            );\r\n\r\n        var email =\r\n            document.getElementById(\r\n                'tfa_email'\r\n            ).value.trim();\r\n\r\n        var phone =\r\n            document.getElementById(\r\n                'tfa_cell'\r\n            ).value.trim();\r\n\r\n        var reference =\r\n            document.getElementById(\r\n                'tfa_reference'\r\n            ).value;\r\n\r\n        if (!window.PaystackPop) {\r\n\r\n            throw new Error(\r\n                'Online payment is not available. ' +\r\n                'Refresh the page and try again.'\r\n            );\r\n        }\r\n\r\n        if (!email) {\r\n\r\n            throw new Error(\r\n                'An email address is required for Online Payment.'\r\n            );\r\n        }\r\n\r\n        if (\r\n            !\/^\\S+@\\S+\\.\\S+$\/.test(\r\n                email\r\n            )\r\n        ) {\r\n\r\n            throw new Error(\r\n                'Enter a valid email address for the payment receipt.'\r\n            );\r\n        }\r\n\r\n        if (\r\n            !amount ||\r\n            amount <= 0\r\n        ) {\r\n\r\n            throw new Error(\r\n                'Select a valid premium before payment.'\r\n            );\r\n        }\r\n\r\n        paymentOpening =\r\n            true;\r\n\r\n        var handler =\r\n            PaystackPop.setup({\r\n\r\n                key:\r\n                    paystackPublicKey,\r\n\r\n                email:\r\n                    email,\r\n\r\n                amount:\r\n                    Math.round(\r\n                        amount * 100\r\n                    ),\r\n\r\n                currency:\r\n                    'ZAR',\r\n\r\n                ref:\r\n                    reference,\r\n\r\n                metadata:{\r\n\r\n                    phone:\r\n                        phone,\r\n\r\n                    product:\r\n                        document.getElementById(\r\n                            'tfa_product_name'\r\n                        ).value,\r\n\r\n                    cover_type:\r\n                        document.getElementById(\r\n                            'tfa_cover_type'\r\n                        ).value,\r\n\r\n                    product_option:\r\n                        document.getElementById(\r\n                            'tfa_product_option'\r\n                        ).value,\r\n\r\n                    tshepo_hope_application_reference:\r\n                        reference,\r\n\r\n                    source:\r\n                        'tshepohope_elementor'\r\n                },\r\n\r\n                callback:\r\n                    function (response) {\r\n\r\n                        paymentOpening =\r\n                            false;\r\n\r\n                        cardPaymentApproved =\r\n                            true;\r\n\r\n                        document.getElementById(\r\n                            'tfa_payment_status'\r\n                        ).value =\r\n                            'payment_callback_received';\r\n\r\n                        document.getElementById(\r\n                            'tfa_payment_reference_status'\r\n                        ).value =\r\n                            'paystack_reference_received';\r\n\r\n                        document.getElementById(\r\n                            'tfa_paystack_reference'\r\n                        ).value =\r\n                            response.reference;\r\n\r\n                        submitToMake()\r\n                            .catch(\r\n                                function (error) {\r\n                                    displayError(\r\n                                        error.message\r\n                                    );\r\n                                }\r\n                            );\r\n                    },\r\n\r\n                onClose:\r\n                    function () {\r\n\r\n                        paymentOpening =\r\n                            false;\r\n\r\n                        document.getElementById(\r\n                            'tfa_payment_status'\r\n                        ).value =\r\n                            'payment_cancelled';\r\n\r\n                        document.getElementById(\r\n                            'tfa_payment_reference_status'\r\n                        ).value =\r\n                            'pending_paystack';\r\n\r\n                        displayError(\r\n                            'The online payment was not completed. ' +\r\n                            'The customer may try again or choose ' +\r\n                            'EasyPay or Tshepo Hope Branch Payment.'\r\n                        );\r\n                    }\r\n            });\r\n\r\n        handler.openIframe();\r\n    }\r\n\r\n    authButton.addEventListener(\r\n        'click',\r\n        async function () {\r\n\r\n            var digits =\r\n                agentCell.value\r\n                    .replace(\/\\D\/g,'');\r\n\r\n            if (\r\n                digits.length === 11 &&\r\n                digits.indexOf('27') === 0\r\n            ) {\r\n\r\n                digits =\r\n                    '0' +\r\n                    digits.slice(2);\r\n            }\r\n\r\n            authenticated =\r\n                false;\r\n\r\n            agentReference.value =\r\n                '';\r\n\r\n            applicationBody.classList.add(\r\n                'is-locked'\r\n            );\r\n\r\n            if (\r\n                !\/^0[6-8][0-9]{8}$\/.test(\r\n                    digits\r\n                )\r\n            ) {\r\n\r\n                authStatus.className =\r\n                    'tfa-full tfa-agent-status is-error';\r\n\r\n                authStatus.textContent =\r\n                    'Enter a valid South African cellphone number.';\r\n\r\n                return;\r\n            }\r\n\r\n            authButton.disabled =\r\n                true;\r\n\r\n            authButton.textContent =\r\n                'Checking RepEasy\u2026';\r\n\r\n            authStatus.className =\r\n                'tfa-full tfa-agent-status';\r\n\r\n            authStatus.textContent =\r\n                'Checking representative details\u2026';\r\n\r\n            try {\r\n\r\n                var response =\r\n                    await fetch(\r\n                        agentWebhook,\r\n                        {\r\n                            method:'POST',\r\n\r\n                            headers:{\r\n                                'Content-Type':\r\n                                    'application\/json'\r\n                            },\r\n\r\n                            body:\r\n                                JSON.stringify({\r\n                                    cell_number:\r\n                                        digits,\r\n                                    source:\r\n                                        'Tshepo Hope'\r\n                                })\r\n                        }\r\n                    );\r\n\r\n                var data =\r\n                    await response.json();\r\n\r\n                if (\r\n                    !response.ok ||\r\n                    data.success !== true ||\r\n                    !data.rep_reference\r\n                ) {\r\n\r\n                    throw new Error(\r\n                        'not_accepted'\r\n                    );\r\n                }\r\n\r\n                var reference =\r\n                    Array.isArray(\r\n                        data.rep_reference\r\n                    )\r\n                        ? data.rep_reference[0]\r\n                        : data.rep_reference;\r\n\r\n                authenticated =\r\n                    true;\r\n\r\n                agentCell.value =\r\n                    digits.replace(\r\n                        \/(\\d{3})(\\d{3})(\\d{4})\/,\r\n                        '$1 $2 $3'\r\n                    );\r\n\r\n                agentReference.value =\r\n                    reference;\r\n\r\n                authStatus.className =\r\n                    'tfa-full tfa-agent-status is-ready';\r\n\r\n                authStatus.textContent =\r\n                    'Agent authenticated successfully: ' +\r\n                    reference;\r\n\r\n                applicationBody.classList.remove(\r\n                    'is-locked'\r\n                );\r\n\r\n                window.setTimeout(\r\n                    resizeSignatureCanvas,\r\n                    50\r\n                );\r\n\r\n            } catch (error) {\r\n\r\n                authStatus.className =\r\n                    'tfa-full tfa-agent-status is-error';\r\n\r\n                authStatus.textContent =\r\n                    error.message ===\r\n                    'not_accepted'\r\n                        ? 'Agent not accepted.'\r\n                        : 'RepEasy could not be reached. Please try again.';\r\n\r\n            } finally {\r\n\r\n                authButton.disabled =\r\n                    false;\r\n\r\n                authButton.textContent =\r\n                    'Authenticate With RepEasy';\r\n            }\r\n        }\r\n    );\r\n\r\n    agentCell.addEventListener(\r\n        'input',\r\n        function () {\r\n\r\n            if (!authenticated) {\r\n                return;\r\n            }\r\n\r\n            authenticated =\r\n                false;\r\n\r\n            agentReference.value =\r\n                '';\r\n\r\n            authStatus.className =\r\n                'tfa-full tfa-agent-status';\r\n\r\n            authStatus.textContent =\r\n                'Cellphone number changed. Authenticate again.';\r\n\r\n            applicationBody.classList.add(\r\n                'is-locked'\r\n            );\r\n        }\r\n    );\r\n\r\n    oldestId.addEventListener(\r\n        'input',\r\n        renderRates\r\n    );\r\n\r\n    rateGroups.addEventListener(\r\n        'click',\r\n        function (event) {\r\n\r\n            var button =\r\n                event.target.closest(\r\n                    '[data-rate]'\r\n                );\r\n\r\n            if (button) {\r\n\r\n                selectRate(\r\n                    Number(\r\n                        button.dataset.rate\r\n                    )\r\n                );\r\n            }\r\n        }\r\n    );\r\n\r\n    addMemberButton.addEventListener(\r\n        'click',\r\n        addMember\r\n    );\r\n\r\n    payment.addEventListener(\r\n        'change',\r\n        showPaymentFields\r\n    );\r\n\r\n    function resizeSignatureCanvas() {\r\n\r\n        var ratio =\r\n            Math.max(\r\n                window.devicePixelRatio || 1,\r\n                1\r\n            );\r\n\r\n        var rectangle =\r\n            canvas.getBoundingClientRect();\r\n\r\n        var savedSignature =\r\n            signed\r\n                ? canvas.toDataURL(\r\n                    'image\/png'\r\n                )\r\n                : null;\r\n\r\n        canvas.width =\r\n            Math.max(\r\n                1,\r\n                Math.floor(\r\n                    rectangle.width *\r\n                    ratio\r\n                )\r\n            );\r\n\r\n        canvas.height =\r\n            Math.floor(\r\n                190 * ratio\r\n            );\r\n\r\n        context.setTransform(\r\n            ratio,\r\n            0,\r\n            0,\r\n            ratio,\r\n            0,\r\n            0\r\n        );\r\n\r\n        context.lineWidth =\r\n            2.2;\r\n\r\n        context.lineCap =\r\n            'round';\r\n\r\n        context.lineJoin =\r\n            'round';\r\n\r\n        context.strokeStyle =\r\n            '#171412';\r\n\r\n        if (savedSignature) {\r\n\r\n            var image =\r\n                new Image();\r\n\r\n            image.onload =\r\n                function () {\r\n\r\n                    context.drawImage(\r\n                        image,\r\n                        0,\r\n                        0,\r\n                        rectangle.width,\r\n                        190\r\n                    );\r\n                };\r\n\r\n            image.src =\r\n                savedSignature;\r\n        }\r\n    }\r\n\r\n    function signaturePoint(event) {\r\n\r\n        var rectangle =\r\n            canvas.getBoundingClientRect();\r\n\r\n        var source =\r\n            event.touches\r\n                ? event.touches[0]\r\n                : event;\r\n\r\n        return {\r\n\r\n            x:\r\n                source.clientX -\r\n                rectangle.left,\r\n\r\n            y:\r\n                source.clientY -\r\n                rectangle.top\r\n        };\r\n    }\r\n\r\n    function startSignature(event) {\r\n\r\n        event.preventDefault();\r\n\r\n        drawing =\r\n            true;\r\n\r\n        signed =\r\n            true;\r\n\r\n        var point =\r\n            signaturePoint(event);\r\n\r\n        context.beginPath();\r\n\r\n        context.moveTo(\r\n            point.x,\r\n            point.y\r\n        );\r\n    }\r\n\r\n    function drawSignature(event) {\r\n\r\n        if (!drawing) {\r\n            return;\r\n        }\r\n\r\n        event.preventDefault();\r\n\r\n        var point =\r\n            signaturePoint(event);\r\n\r\n        context.lineTo(\r\n            point.x,\r\n            point.y\r\n        );\r\n\r\n        context.stroke();\r\n    }\r\n\r\n    function endSignature() {\r\n        drawing = false;\r\n    }\r\n\r\n    [\r\n        'mousedown',\r\n        'touchstart'\r\n    ].forEach(\r\n        function (eventName) {\r\n\r\n            canvas.addEventListener(\r\n                eventName,\r\n                startSignature,\r\n                {passive:false}\r\n            );\r\n        }\r\n    );\r\n\r\n    [\r\n        'mousemove',\r\n        'touchmove'\r\n    ].forEach(\r\n        function (eventName) {\r\n\r\n            canvas.addEventListener(\r\n                eventName,\r\n                drawSignature,\r\n                {passive:false}\r\n            );\r\n        }\r\n    );\r\n\r\n    [\r\n        'mouseup',\r\n        'mouseleave',\r\n        'touchend',\r\n        'touchcancel'\r\n    ].forEach(\r\n        function (eventName) {\r\n\r\n            canvas.addEventListener(\r\n                eventName,\r\n                endSignature\r\n            );\r\n        }\r\n    );\r\n\r\n    document.getElementById(\r\n        'tfa_clear_signature'\r\n    ).addEventListener(\r\n        'click',\r\n        function () {\r\n\r\n            context.clearRect(\r\n                0,\r\n                0,\r\n                canvas.width,\r\n                canvas.height\r\n            );\r\n\r\n            signed =\r\n                false;\r\n\r\n            document.getElementById(\r\n                'tfa_signature_data'\r\n            ).value =\r\n                '';\r\n        }\r\n    );\r\n\r\n    form.addEventListener(\r\n        'submit',\r\n        async function (event) {\r\n\r\n            event.preventDefault();\r\n\r\n            errorBox.style.display =\r\n                'none';\r\n\r\n            try {\r\n\r\n                validateApplication();\r\n\r\n                if (\r\n                    payment.value ===\r\n                    'immediate_card_payment' &&\r\n                    !cardPaymentApproved\r\n                ) {\r\n\r\n                    openPaystack();\r\n                    return;\r\n                }\r\n\r\n                await submitToMake();\r\n\r\n            } catch (error) {\r\n\r\n                submitButton.disabled =\r\n                    false;\r\n\r\n                submitButton.textContent =\r\n                    'Submit Application';\r\n\r\n                displayError(\r\n                    error.message\r\n                );\r\n            }\r\n        }\r\n    );\r\n\r\n    setApplicationIdentity();\r\n\r\n    updateMemberControls();\r\n\r\n    showPaymentFields();\r\n\r\n    resizeSignatureCanvas();\r\n\r\n    window.addEventListener(\r\n        'resize',\r\n        resizeSignatureCanvas\r\n    );\r\n\r\n}());\r\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Tshepo Hope Funerals Funeral Services Application Complete this application with the assistance of an authorised Tshepo Hope sales agent. 1&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-1324","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/tshepohopefs.co.za\/index.php?rest_route=\/wp\/v2\/pages\/1324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tshepohopefs.co.za\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tshepohopefs.co.za\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tshepohopefs.co.za\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tshepohopefs.co.za\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1324"}],"version-history":[{"count":47,"href":"https:\/\/tshepohopefs.co.za\/index.php?rest_route=\/wp\/v2\/pages\/1324\/revisions"}],"predecessor-version":[{"id":1379,"href":"https:\/\/tshepohopefs.co.za\/index.php?rest_route=\/wp\/v2\/pages\/1324\/revisions\/1379"}],"wp:attachment":[{"href":"https:\/\/tshepohopefs.co.za\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}