notes.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <ul class="list-unstyled">
  3. <li class="row no-gutters mb-2" v-bind:key="note.noteid" v-for="note in this.notes">
  4. <modal :id="'note'+note.noteid+'editModal'" tabindex="-1" role="dialog" :aria-labelledby="'note'+note.noteid+'editModalLabel'">
  5. <h5 slot="header" class="modal-title" :id="'note'+note.noteid+'editModalLabel'">
  6. Edit Note
  7. </h5>
  8. <div slot="body">
  9. <div class="form-group">
  10. <label for="content">Content</label>
  11. <textarea :name="'content'+note.noteid" :id="'content'+note.noteid" class="form-control" v-model="note.thenote"></textarea>
  12. </div>
  13. </div>
  14. <div slot="footer">
  15. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  16. <button type="button" class="btn btn-primary" @click="updateNote(note.noteid)">Save</button>
  17. </div>
  18. </modal>
  19. <div class="col-md-1 d-flex flex-column mx-md-3">
  20. <div class="text-center p-0 m-0">{{note.noteuser}}</div>
  21. <div class="text-muted text-small text-center p-0 m-0">{{getHRDate(note.notetime)}}</div>
  22. <div class="btn-group justify-content-center p-0 m-0">
  23. <template v-if="authusername === note.noteuser || authusername === 'admin'">
  24. <button class="btn btn-sm btn-primary m-1" data-toggle="modal" :data-target="'#note'+note.noteid+'editModal'"><i class="fas fa-fw fa-edit"></i></button>
  25. <button class="btn btn-sm btn-danger m-1"><i class="fas fa-fw fa-trash-alt"></i></button>
  26. <button class="btn btn-sm btn-primary m-1"><i class="fa fa-fw fa-random"></i></button>
  27. </template>
  28. </div>
  29. </div>
  30. <div class="col-md-10">
  31. <div class="card m-2">
  32. <div class="card-body p-2">
  33. {{ note.thenote }}
  34. </div>
  35. </div>
  36. </div>
  37. </li>
  38. </ul>
  39. </template>
  40. <script>
  41. import dateMixin from '../mixins/dateMixin'
  42. export default {
  43. mixins:[dateMixin],
  44. props: ['initialnotes', 'authusername'],
  45. data () {
  46. return {
  47. notes: this.initialnotes,
  48. }
  49. }
  50. }
  51. </script>