-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
197 lines (161 loc) · 7.59 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html>
<html lang='en'>
<head>
<meta name='robots' content='noindex'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta charset='UTF-8'>
<title>Diet Doctor Communication Preference Center</title>
<link href='https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap' rel='stylesheet'>
<style>
body {
font-family: 'Inter', sans-serif;
font-weight: 400;
font-size: 16.7px;
}
input[type=checkbox] {
transform: scale(1.5);
}
select {
font-size: 18px;
}
</style>
</head>
<body style='max-width: 640px; margin: 0 auto; padding: 1rem;'>
<a href='https://www.dietdoctor.com/' target='_top'>⬅️ Return to Diet Doctor</a>
<br>
<svg width='48' height='64' viewBox='0 0 48 64' fill='none' xmlns='http://www.w3.org/2000/svg'
style="margin-top: 1rem;">
<path
d='M15.9326 0H0V8.00167H15.9326C29.1301 8.00167 39.8248 18.7439 39.8248 32C39.8248 45.2561 29.1234 55.9983 15.9326 55.9983H0V64H15.9326C33.5248 64 47.7911 49.6703 47.7911 32C47.7911 14.3297 33.5248 0 15.9326 0Z'
fill='#1A1A1A' />
<path
d='M31.8585 32C31.8585 23.1648 24.7287 15.9967 15.9259 15.9967H0V47.9967H15.9326C24.7287 48.0033 31.8585 40.8352 31.8585 32ZM7.96629 23.9983H15.9326C20.334 23.9983 23.8989 27.5791 23.8989 32C23.8989 36.4209 20.334 40.0017 15.9326 40.0017H7.96629V23.9983Z'
fill='#1A1A1A' />
</svg>
<h1>Diet Doctor<br>Communication Preference Center 📢</h1>
<form action='{{preference_center_submit_url}}' method='POST' accept-charset='UTF-8'>
<ul style='display: flex; flex-direction: column; padding: 0;'>
<!-- Global -->
<li
style='display: flex; flex-direction: row; justify-items: center; justify-content: space-between; margin-top: 1rem; display: none;'>
<label for='email_global'>Global Subscription State: </label>
<select id='email_global' name='{% form_field_name :email_global_state %}'>
<option value='opted_in'>✅ Subscribed</option>
<option value='unsubscribed'>❌ Unsubscribed</option>
</select>
</li>
<!-- <hr /> -->
<!-- English -->
<li
style='display: flex; flex-direction: row; justify-items: center; justify-content: space-between; margin-top: 1rem;'>
<label for='english_newsletter' style="font-weight: 500;">🇺🇸 English - Newsletter: </label>
<select id='english_newsletter'
name='{% form_field_name :subscription_group 84e6f8c3-a99a-4da8-9e16-9207785a7a44 %}'>
<option value='subscribed'>✅ Subscribed</option>
<option value='unsubscribed'>❌ Unsubscribed</option>
</select>
</li>
<li
style='display: flex; flex-direction: row; justify-items: center; justify-content: space-between; margin-top: 1rem;'>
<label for='english_program_diabetes' style="font-weight: 500;">🇺🇸 English - Program - Diabetes: </label>
<select id='english_program_diabetes'
name='{% form_field_name :subscription_group 3d5e83eb-bbbe-4f92-b7ad-a1e1f82d7129 %}'>
<option value='subscribed'>✅ Subscribed</option>
<option value='unsubscribed'>❌ Unsubscribed</option>
</select>
</li>
<li
style='display: flex; flex-direction: row; justify-items: center; justify-content: space-between; margin-top: 1rem;'>
<label for='english_program_new_me_reset' style="font-weight: 500;">🇺🇸 English - Program - New Me Reset:
</label>
<select id='english_program_new_me_reset'
name='{% form_field_name :subscription_group 42ea2104-2eee-4be0-a205-6d1261c60a8e %}'>
<option value='subscribed'>✅ Subscribed</option>
<option value='unsubscribed'>❌ Unsubscribed</option>
</select>
</div>
<!-- Swedish -->
<li
style='display: flex; flex-direction: row; justify-items: center; justify-content: space-between; margin-top: 1rem;'>
<label for='swedish_newsletter' style="font-weight: 500;">🇸🇪 Swedish (Svenska) - Newsletter (Nyhetsbrev):
</label>
<select id='swedish_newsletter'
name='{% form_field_name :subscription_group c25c484c-7848-4a94-91e3-31619e656c69 %}'>
<option value='subscribed'>✅ Subscribed</option>
<option value='unsubscribed'>❌ Unsubscribed</option>
</select>
</div>
<li
style='display: flex; flex-direction: row; justify-items: center; justify-content: space-between; margin-top: 1rem;'>
<label for='swedish_program_diabetes' style="font-weight: 500;">🇸🇪 Swedish (Svenska) - Program - Diabetes:
</label>
<select id='swedish_program_diabetes'
name='{% form_field_name :subscription_group b0907bac-b00c-4834-99b3-35d42445c496 %}'>
<option value='subscribed'>✅ Subscribed</option>
<option value='unsubscribed'>❌ Unsubscribed</option>
</select>
</div>
<!-- Spanish -->
<li
style='display: flex; flex-direction: row; justify-items: center; justify-content: space-between; margin-top: 1rem;'>
<label for='spanish_newsletter' style="font-weight: 500;">🇪🇸 Spanish (Español) - Newsletter (Boletín):
</label>
<select id='spanish_newsletter'
name='{% form_field_name :subscription_group 552354e8-2192-4bbc-b3eb-83723be5c183 %}'>
<option value='subscribed'>✅ Subscribed</option>
<option value='unsubscribed'>❌ Unsubscribed</option>
</select>
</li>
<!-- <li
style='display: flex; flex-direction: row; justify-items: center; justify-content: space-between; margin-top: 1rem;'
>
<label for='email_global'>Global Subscription State: </label>
<input type='checkbox' id='email_global' onchange='updateValue(this)' name='{% form_field_name :email_global_state %}'>
</li> -->
</ul>
<input type='submit' value='💾 Save Preferences' style='font-size: 1.6rem; margin-top: 4px;'>
<br>
</form>
</body>
<script>
function updateSubscriptionStatus(elementId, status) {
console.log('elementId', elementId)
console.log('status', status)
var element = document.getElementById(elementId);
if (element) {
if (status === 'subscribed') {
element.value = 'subscribed';
element.checked = true;
}
else if (status === 'opted_in') {
element.value = 'opted_in';
element.checked = true;
}
else {
element.value = 'unsubscribed';
element.checked = false;
}
} else {
console.error('Element not found:', elementId);
}
}
// Global
// updateSubscriptionStatus('email_global', '{{ subscribed_state.${ email_global } }}');
// English
updateSubscriptionStatus('english_newsletter', '{{ subscribed_state.${ 84e6f8c3-a99a-4da8-9e16-9207785a7a44 } }}');
updateSubscriptionStatus('english_program_diabetes', '{{ subscribed_state.${ 3d5e83eb-bbbe-4f92-b7ad-a1e1f82d7129 } }}');
updateSubscriptionStatus('english_program_new_me_reset', '{{ subscribed_state.${ 42ea2104-2eee-4be0-a205-6d1261c60a8e } }}');
// Swedish
updateSubscriptionStatus('swedish_newsletter', '{{ subscribed_state.${ c25c484c-7848-4a94-91e3-31619e656c69 } }}');
updateSubscriptionStatus('swedish_program_diabetes', '{{ subscribed_state.${ b0907bac-b00c-4834-99b3-35d42445c496 } }}');
// Spanish
updateSubscriptionStatus('spanish_newsletter', '{{ subscribed_state.${ 552354e8-2192-4bbc-b3eb-83723be5c183 } }}');
// function updateValue(checkbox) {
// if (checkbox.checked) {
// checkbox.value = 'opted_in';
// } else {
// checkbox.value = 'unsubscribed';
// }
// }
</script>
</html>