Commit f039d92a by Damien Moulard

Merge branch 'dev_cooperatic' of…

Merge branch 'dev_cooperatic' of gl.cooperatic.fr:cooperatic-foodcoops/third-party into dev_cooperatic
parents 77c638b6 24fc11d0
Pipeline #2134 passed with stage
in 1 minute 32 seconds
......@@ -427,7 +427,7 @@ def delete_shift_registration(request):
# Note: 'upcoming_registration_count' in res.partner won't change because the _compute method
# in odoo counts canceled shift registrations.
m = CagetteShift()
res["cancel_shift"] = m.cancel_shift([shift_registration_id])
res["cancel_shift"] = m.cancel_shift([shift_registration_id], origin='bdm')
if shift_is_makeup is True:
fields = {
......
......@@ -76,4 +76,18 @@
#associate_area{
margin-bottom: 15px;
}
.remove_binome_icon {
margin-left: 10px;
color: #e62720;
}
.remove_binome_icon:hover {
cursor: pointer;
}
.chosen_associate_group {
display: flex;
align-items: center;
}
\ No newline at end of file
......@@ -126,6 +126,7 @@ function create_new_coop() {
$('.chosen_associate').html("");
$('.chosen_associate_area').hide();
$('.member_choice').removeClass('choice_active');
$(".remove_binome_icon").on("click", hide_chosen_associate)
local_in_process = getLocalInProcess();
if (getLocalInProcess().length > 0) {
empty_waiting_local_processes();
......@@ -292,7 +293,7 @@ function store_new_coop(event) {
dataType :'json'
}).done(function(rData) {
if (typeof(rData.answer) == 'boolean' && rData.answer == true) {
errors.push("Ce membre à déjà un Binôme majeur");
errors.push("Ce membre a déjà un binôme majeur");
}
if (errors.length == 0) {
_really_save_new_coop(
......@@ -360,11 +361,12 @@ function modify_current_coop() {
$('#new_member_choice_action').hide();
$('#existing_member_choice').addClass('choice_active');
var member_button = '<div>' + current_coop.parent_name + '</div>';
$('.chosen_associate').html(member_button);
$('.chosen_associate_area').show();
associated_old_choice = 'existing_member_choice';
} else {
$('#new_member_choice_action').show();
$('#existing_member_choice_action').hide();
......@@ -383,6 +385,13 @@ function modify_current_coop() {
}
ncoop_view.show();
}
function hide_chosen_associate() {
selected_associate=null;
$(".chosen_associate_area").hide();
$('.chosen_associate').html("");
}
function modify_coop_by_btn_triggered() {
var clicked = $(this);
var coop_id = clicked.find('div').data('id');
......@@ -602,8 +611,9 @@ $('#odoo_user_connect').click();
$('#add_binome').click(function() {
if ($('#associate_area').is(':visible')) {
$('#associate_area').hide();
associated_old_choice = null;
$('#new_member_input').val('');
$('#associate_area .choice_active').removeClass("choice_active");
associated_old_choice = null;
if (current_coop !=null) {
delete current_coop.parent_name;
delete current_coop.parent_id;
......
......@@ -69,7 +69,6 @@ urlpatterns = [
url(r'^admin/manage_attached/delete_pair$', admin.delete_pair),
url(r'^get_makeups_members$', admin.get_makeups_members),
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),
]
......@@ -158,7 +158,7 @@ function init_history() {
if (cell.text() === "Présent.e") {
$(row).addClass('row_partner_ok');
} else if (cell.text() === "Retard") {
} else if (cell.text().includes("Retard")) {
$(row).addClass('row_partner_late');
} else if (cell.text() === "Absent.e") {
$(row).addClass('row_partner_absent');
......
......@@ -268,6 +268,8 @@ function offer_extra_shift() {
},
timeout: 3000,
success: function() {
partner_data.extra_shift_done -= 1;
$("#can_delete_future_registrations_area").hide();
$(".delete_registration_button").off();
$(".delete_registration_button").hide();
......@@ -723,27 +725,31 @@ function init_read_only_calendar_page() {
function init_delete_registration_buttons() {
$(".delete_registration_button").off();
$(".delete_registration_button").on("click", function() {
let shift_name = $(this).closest("div")
.parent().parent()
.find(".shift_line_date")
.text()
.trim();
let shift_id = $(this).closest(".shift_line_container")
.attr('id')
.split('_')[2];
openModal(
`<p>Je m'apprête à supprimer ma présence au service du <b>${shift_name}</b></p>`,
() => {
delete_shift_registration(shift_id);
},
"Confirmer",
false
);
});
$(".delete_registration_button").hide();
$(".delete_registration_button").css('display', 'flex');
if (partner_data.extra_shift_done > 0) {
$(".delete_registration_button").on("click", function() {
let shift_name = $(this).closest("div")
.parent().parent()
.find(".shift_line_date")
.text()
.trim();
let shift_id = $(this).closest(".shift_line_container")
.attr('id')
.split('_')[2];
openModal(
`<p>Je m'apprête à supprimer ma présence au service du <b>${shift_name}</b></p>`,
() => {
delete_shift_registration(shift_id);
},
"Confirmer",
false
);
});
$(".delete_registration_button").css('display', 'flex');
}
}
function init_shifts_exchange() {
......
......@@ -222,8 +222,11 @@ function prepare_shift_line_template(date_begin) {
*/
function init_my_info_data() {
$(".choose_makeups").off();
$(".choose_makeups").hide();
$(".remove_future_registration").off();
$(".remove_future_registration").hide();
$(".unsuscribed_form_link").off();
$(".unsuscribed_form_link").hide();
$(".member_shift_name").text(partner_data.regular_shift_name);
......
......@@ -210,9 +210,10 @@ class CagetteShift(models.Model):
coop_logger.error("Model affect shift nobody found : %s", str(cond))
return response
def cancel_shift(self, idsRegisteur):
def cancel_shift(self, idsRegisteur, origin='memberspace'):
"""Annule un shift"""
fieldsDatas = { "related_shift_state": 'cancel',
"origin": origin,
"state": 'cancel'}
return self.o_api.update('shift.registration', idsRegisteur, fieldsDatas)
......
......@@ -97,7 +97,10 @@
<div >
<p><i>Binôme choisi : </i></p>
</div>
<div class="chosen_associate"></div>
<div class="chosen_associate_group">
<span class="chosen_associate"></span>
<i class="fas fa-times remove_binome_icon"></i>
</div>
</div>
</div>
<div id="new_member_choice_action" style="display:none;">
......
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