Commit 8a35c6c2 by François C.

Merge branch 'ticket_1727' into 'evolution_bdm'

Ticket 1727

See merge request !86
parents 49b745b2 deedd4a3
Pipeline #1550 passed with stage
in 1 minute 31 seconds
...@@ -228,7 +228,7 @@ function display_makeups_members() { ...@@ -228,7 +228,7 @@ function display_makeups_members() {
/** /**
* Send request to update members nb of makeups to do * Send request to update members nb of makeups to do
* *
* @param {Array} member_ids * @param {Array} member_ids
* @param {String} action increment | decrement * @param {String} action increment | decrement
*/ */
......
from django.db import models from django.db import models
from outils.common_imports import * from outils.common_imports import *
from members.models import CagetteServices
from outils.common import OdooAPI from outils.common import OdooAPI
...@@ -11,6 +12,21 @@ class CagetteMembersSpace(models.Model): ...@@ -11,6 +12,21 @@ class CagetteMembersSpace(models.Model):
"""Init with odoo id.""" """Init with odoo id."""
self.o_api = OdooAPI() self.o_api = OdooAPI()
def is_comite(self, partner_id):
"""Check if partner is from comite."""
cond = [['partner_id.id', '=', partner_id]]
fields = ['shift_template_id', 'is_current']
shiftTemplate = self.o_api.search_read('shift.template.registration', cond, fields)
if (shiftTemplate and len(shiftTemplate) > 0):
s_t_id = None
for s_t in shiftTemplate:
if s_t['is_current'] is True:
s_t_id = s_t['shift_template_id'][0]
if s_t_id == CagetteServices.get_committees_shift_id():
return True
else:
return False
def get_shifts_history(self, partner_id, limit, offset, date_from): def get_shifts_history(self, partner_id, limit, offset, date_from):
""" Get partner shifts history """ """ Get partner shifts history """
res = [] res = []
......
...@@ -100,7 +100,7 @@ function init_home() { ...@@ -100,7 +100,7 @@ function init_home() {
e.preventDefault(); e.preventDefault();
goto('faq'); goto('faq');
}); });
if (partner_data.is_in_association === false) { if (partner_data.is_in_association === false) {
$("#home .member_associated_partner_area").hide(); $("#home .member_associated_partner_area").hide();
} else { } else {
......
...@@ -50,18 +50,19 @@ function prepare_server_data(data) { ...@@ -50,18 +50,19 @@ function prepare_server_data(data) {
for (history_item of data) { for (history_item of data) {
if (history_item.is_amnesty !== undefined) { if (history_item.is_amnesty !== undefined) {
let shift_datetime = new Date(history_item.date_begin); let shift_datetime = new Date(history_item.date_begin);
let str_shift_datetime = `${("0" + shift_datetime.getDate()).slice(-2)}/${("0" + (shift_datetime.getMonth() + 1)).slice(-2)}/${shift_datetime.getFullYear()}` let str_shift_datetime = `${("0" + shift_datetime.getDate()).slice(-2)}/${("0" + (shift_datetime.getMonth() + 1)).slice(-2)}/${shift_datetime.getFullYear()}`;
history_item.shift_name = `${history_item.shift_name} du ${str_shift_datetime}` history_item.shift_name = `${history_item.shift_name} du ${str_shift_datetime}`;
} else { } else {
history_item.shift_name = (history_item.shift_id === false) ? '' : history_item.shift_id[1]; history_item.shift_name = (history_item.shift_id === false) ? '' : history_item.shift_id[1];
if (history_item.name === "Services des comités") { if (history_item.name === "Services des comités") {
let shift_datetime = new Date(history_item.date_begin); let shift_datetime = new Date(history_item.date_begin);
let str_shift_datetime = `${("0" + shift_datetime.getDate()).slice(-2)}/${("0" + (shift_datetime.getMonth() + 1)).slice(-2)}/${shift_datetime.getFullYear()}` let str_shift_datetime = `${("0" + shift_datetime.getDate()).slice(-2)}/${("0" + (shift_datetime.getMonth() + 1)).slice(-2)}/${shift_datetime.getFullYear()}`;
str_shift_datetime = str_shift_datetime + " " + shift_datetime.toLocaleTimeString("fr-fr", time_options); str_shift_datetime = str_shift_datetime + " " + shift_datetime.toLocaleTimeString("fr-fr", time_options);
history_item.shift_name = `Services des comités ${str_shift_datetime}` history_item.shift_name = `Services des comités ${str_shift_datetime}`;
} }
} }
......
...@@ -188,10 +188,12 @@ function init_calendar_page() { ...@@ -188,10 +188,12 @@ function init_calendar_page() {
closeModal, closeModal,
"J'ai compris" "J'ai compris"
); );
}).show(); })
.show();
} else { } else {
$("#calendar_explaination_button").hide(); $("#calendar_explaination_button").hide();
$("#calendar_explaination_area").html(template_explanations.html()).show(); $("#calendar_explaination_area").html(template_explanations.html())
.show();
} }
if (incoming_shifts !== null) { if (incoming_shifts !== null) {
...@@ -366,6 +368,12 @@ function init_shifts_exchange() { ...@@ -366,6 +368,12 @@ function init_shifts_exchange() {
$(this).removeClass('active'); $(this).removeClass('active');
}); });
}); });
} else if (
partner_data.comite === "True") {
let msg_template = $("#comite_template");
$(".comite_content_msg").html(msg_template.html());
$("#comite_content").show();
} else if (partner_data.cooperative_state === 'suspended' } else if (partner_data.cooperative_state === 'suspended'
&& partner_data.date_delay_stop === 'False') { && partner_data.date_delay_stop === 'False') {
$("#suspended_content .makeups_nb").text(partner_data.makeups_to_do); $("#suspended_content .makeups_nb").text(partner_data.makeups_to_do);
...@@ -389,8 +397,8 @@ function init_shifts_exchange() { ...@@ -389,8 +397,8 @@ function init_shifts_exchange() {
init_calendar_page(); init_calendar_page();
} }
$(window).smartresize(function(){ $(window).smartresize(function() {
vw = window.innerWidth; vw = window.innerWidth;
init_calendar_page(); init_calendar_page();
}); });
} }
\ No newline at end of file \ No newline at end of file
...@@ -189,11 +189,11 @@ function init_my_info_data() { ...@@ -189,11 +189,11 @@ function init_my_info_data() {
}); });
}); });
} else if (partner_data.cooperative_state === 'exempted') { } else if (partner_data.cooperative_state === 'exempted') {
const d = new Date(Date.parse(partner_data.leave_stop_date)); const d = new Date(Date.parse(partner_data.leave_stop_date));
const f_date_delay_stop = d.getDate()+'/'+("0" + (d.getMonth() + 1)).slice(-2)+'/'+d.getFullYear(); const f_date_delay_stop = d.getDate()+'/'+("0" + (d.getMonth() + 1)).slice(-2)+'/'+d.getFullYear();
$(".delay_date_stop").text(f_date_delay_stop); $(".delay_date_stop").text(f_date_delay_stop);
$(".delay_date_stop_container").show(); $(".delay_date_stop_container").show();
} }
if ( if (
...@@ -252,29 +252,33 @@ $(document).ready(function() { ...@@ -252,29 +252,33 @@ $(document).ready(function() {
}; };
}); });
(function($,sr){ (function($, sr) {
// debouncing function from John Hann // debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) { var debounce = function (func, threshold, execAsap) {
var timeout; var timeout;
return function debounced () { return function debounced () {
var obj = this, args = arguments; var obj = this, args = arguments;
function delayed () { function delayed () {
if (!execAsap) if (!execAsap)
func.apply(obj, args); func.apply(obj, args);
timeout = null; timeout = null;
}; }
if (timeout) if (timeout)
clearTimeout(timeout); clearTimeout(timeout);
else if (execAsap) else if (execAsap)
func.apply(obj, args); func.apply(obj, args);
timeout = setTimeout(delayed, threshold || 100); timeout = setTimeout(delayed, threshold || 100);
}; };
} };
// smartresize // smartresize
jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
jQuery.fn[sr] = function(fn) {
})(jQuery,'smartresize'); return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
\ No newline at end of file };
})(jQuery, 'smartresize');
\ No newline at end of file
...@@ -110,6 +110,9 @@ def index(request, exception=None): ...@@ -110,6 +110,9 @@ def index(request, exception=None):
partnerData['can_have_delay'] = cs.member_can_have_delay(int(partner_id)) partnerData['can_have_delay'] = cs.member_can_have_delay(int(partner_id))
m = CagetteMembersSpace()
partnerData["comite"] = m.is_comite(partner_id)
context['partnerData'] = partnerData context['partnerData'] = partnerData
# Days to hide in the calendar # Days to hide in the calendar
......
...@@ -70,6 +70,9 @@ ...@@ -70,6 +70,9 @@
<h3>Tu ne peux plus sélectionner de rattrapages sur ton espace membre pour le moment, <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> merci de contacter le bureau des membres pour résoudre ce problème en remplissant ce formulaire : </h3>
</div> </div>
<div id="comite_template">
<h3>Vous êtes inscrit.e dans le service des comités, vous n'avez pas accès au calendrier d'échange des services car vous vous organisez directement avec le responsable du comité. Si vous avez des rattrapages à réaliser, merci de contacter le responsable du comité qui vous aidera à planifier les rattrapages ou trouver une solution</h3>
</div>
</div> </div>
</div> </div>
...@@ -117,7 +120,8 @@ ...@@ -117,7 +120,8 @@
"associated_partner_id" : "{{partnerData.associated_partner_id}}", "associated_partner_id" : "{{partnerData.associated_partner_id}}",
"associated_partner_name" : "{{partnerData.associated_partner_name}}", "associated_partner_name" : "{{partnerData.associated_partner_name}}",
"verif_token" : "{{partnerData.verif_token}}", "verif_token" : "{{partnerData.verif_token}}",
"leave_stop_date": "{{partnerData.leave_stop_date}}" "leave_stop_date": "{{partnerData.leave_stop_date}}",
"comite": "{{partnerData.comite}}"
} }
</script> </script>
<script src="{% static "js/all_common.js" %}?v="></script> <script src="{% static "js/all_common.js" %}?v="></script>
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
J'accède au formulaire J'accède au formulaire
</a> </a>
</div> </div>
<div id="comite_content" class="shifts_exchange_page_content">
<div class="comite_content_msg"></div>
</div>
<div id="suspended_content" class="shifts_exchange_page_content"> <div id="suspended_content" class="shifts_exchange_page_content">
<h3> <h3>
J'ai <span class="makeups_nb"></span> rattrapage(s) à effectuer, je dois le(s) sélectionner pour pouvoir refaire mes courses. J'ai <span class="makeups_nb"></span> rattrapage(s) à effectuer, je dois le(s) sélectionner pour pouvoir refaire mes courses.
......
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