Commit 0460d0e0 authored by Denis S. Valdenaire's avatar Denis S. Valdenaire

changement de colonnes pour les jeux empruntes

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