{"id":2695,"date":"2024-04-08T03:05:02","date_gmt":"2024-04-07T19:05:02","guid":{"rendered":"https:\/\/www.sdcharging.com.hk\/?page_id=2695"},"modified":"2024-04-15T07:54:42","modified_gmt":"2024-04-14T23:54:42","slug":"opt-in-out","status":"publish","type":"page","link":"https:\/\/www.kinetacharge.com\/hk\/zh-hant\/opt-in-out\/","title":{"rendered":"Unsubscribe to our Newsletter and Exclusive Privileges (ZH)"},"content":{"rendered":"\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column opt-form is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/www.sdcharging.com.hk\/wp-content\/uploads\/2023\/06\/Asset-1@4x.png\" alt=\"\" style=\"width:80px\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u53d6\u6d88\u8a02\u95b1\u6700\u65b0\u7368\u5bb6\u8cc7\u8a0a\u53ca\u512a\u60e0<\/h2>\n\n\n\n<p class=\"success-message has-vivid-cyan-blue-color has-text-color\"><strong>\u66f4\u65b0\u6210\u529f!<\/strong><\/p>\n\n\n\n<p class=\"fail-message has-vivid-red-color has-text-color\"><strong>\u8acb\u4f7f\u7528SD Charging\u624b\u6a5f\u61c9\u7528\u7a0b\u5f0f\u8a2a\u554f\u6b64\u7db2\u9801<\/strong><\/p>\n\n\n\n<form id=\"opt-in-out-form\" class=\"opt-in-out-form\">\n  <div style=\"flex: 1; display: flex; align-items: start;\">\n    <input type=\"checkbox\" id=\"parent\" \/>\n    <label for=\"parent\" style=\"padding-left: 4px;\">\u6211\u4e0d\u5e0c\u671b\u5bf6\u99ac\u6c7d\u8eca(\u5357\u4e2d\u570b)\u6709\u9650\u516c\u53f8\u3001\u5bf6\u99ac\u9999\u6e2f\u3001\u5bf6\u99ac\u7e3d\u516c\u53f8\u548c\u68ee\u90a3\u7f8e\u96c6\u5718\u4f7f\u7528\u6211\u7684\u500b\u4eba\u8cc7\u6599\u4f86\u63d0\u4f9b\u6700\u65b0\u6d3b\u52d5\u3001\u66f4\u65b0\u3001\u512a\u60e0\u548c\u4fc3\u92b7\u3002<\/label>\n  <\/div>\n  <div class=\"children\">\n    <div>\n      <input type=\"checkbox\" class=\"child\" id=\"opt_in_email\" \/>\n      <label for=\"opt_in_email\">\u900f\u904e\u96fb\u90f5<\/label>\n    <\/div>\n    <div>\n      <input type=\"checkbox\" class=\"child\" id=\"opt_in_sms\" \/>\n      <label for=\"opt_in_sms\">\u900f\u904e\u77ed\u4fe1<\/label>\n    <\/div>\n    <div>\n      <input type=\"checkbox\" class=\"child\" id=\"opt_in_phone\" \/>\n      <label for=\"opt_in_phone\">\u900f\u904e\u96fb\u8a71<\/label>\n    <\/div>\n    <div>\n      <input type=\"checkbox\" class=\"child\" id=\"opt_in_letter\" \/>\n      <label for=\"opt_in_letter\">\u900f\u904e\u4fe1\u4ef6<\/label>\n    <\/div>\n  <\/div>\n  <p class=\"disclaimer\" style=\"margin-top: 18px !important;\">\u900f\u904e\u63d0\u4ea4\u6b64\u8868\u683c\uff0c\u6211\u540c\u610f\u6839\u64da<a href=\"https:\/\/www.sdcharging.com.hk\/zh-hant\/privacy-policy\/\" data-type=\"link\" data-id=\"https:\/\/www.sdcharging.com.hk\/zh-hant\/privacy-policy\/\">\u96b1\u79c1\u653f\u7b56<\/a>\uff0c\u63a5\u6536\u4f86\u81ea\u5bf6\u99ac\u6c7d\u8eca(\u5357\u4e2d\u570b)\u6709\u9650\u516c\u53f8\u3001\u5bf6\u99ac\u9999\u6e2f\u3001\u5bf6\u99ac\u7e3d\u516c\u53f8\u548c\u68ee\u90a3\u7f8e\u96c6\u5718\u7684\u7368\u5bb6\u512a\u60e0\u548c\u6d3b\u52d5\u9080\u8acb\u3001\u6700\u65b0\u6d88\u606f\u4ee5\u53ca\u5176\u4ed6\u76f8\u95dc\u8a0a\u606f\u3002<br>\u6211\u660e\u767d\u9019\u500b\u9078\u64c7\u5c07\u8986\u84cb\u4e4b\u524d\u7684\u8a2d\u5b9a\u3001\u4e26\u4e14\u6211\u53ef\u4ee5\u96a8\u6642\u53d6\u6d88\u8a02\u95b1\u3002<\/p>\n  <input class=\"submit\" type=\"submit\" value=\"\u63d0\u4ea4\" \/>\n<\/form>\n\n<script>\n  document.querySelector('.fail-message').style.display = 'none';\n  document.querySelector('.success-message').style.display = 'none';\n  document.querySelector('.opt-in-out-form').style.display = 'block';\n\n  \/\/ Parse the query parameters\n  const urlParams = new URLSearchParams(window.location.search);\n  const uid = urlParams.get('uid');\n  if (!uid) {\n    document.querySelector('.fail-message').style.display = 'block';\n    document.querySelector('.success-message').style.display = 'none';\n    document.querySelector('.opt-in-out-form').style.display = 'none';\n  }\n  const parentCheckbox = document.querySelector('#parent');\n  const childCheckboxes = document.querySelectorAll('.child');\n\n  \/\/ Function to update the state of the parent checkbox\n  function updateParentCheckbox() {\n    const allChecked = [...childCheckboxes].every((c) => c.checked);\n    const someChecked = [...childCheckboxes].some((c) => c.checked);\n\n    if (allChecked) {\n      parentCheckbox.checked = true;\n      parentCheckbox.indeterminate = false;\n    } else if (someChecked) {\n      parentCheckbox.checked = false;\n      parentCheckbox.indeterminate = true;\n    } else {\n      parentCheckbox.checked = false;\n      parentCheckbox.indeterminate = false;\n    }\n  }\n\n  \/\/ Fill the checkboxes based on the query parameters\n  childCheckboxes.forEach((checkbox) => {\n    const optIn = urlParams.get(checkbox.id);\n    checkbox.checked = optIn === 'false';\n  });\n\n  \/\/ Update the state of the parent checkbox\n  updateParentCheckbox();\n\n  parentCheckbox.addEventListener('change', () => {\n    childCheckboxes.forEach((checkbox) => {\n      checkbox.checked = parentCheckbox.checked;\n    });\n    updateParentCheckbox();\n  });\n\n  childCheckboxes.forEach((checkbox) => {\n    checkbox.addEventListener('change', updateParentCheckbox);\n  });\n\n  \/\/ Handle the form submission\n  document.querySelector('#opt-in-out-form').addEventListener('submit', (event) => {\n    event.preventDefault();\n\n    const options = Array.from(document.querySelectorAll('.child'))\n      .reduce((acc, checkbox) => {\n        acc[checkbox.id] = !checkbox.checked;\n        return acc;\n      }, {});\n\n    fetch(`https:\/\/api.sdcharging.com.hk\/api\/v1\/user\/${uid}\/opt-in-out`, {\n      method: 'PUT',\n      headers: {\n        'Content-Type': 'application\/json',\n      },\n      body: JSON.stringify(options),\n    })\n    .then(response => response.json())\n    .then(data => {\n      \/\/ Show a success message\n      document.querySelector('.fail-message').style.display = 'none';\n      document.querySelector('.success-message').style.display = 'block';\n      document.querySelector('.opt-in-out-form').style.display = 'none';\n      document.querySelector('.disclaimer').style.display = 'none';\n    })\n    .catch((error) => {\n      console.error('Error:', error);\n      document.querySelector('.fail-message').style.display = 'block';\n      document.querySelector('.success-message').style.display = 'none';\n      document.querySelector('.opt-in-out-form').style.display = 'none';\n      document.querySelector('.disclaimer').style.display = 'none';\n    });\n  });\n<\/script>\n<\/div>\n<\/div>\n\n\n\n<style type=\"text\/css\">\n  .opt-form {\n    padding: 30px;\n  }\n\n  .opt-in-out-form {\n      margin-top: 24px;\n  }\n\n  img {\n    margin-bottom: 32px;\n  }\n\n  .children {\n    padding-left: 24px;\n  }\n\n  .submit {\n    padding: 10px 24px 8px !important;\n    margin-top: 24px;\n    border: none;\n    border-radius: 8px;\n    color: #fff;\n    background: #1c69d4;\n  }\n\n  .success-message {\n    margin-top: 24px;\n  }\n\n  .fail-message {\n    margin-top: 24px;\n  }\n<\/style>\n","protected":false},"excerpt":{"rendered":"<p>\u53d6\u6d88\u8a02\u95b1\u6700\u65b0\u7368\u5bb6\u8cc7\u8a0a\u53ca\u512a\u60e0 \u66f4\u65b0\u6210\u529f! \u8acb\u4f7f\u7528SD Charging\u624b\u6a5f\u61c9\u7528\u7a0b\u5f0f\u8a2a\u554f\u6b64\u7db2\u9801 \u6211\u4e0d\u5e0c\u671b\u5bf6\u99ac\u6c7d\u8eca(\u5357\u4e2d\u570b)\u6709\u9650\u516c\u53f8\u3001\u5bf6\u99ac\u9999\u6e2f\u3001\u5bf6\u99ac\u7e3d\u516c\u53f8\u548c\u68ee\u90a3\u7f8e\u96c6\u5718\u4f7f\u7528\u6211\u7684\u500b\u4eba\u8cc7\u6599\u4f86\u63d0\u4f9b\u6700\u65b0\u6d3b\u52d5\u3001\u66f4\u65b0\u3001\u512a\u60e0\u548c\u4fc3\u92b7\u3002 \u900f\u904e\u96fb\u90f5 \u900f\u904e\u77ed\u4fe1 \u900f\u904e\u96fb\u8a71 \u900f\u904e\u4fe1\u4ef6 \u900f\u904e\u63d0\u4ea4\u6b64\u8868\u683c\uff0c\u6211\u540c\u610f\u6839\u64da\u96b1\u79c1\u653f\u7b56\uff0c\u63a5\u6536\u4f86\u81ea\u5bf6\u99ac\u6c7d\u8eca(\u5357\u4e2d\u570b)\u6709\u9650\u516c\u53f8\u3001\u5bf6\u99ac\u9999\u6e2f\u3001\u5bf6\u99ac\u7e3d\u516c\u53f8\u548c\u68ee\u90a3\u7f8e\u96c6\u5718\u7684\u7368\u5bb6\u512a\u60e0\u548c\u6d3b\u52d5\u9080\u8acb\u3001\u6700\u65b0\u6d88\u606f\u4ee5\u53ca\u5176\u4ed6\u76f8\u95dc\u8a0a\u606f\u3002\u6211\u660e\u767d\u9019\u500b\u9078\u64c7\u5c07\u8986\u84cb\u4e4b\u524d\u7684\u8a2d\u5b9a\u3001\u4e26\u4e14\u6211\u53ef\u4ee5\u96a8\u6642\u53d6\u6d88\u8a02\u95b1\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"views\/template-blank.blade.php","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"class_list":["post-2695","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.kinetacharge.com\/hk\/wp-json\/wp\/v2\/pages\/2695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kinetacharge.com\/hk\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.kinetacharge.com\/hk\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.kinetacharge.com\/hk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kinetacharge.com\/hk\/wp-json\/wp\/v2\/comments?post=2695"}],"version-history":[{"count":16,"href":"https:\/\/www.kinetacharge.com\/hk\/wp-json\/wp\/v2\/pages\/2695\/revisions"}],"predecessor-version":[{"id":2768,"href":"https:\/\/www.kinetacharge.com\/hk\/wp-json\/wp\/v2\/pages\/2695\/revisions\/2768"}],"wp:attachment":[{"href":"https:\/\/www.kinetacharge.com\/hk\/wp-json\/wp\/v2\/media?parent=2695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}