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.
Station/cards/js/taskfloor_viewtasks.js

35 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_viewtasks").each(function () {
var card = $(this);
$(this).find(".card_title").prepend("Tasks | ");
var tasklist = $(this).find(".task-list");
var url = $(this).data("apiurl");
$.post(url, {
username: getuser(),
password: getAPIKey(),
action: "gettasks"
}, function (resp) {
if (resp.status == "OK") {
var tasks = resp.tasks;
for (var i = 0; i < tasks.length; i++) {
tasklist.append(
'<div class="list-group-item">'
+ '<div class="d-flex w-100 justify-content-between">'
+ '<h5 class="mb-1"><i class="fas fa-' + tasks[i]['icon'] + ' fa-fw"></i> ' + tasks[i]['title'] + '</h5>'
+ '</div>'
+ '<p>' + tasks[i]['description'] + '</p>'
+ '</div>');
}
} else {
showmsg(resp.msg, "danger");
}
}, "json").fail(function () {
card.css("display", "none");
});
});