Commit e9c05e33 by François C.

Merge branch '6202-SUPERCAFOUTCH-message-lors-de-la-selection-de-creneau' into 'dev_cooperatic'

allow bdm to configure a message that is displayed when a member selects a…

See merge request !268
parents 4ebc82f4 074a03f9
Pipeline #3401 failed with stage
in 1 minute 6 seconds
...@@ -126,7 +126,13 @@ default_msettings = {'msg_accueil': {'title': 'Message borne accueil', ...@@ -126,7 +126,13 @@ default_msettings = {'msg_accueil': {'title': 'Message borne accueil',
'value': '', 'value': '',
'class': 'link', 'class': 'link',
'sort_order': 21 'sort_order': 21
} },
'on_picking_shift_template_msg': {
'title': 'Afficher une info à la sélection d\'un créneau (jour,heure) en respectant la syntaxe en exemple : lundi 14:00 Ici votre message',
'type': 'text',
'value': '',
'sort_order': 22
},
} }
......
...@@ -565,6 +565,17 @@ function init_calendar_page() { ...@@ -565,6 +565,17 @@ function init_calendar_page() {
let new_shift_date = datetime_new_shift.toLocaleDateString("fr-fr", date_options); let new_shift_date = datetime_new_shift.toLocaleDateString("fr-fr", date_options);
let new_shift_time = datetime_new_shift.toLocaleTimeString("fr-fr", time_options); let new_shift_time = datetime_new_shift.toLocaleTimeString("fr-fr", time_options);
function showInfoAboutSelectedShift(modal_template, new_shift_date, new_shift_time) {
var new_shift_week_day = new_shift_date.replace(/ .*/,'');
if (on_picking_shift_template_msg.startsWith(new_shift_week_day + " " + new_shift_time + " ")) {
modal_template.find(".on_picking_shift_template_msg").text(
on_picking_shift_template_msg.replace(new_shift_week_day + " " + new_shift_time + " ","")
);
} else {
modal_template.find(".on_picking_shift_template_msg").text("");
}
}
if (selected_shift !== null && can_exchange_shifts()) { if (selected_shift !== null && can_exchange_shifts()) {
/* shift exchange */ /* shift exchange */
// Set old shift // Set old shift
...@@ -580,6 +591,8 @@ function init_calendar_page() { ...@@ -580,6 +591,8 @@ function init_calendar_page() {
modal_template.find(".date_new_shift").text(new_shift_date); modal_template.find(".date_new_shift").text(new_shift_date);
modal_template.find(".time_new_shift").text(new_shift_time); modal_template.find(".time_new_shift").text(new_shift_time);
showInfoAboutSelectedShift(modal_template, new_shift_date, new_shift_time);
openModal( openModal(
modal_template.html(), modal_template.html(),
() => { () => {
...@@ -601,6 +614,9 @@ function init_calendar_page() { ...@@ -601,6 +614,9 @@ function init_calendar_page() {
modal_template.find(".date_new_shift").text(new_shift_date); modal_template.find(".date_new_shift").text(new_shift_date);
modal_template.find(".time_new_shift").text(new_shift_time); modal_template.find(".time_new_shift").text(new_shift_time);
showInfoAboutSelectedShift(modal_template, new_shift_date, new_shift_time);
openModal( openModal(
modal_template.html(), modal_template.html(),
() => { () => {
...@@ -629,6 +645,8 @@ function init_calendar_page() { ...@@ -629,6 +645,8 @@ function init_calendar_page() {
modal_template.find(".date_new_shift").text(new_shift_date); modal_template.find(".date_new_shift").text(new_shift_date);
modal_template.find(".time_new_shift").text(new_shift_time); modal_template.find(".time_new_shift").text(new_shift_time);
showInfoAboutSelectedShift(modal_template, new_shift_date, new_shift_time);
openModal( openModal(
modal_template.html(), modal_template.html(),
() => { () => {
......
...@@ -164,6 +164,7 @@ def index(request, exception=None): ...@@ -164,6 +164,7 @@ def index(request, exception=None):
context['helper_unsubscribe_form_link'] = msettings['helper_unsubscribe_form_link']['value'] if 'helper_unsubscribe_form_link' in msettings else '' context['helper_unsubscribe_form_link'] = msettings['helper_unsubscribe_form_link']['value'] if 'helper_unsubscribe_form_link' in msettings else ''
context['covid_form_link'] = msettings['covid_form_link']['value'] if 'covid_form_link' in msettings else '' context['covid_form_link'] = msettings['covid_form_link']['value'] if 'covid_form_link' in msettings else ''
context['covid_end_form_link'] = msettings['covid_end_form_link']['value'] if 'covid_end_form_link' in msettings else '' context['covid_end_form_link'] = msettings['covid_end_form_link']['value'] if 'covid_end_form_link' in msettings else ''
context['on_picking_shift_template_msg'] = msettings['on_picking_shift_template_msg']['value'] if 'on_picking_shift_template_msg' in msettings else ''
if getattr(settings, 'USE_EXEMPTIONS_SHIFT_TEMPLATE', False) is True: if getattr(settings, 'USE_EXEMPTIONS_SHIFT_TEMPLATE', False) is True:
exemptions_shift_id = CagetteServices.get_exemptions_shift_id() exemptions_shift_id = CagetteServices.get_exemptions_shift_id()
if exemptions_shift_id is None: if exemptions_shift_id is None:
......
...@@ -74,10 +74,12 @@ ...@@ -74,10 +74,12 @@
<div><span class="date_old_shift"></span> à <span class="time_old_shift"></span></div> <div><span class="date_old_shift"></span> à <span class="time_old_shift"></span></div>
<div>par celui du : </div> <div>par celui du : </div>
<div><span class="date_new_shift"></span> à <span class="time_new_shift"></span></div> <div><span class="date_new_shift"></span> à <span class="time_new_shift"></span></div>
<div><span class="on_picking_shift_template_msg"></span></div>
</div> </div>
<div id="modal_add_shift_template"> <div id="modal_add_shift_template">
<div>Je suis sur le point de m'inscrire au service du : <span class="date_new_shift"></span> à <span class="time_new_shift"></span></div> <div>Je suis sur le point de m'inscrire au service du : <span class="date_new_shift"></span> à <span class="time_new_shift"></span></div>
<div><span class="on_picking_shift_template_msg"></span></div>
</div> </div>
<div id="calendar_explaination_template"> <div id="calendar_explaination_template">
...@@ -133,6 +135,7 @@ ...@@ -133,6 +135,7 @@
var member_cant_have_delay_form_link = '{{member_cant_have_delay_form_link}}'; var member_cant_have_delay_form_link = '{{member_cant_have_delay_form_link}}';
var abcd_calendar_link = "{{abcd_calendar_link}}" var abcd_calendar_link = "{{abcd_calendar_link}}"
var days_to_hide = "{{daysToHide}}" var days_to_hide = "{{daysToHide}}"
var on_picking_shift_template_msg = "{{on_picking_shift_template_msg}}"
var partner_data = { var partner_data = {
"partner_id":"{{partnerData.id}}", "partner_id":"{{partnerData.id}}",
"name":"{{partnerData.display_name|safe}}", "name":"{{partnerData.display_name|safe}}",
......
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