Commit 1eb8934b authored by Denis S. Valdenaire's avatar Denis S. Valdenaire

fin templating des listes simples

parent d9e20a27
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">
<span class="glyphicon glyphicon-list-alt" style="margin-right: 10px;" ></span>
{% if object.id %} Catégorie ESAR : {{ object.name }} {% else %} Nouvelle catégorie ESAR {% endif %}
</h4>
</div>
<div class="modal-body">
{% extends 'modal.html' %}
{% block modal_title %}
{% if object.id %} Catégorie ESAR : {{ object.name }} {% else %} Nouvelle catégorie ESAR {% endif %}
{% endblock %}
{% block modal_body %}
<div class="form-group">
<label class="control-label col-sm-2" for="name">Nom</label>
<div class="col-sm-4">
......@@ -18,48 +13,9 @@
<input type="text" id="label" name="label" class="form-control" value="{{ object.label }}"/>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
{% if object.id != 0 %}
<input type="hidden" id="esar_category_id" value="{{ object.id }}">
<input type="submit" class="btn btn-success" id="save_button" value="Enregistrer les changements">
<input type="button" class="btn btn-danger" id="delete_button" value="Supprimer">
{% else %}
<input type="hidden" id="esar_category_id" value="0">
<input type="button" class="btn btn-success" id="save_button" value="Créer">
{% endif %}
</div>
</div>
<!-- end of panel -->
</div>
</div>
<script>
// buttons events
$('#save_button').click(function(){
if(document.defaultform.name.value == 0) {
alert ("Vous n'avez pas saisi de nom !");
return false;
}
if($('#esar_category_id').val() == 0) {
$('#a').val('create');
} else {
$('#i').val($('#esar_category_id').val());
$('#a').val('update');
}
document.defaultform.submit();
return true;
});
$('#delete_button').click(function(){
{% endblock %}
{% block javascript_msg %}
var msg = 'Voulez-vous réellement supprimer cette catégorie ?\n' +
'Cette action n\'est possible que si celle-ci n\'a pas été\n' +
'utilisée pour la classification d\'un jeu.';
if(confirm(msg)) {
$('#a').val('delete');
document.defaultform.submit();
}
});
</script>
{% endblock %}
<div class="panel panel-default">
<div class="panel-heading">
<h4>
<span class="glyphicon glyphicon-user" style="margin-right: 10px" ></span>
{% if object.id %} Adhésion : {{ object.name }} {% else %} Nouveau type d'adhésion {% endif %}
</h4>
</div>
<div class="panel-body">
{% extends 'modal.html' %}
{% block modal_title %}
{% if object.id %} Adhésion : {{ object.name }} {% else %} Nouveau type d'adhésion {% endif %}
{% endblock %}
{% block modal_body %}
<div class="form-group">
<label class="control-label col-sm-2" for="name">Nom</label>
<div class="col-sm-4">
......@@ -23,49 +19,9 @@
<textarea id="description" name="description" class="form-control" rows="4">{{ object.description }}</textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-12" align="center">
<input type="button" class="btn btn-primary" id="back_button" value="&lt;&lt; Retour à la liste">
{% if object.id %}
<input type="submit" class="btn btn-success" id="save_button" value="Enregistrer les changements">
<input type="button" class="btn btn-danger" id="delete_button" value="Supprimer">
{% else %}
<input type="button" class="btn btn-success" id="save_button" value="Créer">
{% endif %}
</div>
</div>
<!-- end of panel -->
</div>
</div>
<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(){
{% endblock %}
{% block javascript_msg %}
var msg = 'Voulez-vous réellement supprimer ce type d\'adhésion ?\n' +
'Cette action n\'est possible que si ce type n\'a été\n' +
'utilisé pour l\'inscription d\'un adhérent.';
if(confirm(msg)) {
$('#a').val('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=membership_types&a=list';
});
</script>
{% endblock %}
{% extends "base.html" %}
{% block title %}Catégories ESAR{% endblock %}
{% block content %}
<div class="panel panel-default">
<div class="panel-heading">
<span style="font-size: 150%;" class="glyphicon glyphicon-user"></span>
<span style="font-size: 150%; font-weight: bold">
<span style="font-size: 150%;" class="glyphicon glyphicon-user"></span>
<span style="font-size: 150%; font-weight: bold">
Types d'adhésion
</span>
</span>
<span class="btn btn-success btn-md" style="float: right" id="new_button">
<i class="glyphicon glyphicon-plus"></i>
<span>Nouveau type</span>
</span>
<button type="button" class="btn btn-success btn-md" style="float: right"
data-toggle="modal" data-target="#editModal" data-id="0">
<i class="glyphicon glyphicon-plus"></i>
<span>Nouveau type...</span>
</button>
</div>
</div>
<div class="panel-body">
{% include 'ihm_messages.html' %}
<div class="col-sm-12" align="center">
<table id="membership_types_list" class="col-sm-12" width="100%">
<thead>
<tr>
<th width="">Nom</th>
<th>Description</th>
<th>Tarif</th>
<th>Actions</th>
</tr>
</thead>
<table id="object_list" style="display:none">
<thead>
<tr>
<th>Nom</th>
<th>Description</th>
<th>Tarif</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for key, val in objects %}
<tr>
<tr>
<th>{{ val.name }}</th>
<td>{{ val.description }}</td>
<td>{{ val.price }}</td>
<td align="center">
<a href="index.php?o=membership_types&a=edit&i={{ val.id }}">
<button type="button" class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
</a>
<a onClick="if(confirm('Êtes vous sur ?')) { $('#a').val('delete'); $('#i').val('{{ val.id }}'); defaultform.submit()}" href="#">
<button type="button" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</a>
</td>
<td align="center">
<button type="button" class="btn btn-success btn-xs"
data-toggle="modal" data-target="#editModal" data-id="{{ val.id }}">
<i class="glyphicon glyphicon-edit"></i>
</button>
<a href="#" onClick="if(confirm('Êtes vous sur ?')) { $('#a').val('delete'); $('#i').val('{{ val.id }}'); defaultform.submit()}" href="#">
<button type="button" class="btn btn-danger btn-xs">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="4">Aucun type d'adhésion trouvée</td>
<tr>
<td colspan="4">
Aucun type d'adhésion trouvée
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- 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>
$(document).ready(function() {
$('#new_button').click(function(){
$('#a').val('new');
defaultform.submit();
$('#object_list').DataTable({
"autoWidth": false,
"fnDrawCallback": function() {
$(this).show();
}
});
$("#editModal").on("show.bs.modal", function(e) {
var button = $(e.relatedTarget);
if(button.data('id') == 0) {
$(this).find(".modal-content").load("index.php?o=" + $('#o').val() + "&a=new");
} else {
$(this).find(".modal-content").load("index.php?o=" + $('#o').val() + "&a=edit&i=" + button.data('id'));
}
}).on("hidden.bs.modal", function(e) {
$(this).find(".modal-content").empty();
});
});
/* FIXME : translation of the table
see https://datatables.net/plug-ins/i18n/French
*/
</script>
{% endblock %}
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">
<span class="glyphicon glyphicon-list-alt" style="margin-right: 10px;" ></span>
{% block modal_title %}{% endblock %}
</h4>
</div>
<div class="modal-body">
{% block modal_body %}{% endblock %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
{% if object.id != 0 %}
<input type="hidden" id="modal_object_id" value="{{ object.id }}">
<input type="submit" class="btn btn-success" id="save_button" value="Enregistrer les changements">
<input type="button" class="btn btn-danger" id="delete_button" value="Supprimer">
{% else %}
<input type="hidden" id="modal_object_id" value="0">
<input type="button" class="btn btn-success" id="save_button" value="Créer">
{% endif %}
</div>
</div>
<!-- end of panel -->
</div>
</div>
<script>
// buttons events
$('#save_button').click(function(){
if(document.defaultform.name.value == 0) {
alert ("Vous n'avez pas saisi de nom !");
return false;
}
if($('#modal_object_id').val() == 0) {
$('#a').val('create');
} else {
$('#i').val($('#modal_object_id').val());
$('#a').val('update');
}
document.defaultform.submit();
return true;
});
$('#delete_button').click(function(){
{% block javascript_msg %}{% endblock %}
if(confirm(msg)) {
$('#a').val('delete');
document.defaultform.submit();
}
});
</script>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">
<span class="glyphicon glyphicon-list-alt" style="margin-right: 10px;" ></span>
{% if object.id %} Méthode de paiement : {{ object.name }} {% else %} Nouvelle méthode de paiement {% endif %}
</h4>
</div>
<div class="modal-body">
{% extends 'modal.html' %}
{% block modal_title %}
{% if object.id %} Méthode de paiement : {{ object.name }} {% else %} Nouvelle méthode de paiement {% endif %}
{% endblock %}
{% block modal_body %}
<div class="form-group">
<label class="control-label col-sm-2" for="name">Nom</label>
<div class="col-sm-10">
......@@ -20,48 +15,9 @@
<textarea id="description" name="description" class="form-control" rows="4">{{ object.description }}</textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
{% if object.id != 0 %}
<input type="hidden" id="paiement_method_id" value="{{ object.id }}">
<input type="submit" class="btn btn-success" id="save_button" value="Enregistrer les changements">
<input type="button" class="btn btn-danger" id="delete_button" value="Supprimer">
{% else %}
<input type="hidden" id="paiement_method_id" value="0">
<input type="button" class="btn btn-success" id="save_button" value="Créer">
{% endif %}
</div>
</div>
<!-- end of panel -->
</div>
</div>
<script>
// buttons events
$('#save_button').click(function(){
if(document.defaultform.name.value == 0) {
alert ("Vous n'avez pas saisi de nom !");
return false;
}
if($('#paiement_method_id').val() == 0) {
$('#a').val('create');
} else {
$('#i').val($('#paiement_method_id').val());
$('#a').val('update');
}
document.defaultform.submit();
return true;
});
$('#delete_button').click(function(){
{% endblock %}
{% block javascript_msg %}
var msg = 'Voulez-vous réellement supprimer cette méthode de paiement ?\n' +
'Cette action n\'est possible que si cette méthode n\'a pas été\n' +
'utilisée pour l\'inscription d\'un adhérent.';
if(confirm(msg)) {
$('#a').val('delete');
document.defaultform.submit();
}
});
</script>
{% endblock %}
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