Commit 5cd5e736 by Félicie

deleted function

parent 415927be
Pipeline #1883 failed with stage
in 1 minute 25 seconds
......@@ -339,6 +339,11 @@ def get_makeups_members(request):
res = CagetteMembers.get_makeups_members()
return JsonResponse({ 'res' : res })
def get_attached_members(request):
""" Récupération des membres en binôme """
res = CagetteMembers.get_attached_members()
return JsonResponse({ 'res' : res })
def update_members_makeups(request):
""" Met à jour les rattrapages des membres passés dans la requête """
res = {}
......@@ -431,7 +436,6 @@ def get_member_info(request,coop_id):
'parent_id',
'is_associated_people',
'parent_name',
'barcode_base',
"makeups_to_do"
]
member = api.search_read('res.partner', [['barcode_base', '=', coop_id]], fields)
......@@ -551,3 +555,8 @@ def delete_pair(request):
return response
else:
return JsonResponse({"message": "Method Not Allowed"}, status=405)
def get_attached_members(request):
""" Récupération des membres qui doivent faire des rattrapages """
res = CagetteMembers.get_attached_members()
return JsonResponse({ 'res' : res })
......@@ -1093,6 +1093,14 @@ class CagetteMembers(models.Model):
res = api.search_read('res.partner', cond, fields)
return res
@staticmethod
def get_attached_members():
api = OdooAPI()
cond = [['is_associated_people','=', True]]
fields = ['id', 'name', 'parent_name']
res = api.search_read('res.partner', cond, fields)
return res
class CagetteServices(models.Model):
"""Class to handle cagette Odoo services."""
......
......@@ -72,6 +72,16 @@
margin: 1rem;
}
/* Attached members table */
.table_area {
margin-top: 20px;
}
#table_top_area {
display: flex;
justify-content: space-between;
}
/* -- Tiles */
.tiles_container {
......
......@@ -52,7 +52,6 @@ function ready_for_submission() {
}
}
/**
* Display member info
*/
......@@ -73,7 +72,110 @@ function display_member_infos(divId, memberData) {
}
}
/**
* Load attached members
*/
function load_attached_members() {
console.log(get_attached_members)
$.ajax({
type: 'GET',
url: "/members/get_attached_members",
dataType:"json",
traditional: true,
contentType: "application/json; charset=utf-8",
success: function(data) {
attached_members = data.res;
display_attached_members();
},
error: function(data) {
err = {msg: "erreur serveur lors de la récupération des membres avec rattrapage", ctx: 'load_makeups_members'};
if (typeof data.responseJSON != 'undefined' && typeof data.responseJSON.error != 'undefined') {
err.msg += ' : ' + data.responseJSON.error;
}
report_JS_error(err, 'orders');
closeModal();
alert('Erreur serveur lors de la récupération des membres avec rattrapage. Ré-essayez plus tard.');
}
});
}
/**
* Display table of attached members
*/
function display_attached_members() {
if (attached_members_table) {
$('#attached_members_table').off();
attached_members_table.clear().destroy();
$('#attached_members_table').empty();
}
attached_members_table = $('#attached_members_table').DataTable({
data: attached_members,
columns: [
{
data: "id",
title: '',
className: "dt-body-center",
orderable: false,
render: function (data) {
return `<input type="checkbox" class="select_member_cb" id="select_member_${data}" value="${data}">`;
},
width: "3%"
},
{
data: "parent_name",
title: "Nom du titulaire"
},
{
data: "name",
title: "en binôme avec",
}
],
aLengthMenu: [
[
25,
50,
-1
],
[
25,
50,
"Tout"
]
],
iDisplayLength: 25,
oLanguage: {
"sProcessing": "Traitement en cours...",
"sSearch": "Rechercher dans le tableau",
"sLengthMenu": "Afficher _MENU_ &eacute;l&eacute;ments",
"sInfo": "Affichage de l'&eacute;l&eacute;ment _START_ &agrave; _END_ sur _TOTAL_ &eacute;l&eacute;ments",
"sInfoEmpty": "Affichage de l'&eacute;l&eacute;ment 0 &agrave; 0 sur 0 &eacute;l&eacute;ment",
"sInfoFiltered": "(filtr&eacute; de _MAX_ &eacute;l&eacute;ments au total)",
"sInfoPostFix": "",
"sLoadingRecords": "Chargement en cours...",
"sZeroRecords": "Aucun &eacute;l&eacute;ment &agrave; afficher",
"sEmptyTable": "Aucune donn&eacute;e disponible dans le tableau",
"oPaginate": {
"sFirst": "Premier",
"sPrevious": "Pr&eacute;c&eacute;dent",
"sNext": "Suivant",
"sLast": "Dernier"
},
"oAria": {
"sSortAscending": ": activer pour trier la colonne par ordre croissant",
"sSortDescending": ": activer pour trier la colonne par ordre d&eacute;croissant"
},
"select": {
"rows": {
"_": "%d lignes séléctionnées",
"0": "Aucune ligne séléctionnée",
"1": "1 ligne séléctionnée"
}
}
}
});
}
$(document).ready(function() {
......
......@@ -64,4 +64,5 @@ urlpatterns = [
url(r'^update_members_makeups$', admin.update_members_makeups),
url(r'^delete_shift_registration$', admin.delete_shift_registration),
url(r'^get_member_info/(\d+)$', admin.get_member_info),
url(r'^get_attached_members$', admin.get_attached_members),
]
......@@ -60,13 +60,9 @@
</div>
</div>
<div class="create_pair_button">
<button id="createPair" type="button" name="button" disabled>Créer le binôme</button>
</div>
<div class="create_pair_button">
<button id="createPair" type="button" name="button" disabled>Créer le binôme</button>
</div>
<div class="tile">
<div class="search_member_form_area" id="search_member_form_area">
<h4>Rechercher le.a coopérateur.ice suppléant.e</h4>
......@@ -98,8 +94,6 @@
<span class="member_associated_partner member_info"></span>
</div>
</div>
</div>
</div>
</div>
</div>
......
......@@ -27,23 +27,12 @@
<div class="page_content">
<div id="search_member_area">
<div id="search_member_form_area">
<h4>Rechercher le.a coopérateur.ice attaché.e au binôme</h4>
<form id="search_member_form" action="javascript:;" method="post">
<input type="text" id="search_member_input" value="" placeholder="Nom ou numéro du coop..." required>
<button type="submit" class="btn--primary" id="search_member_button">Recherche</button>
</form>
</div>
</div>
<div class="search_member_results_area" style="display:none;">
<div class="search_results_text">
<p><i>Choisissez parmi les membres trouvés :</i></p>
</div>
<div class="search_member_results"></div>
</div>
<div id="subheader">
<h4>Liste des membres en binômes</h4>
</div>
<div class="table_area">
<table id="attached_members_table" class="display" cellspacing="0" width="100%"></table>
</div>
</div>
</div>
......
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