MessageForm.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div v-if="permission">
  3. <div v-if="external">
  4. <a
  5. :href="external"
  6. class="btn btn-lg btn-primary btn-block"
  7. target="_blank"
  8. rel="noopener"
  9. >
  10. <span>Add Message 🔗</span>
  11. </a>
  12. <br />
  13. <button
  14. type="button"
  15. class="btn btn-lg btn-primary btn-xs pull-right"
  16. @click="toggleForm()"
  17. >
  18. Add Message Form 📝
  19. </button>
  20. </div>
  21. <div v-else>
  22. <button
  23. type="button"
  24. class="btn btn-lg btn-primary btn-block"
  25. @click="toggleForm()"
  26. >
  27. Add Message 📝
  28. </button>
  29. </div>
  30. <div v-if="show === true">
  31. <form class="message-form" @submit.prevent="submitMessageForm()">
  32. <div class="alert alert-info">
  33. <p><strong>Add a message and files below.</strong></p>
  34. </div>
  35. <textarea
  36. class="form-control"
  37. v-model="message"
  38. placeholder="add your message here"
  39. ></textarea>
  40. <br />
  41. <label class="btn btn-default btn-block">
  42. <input type="file" multiple @change="handleFileChange($event)" />
  43. </label>
  44. <br />
  45. <button class="btn btn-lg btn-success btn-block">
  46. Save/Upload 💾
  47. </button>
  48. </form>
  49. </div>
  50. </div>
  51. </template>
  52. <script>
  53. export default {
  54. name: "MessageForm",
  55. props: ["external", "interactionId", "teamId", "permission"],
  56. computed: {
  57. displayForm: function() {
  58. return "mode_record_details";
  59. }
  60. },
  61. data: function() {
  62. return {
  63. attachment: "",
  64. message: "",
  65. show: false
  66. };
  67. },
  68. methods: {
  69. handleFileChange(event) {
  70. console.log(event.target.files);
  71. console.log("TODO");
  72. },
  73. submitMessageForm: function() {
  74. //interactionId, teamId, message, attachments
  75. console.log("TODO");
  76. },
  77. toggleForm: function() {
  78. if (this.show) {
  79. this.show = false;
  80. } else {
  81. this.show = true;
  82. }
  83. }
  84. }
  85. };
  86. </script>
  87. <style scoped>
  88. .message-form {
  89. margin-top: 10px;
  90. }
  91. </style>