Commit b56ce370 authored by thejoelinux's avatar thejoelinux

selecteur pour ne voir que les jeux en retard

parent 6e61c1db
......@@ -75,7 +75,11 @@ class Game extends Record {
// SQL SELECT lud_games lud_esar_categories lud_loans
$sql = "SELECT g.id, g.name, g.age_min, g.age_max,
CONCAT (ec.label, ' - ', ec.name) AS label, g.archived,
l.id as loan_status
CASE WHEN l.end_date < curdate()
THEN -1
ELSE
l.id
END AS loan_status
FROM ".Game::$table." g
LEFT OUTER JOIN ".Esar_Category::$table." ec ON g.esar_category_id = ec.id
LEFT OUTER JOIN ".Loan::$table." l ON (g.id = l.game_id AND l.is_back = 0)
......
......@@ -58,6 +58,8 @@ $(document).ready(function() {
return (archived == 1);
} else if(show === "borrowed") {
return (borrowed !== null);
} else if(show === "borrowedlate") {
return (borrowed == -1);
} else {
return true;
}
......@@ -83,6 +85,9 @@ $(document).ready(function() {
"defaultContent": 'Disponible',
"render": function(data, type, row) {
if(row.loan_status !== null) {
if(row.loan_status == -1) {
return 'En retard';
}
return 'Emprunté';
}
}
......@@ -141,6 +146,7 @@ $(document).ready(function() {
$("div.filter_comp").html('<select class="toggle_row_display pull-left" style="margin-top: 5px">'
+ '<option value="all">Tous sauf archivés</option>'
+ '<option value="borrowed">Seulement les empruntés</option>'
+ '<option value="borrowedlate">Seulement les empruntés en retard</option>'
+ '<option value="archived">Seulement les archivés</option></select>');
$(".toggle_row_display").on("change", function() {
......
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