Skip to content

Commit 36be864

Browse files
SBCQ-100 Fixed the exam received date bug
1 parent 2b175db commit 36be864

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed

frontend/src/components/exams/add-exam-final-step.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,11 @@
9999
<b-col cols="3">
100100
<span class="confirm-header">Received Date</span>
101101
</b-col>
102-
<b-col align-self="end" v-if="setup === 'individual'">
102+
<b-col align-self="end" v-if="setup === 'individual' || setup === 'other'">
103103
<span class="confirm-item">{{
104104
formatDate(exam.exam_received_date)
105105
}}</span>
106106
</b-col>
107-
<b-col align-self="end" v-else>
108-
<span v-if="!tab.showRadio" class="confirm-item">{{
109-
formatDate(exam.exam_received_date)
110-
}}</span>
111-
<span v-if="tab.showRadio" class="confirm-item">Not Yet Received</span>
112-
</b-col>
113107
</b-row>
114108
<b-row no-gutters align-h="between" align-v="end">
115109
<b-col cols="1" />

frontend/src/components/exams/add-exam-form-components.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,17 +357,17 @@ export class DropdownQuestion extends Vue {
357357
template: `
358358
<b-row no-gutters>
359359
<b-col cols="6">
360-
<b-form-group v-if="showRadio">
360+
<b-form-group>
361361
<label>{{ q.text1 }}
362362
<span v-if="error" style="color: red">{{ validationObj[q.key].message }}</span>
363363
</label><br>
364364
<b-form-radio-group v-model="showRadio"
365365
@input="preSetDate()"
366366
@change="unsetDate"
367367
autocomplete="off"
368-
:options="['other', 'pesticide'].includes(modalSetup) ? otherOptions : options"/>
368+
:options="options"/>
369369
</b-form-group>
370-
<b-form-group v-else>
370+
<b-form-group v-if="!showRadio">
371371
<label>{{ q.text2 }}
372372
<span v-if="error" style="color: red">{{ validationObj[q.key].message }}</span>
373373
</label>
@@ -417,7 +417,7 @@ export class ExamReceivedQuestion extends Vue {
417417
}
418418

419419
set showRadio (e) {
420-
this.captureExamDetail({ key: 'exam_received_date', value: null })
420+
this.captureExamDetail({ key: 'exam_received_date', value: moment(new Date()).format() })
421421
this.toggleIndividualCaptureTabRadio(e)
422422
}
423423

@@ -458,6 +458,13 @@ export class ExamReceivedQuestion extends Vue {
458458
}
459459
})
460460
}
461+
462+
mounted() {
463+
// Check if the radio button is initially set to true
464+
if (this.modalSetup === 'other' || this.modalSetup === 'pesticide') {
465+
this.exam[this.q['exam_received_date']] = moment().format()
466+
}
467+
}
461468
}
462469

463470
// InputQuestion
@@ -1104,4 +1111,4 @@ export class TimeQuestion extends Vue {
11041111
}
11051112
})
11061113
}
1107-
}
1114+
}

frontend/src/components/exams/add-exam-form-controller.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ export default class AddExamFormController extends Vue {
311311
messages[key] = ''
312312
return
313313
}
314+
if (key === 'exam_received_date') {
315+
valid[key] = true
316+
return
317+
}
314318
// To turn this on for event ID checks only on group exams,
315319
// add && group_exam_indicator to the if block
316320
// below as well

frontend/src/components/exams/add-exam-modal.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ export default class AddExamModal extends Vue {
337337
return
338338
case 'other':
339339
this.resetModal()
340+
this.captureExamDetail({ key: 'exam_received_date', value: moment(new Date()).format('YYYY-MM-DD') })
340341
this.captureExamDetail({ key: 'on_or_off', value: 'on' })
341342
this.captureExamDetail({ key: 'expiry_date', value: '' })
342343
return

frontend/src/store/actions/actions-model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,11 +2138,11 @@ export const commonActions: any = {
21382138
if (responses.notes === null) {
21392139
responses.notes = ''
21402140
}
2141-
if (context.state.addExamModal.setup === 'other') {
2142-
if (context.state.captureITAExamTabSetup.showRadio === true) {
2143-
delete responses.exam_received_date
2144-
}
2145-
}
2141+
// if (context.state.addExamModal.setup === 'other') {
2142+
// if (context.state.captureITAExamTabSetup.showRadio === true) {
2143+
// delete responses.exam_received_date
2144+
// }
2145+
// }
21462146

21472147
if (context.state.addExamModal.setup === 'pesticide') {
21482148
responses.exam_name = 'Environment'

0 commit comments

Comments
 (0)