2018-12-12 14:34:39 +01:00
|
|
|
const CreateMsgRouter = {
|
|
|
|
template: `
|
|
|
|
<div class="card om-card">
|
2019-02-07 22:13:11 +01:00
|
|
|
<h4>Neue Nachricht erstellen</h4>
|
2019-02-07 12:16:40 +01:00
|
|
|
<form class="new-msg-form" @submit.prevent=createMsg>
|
2018-12-12 14:34:39 +01:00
|
|
|
<div class="form-group bmd-form-group">
|
|
|
|
<label class="bmd-label-floating">Betreff</label>
|
2019-02-08 13:40:21 +01:00
|
|
|
<input type="text" class="form-control" id="subject" value="WICHTIG!">
|
2018-12-12 14:34:39 +01:00
|
|
|
</div>
|
|
|
|
<div class="form-group bmd-form-group">
|
|
|
|
<label class="bmd-label-floating">Tags</label>
|
2019-02-08 13:40:21 +01:00
|
|
|
<input type="text" class="form-control" id="tag" value="#efi">
|
2018-12-12 14:34:39 +01:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="bmd-label-floating">Nachricht</label>
|
2019-02-08 13:40:21 +01:00
|
|
|
<textarea class="form-control" id="message" rows="5">Nachricht</textarea>
|
2018-12-12 14:34:39 +01:00
|
|
|
</div>
|
2019-02-07 12:16:40 +01:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="bmd-label-floating">User</label>
|
2019-02-08 13:40:21 +01:00
|
|
|
<input type="text" class="form-control" id="user" value="Dito27">
|
2019-02-07 12:16:40 +01:00
|
|
|
</div>
|
2018-12-18 09:20:13 +01:00
|
|
|
<button class="btn btn-default"><a @click="$router.go(-1)">ABBRECHEN </a></button>
|
2018-12-12 14:34:39 +01:00
|
|
|
<button type="submit" class="btn btn-raised om-btn">SENDEN</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
data: function () {
|
2018-12-12 15:56:09 +01:00
|
|
|
return {};
|
2018-12-12 14:34:39 +01:00
|
|
|
},
|
|
|
|
methods: {
|
2019-02-07 12:16:40 +01:00
|
|
|
createMsg: function() {
|
|
|
|
var subject=$("#subject").val();
|
|
|
|
var message=$("#message").val();
|
|
|
|
var tag=$("#tag").val();
|
|
|
|
var user=$("#user").val();
|
2019-02-08 13:40:21 +01:00
|
|
|
console.log ("Message Created: "+tag+" "+message+" "+user);
|
2019-02-08 13:52:48 +01:00
|
|
|
$.ajax ({ url: "api/createMsg", data: {sub: subject, mess: message, use: user, ta: tag}, method: "POST" }) .done (have_result) .fail (have_error);
|
2019-02-07 12:16:40 +01:00
|
|
|
function have_result (res) {
|
|
|
|
console.log (res);
|
|
|
|
}
|
|
|
|
function have_error (err) {
|
2019-02-08 13:40:21 +01:00
|
|
|
console.log ("error: " + err.responseText);
|
2019-02-07 12:16:40 +01:00
|
|
|
console.log (err);
|
|
|
|
}
|
|
|
|
},
|
2018-12-12 14:34:39 +01:00
|
|
|
},
|
2019-01-16 17:38:57 +01:00
|
|
|
mounted: function() {
|
|
|
|
if ($(this).bootstrapMaterialDesign)
|
|
|
|
$(this).bootstrapMaterialDesign();
|
|
|
|
},
|
2018-12-12 14:34:39 +01:00
|
|
|
};
|