Commit 1b3bbae9 by Damien Moulard

display message when member cant have delay

parent f66bf1cc
......@@ -34,6 +34,11 @@ default_msettings = {'msg_accueil': {'title': 'Message borne accueil',
'title': 'Lien vers le formulaire de ré-inscription',
'type': 'text',
'value': ''
},
'member_cant_have_delay_form_link' : {
'title': 'Lien vers le formulaire pour les membres n\'ayant pas rattrapé leur service après 6 mois',
'type': 'text',
'value': ''
}
}
......
......@@ -13,10 +13,25 @@
text-align: center;
}
#shifts_exchange .select_makeups, #shifts_exchange .unsuscribed_form_link {
#shifts_exchange .select_makeups, #shifts_exchange .unsuscribed_form_link, .cant_have_delay_form_link {
margin: 1.5rem 0;
}
/* -- Suspended can't have delay screen */
#suspended_cant_have_delay_content {
align-items: center;
text-align: center;
width: 50%;
}
@media screen and (max-width:768px) {
#suspended_cant_have_delay_content {
align-items: center;
text-align: center;
width: 90%;
}
}
/* -- Calendar screen, area on top of the calendar */
#calendar_top_info {
......
......@@ -43,9 +43,17 @@ function request_delay() {
&& typeof data.responseJSON != 'undefined'
&& data.responseJSON.message === "delays limit reached") {
closeModal();
alert("Vous avez mis plus de 6 mois pour rattraper un service, " +
"vous ne pouvez plus rien faire depuis l'espace membre. " +
"Merci de contacter le BDM.");
let msg_template = $("#cant_have_delay_msg_template");
openModal(
msg_template.html(),
() => {
window.location =member_cant_have_delay_form_link;
},
"J'accède au formulaire",
true,
false
)
} else {
err = {msg: "erreur serveur lors de la création du délai", ctx: 'request_delay'};
if (typeof data.responseJSON != 'undefined' && typeof data.responseJSON.error != 'undefined') {
......
......@@ -13,12 +13,12 @@ function can_exchange_shifts() {
}
/**
* A partner can add a shift if:
* A partner should select a shift if:
* - s.he has makeups to do
* - s.he's not an associated partner
* @returns boolean
*/
function can_select_makeup() {
function should_select_makeup() {
return partner_data.makeups_to_do > 0 && partner_data.is_associated_people === "False";
}
......@@ -201,7 +201,7 @@ function init_calendar_page() {
.then(init_shifts_list);
}
if (can_select_makeup()) {
if (should_select_makeup()) {
$(".makeups_nb").text(partner_data.makeups_to_do);
$("#need_to_select_makeups_message").show();
}
......@@ -283,7 +283,7 @@ function init_calendar_page() {
closeModal,
"J'ai compris"
);
} else if (can_select_makeup()) {
} else if (should_select_makeup()) {
/* choose a makeup service */
// Check if selected new shift is in less than 6 months
if (partner_data.date_delay_stop !== 'False') {
......@@ -339,6 +339,22 @@ function init_shifts_exchange() {
$(this).removeClass('active');
});
});
} else if (
partner_data.cooperative_state === 'suspended'
&& partner_data.can_have_delay === 'False')
{
let msg_template = $("#cant_have_delay_msg_template");
$(".suspended_cant_have_delay_msg").html(msg_template.html())
$("#suspended_cant_have_delay_content").show()
$(".cant_have_delay_form_link")
.show()
.attr('href', member_cant_have_delay_form_link)
.on('click', function() {
setTimeout(500, () => {
$(this).removeClass('active');
});
});
} else if (partner_data.cooperative_state === 'suspended'
&& partner_data.date_delay_stop === 'False') {
$("#suspended_content").show();
......
......@@ -89,14 +89,16 @@ def index(request, exception=None):
except:
pass
context['partnerData'] = partnerData
if partnerData["parent_id"] is not False:
partnerData["parent_name"] = partnerData["parent_id"][1]
partnerData["parent_id"] = partnerData["parent_id"][0]
else:
partnerData["parent_name"] = False
partnerData['can_have_delay'] = cs.member_can_have_delay(int(partner_id))
context['partnerData'] = partnerData
# Days to hide in the calendar
days_to_hide = "0"
context['ADDITIONAL_INFO_SHIFT_PAGE'] = getattr(settings, 'ADDITIONAL_INFO_SHIFT_PAGE', '')
......@@ -105,9 +107,16 @@ def index(request, exception=None):
context['daysToHide'] = days_to_hide
msettings = MConfig.get_settings('members')
context['abcd_calendar_link'] = msettings['abcd_calendar_link']['value'] if 'abcd_calendar_link' in msettings else ''
context['unsuscribe_form_link'] = msettings['unsuscribe_form_link']['value'] if 'unsuscribe_form_link' in msettings else ''
context['forms_link'] = msettings['forms_link']['value'] if 'forms_link' in msettings else ''
context['unsuscribe_form_link'] = ( msettings['unsuscribe_form_link']['value']
if 'unsuscribe_form_link' in msettings
else '')
context['member_cant_have_delay_form_link'] = ( msettings['member_cant_have_delay_form_link']['value']
if 'member_cant_have_delay_form_link' in msettings
else '')
context['abcd_calendar_link'] = ( msettings['abcd_calendar_link']['value']
if 'abcd_calendar_link' in msettings
else '')
else:
# may arrive when switching database without cleaning cookie
......
......@@ -63,6 +63,12 @@
<p>3/12 <i class="arrow_explanation_numbers fas fa-arrow-right"></i> il y a déjà 3 places réservées à ce service sur 12 disponibles.
<b>Plus le chiffre de gauche est petit, plus on a besoin de coopérateurs.rices à ce service !</b></p>
</div>
<div id="cant_have_delay_msg_template">
<h3>Bonjour, tu avais 6 mois pour rattraper tes services manqués et il semblerait que tu ne l'aies pas fait.</h3>
<h3>Tu ne peux plus sélectionner de rattrapages sur ton espace membre pour le moment,
merci de contacter le bureau des membres pour résoudre ce problème en remplissant ce formulaire : </h3>
</div>
</div>
</div>
......@@ -70,6 +76,7 @@
var app_env = '{{app_env}}';
var forms_link = '{{forms_link}}';
var unsuscribe_form_link = '{{unsuscribe_form_link}}';
var member_cant_have_delay_form_link = '{{member_cant_have_delay_form_link}}';
var abcd_calendar_link = "{{abcd_calendar_link}}"
var days_to_hide = "{{daysToHide}}"
var partner_data = {
......@@ -79,7 +86,7 @@
"date_delay_stop":"{{partnerData.date_delay_stop}}",
"cooperative_state":"{{partnerData.cooperative_state}}",
"regular_shift_name":"{{partnerData.regular_shift_name}}",
"verif_token" : "{{partnerData.verif_token}}",
"can_have_delay" : "{{partnerData.can_have_delay}}",
"makeups_to_do" : "{{partnerData.makeups_to_do}}",
"barcode_base" : "{{partnerData.barcode_base}}",
"street" : "{{partnerData.street}}",
......@@ -92,6 +99,7 @@
"is_associated_people" : "{{partnerData.is_associated_people}}",
"parent_id" : "{{partnerData.parent_id}}",
"parent_name" : "{{partnerData.parent_name}}",
"verif_token" : "{{partnerData.verif_token}}",
}
</script>
<script src="{% static "js/all_common.js" %}?v="></script>
......
......@@ -5,6 +5,12 @@
J'accède au formulaire
</a>
</div>
<div id="suspended_cant_have_delay_content" class="shifts_exchange_page_content">
<div class="suspended_cant_have_delay_msg"></div>
<a href="#" target="_blank" class="btn--warning cant_have_delay_form_link">
J'accède au formulaire
</a>
</div>
<div id="suspended_content" class="shifts_exchange_page_content">
<h3>Je suis suspendu.e, je dois sélectionner mes rattrapages pour pouvoir refaire mes courses.</h3>
<button type="button" class="btn--danger select_makeups">
......
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