You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
|
|
$(".card_taskfloor_viewmessages").each(function () {
|
|
var card = $(this);
|
|
$(this).find(".card_title").prepend("Messages | ");
|
|
var msglist = $(this).find(".message-list");
|
|
var url = $(this).data("apiurl");
|
|
$.post(url, {
|
|
username: getuser(),
|
|
password: getAPIKey(),
|
|
action: "getmsgs"
|
|
}, function (resp) {
|
|
if (resp.status == "OK") {
|
|
var msgs = resp.messages;
|
|
for (var msg in msgs) {
|
|
msglist.append(
|
|
'<div class="list-group-item">'
|
|
+ '<small>' + msgs[msg]['from']['name'] + ' <i class="fas fa-caret-right"></i> ' + msgs[msg]['to']['name'] + '</small>'
|
|
+ '<p class="mb-1">' + msgs[msg]['text'] + '</p>'
|
|
+ '<small>' + msgs[msg]['sent'] + '</small>'
|
|
+ '</div>');
|
|
}
|
|
} else {
|
|
showmsg(resp.msg, "danger");
|
|
}
|
|
}, "json").fail(function () {
|
|
card.css("display", "none");
|
|
});
|
|
}); |