2023-03-21 14:02:06 +01:00
|
|
|
<template>
|
|
|
|
<v-card title="Add Comment">
|
|
|
|
<v-card-text>
|
|
|
|
<p>Add new comment for : {{ customer.acc_no }} - {{ customer.name }}</p>
|
|
|
|
<v-textarea v-model="comment" label="Comment"></v-textarea>
|
|
|
|
</v-card-text>
|
|
|
|
<v-card-actions>
|
2023-03-21 17:57:39 +01:00
|
|
|
<v-btn color="blue" :loading="saving" @click="saveComment">Save</v-btn>
|
2023-03-21 14:02:06 +01:00
|
|
|
<v-spacer></v-spacer>
|
|
|
|
<v-btn color="grey" @click="$emit('return','cancel')">Cancel</v-btn>
|
|
|
|
</v-card-actions>
|
|
|
|
|
|
|
|
</v-card>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
customer: null
|
|
|
|
},
|
|
|
|
data(){
|
|
|
|
return {
|
|
|
|
comment: "",
|
|
|
|
saving: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
saveComment() {
|
|
|
|
this.saving = true
|
2023-03-21 16:06:42 +01:00
|
|
|
let url = this.$api_url + "/customers/comments"
|
2023-03-21 14:02:06 +01:00
|
|
|
axios.put(url, {
|
2023-03-21 16:06:42 +01:00
|
|
|
acc_no: this.customer.acc_no,
|
2023-03-21 14:02:06 +01:00
|
|
|
comment: this.comment
|
|
|
|
})
|
|
|
|
.then(resp => {
|
|
|
|
console.log(resp.data)
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
this.saving = false
|
|
|
|
this.$emit('return',"saved")
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|