NoteFormModal.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <modal :id="modalId" tabindex="-1" role="dialog" :aria-labelledby="modalId+'Label'">
  3. <h5 slot="header" class="modal-title" :id="modalId+'Label'">
  4. Edit Note
  5. </h5>
  6. <div slot="body">
  7. <div class="form-group">
  8. <label for="content">Content</label>
  9. <textarea :name="'content'+note.noteid" :id="'content'+note.noteid" class="form-control" v-model="note.thenote"></textarea>
  10. </div>
  11. </div>
  12. <div slot="footer">
  13. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  14. <button type="button" class="btn btn-primary" @click="updateNote(note)">Save</button>
  15. </div>
  16. </modal>
  17. </template>
  18. <script>
  19. import Modal from '../components/Modal.vue'
  20. export default {
  21. components: {
  22. Modal,
  23. },
  24. props: {
  25. populateWith: {
  26. type: Object,
  27. require: true
  28. },
  29. modalId: {
  30. type: String,
  31. require: true
  32. },
  33. noteType: {
  34. type: Number
  35. },
  36. noteUser: {
  37. type: String
  38. },
  39. woid: {
  40. type: Number
  41. }
  42. },
  43. data () {
  44. return {
  45. note: JSON.parse(JSON.stringify(this.populateWith))
  46. }
  47. },
  48. methods: {
  49. updateNote (note) {
  50. axios.put('/api/workorders/notes/' + note.noteid, note)
  51. .then((response) => {
  52. this.hideModal()
  53. })
  54. },
  55. hideModal () {
  56. $('#'+this.modalId).modal('hide')
  57. }
  58. }
  59. }
  60. </script>