{"id":699,"date":"2024-03-05T12:56:41","date_gmt":"2024-03-05T12:56:41","guid":{"rendered":"http:\/\/www.acaciamanagementconsultancy.com\/?page_id=699"},"modified":"2024-03-06T09:56:29","modified_gmt":"2024-03-06T09:56:29","slug":"unit304","status":"publish","type":"page","link":"https:\/\/www.acaciamanagementconsultancy.com\/?page_id=699","title":{"rendered":"Unit304"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"699\" class=\"elementor elementor-699\" data-elementor-post-type=\"page\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8f17ecf elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8f17ecf\" data-element_type=\"section\" data-e-type=\"section\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-fbd0962\" data-id=\"fbd0962\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-57a13ef elementor-widget elementor-widget-text-editor\" data-id=\"57a13ef\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t        <div class=\"wp-sjs-plugin\" id=\"surveyContainer-1\">\r\n            <div id=\"surveyElement-1\">Survey is loading&#8230;<\/div>\r\n            <div id=\"surveyResult-1\"><\/div>\r\n        <\/div>\r\n        <script>\r\n            jQuery.ajax({\r\n                url:  \"https:\/\/www.acaciamanagementconsultancy.com\/wp-admin\/admin-ajax.php?action=SurveyJS_GetSurveyJson\",\r\n                type: \"POST\",\r\n                data: { Id: 1, _wpnonce: '995ad17fc3' },\r\n                success: function (data) {\r\n                    var json = {}\r\n                    let theme;\r\n                    if (data.json) {\r\n                        json = JSON.parse(data.json.replace(\/\\\\\\\"\/g, \"\\\"\").replace(\/\\\\\\\\\/g, \"\\\\\").replace(\/\\\\'\/g, \"'\"));\r\n                    }\r\n                    if (data.theme) {\r\n                        theme = JSON.parse(data.theme.replace(\/\\\\\\\"\/g, \"\\\"\").replace(\/\\\\\\\\\/g, \"\\\\\").replace(\/\\\\'\/g, \"'\"));\r\n                    } else {\r\n                        theme = null\r\n                    }\r\n                    jQuery(document).ready(()=>{\r\n                        initSurvey1(json, theme);\r\n                    });\r\n                }\r\n            });\r\n\r\n            function initSurvey1(json, theme) {\r\n                const survey1 = new Survey.Model(json);\r\n                if (!!theme) {\r\n                    survey1.applyTheme(theme);\r\n                }\r\n                window.survey1 = survey1;               \r\n                survey1                    .onComplete\r\n                    .add(function (sender, options) {\r\n                        options.showSaveInProgress();\r\n                        jQuery.ajax({\r\n                            url:  \"https:\/\/www.acaciamanagementconsultancy.com\/wp-admin\/admin-ajax.php?action=SurveyJS_SaveResult\",\r\n                            type: \"POST\",\r\n                    data: { SurveyId: '1', Json : JSON.stringify(sender.data), _wpnonce: 'd0f890f9f9' },\r\n                            success: function (data) {options.showSaveSuccess();},\r\n                            error: function (xhr) {options.showSaveError(xhr.responseText);}\r\n                        });\r\n                        \/\/document\r\n                        \/\/    .querySelector(\"#surveyResult-1\")\r\n                        \/\/    .innerHTML = \"result: \" + JSON.stringify(sender.data);\r\n                    });\r\n\r\n                survey1.onUploadFiles.add((_, options) => {\r\n                    const formData = new FormData();\r\n                    options.files.forEach((file) => {\r\n                        formData.append(file.name, file);\r\n                    });\r\n                formData.append(\"_wpnonce\", \"75047e392a\");\r\n\r\n                    fetch(\"https:\/\/www.acaciamanagementconsultancy.com\/wp-admin\/admin-ajax.php?action=SurveyJS_UploadFiles\", {\r\n                        method: \"POST\",\r\n                        body: formData\r\n                    })\r\n                        .then((response) => response.json())\r\n                        .then((data) => {\r\n                            options.callback(\r\n                                options.files.map((file) => {\r\n                                    return {\r\n                                        file: file,\r\n                                        content: data[file.name]\r\n                                    };\r\n                                })\r\n                            );\r\n                        })\r\n                        .catch((error) => {\r\n                            console.error(\"Error: \", error);\r\n                            options.callback([], [ 'An error occurred during file upload.' ]);\r\n                        });\r\n                });\r\n\r\n                function deleteFile(fileURL, options) {\r\n                    try {\r\n                        const deleteFileBaseUrl = \"https:\/\/www.acaciamanagementconsultancy.com\/wp-admin\/admin-ajax.php?action=SurveyJS_DeleteFile&#038;_wpnonce=6f583a4915\";\r\n                        const apiUrl = `${deleteFileBaseUrl}&name=${encodeURIComponent(fileURL)}`;\r\n                        fetch(apiUrl);\r\n                    } catch (error) {\r\n                        options.callback(\"error\");\r\n                    }\r\n                }\r\n\r\n                survey1.onClearFiles.add((_, options) => {\r\n                    if (!options.value || options.value.length === 0) {\r\n                        options.callback(\"success\");\r\n                        return;\r\n                    }\r\n\r\n                    if (!options.fileName && !!options.value) {\r\n                        for (const item of options.value) {\r\n                            deleteFile(item.content, options);\r\n                        }\r\n                    } else {\r\n                        const fileToRemove = options.value.find(\r\n                            (item) => item.name === options.fileName\r\n                        );\r\n                        if (fileToRemove) {\r\n                            deleteFile(fileToRemove.content, options);\r\n                        } else {\r\n                            console.error(`File with name ${options.fileName} is not found`);\r\n                        }\r\n                    }\r\n                    options.callback(\"success\");\r\n                });\r\n\r\n                jQuery(\"#surveyElement-1\").Survey({model: survey1\/*, css: customCss*\/});\r\n            }\r\n        <\/script>        \r\n        \t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":{"footnotes":""},"class_list":["post-699","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.acaciamanagementconsultancy.com\/index.php?rest_route=\/wp\/v2\/pages\/699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.acaciamanagementconsultancy.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.acaciamanagementconsultancy.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.acaciamanagementconsultancy.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.acaciamanagementconsultancy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=699"}],"version-history":[{"count":22,"href":"https:\/\/www.acaciamanagementconsultancy.com\/index.php?rest_route=\/wp\/v2\/pages\/699\/revisions"}],"predecessor-version":[{"id":728,"href":"https:\/\/www.acaciamanagementconsultancy.com\/index.php?rest_route=\/wp\/v2\/pages\/699\/revisions\/728"}],"wp:attachment":[{"href":"https:\/\/www.acaciamanagementconsultancy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}