note-form-modal.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. export default {
  20. props: {
  21. populateWith: {
  22. type: Object,
  23. require: true
  24. },
  25. modalId: {
  26. type: String,
  27. require: true
  28. },
  29. noteType: {
  30. type: Number
  31. },
  32. noteUser: {
  33. type: String
  34. },
  35. woid: {
  36. type: Number
  37. }
  38. },
  39. data () {
  40. return {
  41. note: JSON.parse(JSON.stringify(this.populateWith))
  42. }
  43. },
  44. methods: {
  45. updateNote (note) {
  46. axios.put('/api/workorders/notes/' + note.noteid, note)
  47. .then((response) => {
  48. hideModal()
  49. })
  50. },
  51. hideModal () {
  52. $('#'+this.modalId).modal('hide')
  53. }
  54. }
  55. }
  56. </script>