Commit 0460d0e0 authored by thejoelinux's avatar thejoelinux

changement de colonnes pour les jeux empruntes

parent 6b711e32
......@@ -80,10 +80,13 @@ class Game extends Record {
DATEDIFF(l.end_date, curdate())
ELSE
l.id
END AS loan_status
END AS loan_status,
m.id AS member_id,
CONCAT(m.firstname, ' ', m.lastname) AS member_name
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)
LEFT OUTER JOIN ".Member::$table." m ON (l.member_id = m.id)
$where_clause
ORDER BY g.name";
$GLOBALS["data"]->select($sql, $games, "Game");
......
......@@ -28,6 +28,7 @@
<th>Age max.</th>
<th>ESAR</th>
<th>Etat</th>
<th>Emprunteur</th>
<th>Actions</th>
</tr>
</thead>
......@@ -54,6 +55,7 @@
}
</style>
<script>
var table;
$(document).ready(function() {
$("#editModal").on("show.bs.modal", function(e) {
var button = $(e.relatedTarget);
......@@ -84,7 +86,7 @@ $(document).ready(function() {
}
);
var table = $('#list_games').DataTable({
table = $('#list_games').DataTable({
"autoWidth": false,
"dom": '<"filter_comp">frtlp',
"ajax": "api.php?o=games&a=list&dt_format=1",
......@@ -94,7 +96,7 @@ $(document).ready(function() {
"columnDefs": [
{
"targets": [1,2],
className: "text-center"
className: "text-center",
},{
"targets": [1,2,3],
"defaultContent": ''
......@@ -114,7 +116,17 @@ $(document).ready(function() {
}
}
},{
"targets": 5, // action
"targets": 5, // borrower
"render": function(data, type, row) {
if(row.loan_status !== null) {
return '<a href="index.php?o=members&a=edit&i=' + row.member_id
+ '">' + row.member_name + '</a>';
}
return '';
},
visible: false
},{
"targets": 6, // action
"render": function(data, type, row) {
var html = '<button type="button" class="btn btn-primary btn-xs edit_button" '
+ ' data-toggle="tooltip" title="Editer" '
......@@ -143,6 +155,7 @@ $(document).ready(function() {
{"data": "age_max"},
{"data": "label"},
{"data": "loan_status"},
{"data": "member_name"},
{"data": null}
],
"fnDrawCallback": function() {
......@@ -172,6 +185,10 @@ $(document).ready(function() {
+ '<option value="archived">Seulement les archivés</option></select>');
$(".toggle_row_display").on("change", function() {
var show_age = $(".toggle_row_display").val().indexOf("borrowed");
table.column(1).visible(show_age);
table.column(2).visible(show_age);
table.column(5).visible(!show_age);
table.draw();
});
}
......
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