Add POP as field on the form vue component so whether or not it is valid can be tracked to toggle the save button
This commit is contained in:
parent
5a664c5a83
commit
2d20d27d01
@ -7,6 +7,7 @@ const JEDI_CLIN_TYPE = 'jedi_clin_type'
|
|||||||
const OBLIGATED_AMOUNT = 'obligated_amount'
|
const OBLIGATED_AMOUNT = 'obligated_amount'
|
||||||
const START_DATE = 'start_date'
|
const START_DATE = 'start_date'
|
||||||
const END_DATE = 'end_date'
|
const END_DATE = 'end_date'
|
||||||
|
const POP = 'period_of_performance'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'clin-fields',
|
name: 'clin-fields',
|
||||||
@ -69,6 +70,11 @@ export default {
|
|||||||
clinType: this.clinType,
|
clinType: this.clinType,
|
||||||
amount: this.initialAmount,
|
amount: this.initialAmount,
|
||||||
})
|
})
|
||||||
|
emitEvent('field-mount', this, {
|
||||||
|
optional: false,
|
||||||
|
name: POP,
|
||||||
|
valid: this.checkPopValid(),
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@ -92,6 +98,15 @@ export default {
|
|||||||
return this.startDate < this.endDate
|
return this.startDate < this.endDate
|
||||||
},
|
},
|
||||||
|
|
||||||
|
validatePop: function() {
|
||||||
|
this.popValid = this.checkPopValid()
|
||||||
|
this.showPopError = !this.popValid
|
||||||
|
emitEvent('field-change', this, {
|
||||||
|
name: POP,
|
||||||
|
valid: this.checkPopValid(),
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
handleFieldChange: function(event) {
|
handleFieldChange: function(event) {
|
||||||
if (this._uid === event.parent_uid) {
|
if (this._uid === event.parent_uid) {
|
||||||
if (event.name.includes(JEDI_CLIN_TYPE)) {
|
if (event.name.includes(JEDI_CLIN_TYPE)) {
|
||||||
@ -102,12 +117,10 @@ export default {
|
|||||||
this.clinChangeEvent()
|
this.clinChangeEvent()
|
||||||
} else if (event.name.includes(START_DATE)) {
|
} else if (event.name.includes(START_DATE)) {
|
||||||
this.startDate = new Date(event.value)
|
this.startDate = new Date(event.value)
|
||||||
this.popValid = this.checkPopValid()
|
this.validatePop()
|
||||||
this.showPopError = !this.popValid
|
|
||||||
} else if (event.name.includes(END_DATE)) {
|
} else if (event.name.includes(END_DATE)) {
|
||||||
this.endDate = new Date(event.value)
|
this.endDate = new Date(event.value)
|
||||||
this.popValid = this.checkPopValid()
|
this.validatePop()
|
||||||
this.showPopError = !this.popValid
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user