Commit c66994cf by Damien Moulard

Merge branch '2865-email-bdm-deletion' into 'dev_cooperatic'

2865-email-bdm-deletion

See merge request !158
parents 74b6522d 2e1ed9bb
Pipeline #2125 passed with stage
in 1 minute 46 seconds
...@@ -556,8 +556,11 @@ def get_member_info(request, id): ...@@ -556,8 +556,11 @@ def get_member_info(request, id):
member = member[0] member = member[0]
parent = None parent = None
if member['parent_id']: if member['parent_id']:
parent = api.search_read('res.partner', [['id', '=', int(member['parent_id'][0])]], ['barcode_base'])[0] res_parent = api.search_read('res.partner', [['id', '=', int(member['parent_id'][0])]], ['barcode_base', 'email'])
if res_parent:
parent = res_parent[0]
member['parent_barcode_base'] = parent['barcode_base'] member['parent_barcode_base'] = parent['barcode_base']
member['parent_email'] = parent['email']
res['member'] = member res['member'] = member
response = JsonResponse(res) response = JsonResponse(res)
else: else:
...@@ -804,8 +807,3 @@ def delete_pair(request): ...@@ -804,8 +807,3 @@ def delete_pair(request):
return response return response
else: else:
return JsonResponse({"message": "Method Not Allowed"}, status=405) 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 })
...@@ -118,5 +118,19 @@ ...@@ -118,5 +118,19 @@
} }
/* Modale */ /* Modale */
.attached-members .member div {width: 50px; display: inline-block;} .attached-members .member div {width: 50px; display: inline-block; margin: 1rem 0;}
.attached-members .member div.name {width: 80%;} .attached-members .member div.name {width: 100%; position: relative;}
\ No newline at end of file .attached-members .member div.select_after_unattached_state {
position: absolute;
right:5rem;
top:0;
bottom:0;
margin: 0;
display:flex;
justify-content: center ;
align-items: center;
}
.attached-members .member .after_unattached_state {
cursor: pointer;
}
\ No newline at end of file
...@@ -4,6 +4,9 @@ var childId = null; ...@@ -4,6 +4,9 @@ var childId = null;
var parentName = null; var parentName = null;
var childName = null; var childName = null;
var parentEmail = null;
var childEmail = null;
const possible_cooperative_state = { const possible_cooperative_state = {
suspended: "Rattrapage", suspended: "Rattrapage",
exempted: "Exempté.e", exempted: "Exempté.e",
...@@ -237,6 +240,14 @@ function confirmDeletion(childId) { ...@@ -237,6 +240,14 @@ function confirmDeletion(childId) {
modalContent.find("#parentName").text(parentName); modalContent.find("#parentName").text(parentName);
modalContent.find("#childName").text(childName); modalContent.find("#childName").text(childName);
if (parentEmail != false) {
modalContent.find("#parentEmail").text(parentEmail)
}
if (childEmail != false) {
modalContent.find("#childEmail").text(childEmail)
}
modalContent = modalContent.html(); modalContent = modalContent.html();
openModal(modalContent, () => { openModal(modalContent, () => {
if (is_time_to('delete_pair')) { if (is_time_to('delete_pair')) {
...@@ -438,8 +449,14 @@ $(document).ready(function() { ...@@ -438,8 +449,14 @@ $(document).ready(function() {
traditional: true, traditional: true,
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
success: function(data) { success: function(data) {
if (data.member.parent_barcode_base !== undefined) {
parentName = data.member.parent_barcode_base + ' - ' + data.member.parent_name; parentName = data.member.parent_barcode_base + ' - ' + data.member.parent_name;
} else {
parentName = data.member.parent_name;
}
parentEmail = data.member.parent_email;
childName = data.member.barcode_base + ' - ' + data.member.name; childName = data.member.barcode_base + ' - ' + data.member.name;
childEmail = data.member.email;
confirmDeletion(childId); confirmDeletion(childId);
}, },
error: function(data) { error: function(data) {
......
...@@ -18,16 +18,28 @@ ...@@ -18,16 +18,28 @@
<div id="confirmModal"> <div id="confirmModal">
<h3>Le binôme est sur le point d'être désolidarisé</h3> <h3>Le binôme est sur le point d'être désolidarisé</h3>
<br /> <br />
Êtes-vous sûr.e de vouloir désolidariser :
<div> <div>
Êtes-vous sur de vouloir désolidariser
<div class="attached-members"> <div class="attached-members">
<div class="member"> <div class="member">
<div class="name"><strong><span id="parentName"></span></strong> (titulaire)</div> <div class="name">
<div><input type="checkbox" name="parent_gone" class="after_unattached_state" /></div> <strong><span id="parentName"></span></strong> (titulaire)<br />
<i><span id="parentEmail"></span></i>
<div class="select_after_unattached_state">
<input type="checkbox" name="parent_gone" class="after_unattached_state" />
</div>
</div>
</div> </div>
et
<div class="member"> <div class="member">
<div class="name"><strong><span id="childName"></span></strong></div> <div class="name">
<div><input type="checkbox" name="child_gone" class="after_unattached_state" /></div> <strong><span id="childName"></span></strong><br />
<i><span id="childEmail"></span></i>
<div class="select_after_unattached_state">
<input type="checkbox" name="child_gone" class="after_unattached_state" />
</div>
</div>
</div> </div>
</div> </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