Add QC shifts, add proper icon, check for app permissions, adjust styles, fix UI bugs, prepare login UI for quick access mode
41 lines
1.6 KiB
JavaScript
41 lines
1.6 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_qwikclock_myshifts").each(function () {
|
|
var card = $(this);
|
|
$(this).find(".card_title").prepend("Shifts | ");
|
|
var shiftbox = $(this).find(".shift-box");
|
|
var shifttable = $(this).find(".shift-table");
|
|
var url = $(this).data("apiurl");
|
|
$.post(url, {
|
|
username: getuser(),
|
|
password: getAPIKey(),
|
|
action: "getassignedshifts"
|
|
}, function (resp) {
|
|
if (resp.status == "OK") {
|
|
var shifts = resp.shifts;
|
|
if (shifts.length > 0) {
|
|
shifttable.html('<thead><tr><th>Shift</th><th><i class="fas fa-play d-sm-none d-lg-inline"></i> Start</th><th><i class="fas fa-stop d-sm-none d-lg-inline"></i> End</th><th><i class="far fa-calendar-alt d-sm-none d-lg-inline"></i> Days</th></tr></thead>');
|
|
shifttable.append("<tbody>");
|
|
for (var shift in shifts) {
|
|
var days = "";
|
|
for (var day in shifts[shift]["day_list"]) {
|
|
days += " " + shifts[shift]["day_list"][day];
|
|
}
|
|
days = days.trim();
|
|
shifttable.append('<tr><td>' + shifts[shift]['shiftname'] + '</td><td>' + shifts[shift]['start_f'] + '</td><td>' + shifts[shift]['end_f'] + '</td><td>' + days + '</td></tr>');
|
|
}
|
|
shifttable.append("</tbody>");
|
|
} else {
|
|
shifttable.html('<div class="alert alert-primary"><i class="fas fa-info-circle"></i> No shifts assigned.</div>');
|
|
}
|
|
} else {
|
|
showmsg(resp.msg, "danger");
|
|
}
|
|
}, "json").fail(function () {
|
|
card.css("display", "none");
|
|
});
|
|
}); |