Skip to content
Snippets Groups Projects
Commit 2d4e949a authored by Tim Repke's avatar Tim Repke
Browse files

colourcoding admin list

parent 4866834c
No related branches found
No related tags found
No related merge requests found
......@@ -182,8 +182,15 @@ class AdminListPage extends AdminPage {
$(document).ready(function(){
ltab = $("#mlist").DataTable({
"rowCallback": function (row, data, index) {
if (data['.$buttoncol.'].split(",")[2] != 0) {
var spl = data['.$buttoncol.'].split(",");
if (spl[2] != 0) {
$("td", row).addClass("list-backstepped");
} else if (spl[0] != 0 && spl[1] != 0) {
$("td", row).addClass("list-repaid");
} else if (spl[0] != 0) {
$("td", row).addClass("list-paid");
} else if (spl[0] == 0) {
$("td", row).addClass("list-unpaid");
}
},
"columnDefs": [
......@@ -242,15 +249,35 @@ class AdminListPage extends AdminPage {
var newstate = (((state-1)<0) ? 1 : 0);
$.get("index.php?page=list&ajax=ajax&update="+type+"&hash="+hash+"&nstate="+newstate ,"",
function(){
if(newstate === 1 && type === "backstepped") {
$("td", $(that).parent().parent()).addClass("list-backstepped");
} else {
$("td", $(that).parent().parent()).removeClass("list-backstepped");
}
that.className="btn btn-"+type+"-"+newstate;
that.setAttribute("onclick", "btnclick(this, \'"+type+"\', \'"+hash+"\', "+newstate+")");
var p = $("div", $(that).parent())[0].className;
var r = $("div", $(that).parent())[1].className;
var b = $("div", $(that).parent())[2].className;
if (b == "btn btn-backstepped-1") {
updateClass(that, "list-backstepped");
} else if (p == "btn btn-paid-1" && r == "btn btn-repaid-1") {
updateClass(that, "list-repaid");
} else if (p == "btn btn-paid-1") {
updateClass(that, "list-paid");
} else if (p == "btn btn-paid-0") {
updateClass(that, "list-unpaid");
} else {
updateClass(that);
}
});
}
function updateClass(that, nClass = null) {
$("td", $(that).parent().parent()).removeClass("list-backstepped")
.removeClass("list-repaid")
.removeClass("list-paid")
.removeClass("list-unpaid");
if(nClass != null)
$("td", $(that).parent().parent()).addClass(nClass);
}
</script>';
}
......
......@@ -63,11 +63,21 @@ form table tr td{
padding: 0 5px;
}
.list-backstepped{
.list-backstepped, .list-backstepped a {
color: #d3d3d3 !important;
}
.list-backstepped a{
color: #d3d3d3 !important;
.list-unpaid, .list-unpaid a {
background-color: #ffc6c1;
}
.list-paid, .list-paid a {
background-color: #e5ffc7;
}
.list-repaid, .list-repaid a {
background-color: #1bffbe;
color: grey !important;
}
.cost-table{
padding: 5px;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment