Add QC shifts, add proper icon, check for app permissions, adjust styles, fix UI bugs, prepare login UI for quick access mode
53 lines
1.4 KiB
JavaScript
53 lines
1.4 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_punchinout").each(function () {
|
|
var card = $(this);
|
|
var url = $(this).data("apiurl");
|
|
$.post(url, {
|
|
username: getuser(),
|
|
password: getAPIKey(),
|
|
action: "ping"
|
|
}, function (resp) {
|
|
// We didn't get a 403
|
|
}, "json").fail(function () {
|
|
card.css("display", "none");
|
|
});
|
|
});
|
|
|
|
$(".card_qwikclock_punchinout").on("click", ".start_btn", function () {
|
|
var parent = $(this).parents(".card_app");
|
|
var url = parent.data("apiurl");
|
|
console.log(url + " " + getuser());
|
|
$.post(url, {
|
|
username: getuser(),
|
|
password: getAPIKey(),
|
|
action: "punchin"
|
|
}, function (resp) {
|
|
if (resp.status == "OK") {
|
|
showmsg(resp.msg, "success");
|
|
} else {
|
|
showmsg(resp.msg, "danger");
|
|
}
|
|
}, "json");
|
|
});
|
|
|
|
$(".card_qwikclock_punchinout").on("click", ".stop_btn", function () {
|
|
var parent = $(this).parents(".card_app");
|
|
var url = parent.data("apiurl");
|
|
console.log(url + " " + getuser());
|
|
$.post(url, {
|
|
username: getuser(),
|
|
password: getAPIKey(),
|
|
action: "punchout"
|
|
}, function (resp) {
|
|
if (resp.status == "OK") {
|
|
showmsg(resp.msg, "success");
|
|
} else {
|
|
showmsg(resp.msg, "danger");
|
|
}
|
|
}, "json");
|
|
}); |