Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
ludotheque
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
18
Issues
18
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Denis S. Valdenaire
ludotheque
Commits
45514589
Commit
45514589
authored
Dec 25, 2015
by
Denis S. Valdenaire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes
#61
+ correction sur l'index
parent
5c79fb68
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
88 deletions
+94
-88
classes/loan.php
classes/loan.php
+1
-0
index.php
index.php
+1
-0
views/games/edit.html
views/games/edit.html
+67
-39
views/games/loans.html
views/games/loans.html
+25
-49
No files found.
classes/loan.php
View file @
45514589
...
...
@@ -54,6 +54,7 @@ class Loan extends Record {
public
static
function
fetch_loans
(
&
$loans
,
$id
)
{
// SQL SELECT loans members
$sql
=
" SELECT l.id, start_date, end_date, is_back, l.created_at, l.updated_at,
CASE WHEN (end_date < curdate() AND is_back = 0) THEN 1 ELSE 0 END AS is_late,
l.member_id, CONCAT(m.firstname, ' ', m.lastname) AS member_name
FROM loans l, members m
WHERE l.game_id =
$id
...
...
index.php
View file @
45514589
...
...
@@ -44,6 +44,7 @@ if($logged_user->id == 0) {
if
(
!
array_key_exists
(
"o"
,
$_REQUEST
)
||
$_REQUEST
[
"o"
]
==
""
||
!
file_exists
(
"controllers/"
.
$_REQUEST
[
"o"
]
.
".php"
))
{
$_REQUEST
[
"o"
]
=
"home"
;
$_REQUEST
[
"a"
]
=
"index"
;
}
}
$_REQUEST
[
"a"
]
=
(
array_key_exists
(
"a"
,
$_REQUEST
))
?
$_REQUEST
[
"a"
]
:
""
;
...
...
views/games/edit.html
View file @
45514589
...
...
@@ -11,17 +11,22 @@
{% if game.loan_id %}
INDISPONIBLE :
jusqu'au {{ game.loan_end_date | date("d/m/Y") }}
<span
class=
"btn btn-success btn-md"
style=
"float: right"
id=
"reservation_button"
>
<i
class=
"glyphicon glyphicon-plus"
></i>
<span>
Réserver...
</span>
</span>
<button
type=
"button"
class=
"btn btn-primary btn-md"
style=
"float: right; margin-right: 20px"
data-toggle=
"modal"
data-target=
"#editModal"
data-id=
"reservations"
>
<i
class=
"glyphicon glyphicon-plus"
></i>
<span>
Réserver...
</span>
</button>
{% else %}
DISPONIBLE
{% endif %}
</small>
<a
href=
"index.php?o=games&a=loans&i={{ game.id }}"
>
Historique des emprunts
</a>
<button
type=
"button"
class=
"btn btn-primary btn-md"
style=
"float: right; margin-right: 20px"
data-toggle=
"modal"
data-target=
"#editModal"
data-id=
"loans"
>
<i
class=
"glyphicon glyphicon-list"
></i>
<span>
Historique des emprunts
</span>
</button>
{% else %}
Nouveau jeu
{% endif %}
...
...
@@ -183,39 +188,62 @@
<!-- end of panel -->
</div>
</div>
<!-- edit modal skel -->
<div
class=
"modal fade"
id=
"editModal"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"editModalLabel"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
</div>
</div>
</div>
<!-- end edit modal -->
<script>
// buttons events
$
(
'
#save_button
'
).
click
(
function
(){
if
(
document
.
defaultform
.
name
.
value
==
0
)
{
alert
(
"
Vous n'avez pas saisi de nom !
"
);
return
false
;
}
if
(
$
(
'
#i
'
).
val
()
==
0
)
{
$
(
'
#a
'
).
val
(
'
create
'
);
}
else
{
$
(
'
#a
'
).
val
(
'
update
'
);
}
document
.
defaultform
.
submit
();
return
true
;
});
$
(
'
#delete_button
'
).
click
(
function
(){
var
msg
=
'
Voulez-vous réellement supprimer un jeu ?
\n
'
+
'
Cette action n
\'
est possible que si le jeu n
\'
a été
\n
'
+
'
l
\'
objet d
\'
aucun emprunt.
'
;
if
(
confirm
(
msg
))
{
$
(
'
#a
'
).
val
(
'
confirm_delete
'
);
document
.
defaultform
.
submit
();
}
});
$
(
'
#back_button
'
).
click
(
function
(){
// TODO this function should verify that the object has not been modified
// and if yes, ask for confirmation from the user.
window
.
location
.
href
=
'
index.php?o=games&a=list
'
;
});
$
(
'
#reservation_button
'
).
click
(
function
(){
$
(
'
#o
'
).
val
(
'
reservations
'
);
$
(
'
#a
'
).
val
(
'
new
'
);
document
.
defaultform
.
submit
();
$
(
document
).
ready
(
function
()
{
// buttons events
$
(
'
#save_button
'
).
click
(
function
(){
if
(
document
.
defaultform
.
name
.
value
==
0
)
{
alert
(
"
Vous n'avez pas saisi de nom !
"
);
return
false
;
}
if
(
$
(
'
#i
'
).
val
()
==
0
)
{
$
(
'
#a
'
).
val
(
'
create
'
);
}
else
{
$
(
'
#a
'
).
val
(
'
update
'
);
}
document
.
defaultform
.
submit
();
return
true
;
});
$
(
'
#delete_button
'
).
click
(
function
(){
var
msg
=
'
Voulez-vous réellement supprimer un jeu ?
\n
'
+
'
Cette action n
\'
est possible que si le jeu n
\'
a été
\n
'
+
'
l
\'
objet d
\'
aucun emprunt.
'
;
if
(
confirm
(
msg
))
{
$
(
'
#a
'
).
val
(
'
confirm_delete
'
);
document
.
defaultform
.
submit
();
}
});
$
(
'
#back_button
'
).
click
(
function
(){
// TODO this function should verify that the object has not been modified
// and if yes, ask for confirmation from the user.
window
.
location
.
href
=
'
index.php?o=games&a=list
'
;
});
$
(
'
#reservation_button
'
).
click
(
function
(){
$
(
'
#o
'
).
val
(
'
reservations
'
);
$
(
'
#a
'
).
val
(
'
new
'
);
document
.
defaultform
.
submit
();
});
$
(
"
#editModal
"
).
on
(
"
show.bs.modal
"
,
function
(
e
)
{
var
button
=
$
(
e
.
relatedTarget
);
if
(
button
.
data
(
'
id
'
)
==
'
loans
'
)
{
$
(
this
).
find
(
"
.modal-content
"
).
load
(
"
index.php?o=games&a=loans&i=
"
+
{{
game
.
id
}});
}
else
{
// reservation
$
(
this
).
find
(
"
.modal-content
"
)
.
load
(
"
index.php?o=games&a=reservations&i=
"
+
{{
game
.
id
}});
}
}).
on
(
"
hidden.bs.modal
"
,
function
(
e
)
{
$
(
this
).
find
(
"
.modal-content
"
).
empty
();
});
});
</script>
{% endblock %}
views/games/loans.html
View file @
45514589
{% extends "base.html" %}
{% block title %}Historique des emprunts{% endblock %}
{% block content %}
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h4>
<!-- class="panel-title" -->
<span
class=
"glyphicon glyphicon-knight"
style=
"margin-right: 10px"
></span>
{{ game.name }}
<small>
{% if game.loan_id %}
INDISPONIBLE :
jusqu'au {{ game.loan_end_date | date("d/m/Y") }}
<span
class=
"btn btn-success btn-md"
style=
"float: right"
id=
"reservation_button"
>
<i
class=
"glyphicon glyphicon-plus"
></i>
<span>
Réserver...
</span>
</span>
{% else %}
DISPONIBLE
{% endif %}
</small>
<a
href=
"index.php?o=games&a=loans&i={{ game.id }}"
>
Historique des emprunts
</a>
</h4>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<h4
class=
"modal-title"
id=
"myModalLabel"
>
<span
class=
"glyphicon glyphicon-list-alt"
style=
"margin-right: 10px;"
></span>
{{ game.name }} - Historique des emprunts
</h4>
</div>
<div
class=
"panel-body"
>
<table
id=
"object_list"
class=
"col-sm-12"
width=
"100%"
>
<div
class=
"modal-body"
>
<table
id=
"object_list"
width=
"100%"
>
<thead>
<tr>
<th>
Nom
</th>
<th>
Date emprunt
</th>
<th>
Date retour
</th>
<th>
Rendu
</th>
<th>
Actions
</th>
<th>
Adhérent
</th>
<th>
Date emprunt / retour
</th>
</tr>
</thead>
<tbody>
{% for key, val in game.loans %}
<tr>
<td><a
href=
"index.php?o=member&a=edit&i={{ val.member_id }}"
>
{{ val.member_name }}
</a>
{% if val.is_late %}
<span
class=
"label label-warning"
>
En retard
</span>
{% endif %}
</td>
<td>
{{ val.start_date | date("d/m/Y") }}
</td>
<td>
{{ val.end_date | date("d/m/Y") }}
</td>
<td><input
type=
"checkbox"
id=
"is_back_{{ val.id }}"
name=
"is_back_{{ val.id }}"
class=
"form-control is_back_cbx"
data-switch-with-ajax
{{
val.is_back
?
'
checked
'
}}
></td>
<td>
whatever...
<td><a
href=
"index.php?o=members&a=edit&i={{ val.member_id }}"
>
{{ val.member_name }}
</a>
{% if val.is_late %}
<span
class=
"label label-warning"
>
En retard
</span>
{% else %}
{% if val.is_back == 0 %}
<span
class=
"label label-success"
>
En cours
</span>
{% endif %}
{% endif %}
</td>
<td>
{{ val.start_date | date("d/m/Y") }} / {{ val.end_date | date("d/m/Y") }}
</td>
{% else %}
<tr>
<th
colspan=
"
5
"
>
<th
colspan=
"
2
"
>
<div
class=
"alert alert-warning"
role=
"alert"
>
Aucun emprunt
</div>
</th>
</tr>
...
...
@@ -57,13 +38,8 @@
</tbody>
</table>
<!-- end of panel -->
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
Close
</button>
</div>
</div>
<script>
$
(
'
#back_button
'
).
click
(
function
(){
window
.
location
.
href
=
'
index.php?o=games&a=list
'
;
});
</script>
{% endblock %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment