| 3358 | }); | 3358 | }); |
| 3359 | useGroupScoringSelect.val((entry.useGroupScoring === null || entry.useGroupScoring === undefined) ? 'null' : entry.useGroupScoring ? 'true' : 'false').trigger('input'); | 3359 | useGroupScoringSelect.val((entry.useGroupScoring === null || entry.useGroupScoring === undefined) ? 'null' : entry.useGroupScoring ? 'true' : 'false').trigger('input'); |
| 3360 | | 3360 | |
| 3361 | function handleOptionalSelect(name) { | 3361 | function handleOptionalSelect(fieldName) { |
| 3362 | const key = originalWIDataKeyMap[name]; | 3362 | const key = originalWIDataKeyMap[fieldName]; |
| 3363 | const checkBoxElem = template.find(`input[type="checkbox"][name="${name}"]`); | 3363 | const checkBoxElem = template.find(`input[type="checkbox"][name="${fieldName}"]`); |
| 3364 | checkBoxElem.data('uid', entry.uid); | 3364 | checkBoxElem.data('uid', entry.uid); |
| 3365 | checkBoxElem.on('change', async function () { | 3365 | checkBoxElem.on('change', async function () { |
| 3366 | const uid = $(this).data('uid'); | 3366 | const uid = $(this).data('uid'); |
| 3367 | const isChecked = $(this).is(':checked'); | 3367 | const isChecked = $(this).is(':checked'); |
| 3368 | | 3368 | |
| 3369 | data.entries[uid][name] = isChecked; | 3369 | data.entries[uid][fieldName] = isChecked; |
| 3370 | setWIOriginalDataValue(data, uid, key, data.entries[uid][name]); | 3370 | setWIOriginalDataValue(data, uid, key, data.entries[uid][fieldName]); |
| 3371 | await saveWorldInfo(name, data); | 3371 | await saveWorldInfo(name, data); |
| 3372 | }); | 3372 | }); |
| 3373 | checkBoxElem.prop('checked', !!entry[name]).trigger('change'); | 3373 | checkBoxElem.prop('checked', !!entry[name]).trigger('change'); |