├── dist
├── test.txt
├── assets
│ ├── images
│ │ ├── success1.gif
│ │ ├── success10.gif
│ │ ├── success2.gif
│ │ ├── success3.gif
│ │ ├── success4.gif
│ │ ├── success5.gif
│ │ ├── success6.gif
│ │ ├── success7.gif
│ │ ├── success8.gif
│ │ └── success9.gif
│ ├── styles
│ │ ├── check_box.svg
│ │ ├── check_box_outline_blank.svg
│ │ └── verify.css
│ └── scripts
│ │ └── default.js
└── index.html
├── src
├── assets
│ ├── images
│ │ ├── success1.gif
│ │ ├── success2.gif
│ │ ├── success3.gif
│ │ ├── success4.gif
│ │ ├── success5.gif
│ │ ├── success6.gif
│ │ ├── success7.gif
│ │ ├── success8.gif
│ │ ├── success9.gif
│ │ └── success10.gif
│ ├── styles
│ │ ├── check_box.svg
│ │ ├── check_box_outline_blank.svg
│ │ └── verify.css
│ └── scripts
│ │ └── default.js
├── denovo.html
└── index.html
├── README.md
└── .gitignore
/dist/test.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/assets/images/success1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/src/assets/images/success1.gif
--------------------------------------------------------------------------------
/src/assets/images/success2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/src/assets/images/success2.gif
--------------------------------------------------------------------------------
/src/assets/images/success3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/src/assets/images/success3.gif
--------------------------------------------------------------------------------
/src/assets/images/success4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/src/assets/images/success4.gif
--------------------------------------------------------------------------------
/src/assets/images/success5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/src/assets/images/success5.gif
--------------------------------------------------------------------------------
/src/assets/images/success6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/src/assets/images/success6.gif
--------------------------------------------------------------------------------
/src/assets/images/success7.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/src/assets/images/success7.gif
--------------------------------------------------------------------------------
/src/assets/images/success8.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/src/assets/images/success8.gif
--------------------------------------------------------------------------------
/src/assets/images/success9.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/src/assets/images/success9.gif
--------------------------------------------------------------------------------
/dist/assets/images/success1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/dist/assets/images/success1.gif
--------------------------------------------------------------------------------
/dist/assets/images/success10.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/dist/assets/images/success10.gif
--------------------------------------------------------------------------------
/dist/assets/images/success2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/dist/assets/images/success2.gif
--------------------------------------------------------------------------------
/dist/assets/images/success3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/dist/assets/images/success3.gif
--------------------------------------------------------------------------------
/dist/assets/images/success4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/dist/assets/images/success4.gif
--------------------------------------------------------------------------------
/dist/assets/images/success5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/dist/assets/images/success5.gif
--------------------------------------------------------------------------------
/dist/assets/images/success6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/dist/assets/images/success6.gif
--------------------------------------------------------------------------------
/dist/assets/images/success7.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/dist/assets/images/success7.gif
--------------------------------------------------------------------------------
/dist/assets/images/success8.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/dist/assets/images/success8.gif
--------------------------------------------------------------------------------
/dist/assets/images/success9.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/dist/assets/images/success9.gif
--------------------------------------------------------------------------------
/src/assets/images/success10.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dwebdevcore/verify_api/HEAD/src/assets/images/success10.gif
--------------------------------------------------------------------------------
/src/assets/styles/check_box.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 | check_box
4 |
5 |
6 |
--------------------------------------------------------------------------------
/dist/assets/styles/check_box.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 | check_box
4 |
5 |
6 |
--------------------------------------------------------------------------------
/dist/assets/styles/check_box_outline_blank.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 | check_box_outline_blank
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/assets/styles/check_box_outline_blank.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 | check_box_outline_blank
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Website Verification Form
2 |
3 | This form is to verify site services/taxonomy once they're ready to launch.
4 |
5 | ## GET API
6 |
7 | The form reads site data from our Services API and posts it to our update API.
8 |
9 | This API accepts a few options.
10 |
11 | `https://api.heartland.com/services/` returns all services.
12 |
13 | Adding a `practice_id` or `content_url` returns services offered at that practice.
14 |
15 | Adding `?verification=on` to the GET request returns all services each containing a bool value called `is_provided`.
16 |
17 |
18 | ## URL Params
19 |
20 | This page accepts two URL params, one for the site:
21 |
22 | `site=mycharlestondentist`
23 |
24 | And optionally one for the auth token:
25 |
26 | `auth=1234`
27 |
28 | Auth tokens will be distributed with emails to the reps who approve the sites.
29 |
30 | Auth tokens expire after 5 uses.
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | # Logs
3 | logs
4 | *.log
5 | npm-debug.log*
6 | yarn-debug.log*
7 | yarn-error.log*
8 |
9 | # Runtime data
10 | pids
11 | *.pid
12 | *.seed
13 | *.pid.lock
14 |
15 | # Directory for instrumented libs generated by jscoverage/JSCover
16 | lib-cov
17 |
18 | # Coverage directory used by tools like istanbul
19 | coverage
20 |
21 | # nyc test coverage
22 | .nyc_output
23 |
24 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
25 | .grunt
26 |
27 | # Bower dependency directory (https://bower.io/)
28 | bower_components
29 |
30 | # node-waf configuration
31 | .lock-wscript
32 |
33 | # Compiled binary addons (https://nodejs.org/api/addons.html)
34 | build/Release
35 |
36 | # Dependency directories
37 | node_modules/
38 | jspm_packages/
39 |
40 | # TypeScript v1 declaration files
41 | typings/
42 |
43 | # Optional npm cache directory
44 | .npm
45 |
46 | # Optional eslint cache
47 | .eslintcache
48 |
49 | # Optional REPL history
50 | .node_repl_history
51 |
52 | # Output of 'npm pack'
53 | *.tgz
54 |
55 | # Yarn Integrity file
56 | .yarn-integrity
57 |
58 | # dotenv environment variables file
59 | .env
60 |
61 | # next.js build output
62 | .next
63 |
--------------------------------------------------------------------------------
/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | '};fetch(d).then(function(g){return g.json()}).then(function(g){if(!1==g.error){a.innerHTML=' \n \n
Verify Practice Services for '+g.practice_info.name+' \n
Please look over '+g.practice_info.name+' and use this page to notify us of any changes to the services offered. Changes made here will appear by the next day, if not sooner. If a service is selected here but is still not shown on your site, then you may request content to be created or modified.
\n
\n ';var h={};Object.keys(g.services).sort().forEach(function(l){h[l]=g.services[l]}),b.innerHTML=' \n \n \n Please enter the authorization code found in your email. \n \n ',clearChildren(),selectParent()}else a.innerHTML='\n
Error: '+g.message+' \n
Double check the link you recieved. If it’s incorrect, contact the Digital Marketing team.
\n
\n '}).then(function(){var g=function(){var l=document.querySelector('div.form .response');l&&l.parentNode.removeChild(l),fetch(e,{method:'post',body:new FormData(h)}).then(function(m){return m.json()}).then(function(m){a.removeChild(document.querySelector('.message'));var n=document.createElement('div');n.classList.add('response'),console.log('error?',m),m.error?(n.classList.add('error'),n.innerHTML=''+m.message+'
'):(n.classList.add('success'),n.innerHTML=''+m.message+'
\n Please allow 24-48 for your changes to be made live on your site. If you still don\'t see the changes, please contact the web team.
'),h.innerHTML='',h.appendChild(n);var o=Math.floor(10*Math.random())+1,p=document.createElement('div');p.classList.add('success-img'),p.innerHTML=' ',h.insertBefore(p,n)})},h=document.getElementById('update-form');h.addEventListener('submit',function(l){l.preventDefault(),g()})}).catch(function(){a.innerHTML='\n
Unable to connect to API resource \n
Try again later or contact the Digital Marketing team.
\n
\n '})});
--------------------------------------------------------------------------------
/dist/assets/styles/verify.css:
--------------------------------------------------------------------------------
1 | :root {
2 | font-size: 100%;
3 | line-height: 1.2;
4 | }
5 | :root * {
6 | box-sizing: border-box;
7 | }
8 | body {
9 | margin: 0;
10 | color: #333;
11 | min-height: 100vh;
12 | font: 400 1rem/1.2 Montserrat, Helvetica, Arial, sans-serif;
13 | background: linear-gradient(135deg, rgba(5,127,162,1) 0%, rgba(11,141,143,1) 100%);
14 | }
15 |
16 | .page-header {
17 | padding: 2em;
18 | margin: 0 auto;
19 | max-width: 1000px;
20 | color: #fff;
21 | }
22 | .page-header .logo {
23 | display: block;
24 | margin: 0 auto;
25 | width: 300px;
26 | max-width: 100%;
27 | }
28 | .page-header h1 {
29 | font-size: 1.5em;
30 | font-weight: 600;
31 | margin: 2em auto;
32 | text-align: center;
33 | }
34 | @media only screen and (min-width: 480px) {
35 | .page-header h1 {
36 | font-size: 2em;
37 | }
38 | }
39 | .page-header p {
40 | text-align: left;
41 | font-weight: 200;
42 | font-size: 1.2em;
43 | line-height: 1.5;
44 | }
45 | .page-header .error p {
46 | text-align: center;
47 | }
48 |
49 |
50 | div.form {
51 | max-width: calc(860px - 6em);
52 | margin: 3em 1.5em;
53 | padding: 0 0 10em;
54 | }
55 | @media only screen and (min-width: 480px) {
56 | div.form {
57 | margin: 3em;
58 | }
59 | }
60 | @media only screen and (min-width: 860px) {
61 | div.form {
62 | margin: 1em auto;
63 | }
64 | }
65 | ul {
66 | list-style: none;
67 | margin: 0;
68 | padding: 0;
69 | }
70 | li {
71 | margin: 0;
72 | padding: 0;
73 | }
74 | ul.categories > li {
75 | display: block;
76 | width: auto;
77 | margin: 3em auto;
78 | border-radius: 4px;
79 | background: #fff;
80 | background: linear-gradient(135deg, rgba(242,242,242,1) 0%, rgba(237,237,237,1) 100%);
81 | box-shadow: 1px 1px 9px -2px rgba(0,0,0,0.4);
82 | }
83 | .categories > li > label {
84 | display: block;
85 | width: 100%;
86 | background-color: #333;
87 | color: #fff;
88 | font-size: 1.5rem;
89 | line-height: 2;
90 | border-radius: 4px 4px 0 0;
91 | padding: 0 0.5em;
92 | vertical-align: middle;
93 | }
94 | ul.categories li p {
95 | padding: 1em 1.5em 0.5em;
96 | margin: 0;
97 | }
98 | ul.services {
99 | padding: 0.5em 1.5em 1em;
100 | }
101 | ul.services li {
102 | font-size: 1.2rem;
103 | line-height: 1.6;
104 | margin-left: 1.3em;
105 | }
106 | ul.services li label {
107 | margin-left: -1.3em;
108 | text-indent: 1.3em;
109 | }
110 |
111 |
112 | form {
113 |
114 | }
115 | input[type="checkbox"] ~ label {
116 | cursor: pointer;
117 | }
118 | input[type="checkbox"] ~ label svg {
119 | position: relative;
120 | top: 2px;
121 | }
122 | input[type="checkbox"].category:checked:hover ~ ul.services li input[type="checkbox"]:checked ~ label,
123 | input[type="checkbox"].category:checked ~ label:hover ~ ul.services li input[type="checkbox"]:checked ~ label {
124 | text-decoration: line-through;
125 | color: #f00;
126 | }
127 | ul.services input[type="checkbox"]:not(:checked) ~ label {
128 | opacity: 0.5;
129 | }
130 | ul.services input[type="checkbox"]:not(:checked):hover ~ label,
131 | ul.services input[type="checkbox"]:not(:checked) ~ label:hover {
132 | color: #3a8e11;
133 | opacity: 1;
134 | }
135 |
136 | .form .response {
137 | margin: 2em auto 0;
138 | padding: 2em 1em;
139 | background: #eee;
140 | /* border: 3px solid #bbb; */
141 | box-shadow: 1px 1px 9px -2px rgba(0,0,0,0.4);
142 | }
143 | .form .response p {
144 | font-size: 1.2em;
145 | line-height: 1.5;
146 | padding: 0 0 0.5em;
147 | }
148 | .form .response p:last-child {
149 | border-bottom: 3px solid #bbb;
150 | }
151 | .response.success p:last-child {
152 | border-color: #3a8e11;
153 | }
154 | .response.error p:last-child {
155 | border-color: #f4961a;
156 | }
157 | form .success-img {
158 | }
159 | .success-img img {
160 | width: 100%;
161 | max-width: 500px;
162 | display: block;
163 | margin: 0 auto;
164 | }
165 |
166 | label[for=authcode] {
167 | display: block;
168 | color: #fff;
169 | text-align: center;
170 | }
171 | input.authcode {
172 | display: block;
173 | margin: 0.5em auto 1em;
174 | background: #fff;
175 | color: #333;
176 | font-size: 1.4em;
177 | padding: 0.3em;
178 | border: none;
179 | box-shadow: inset 1px 1px 9px -2px rgba(0,0,0,0.4);
180 | width: 100%;
181 | max-width: 400px;
182 | }
183 | input[type=submit] {
184 | display: block;
185 | margin: 2em 0 0 auto;
186 | background: #fff;
187 | color: #333;
188 | cursor: pointer;
189 | font-size: 1.6em;
190 | padding: 0.5em 2em;
191 | border: none;
192 | box-shadow: 1px 1px 9px -2px rgba(0,0,0,0.4);
193 | }
194 | input[type=submit]:hover {
195 | background: #333;
196 | color: #fff;
197 | }
198 | input[type=submit]:active {
199 | background: #333;
200 | color: #fff;
201 | position: relative;
202 | top: 1px;
203 | left: 1px;
204 | box-shadow: 0px 0px 9px -2px rgba(0,0,0,0.4);
205 | }
206 |
207 |
208 |
209 | .icon {
210 | display: inline-block;
211 | width: 1em;
212 | height: 1em;
213 | stroke-width: 0;
214 | stroke: currentColor;
215 | fill: currentColor;
216 | }
217 | input[type="checkbox"] {
218 | display: none;
219 | }
220 | input[type="checkbox"]:checked ~ label svg.icon-check {display: inline-block;}
221 | input[type="checkbox"]:checked ~ label svg.icon-uncheck {display: none;}
222 | input[type="checkbox"]:not(:checked) ~ label svg.icon-check {display: none;}
223 | input[type="checkbox"]:not(:checked) ~ label svg.icon-uncheck {display: inline-block;}
224 |
--------------------------------------------------------------------------------
/src/assets/styles/verify.css:
--------------------------------------------------------------------------------
1 | :root {
2 | font-size: 100%;
3 | line-height: 1.2;
4 | }
5 | :root * {
6 | box-sizing: border-box;
7 | }
8 | body {
9 | margin: 0;
10 | color: #333;
11 | min-height: 100vh;
12 | font: 400 1rem/1.2 Montserrat, Helvetica, Arial, sans-serif;
13 | background: linear-gradient(135deg, rgba(5,127,162,1) 0%, rgba(11,141,143,1) 100%);
14 | }
15 |
16 | .page-header {
17 | padding: 2em;
18 | margin: 0 auto;
19 | max-width: 1000px;
20 | color: #fff;
21 | }
22 | .page-header .logo {
23 | display: block;
24 | margin: 0 auto;
25 | width: 300px;
26 | max-width: 100%;
27 | }
28 | .page-header h1 {
29 | font-size: 1.5em;
30 | font-weight: 600;
31 | margin: 2em auto;
32 | text-align: center;
33 | }
34 | @media only screen and (min-width: 480px) {
35 | .page-header h1 {
36 | font-size: 2em;
37 | }
38 | }
39 | .page-header p {
40 | text-align: left;
41 | font-weight: 200;
42 | font-size: 1.2em;
43 | line-height: 1.5;
44 | }
45 | .page-header .error p {
46 | text-align: center;
47 | }
48 |
49 |
50 | div.form {
51 | max-width: calc(860px - 6em);
52 | margin: 3em 1.5em;
53 | padding: 0 0 10em;
54 | }
55 | @media only screen and (min-width: 480px) {
56 | div.form {
57 | margin: 3em;
58 | }
59 | }
60 | @media only screen and (min-width: 860px) {
61 | div.form {
62 | margin: 1em auto;
63 | }
64 | }
65 | ul {
66 | list-style: none;
67 | margin: 0;
68 | padding: 0;
69 | }
70 | li {
71 | margin: 0;
72 | padding: 0;
73 | }
74 | ul.categories > li {
75 | display: block;
76 | width: auto;
77 | margin: 3em auto;
78 | border-radius: 4px;
79 | background: #fff;
80 | background: linear-gradient(135deg, rgba(242,242,242,1) 0%, rgba(237,237,237,1) 100%);
81 | box-shadow: 1px 1px 9px -2px rgba(0,0,0,0.4);
82 | }
83 | .categories > li > label {
84 | display: block;
85 | width: 100%;
86 | background-color: #333;
87 | color: #fff;
88 | font-size: 1.5rem;
89 | line-height: 2;
90 | border-radius: 4px 4px 0 0;
91 | padding: 0 0.5em;
92 | vertical-align: middle;
93 | }
94 | ul.categories li p {
95 | padding: 1em 1.5em 0.5em;
96 | margin: 0;
97 | }
98 | ul.services {
99 | padding: 0.5em 1.5em 1em;
100 | }
101 | ul.services li {
102 | font-size: 1.2rem;
103 | line-height: 1.6;
104 | margin-left: 1.3em;
105 | }
106 | ul.services li label {
107 | margin-left: -1.3em;
108 | text-indent: 1.3em;
109 | }
110 |
111 |
112 | form {
113 |
114 | }
115 | input[type="checkbox"] ~ label {
116 | cursor: pointer;
117 | }
118 | input[type="checkbox"] ~ label svg {
119 | position: relative;
120 | top: 2px;
121 | }
122 | input[type="checkbox"].category:checked:hover ~ ul.services li input[type="checkbox"]:checked ~ label,
123 | input[type="checkbox"].category:checked ~ label:hover ~ ul.services li input[type="checkbox"]:checked ~ label {
124 | text-decoration: line-through;
125 | color: #f00;
126 | }
127 | ul.services input[type="checkbox"]:not(:checked) ~ label {
128 | opacity: 0.5;
129 | }
130 | ul.services input[type="checkbox"]:not(:checked):hover ~ label,
131 | ul.services input[type="checkbox"]:not(:checked) ~ label:hover {
132 | color: #3a8e11;
133 | opacity: 1;
134 | }
135 |
136 | .form .response {
137 | margin: 2em auto 0;
138 | padding: 2em 1em;
139 | background: #eee;
140 | /* border: 3px solid #bbb; */
141 | box-shadow: 1px 1px 9px -2px rgba(0,0,0,0.4);
142 | }
143 | .form .response p {
144 | font-size: 1.2em;
145 | line-height: 1.5;
146 | padding: 0 0 0.5em;
147 | }
148 | .form .response p:last-child {
149 | border-bottom: 3px solid #bbb;
150 | }
151 | .response.success p:last-child {
152 | border-color: #3a8e11;
153 | }
154 | .response.error p:last-child {
155 | border-color: #f4961a;
156 | }
157 | form .success-img {
158 | }
159 | .success-img img {
160 | width: 100%;
161 | max-width: 500px;
162 | display: block;
163 | margin: 0 auto;
164 | }
165 |
166 | label[for=authcode] {
167 | display: block;
168 | color: #fff;
169 | text-align: center;
170 | }
171 | input.authcode {
172 | display: block;
173 | margin: 0.5em auto 1em;
174 | background: #fff;
175 | color: #333;
176 | font-size: 1.4em;
177 | padding: 0.3em;
178 | border: none;
179 | box-shadow: inset 1px 1px 9px -2px rgba(0,0,0,0.4);
180 | width: 100%;
181 | max-width: 400px;
182 | }
183 | input[type=submit] {
184 | display: block;
185 | margin: 2em 0 0 auto;
186 | background: #fff;
187 | color: #333;
188 | cursor: pointer;
189 | font-size: 1.6em;
190 | padding: 0.5em 2em;
191 | border: none;
192 | box-shadow: 1px 1px 9px -2px rgba(0,0,0,0.4);
193 | }
194 | input[type=submit]:hover {
195 | background: #333;
196 | color: #fff;
197 | }
198 | input[type=submit]:active {
199 | background: #333;
200 | color: #fff;
201 | position: relative;
202 | top: 1px;
203 | left: 1px;
204 | box-shadow: 0px 0px 9px -2px rgba(0,0,0,0.4);
205 | }
206 |
207 |
208 |
209 | .icon {
210 | display: inline-block;
211 | width: 1em;
212 | height: 1em;
213 | stroke-width: 0;
214 | stroke: currentColor;
215 | fill: currentColor;
216 | }
217 | input[type="checkbox"] {
218 | display: none;
219 | }
220 | input[type="checkbox"]:checked ~ label svg.icon-check {display: inline-block;}
221 | input[type="checkbox"]:checked ~ label svg.icon-uncheck {display: none;}
222 | input[type="checkbox"]:not(:checked) ~ label svg.icon-check {display: none;}
223 | input[type="checkbox"]:not(:checked) ~ label svg.icon-uncheck {display: inline-block;}
224 |
--------------------------------------------------------------------------------
/src/assets/scripts/default.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | const apiDisabled = false;
3 |
4 | const clearChildren = function() {
5 | var $options = document.querySelectorAll('input[type="checkbox"].category');
6 | for(var i = 0; i< $options.length; i++) {
7 | $options[i].addEventListener( 'change', function() {
8 | if(this.checked) {
9 | } else {
10 | var $childOptions = document.querySelectorAll(`#${this.id} ~ ul input.service`);
11 | for(var j = 0; j < $childOptions.length; j++) {
12 | $childOptions[j].checked = false;
13 | }
14 | }
15 | });
16 | }
17 | }
18 |
19 | const selectParent = function() {
20 | var $options = document.querySelectorAll('input[type="checkbox"].service');
21 | for(var i = 0; i< $options.length; i++) {
22 | $options[i].addEventListener( 'change', function() {
23 | if(this.checked) {
24 | this.parentElement.parentElement.parentElement.querySelector('input.category').checked = true;
25 | }
26 | });
27 | }
28 | }
29 |
30 | function tokenizeURLArgs(url) {
31 | let result = {};
32 | let _url = url.replace('/', '').replace('?', '').replace('%20', ' ');
33 | _url.split('&').map((k) => {
34 | let item = k.split('=');
35 | if (item[0] !== '') { result[item[0]] = item[1]; }
36 | });
37 | return result;
38 | }
39 |
40 | document.addEventListener("DOMContentLoaded", function() {
41 | const $intro = document.getElementById('intro');
42 | const $form = document.getElementById('update-form');
43 | const urlParams = tokenizeURLArgs(window.location.search);
44 | if (typeof(apiDisabled) !== 'undefined' && apiDisabled) {
45 | $intro.innerHTML =
46 | `
47 |
Service Unavailable
48 |
The Verification service will be available when the next batch of sites is ready for launch.
49 |
50 | `;
51 | return false;
52 | }
53 | if (!urlParams.site) {
54 | $intro.innerHTML =
55 | `
56 |
No sites found
57 |
You need to use the URL provided by your RMS.
58 |
59 | `;
60 | return false;
61 | }
62 | const serviceURL = `https://api.heartland.com/services/v1/${urlParams.site}/?verification=on`;
63 | const submissionURL = `https://api.heartland.com/services/v1/${urlParams.site}/update/`;
64 | const svg = {
65 | checkbox: ' '
66 | };
67 | fetch(serviceURL)
68 | .then(data => data.json())
69 | .then(data => {
70 | if (data.error == false) {
71 | $intro.innerHTML =
72 | `
78 |
79 |
Verify Practice Services for ${data.practice_info.name}
80 |
Please look over ${data.practice_info.name} and use this page to notify us of any changes to the services offered. Changes made here will appear by the next day, if not sooner. If a service is selected here but is still not shown on your site, then you may request content to be created or modified.
81 |
82 | `;
83 | const keysAlpha = {};
84 | Object.keys(data.services).sort().forEach(key => {
85 | keysAlpha[key] = data.services[key];
86 | });
87 | $form.innerHTML =
88 | `
89 |
90 |
129 | Please enter the authorization code found in your email.
130 |
131 | `;
132 |
133 | clearChildren();
134 | selectParent();
135 |
136 | } else {
137 | $intro.innerHTML =
138 | `
139 |
Error: ${data.message}
140 |
Double check the link you recieved. If it’s incorrect, contact the Digital Marketing team.
141 |
142 | `;
143 | }
144 | })
145 | .then(() => {
146 | const sendData = () => {
147 | let $response = document.querySelector('div.form .response')
148 | if ($response) {
149 | $response.parentNode.removeChild($response);
150 | }
151 | fetch(submissionURL, {method: 'post', body: new FormData($form)})
152 | .then(response => response.json())
153 | .then(function(data) {
154 | $intro.removeChild(document.querySelector('.message'));
155 | let $response = document.createElement("div");
156 | $response.classList.add("response");
157 | console.log("error?", data);
158 | if (data.error) {
159 | $response.classList.add("error");
160 | $response.innerHTML = `${data.message}
`;
161 | } else {
162 | $response.classList.add("success");
163 | $response.innerHTML = `${data.message}
164 | Please allow 24-48 for your changes to be made live on your site. If you still don't see the changes, please contact the web team.
`;
165 | }
166 | $form.innerHTML = '';
167 | $form.appendChild($response);
168 | let rand = Math.floor(Math.random() * 10) + 1;
169 | let $responseGif = document.createElement("div");
170 | $responseGif.classList.add("success-img");
171 | $responseGif.innerHTML = ` `;
172 | $form.insertBefore($responseGif, $response);
173 | });
174 | }
175 |
176 | const $form = document.getElementById('update-form');
177 | $form.addEventListener('submit', event => {
178 | event.preventDefault();
179 | sendData();
180 | });
181 | })
182 | .catch( function() {
183 | $intro.innerHTML =
184 | `
185 |
Unable to connect to API resource
186 |
Try again later or contact the Digital Marketing team.
187 |
188 | `;
189 | });
190 | });
--------------------------------------------------------------------------------