Commit 90a84df1 by Damien Moulard

Merge branch…

Merge branch '3880-3881-explication-ajout-suppression-rattrapage-depuis-gestion-des-rattrapages' into 'dev_cooperatic'

give explanation when you add or delete makeup and display it point movements screen in odoo

See merge request !205
parents c029066b 76290dbe
Pipeline #2441 passed with stage
in 1 minute 26 seconds
...@@ -400,7 +400,7 @@ def update_members_makeups(request): ...@@ -400,7 +400,7 @@ def update_members_makeups(request):
points_update = points_diff points_update = points_diff
data = { data = {
'name': "Modif manuelle des rattrapages depuis l'admin BDM", 'name': "Admin BDM - " + member_data["description"],
'shift_id': False, 'shift_id': False,
'type': member_data["member_shift_type"], 'type': member_data["member_shift_type"],
'partner_id': int(member_data["member_id"]), 'partner_id': int(member_data["member_id"]),
......
...@@ -169,10 +169,18 @@ function display_makeups_members() { ...@@ -169,10 +169,18 @@ function display_makeups_members() {
const member = makeups_members.find(m => m.id == member_id); const member = makeups_members.find(m => m.id == member_id);
let modal_template = $("#modal_decr_makeup_counter");
modal_template.find(".member_name").text(member.name);
openModal( openModal(
`Enlever un rattrapage à ${member.name} ?`, modal_template.html(),
() => { () => {
update_members_makeups([member_id], "decrement"); update_members_makeups(
[member_id],
"decrement",
($("#decr-signature")[0].value || "auteur inconnu") + ' : ' + ($("#decr-explanation")[0].value || "pas d'explication")
);
}, },
"Confirmer", "Confirmer",
false false
...@@ -186,10 +194,18 @@ function display_makeups_members() { ...@@ -186,10 +194,18 @@ function display_makeups_members() {
const member = makeups_members.find(m => m.id == member_id); const member = makeups_members.find(m => m.id == member_id);
let modal_template = $("#modal_incr_makeup_counter");
modal_template.find(".member_name").text(member.name);
openModal( openModal(
`Ajouter un rattrapage à ${member.name} ?`, modal_template.html(),
() => { () => {
update_members_makeups([member_id], "increment"); update_members_makeups(
[member_id],
"increment",
($("#incr-signature")[0].value || "auteur inconnu") + ' : ' + ($("#incr-explanation")[0].value || "pas d'explication")
);
}, },
"Confirmer", "Confirmer",
false false
...@@ -217,9 +233,13 @@ function display_makeups_members() { ...@@ -217,9 +233,13 @@ function display_makeups_members() {
if (first_select) { if (first_select) {
$("#decrement_selected_members_makeups").on("click", () => { $("#decrement_selected_members_makeups").on("click", () => {
openModal( openModal(
`Enlever un rattrapage aux membres sélectionnés ?`, $("#modal_decr_selected_makeup_counter").html(),
() => { () => {
update_members_makeups(selected_rows, "decrement"); update_members_makeups(
selected_rows,
"decrement",
($("#decr-signature-selected")[0].value || "auteur inconnu") + ' : ' + ($("#decr-explanation-selected")[0].value || "pas d'explication")
);
}, },
"Confirmer", "Confirmer",
false false
...@@ -256,8 +276,9 @@ function display_makeups_members() { ...@@ -256,8 +276,9 @@ function display_makeups_members() {
* *
* @param {Array} member_ids * @param {Array} member_ids
* @param {String} action increment | decrement * @param {String} action increment | decrement
* @param description
*/ */
function update_members_makeups(member_ids, action) { function update_members_makeups(member_ids, action, description) {
openModal(); openModal();
data = []; data = [];
...@@ -292,7 +313,8 @@ function update_members_makeups(member_ids, action) { ...@@ -292,7 +313,8 @@ function update_members_makeups(member_ids, action) {
target_makeups_nb: makeups_members[member_index].makeups_to_do, target_makeups_nb: makeups_members[member_index].makeups_to_do,
member_shift_type: makeups_members[member_index].shift_type, member_shift_type: makeups_members[member_index].shift_type,
display_ftop_points: makeups_members[member_index].display_ftop_points, display_ftop_points: makeups_members[member_index].display_ftop_points,
display_std_points: makeups_members[member_index].display_std_points display_std_points: makeups_members[member_index].display_std_points,
description: description,
}); });
} }
...@@ -415,10 +437,18 @@ function display_possible_members() { ...@@ -415,10 +437,18 @@ function display_possible_members() {
display_ftop_points: member.display_ftop_points display_ftop_points: member.display_ftop_points
}); });
let modal_template = $("#modal_incr_makeup_counter");
modal_template.find(".member_name").text(member.name);
openModal( openModal(
`Ajouter un rattrapage à ${member.name} ?`, modal_template.html(),
() => { () => {
update_members_makeups([member.id], "increment"); update_members_makeups(
[member.id],
"increment",
($("#incr-signature")[0].value || "auteur inconnu") + ' : ' + ($("#incr-explanation")[0].value || "pas d'explication")
);
members_search_results = []; members_search_results = [];
$('#search_member_input').val(''); $('#search_member_input').val('');
$('.search_member_results_area').hide(); $('.search_member_results_area').hide();
......
...@@ -64,6 +64,21 @@ ...@@ -64,6 +64,21 @@
pour une durée de 6 mois à partir d'aujourd'hui. pour une durée de 6 mois à partir d'aujourd'hui.
</p> </p>
</div> </div>
<div id="modal_incr_makeup_counter">
<p>Ajouter un rattrapage à <span class="member_name"></span> ?</p>
<br><label for="incr-explanation">Explication : </label><input class="" type="text" id="incr-explanation">
<br><br><label for="incr-signature">Signature : </label><input class="" type="text" id="incr-signature">
</div>
<div id="modal_decr_makeup_counter">
<p>Enlever un rattrapage à <span class="member_name"></span> ?</p>
<br><label for="decr-explanation">Explication : </label><input class="" type="text" id="decr-explanation">
<br><br><label for="decr-signature">Signature : </label><input class="" type="text" id="decr-signature">
</div>
<div id="modal_decr_selected_makeup_counter">
<p>Enlever un rattrapage aux membres sélectionnés ?</p>
<br><label for="decr-explanation-selected">Explication : </label><input class="" type="text" id="decr-explanation-selected">
<br><br><label for="decr-signature-selected">Signature : </label><input class="" type="text" id="decr-signature-selected">
</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