{"id":12577,"date":"2025-11-21T13:14:01","date_gmt":"2025-11-21T12:14:01","guid":{"rendered":"https:\/\/afrikapass.com\/?page_id=12577"},"modified":"2025-11-21T15:25:45","modified_gmt":"2025-11-21T14:25:45","slug":"visa-applications","status":"publish","type":"page","link":"https:\/\/afrikapass.com\/en\/visa-applications\/","title":{"rendered":"Visa Applications"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"12577\" class=\"elementor elementor-12577\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-08210d9 e-con-full e-flex e-con e-parent\" data-id=\"08210d9\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t<div class=\"elementor-element elementor-element-e951119 e-con-full e-flex e-con e-child\" data-id=\"e951119\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-bd35cfd elementor-widget elementor-widget-shortcode\" data-id=\"bd35cfd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-0acf37d e-con-full e-flex e-con e-child\" data-id=\"0acf37d\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-bcc131a elementor-widget elementor-widget-html\" data-id=\"bcc131a\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;sticky&quot;:&quot;top&quot;,&quot;sticky_offset&quot;:30,&quot;sticky_on&quot;:[&quot;desktop&quot;,&quot;laptop&quot;,&quot;tablet&quot;],&quot;sticky_parent&quot;:&quot;yes&quot;,&quot;sticky_effects_offset&quot;:0,&quot;sticky_anchor_link_offset&quot;:0}\" data-widget_type=\"html.default\">\n\t\t\t\t\t<div id=\"price-summary\" style=\"background:#002b5c;color:#fff;padding:25px;border-radius:8px;font-size:16px;\">\n  <p style=\"display: flex; justify-content: space-between;\">Visa Type: <span id=\"price-visa-type\">0 \u20ac<\/span><\/p>\n  <p style=\"display: flex; justify-content: space-between;\">Passport Type: <span id=\"price-pp-type\">0 \u20ac<\/span><\/p>\n  <p style=\"display: flex; justify-content: space-between;\">Length of Stay: <span id=\"price-length-of-stay\">0 \u20ac<\/span><\/p>\n  <p style=\"display: flex; justify-content: space-between;\">Processing Method: <span id=\"price-processing-method\">0 \u20ac<\/span><\/p>\n\n  <div id=\"extra-services-list\" style=\"margin:15px 0;\"><\/div>\n  \n  <hr>\n\n  <p style=\"margin-top: 15px; display: flex; justify-content: space-between;\">Sub Total (incl. 0% VAT): <span id=\"price-subtotal\">0 \u20ac<\/span><\/p>\n  <p style=\"margin-top: 15px; display: flex; justify-content: space-between;\">Total Amount (incl. 0% VAT): <span id=\"price-total\">0 \u20ac<\/span><\/p>\n<\/div>\n\n\n\n<script>\njQuery(document).ready(function($){\n\n    const priceFields = [\n        { fieldId: \"input_6_78\", target: \"price-visa-type\" },\n        { fieldId: \"input_6_96\", target: \"price-pp-type\" },\n        { fieldId: \"input_6_63\", target: \"price-processing-method\" },\n        { fieldId: \"input6_97\", target: \"price-length-of-stay\" },\n    ];\n\n    const checkboxFieldId = \"field_6_88\";\n\n    \/\/ ------------------------------\n    \/\/ SAVE SELECTIONS TO LOCALSTORAGE\n    \/\/ ------------------------------\n    function saveSelections() {\n        let selections = {\n            selects: {},\n            checkboxes: []\n        };\n\n        \/\/ Save select fields\n        priceFields.forEach(item => {\n            selections.selects[item.fieldId] = $(\"#\" + item.fieldId).val();\n        });\n\n        \/\/ Save checkbox values\n        $(\"#\" + checkboxFieldId + \" input[type='checkbox']:checked\").each(function(){\n            selections.checkboxes.push($(this).val());\n        });\n\n        localStorage.setItem(\"visaSelections\", JSON.stringify(selections));\n    }\n\n    \/\/ ------------------------------\n    \/\/ RESTORE SELECTIONS FROM STORAGE\n    \/\/ ------------------------------\n    function restoreSelections() {\n        let saved = localStorage.getItem(\"visaSelections\");\n        if (!saved) return;\n\n        saved = JSON.parse(saved);\n\n        \/\/ Restore select dropdowns\n        Object.keys(saved.selects).forEach(fieldId => {\n            $(\"#\" + fieldId).val(saved.selects[fieldId]).trigger(\"change\");\n        });\n\n        \/\/ Restore checkbox states\n        $(\"#\" + checkboxFieldId + \" input[type='checkbox']\").each(function(){\n            if (saved.checkboxes.includes($(this).val())) {\n                $(this).prop(\"checked\", true);\n            }\n        });\n    }\n\n    \/\/ ------------------------------\n    \/\/ EXTRACT PRICE\n    \/\/ ------------------------------\n    function extractPrice(labelEl) {\n        let p = $(labelEl).attr(\"price\");\n        return p ? parseFloat(p) : 0;\n    }\n\n    \/\/ ------------------------------\n    \/\/ UPDATE SUMMARY PRICES\n    \/\/ ------------------------------\n    function updatePrices() {\n        let total = 0;\n\n        \/\/ Select fields\n        priceFields.forEach(item => {\n            let val = $(\"#\" + item.fieldId).val();\n            let price = 0;\n\n            if (val && val.includes(\"|\")) {\n                price = parseFloat(val.split(\"|\")[1]);\n            }\n\n            $(\"#\" + item.target).text(price + \" \u20ac\");\n            total += price;\n        });\n\n        \/\/ Checkbox fields\n        let html = \"\";\n        $(\"#\" + checkboxFieldId + \" input[type='checkbox']:checked\").each(function(){\n            let label = $(this).closest(\".gchoice\").find(\"label\");\n\n            \/\/ Clean service name\n            let serviceName = label.clone()\n                .children()\n                .remove()\n                .end()\n                .text()\n                .replace(\/\\+\\d+.*$\/, \"\")\n                .trim();\n\n            let price = extractPrice(label);\n\n            html += `\n                <p style=\"display:flex;justify-content:space-between;\">\n                    ${serviceName}\n                    <span>${price} \u20ac<\/span>\n                <\/p>\n            `;\n\n            total += price;\n        });\n\n        $(\"#extra-services-list\").html(html);\n        $(\"#price-subtotal\").text(total + \" \u20ac\");\n        $(\"#price-total\").text(total + \" \u20ac\");\n\n        \/\/ Save after every update\n        saveSelections();\n    }\n\n    \/\/ ------------------------------\n    \/\/ EVENT LISTENERS\n    \/\/ ------------------------------\n    $(\"body\").on(\"change\", \"select, input[type='checkbox']\", updatePrices);\n\n    \/\/ Restore saved values before updating prices\n    restoreSelections();\n\n    \/\/ First load\n    \/\/ Run update after a short delay to ensure DOM has updated\nsetTimeout(function() {\n    updatePrices();\n}, 100);\n\n    \/\/ ------------------------------\n    \/\/ CLEAR LOCAL STORAGE ON SUCCESS\n    \/\/ ------------------------------\n    $(document).on(\"gform_confirmation_loaded\", function(event, formId){\n        if (formId == 4) {  \/\/ Change to your Gravity Form ID\n            localStorage.removeItem(\"visaSelections\");\n        }\n    });\n});\n<\/script>\n\n\t\t\t\t<\/div>\n\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>Visa Type: 0 \u20ac Passport Type: 0 \u20ac Length of Stay: 0 \u20ac Processing Method: 0 \u20ac Sub Total (incl. 0% VAT): 0 \u20ac Total Amount (incl. 0% VAT): 0 \u20ac<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"class_list":["post-12577","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/afrikapass.com\/en\/wp-json\/wp\/v2\/pages\/12577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afrikapass.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/afrikapass.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/afrikapass.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afrikapass.com\/en\/wp-json\/wp\/v2\/comments?post=12577"}],"version-history":[{"count":10,"href":"https:\/\/afrikapass.com\/en\/wp-json\/wp\/v2\/pages\/12577\/revisions"}],"predecessor-version":[{"id":12683,"href":"https:\/\/afrikapass.com\/en\/wp-json\/wp\/v2\/pages\/12577\/revisions\/12683"}],"wp:attachment":[{"href":"https:\/\/afrikapass.com\/en\/wp-json\/wp\/v2\/media?parent=12577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}