Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

createMessage.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. const CreateMsgRouter = {
  2. template: `
  3. <div class="card om-card">
  4. <h4>Neue Nachricht erstellen</h4>
  5. <form class="new-msg-form" @submit.prevent=createMsg>
  6. <div class="form-group">
  7. <label class="bmd-label-floating">User*</label>
  8. <input type="text" class="form-control" id="user">
  9. </div>
  10. <div class="form-group bmd-form-group">
  11. <label class="bmd-label-floating">Betreff*</label>
  12. <input type="text" class="form-control" id="subject">
  13. </div>
  14. <div class="form-group bmd-form-group">
  15. <label class="bmd-label-floating">Tags</label>
  16. <input type="text" class="form-control" id="tag">
  17. </div>
  18. <v-combobox
  19. v-model="select"
  20. :items="items"
  21. label="I use chips"
  22. multiple
  23. chips
  24. ></v-combobox>
  25. <div class="form-group">
  26. <label class="bmd-label-floating">Nachricht*</label>
  27. <textarea class="form-control" id="message" rows="5"></textarea>
  28. </div>
  29. <button class="btn btn-default"><a @click="$router.go(-1)">ABBRECHEN </a></button>
  30. <button type="submit" class="btn btn-raised om-btn"><a @click="$router.push('/home')">SENDEN</a></button>
  31. </form>
  32. </div>
  33. `,
  34. data: function () {
  35. return {
  36. select: ['Design', 'jj'],
  37. items: [
  38. 'Programming',
  39. 'Design',
  40. 'Vue',
  41. 'Vuetify'
  42. ]
  43. };
  44. },
  45. methods: {
  46. createMsg: function () {
  47. var subject = $("#subject").val();
  48. var message = $("#message").val();
  49. var tag = $("#tag").val();
  50. var user = $("#user").val();
  51. console.log("Message Created: " + tag + " " + message + " " + user);
  52. $.ajax({
  53. url: "api/createMsg",
  54. data: {
  55. sub: subject,
  56. mess: message,
  57. use: user,
  58. ta: tag
  59. },
  60. method: "POST"
  61. }).done(have_result).fail(have_error);
  62. function have_result(res) {
  63. console.log(res);
  64. }
  65. function have_error(err) {
  66. console.log("error: " + err.responseText);
  67. console.log(err);
  68. }
  69. },
  70. },
  71. mounted: function () {
  72. if ($(this).bootstrapMaterialDesign)
  73. $(this).bootstrapMaterialDesign();
  74. },
  75. };