forked from AkkomaGang/admin-fe
Add alert message when note is empty
This commit is contained in:
parent
b949ddae60
commit
d23abecff9
1 changed files with 8 additions and 4 deletions
|
@ -55,10 +55,14 @@ export default {
|
||||||
this.$data.showNewNoteInput = !this.$data.showNewNoteInput
|
this.$data.showNewNoteInput = !this.$data.showNewNoteInput
|
||||||
},
|
},
|
||||||
addNewNote(reportId) {
|
addNewNote(reportId) {
|
||||||
|
if (this.$data.note.length < 2) {
|
||||||
|
this.$message('Note must contain at least 2 characters')
|
||||||
|
} else {
|
||||||
const currentUserNickname = this.$store.state.user.name
|
const currentUserNickname = this.$store.state.user.name
|
||||||
const note = { author: currentUserNickname, text: this.$data.note, timestamp: '2019/04/01' }
|
const note = { author: currentUserNickname, text: this.$data.note, timestamp: '2019/04/01' }
|
||||||
this.$store.dispatch('AddNote', { reportId, note })
|
this.$store.dispatch('AddNote', { reportId, note })
|
||||||
this.$data.note = ''
|
this.$data.note = ''
|
||||||
|
}
|
||||||
},
|
},
|
||||||
deleteNote(reportId, noteId) {
|
deleteNote(reportId, noteId) {
|
||||||
this.$confirm(i18n.t('reports.confirmMsg'), {
|
this.$confirm(i18n.t('reports.confirmMsg'), {
|
||||||
|
|
Loading…
Reference in a new issue