2017-12-16 13:54:00 -07:00
|
|
|
/* 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/. */
|
|
|
|
|
2017-12-16 13:38:20 -07:00
|
|
|
function addPerson(p) {
|
|
|
|
p = p.trim();
|
|
|
|
if (p == "") {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ($("#peoplelist div[data-user=" + p + "]").length) {
|
|
|
|
$("#peoplelist .list-group-item[data-user=" + p + "]").animate({
|
|
|
|
backgroundColor: "#ff0000",
|
|
|
|
}, 500, "linear", function () {
|
|
|
|
$("#peoplelist .list-group-item[data-user=" + p + "]").animate({
|
|
|
|
backgroundColor: "#ffffff",
|
|
|
|
}, 500);
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
}
|
2018-01-28 23:54:27 -07:00
|
|
|
$('#peoplelist').append("<div class=\"list-group-item\" data-user=\"" + p + "\">" + p + "<div class=\"btn btn-danger btn-sm float-right rmperson\"><i class=\"fas fa-trash\"></i></div><input type=\"hidden\" name=\"employees[]\" value=\"" + p + "\" /></div>");
|
2017-12-16 13:38:20 -07:00
|
|
|
$("#people-box").val("");
|
|
|
|
}
|
|
|
|
|
|
|
|
function removePerson(p) {
|
|
|
|
$("#peoplelist div[data-user=" + p + "]").remove();
|
|
|
|
}
|
|
|
|
|
2017-11-13 16:39:13 -07:00
|
|
|
$("#selectmanagerbtn").click(function () {
|
|
|
|
document.location.href = "app.php?page=managers&man=" + $("#manager-box").val();
|
|
|
|
});
|
|
|
|
|
2019-01-02 23:52:41 -07:00
|
|
|
$("#people-box").on("change", function (event) {
|
|
|
|
addPerson($("#people-box").val());
|
2017-10-10 20:20:30 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
$("#addpersonbtn").click(function () {
|
|
|
|
addPerson($("#people-box").val());
|
|
|
|
});
|
|
|
|
|
2017-11-13 16:26:29 -07:00
|
|
|
$('#peoplelist').on("click", ".rmperson", function () {
|
|
|
|
removePerson($(this).parent().data("user"));
|
|
|
|
});
|