2019-06-04 16:32:37 +02:00
|
|
|
const data=[
|
|
|
|
'#th',
|
|
|
|
'#efi',
|
|
|
|
'#wichtig',
|
|
|
|
];
|
2018-12-12 14:34:39 +01:00
|
|
|
const CreateMsgRouter = {
|
2019-04-17 15:58:15 +02:00
|
|
|
template: `
|
2019-06-04 16:32:37 +02:00
|
|
|
<div class="content card om-card">
|
2019-02-07 22:13:11 +01:00
|
|
|
<h4>Neue Nachricht erstellen</h4>
|
2019-04-17 15:58:15 +02:00
|
|
|
|
2019-06-04 16:32:37 +02:00
|
|
|
<b-field>
|
|
|
|
<b-input placeholder="User" id="user"></b-input>
|
|
|
|
</b-field>
|
2019-04-17 15:58:15 +02:00
|
|
|
|
2019-06-04 16:32:37 +02:00
|
|
|
<b-field>
|
|
|
|
<b-input placeholder="Betreff" id="subject"></b-input>
|
|
|
|
</b-field>
|
2019-04-17 15:58:15 +02:00
|
|
|
|
2019-06-04 16:32:37 +02:00
|
|
|
<b-field label="Tags">
|
|
|
|
<b-taginput
|
|
|
|
v-model="selected"
|
|
|
|
:data=items
|
|
|
|
autocomplete
|
|
|
|
allow-new:false
|
|
|
|
icon="label"
|
|
|
|
placeholder="#"
|
|
|
|
@typing="getFilteredTags" id="tag">
|
|
|
|
</b-taginput>
|
|
|
|
</b-field>
|
2019-04-17 15:58:15 +02:00
|
|
|
|
2019-06-04 16:32:37 +02:00
|
|
|
<b-field>
|
|
|
|
<b-input placeholder="Nachricht" id="message" type="textarea"></b-input>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<b-button @click="$router.go(-1)">ABBRECHEN</b-button>
|
|
|
|
<b-button type="is-primary" @click="$router.push('/home')">SENDEN</b-button>
|
2019-04-17 15:58:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-12 14:34:39 +01:00
|
|
|
</div>
|
|
|
|
`,
|
2019-04-17 15:58:15 +02:00
|
|
|
data: function () {
|
|
|
|
return {
|
2019-06-04 16:32:37 +02:00
|
|
|
selected: [],
|
|
|
|
items: data
|
2019-04-17 15:58:15 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
createMsg: function () {
|
|
|
|
var subject = $("#subject").val();
|
|
|
|
var message = $("#message").val();
|
|
|
|
var tag = $("#tag").val();
|
|
|
|
var user = $("#user").val();
|
|
|
|
console.log("Message Created: " + tag + " " + message + " " + user);
|
|
|
|
$.ajax({
|
|
|
|
url: "api/createMsg",
|
|
|
|
data: {
|
|
|
|
sub: subject,
|
|
|
|
mess: message,
|
|
|
|
use: user,
|
|
|
|
ta: tag
|
|
|
|
},
|
|
|
|
method: "POST"
|
|
|
|
}).done(have_result).fail(have_error);
|
|
|
|
|
|
|
|
function have_result(res) {
|
|
|
|
console.log(res);
|
2019-02-07 12:16:40 +01:00
|
|
|
}
|
2019-04-17 15:58:15 +02:00
|
|
|
|
|
|
|
function have_error(err) {
|
|
|
|
console.log("error: " + err.responseText);
|
|
|
|
console.log(err);
|
2019-02-07 12:16:40 +01:00
|
|
|
}
|
|
|
|
},
|
2019-06-04 16:32:37 +02:00
|
|
|
getFilteredTags(text) {
|
|
|
|
this.items = data.filter((option) => {
|
|
|
|
return option
|
|
|
|
.toString()
|
|
|
|
.toLowerCase()
|
|
|
|
.indexOf(text.toLowerCase()) >= 0
|
|
|
|
})
|
|
|
|
},
|
2019-04-17 15:58:15 +02:00
|
|
|
},
|
|
|
|
mounted: function () {
|
|
|
|
if ($(this).bootstrapMaterialDesign)
|
|
|
|
$(this).bootstrapMaterialDesign();
|
|
|
|
},
|
2018-12-12 14:34:39 +01:00
|
|
|
};
|