Commit fd175fdf authored by thejoelinux's avatar thejoelinux

nombre de jours sur les jeux en retard

parent b56ce370
......@@ -76,7 +76,8 @@ class Game extends Record {
$sql = "SELECT g.id, g.name, g.age_min, g.age_max,
CONCAT (ec.label, ' - ', ec.name) AS label, g.archived,
CASE WHEN l.end_date < curdate()
THEN -1
THEN
DATEDIFF(l.end_date, curdate())
ELSE
l.id
END AS loan_status
......
......@@ -59,7 +59,7 @@ $(document).ready(function() {
} else if(show === "borrowed") {
return (borrowed !== null);
} else if(show === "borrowedlate") {
return (borrowed == -1);
return (borrowed <= -1);
} else {
return true;
}
......@@ -85,8 +85,10 @@ $(document).ready(function() {
"defaultContent": 'Disponible',
"render": function(data, type, row) {
if(row.loan_status !== null) {
if(row.loan_status == -1) {
return 'En retard';
if(row.loan_status <= -1) {
return '<span style="margin:0.25em;" '
+ ' class="label label-danger">En retard de '
+ (0 - row.loan_status) + ' jour(s)</span>';
}
return 'Emprunté';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment