Update Events (#10)
This update restructures the events page code and provides additional functionality. - Overwrite old entries on re-submission of previously used emails - Build data and stats caches on launch for use in submission checks and stats regeneration - Update to form content - Move stats function to separate utils file Reviewed-on: ayo/website#10 Co-authored-by: Jimmy Vargo <james@ayo.tokyo> Co-committed-by: Jimmy Vargo <james@ayo.tokyo>
This commit is contained in:
parent
b2bf426820
commit
dae67ce653
8 changed files with 128 additions and 53 deletions
|
|
@ -35,7 +35,7 @@ const send = () => {
|
|||
const times = [...document.querySelectorAll('[id^=time-]')]?.reduce((entries, checkbox) => {
|
||||
return { ...entries, [checkbox.id]: checkbox.checked }
|
||||
}, {})
|
||||
if (Object.values(times).every(time => time == false)) {
|
||||
if (Object.values(times).every(item => item == false)) {
|
||||
error.style.display = 'block'
|
||||
error.innerHTML = 'Please select at least one convenient time.
都合の時間を一つ以上を選択してください。'
|
||||
return
|
||||
|
|
@ -44,12 +44,21 @@ const send = () => {
|
|||
const topics = [...document.querySelectorAll('[id^=topic-]')]?.reduce((entries, checkbox) => {
|
||||
return { ...entries, [checkbox.id]: checkbox.checked }
|
||||
}, {})
|
||||
if (Object.values(topics).every(time => time == false)) {
|
||||
if (Object.values(topics).every(item => item == false)) {
|
||||
error.style.display = 'block'
|
||||
error.innerHTML = 'Please select at least one topic of interest.
興味あるテーマを一つ以上を選択してください。'
|
||||
return
|
||||
}
|
||||
|
||||
const background = [...document.querySelectorAll('[id^=background-]')]?.reduce((entries, checkbox) => {
|
||||
return { ...entries, [checkbox.id]: checkbox.checked }
|
||||
}, {})
|
||||
if (Object.values(background).every(item => item == false)) {
|
||||
error.style.display = 'block'
|
||||
error.innerHTML = 'Please select at least one background.
履歴・業種を一つ以上を選択してください。'
|
||||
return
|
||||
}
|
||||
|
||||
const otherText = document.getElementById('other-text')
|
||||
if (topics['topic-other'] && !otherText.value.trim()) {
|
||||
error.style.display = 'block'
|
||||
|
|
@ -58,12 +67,15 @@ const send = () => {
|
|||
}
|
||||
|
||||
const language = document.getElementById('language')
|
||||
const presentationInterest = document.getElementById('presentation-interest')
|
||||
const data = {
|
||||
name: name.value,
|
||||
email: email.value,
|
||||
...times,
|
||||
...topics,
|
||||
...background,
|
||||
'topic-other': topics['topic-other'] ? otherText.value : null,
|
||||
'presentation-interest': presentationInterest.value,
|
||||
'language-english': language.value == 'english' || language.value == 'either',
|
||||
'language-japanese': language.value == 'japanese' || language.value == 'either',
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue