Display and overwrite task order uploads correctly.
- Populate the POSTed form with additional data from the existing TO model. This way the pdf attachment has to be explicitly overwritten. - Adjust the frontend so that if there is an existing PDF, it only sends a file input back if the user removes the existing PDF.
This commit is contained in:
@@ -26,24 +26,27 @@ export default {
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
hasInitialData: !!this.initialData,
|
||||
attachment: this.initialData || null,
|
||||
showErrors: this.initialErrors,
|
||||
changed: false,
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
showUploadInput: function() {
|
||||
this.showUpload = true
|
||||
},
|
||||
addAttachment: function(e) {
|
||||
this.attachment = e.target.value
|
||||
this.showErrors = false
|
||||
this.changed = true
|
||||
},
|
||||
removeAttachment: function(e) {
|
||||
e.preventDefault()
|
||||
this.attachment = null
|
||||
this.$refs.attachmentInput.value = null
|
||||
if (this.$refs.attachmentInput) {
|
||||
this.$refs.attachmentInput.value = null
|
||||
}
|
||||
this.showErrors = false
|
||||
this.changed = true
|
||||
},
|
||||
},
|
||||
|
||||
@@ -56,5 +59,8 @@ export default {
|
||||
hasAttachment: function() {
|
||||
return !!this.attachment
|
||||
},
|
||||
hideInput: function() {
|
||||
return this.hasInitialData && !this.changed
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user