Commit f8e05261 by Damien Moulard

fix merge conflict

parents 0e1681db 9df74e1f
Pipeline #1294 passed with stage
in 1 minute 23 seconds
...@@ -266,7 +266,7 @@ function fill_service_entry(s) { ...@@ -266,7 +266,7 @@ function fill_service_entry(s) {
m_list = '<ul class="members_list">'; m_list = '<ul class="members_list">';
if (typeof s.late != "undefined" && s.late == true) { if (typeof s.late != "undefined" && s.late == true) {
m_list = '<ul class="members_list late">'; m_list = '<ul class="members_list late">';
} }
$.each(s.members, function(i, e) { $.each(s.members, function(i, e) {
var li_class = "btn"; var li_class = "btn";
var li_data = ""; var li_data = "";
...@@ -448,15 +448,16 @@ function record_service_presence() { ...@@ -448,15 +448,16 @@ function record_service_presence() {
var res = rData.res; var res = rData.res;
var next = (res.update == 'ok') var next = (res.update == 'ok')
||(res.rattrapage && !isNaN(res.rattrapage)); ||(res.rattrapage && !isNaN(res.rattrapage));
if (next) { if (next) {
fill_service_entry_sucess(rData.res.member); fill_service_entry_sucess(rData.res.member);
goto_page(pages.service_entry_success); goto_page(pages.service_entry_success);
} else if (rData.res.error) { } else if (rData.res.error) {
alert(rData.res.error); alert(rData.res.error);
} else { } else {
alert("Un problème est survenu. S'il persiste merci de le signaler à un responsable du magasin.") alert("Un problème est survenu. S'il persiste merci de le signaler à un responsable du magasin.");
} }
} }
loading2.hide(); loading2.hide();
} }
); );
......
...@@ -46,7 +46,8 @@ function display_current_coop_form() { ...@@ -46,7 +46,8 @@ function display_current_coop_form() {
// form.find('[name="barcode_base"]').val(current_coop.barcode_base); // form.find('[name="barcode_base"]').val(current_coop.barcode_base);
form.find('[name="email"]').val(current_coop._id); form.find('[name="email"]').val(current_coop._id);
if (current_coop.shift_template && if (current_coop.shift_template &&
current_coop.shift_template.data.type == 2) { current_coop.shift_template.data.type == 2 &&
typeof manage_ftop != "undefined" && manage_ftop == true) {
$('#choosen_shift input').hide(); $('#choosen_shift input').hide();
ftop_shift.val('Volant'); ftop_shift.val('Volant');
ftop_shift.show(); ftop_shift.show();
......
...@@ -117,6 +117,7 @@ def prepa_odoo(request): ...@@ -117,6 +117,7 @@ def prepa_odoo(request):
'ask_for_sex': getattr(settings, 'SUBSCRIPTION_ASK_FOR_SEX', False), 'ask_for_sex': getattr(settings, 'SUBSCRIPTION_ASK_FOR_SEX', False),
'ask_for_street2': getattr(settings, 'SUBSCRIPTION_ADD_STREET2', False), 'ask_for_street2': getattr(settings, 'SUBSCRIPTION_ADD_STREET2', False),
'ask_for_second_phone': getattr(settings, 'SUBSCRIPTION_ADD_SECOND_PHONE', False), 'ask_for_second_phone': getattr(settings, 'SUBSCRIPTION_ADD_SECOND_PHONE', False),
'show_ftop_button': getattr(settings, 'SHOW_FTOP_BUTTON', True),
'db': settings.COUCHDB['dbs']['member']} 'db': settings.COUCHDB['dbs']['member']}
# with_addr_complement # with_addr_complement
...@@ -150,6 +151,7 @@ def validation_inscription(request, email): ...@@ -150,6 +151,7 @@ def validation_inscription(request, email):
'ask_for_sex': getattr(settings, 'SUBSCRIPTION_ASK_FOR_SEX', False), 'ask_for_sex': getattr(settings, 'SUBSCRIPTION_ASK_FOR_SEX', False),
'ask_for_street2': getattr(settings, 'SUBSCRIPTION_ADD_STREET2', False), 'ask_for_street2': getattr(settings, 'SUBSCRIPTION_ADD_STREET2', False),
'ask_for_second_phone': getattr(settings, 'SUBSCRIPTION_ADD_SECOND_PHONE', False), 'ask_for_second_phone': getattr(settings, 'SUBSCRIPTION_ADD_SECOND_PHONE', False),
'show_ftop_button': getattr(settings, 'SHOW_FTOP_BUTTON', True),
'em_url': settings.EM_URL, 'em_url': settings.EM_URL,
'WELCOME_ENTRANCE_MSG': settings.WELCOME_ENTRANCE_MSG, 'WELCOME_ENTRANCE_MSG': settings.WELCOME_ENTRANCE_MSG,
'WELCOME_SUBTITLE_ENTRANCE_MSG': getattr(settings, 'WELCOME_SUBTITLE_ENTRANCE_MSG', '')} 'WELCOME_SUBTITLE_ENTRANCE_MSG': getattr(settings, 'WELCOME_SUBTITLE_ENTRANCE_MSG', '')}
......
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
*/ */
function toggleHeader() { function toggleHeader() {
var x = document.getElementById("topnav"); var x = document.getElementById("topnav");
if (x.className === "topnav") { if (x.className === "topnav") {
x.className += " responsive"; x.className += " responsive";
} else { } else {
x.className = "topnav"; x.className = "topnav";
} }
} }
$(document).ready(function() { $(document).ready(function() {
// Navbar redirections // Navbar redirections
......
...@@ -5,22 +5,23 @@ const possible_cooperative_state = { ...@@ -5,22 +5,23 @@ const possible_cooperative_state = {
up_to_date: "À jour", up_to_date: "À jour",
unsubscribed: "Désinscrit.e", unsubscribed: "Désinscrit.e",
delay: "En délai" delay: "En délai"
} };
/** /**
* Request a 6 month delay * Request a 6 month delay
*/ */
function request_delay() { function request_delay() {
return new Promise((resolve) => { return new Promise((resolve) => {
let today = new Date(); let today = new Date();
const delay_start = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate(); const delay_start = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
let today_plus_six_month = new Date(); let today_plus_six_month = new Date();
today_plus_six_month.setMonth(today_plus_six_month.getMonth()+6); today_plus_six_month.setMonth(today_plus_six_month.getMonth()+6);
const diff_time = Math.abs(today_plus_six_month - today); const diff_time = Math.abs(today_plus_six_month - today);
const diff_days = Math.ceil(diff_time / (1000 * 60 * 60 * 24)); const diff_days = Math.ceil(diff_time / (1000 * 60 * 60 * 24));
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: "/shifts/request_delay", url: "/shifts/request_delay",
...@@ -34,7 +35,7 @@ const possible_cooperative_state = { ...@@ -34,7 +35,7 @@ const possible_cooperative_state = {
success: function() { success: function() {
partner_data.cooperative_state = 'delay'; partner_data.cooperative_state = 'delay';
partner_data.date_delay_stop = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate(); partner_data.date_delay_stop = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
resolve(); resolve();
}, },
error: function(data) { error: function(data) {
...@@ -54,16 +55,18 @@ const possible_cooperative_state = { ...@@ -54,16 +55,18 @@ const possible_cooperative_state = {
function init_my_shifts_tile() { function init_my_shifts_tile() {
if (incoming_shifts.length === 0) { if (incoming_shifts.length === 0) {
$("#home_tile_my_services #home_incoming_services").text("Aucun service à venir...") $("#home_tile_my_services #home_incoming_services").text("Aucun service à venir...");
} else { } else {
$("#home_tile_my_services #home_incoming_services").empty(); $("#home_tile_my_services #home_incoming_services").empty();
let cpt = 0; let cpt = 0;
for (shift of incoming_shifts) { for (shift of incoming_shifts) {
if (cpt === 3) { if (cpt === 3) {
break; break;
} else { } else {
let shift_line_template = prepare_shift_line_template(shift.date_begin); let shift_line_template = prepare_shift_line_template(shift.date_begin);
$("#home_tile_my_services #home_incoming_services").append(shift_line_template.html()); $("#home_tile_my_services #home_incoming_services").append(shift_line_template.html());
cpt++; cpt++;
...@@ -82,11 +85,11 @@ function init_home() { ...@@ -82,11 +85,11 @@ function init_home() {
$("#see_more_info_link").on('click', (e) => { $("#see_more_info_link").on('click', (e) => {
e.preventDefault(); e.preventDefault();
goto('mes-infos'); goto('mes-infos');
}) });
// Init my info tile // Init my info tile
init_my_info_data(); init_my_info_data();
if (incoming_shifts !== null) { if (incoming_shifts !== null) {
init_my_shifts_tile(); init_my_shifts_tile();
} else { } else {
......
...@@ -5,7 +5,7 @@ const history_items_limit = 10; ...@@ -5,7 +5,7 @@ const history_items_limit = 10;
/** /**
* Load the partner points history * Load the partner points history
*/ */
function load_partner_history(offset = 0) { function load_partner_history(offset = 0) {
return new Promise((resolve) => { return new Promise((resolve) => {
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
...@@ -40,8 +40,8 @@ const history_items_limit = 10; ...@@ -40,8 +40,8 @@ const history_items_limit = 10;
/** /**
* Format history data to insert in the table * Format history data to insert in the table
* *
* @param {Array} data * @param {Array} data
* @returns formated data array * @returns formated data array
*/ */
function prepare_server_data(data) { function prepare_server_data(data) {
...@@ -52,6 +52,7 @@ function prepare_server_data(data) { ...@@ -52,6 +52,7 @@ function prepare_server_data(data) {
let datetime_shift_start = new Date(history_item.create_date); let datetime_shift_start = new Date(history_item.create_date);
let f_date_shift_start = datetime_shift_start.toLocaleDateString("fr-fr", date_options); let f_date_shift_start = datetime_shift_start.toLocaleDateString("fr-fr", date_options);
f_date_shift_start = f_date_shift_start.charAt(0).toUpperCase() + f_date_shift_start.slice(1); f_date_shift_start = f_date_shift_start.charAt(0).toUpperCase() + f_date_shift_start.slice(1);
history_item.movement_date = f_date_shift_start + " - " + datetime_shift_start.toLocaleTimeString("fr-fr"); history_item.movement_date = f_date_shift_start + " - " + datetime_shift_start.toLocaleTimeString("fr-fr");
...@@ -83,14 +84,15 @@ function prepare_server_data(data) { ...@@ -83,14 +84,15 @@ function prepare_server_data(data) {
} }
/** /**
* Init the History section: display the history table * Init the History section: display the history table
*/ */
function init_history() { function init_history() {
$(".loading-history").hide(); $(".loading-history").hide();
$("#history").show(); $("#history").show();
if (partner_history.length === 0) { if (partner_history.length === 0) {
$("#history").empty().text("Aucun historique... pour l'instant !") $("#history").empty()
.text("Aucun historique... pour l'instant !");
} else { } else {
let viewportWidth = $(window).width(); let viewportWidth = $(window).width();
...@@ -100,7 +102,7 @@ function init_history() { ...@@ -100,7 +102,7 @@ function init_history() {
{ {
data: "movement_date", data: "movement_date",
title: `Date`, title: `Date`,
responsivePriority: 1, responsivePriority: 1
}, },
{ {
data: "created_by", data: "created_by",
...@@ -110,20 +112,20 @@ function init_history() { ...@@ -110,20 +112,20 @@ function init_history() {
}, },
{ {
data: "shift_name", data: "shift_name",
title: "Service", title: "Service"
}, },
{ {
data: "name", data: "name",
title: "Détails", title: "Détails",
responsivePriority: 3, responsivePriority: 3
}, },
{ {
data: "point_qty", data: "point_qty",
title: (viewportWidth <= 768) ? "Mvmt de points" : "Mouvement de points", title: (viewportWidth <= 768) ? "Mvmt de points" : "Mouvement de points",
responsivePriority: 2, responsivePriority: 2,
width: "10%", width: "10%",
className: (viewportWidth <= 768) ? "dt-body-center" : '', className: (viewportWidth <= 768) ? "dt-body-center" : ''
}, }
], ],
iDisplayLength: -1, iDisplayLength: -1,
ordering: false, ordering: false,
...@@ -133,7 +135,7 @@ function init_history() { ...@@ -133,7 +135,7 @@ function init_history() {
createdRow: function(row) { createdRow: function(row) {
for (var i = 0; i < row.cells.length; i++) { for (var i = 0; i < row.cells.length; i++) {
const cell = $(row.cells[i]); const cell = $(row.cells[i]);
if (cell.text() === "Présent") { if (cell.text() === "Présent") {
$(row).addClass('row_partner_ok'); $(row).addClass('row_partner_ok');
} else if (cell.text() === "Retard") { } else if (cell.text() === "Retard") {
...@@ -155,12 +157,13 @@ function init_incoming_shifts() { ...@@ -155,12 +157,13 @@ function init_incoming_shifts() {
$("#incoming_shifts").show(); $("#incoming_shifts").show();
if (incoming_shifts.length === 0) { if (incoming_shifts.length === 0) {
$("#incoming_shifts").text("Aucun service à venir...") $("#incoming_shifts").text("Aucun service à venir...");
} else { } else {
$("#incoming_shifts").empty(); $("#incoming_shifts").empty();
for (shift of incoming_shifts) { for (shift of incoming_shifts) {
let shift_line_template = prepare_shift_line_template(shift.date_begin); let shift_line_template = prepare_shift_line_template(shift.date_begin);
$("#incoming_shifts").append(shift_line_template.html()); $("#incoming_shifts").append(shift_line_template.html());
} }
} }
...@@ -196,8 +199,8 @@ function init_my_shifts() { ...@@ -196,8 +199,8 @@ function init_my_shifts() {
load_partner_history(partner_history.length) load_partner_history(partner_history.length)
.then((data) => { .then((data) => {
partner_history = partner_history.concat(data); partner_history = partner_history.concat(data);
if (history_table) { if (history_table) {
history_table.rows.add( data ).draw( false ); history_table.rows.add(data).draw(false);
} }
$('.loading-more-history').hide(); $('.loading-more-history').hide();
......
...@@ -13,7 +13,7 @@ var date_options = {weekday: "long", year: "numeric", month: "long", day: "numer ...@@ -13,7 +13,7 @@ var date_options = {weekday: "long", year: "numeric", month: "long", day: "numer
/** /**
* Load the shifts the member is registered to * Load the shifts the member is registered to
* @param {int} partner_id * @param {int} partner_id
*/ */
function load_partner_shifts(partner_id) { function load_partner_shifts(partner_id) {
return new Promise((resolve) => { return new Promise((resolve) => {
...@@ -48,10 +48,10 @@ function load_partner_shifts(partner_id) { ...@@ -48,10 +48,10 @@ function load_partner_shifts(partner_id) {
/* - Navigation */ /* - Navigation */
/** /**
* *
* @param {String} page home | mes-infos | mes-services | echange-de-services * @param {String} page home | mes-infos | mes-services | echange-de-services
*/ */
function goto(page) { function goto(page) {
if (window.location.pathname === base_location) { if (window.location.pathname === base_location) {
history.pushState({}, '', page); history.pushState({}, '', page);
} else { } else {
...@@ -68,45 +68,45 @@ function update_dom() { ...@@ -68,45 +68,45 @@ function update_dom() {
if (window.location.pathname === base_location || window.location.pathname === base_location + "home") { if (window.location.pathname === base_location || window.location.pathname === base_location + "home") {
current_location = "home"; current_location = "home";
$( "#main_content" ).load( "/members_space/homepage", update_content ); $("#main_content").load("/members_space/homepage", update_content);
$("#nav_home").addClass("active"); $("#nav_home").addClass("active");
} else if (window.location.pathname === base_location + "mes-infos") { } else if (window.location.pathname === base_location + "mes-infos") {
current_location = "my_info"; current_location = "my_info";
$( "#main_content" ).load( "/members_space/my_info", update_content ); $("#main_content").load("/members_space/my_info", update_content);
$("#nav_my_info").addClass("active"); $("#nav_my_info").addClass("active");
} else if (window.location.pathname === base_location + "mes-services") { } else if (window.location.pathname === base_location + "mes-services") {
current_location = "my_shifts"; current_location = "my_shifts";
$( "#main_content" ).load( "/members_space/my_shifts", update_content ); $("#main_content").load("/members_space/my_shifts", update_content);
$("#nav_my_shifts").addClass("active"); $("#nav_my_shifts").addClass("active");
} else if (window.location.pathname === base_location + "echange-de-services") { } else if (window.location.pathname === base_location + "echange-de-services") {
current_location = "shifts_exchange"; current_location = "shifts_exchange";
$( "#main_content" ).load( "/members_space/shifts_exchange", update_content ); $("#main_content").load("/members_space/shifts_exchange", update_content);
$("#nav_shifts_exchange").addClass("active"); $("#nav_shifts_exchange").addClass("active");
} else { } else {
$( "#main_content" ).load( "/members_space/no_content" ); $("#main_content").load("/members_space/no_content");
} }
} }
/** /**
* Update the data displayed depending on the current location (ex: insert personal data in the DOM when on the 'My Info' page) * Update the data displayed depending on the current location (ex: insert personal data in the DOM when on the 'My Info' page)
*/ */
function update_content() { function update_content() {
switch (current_location) { switch (current_location) {
case 'home': case 'home':
init_home(); init_home();
break; break;
case 'my_info': case 'my_info':
init_my_info(); init_my_info();
break; break;
case 'my_shifts': case 'my_shifts':
init_my_shifts(); init_my_shifts();
break; break;
case 'shifts_exchange': case 'shifts_exchange':
init_shifts_exchange(); init_shifts_exchange();
break; break;
default: default:
console.log(`Bad input`); console.log(`Bad input`);
} }
} }
/* - Shifts */ /* - Shifts */
...@@ -114,7 +114,7 @@ function update_dom() { ...@@ -114,7 +114,7 @@ function update_dom() {
/** /**
* Prepare a shift line to insert into the DOM. * Prepare a shift line to insert into the DOM.
* Is used in: Home - My Shifts tile ; My Shifts - Incoming shifts section * Is used in: Home - My Shifts tile ; My Shifts - Incoming shifts section
* *
* @param {String} date_begin beginning datetime of the shift * @param {String} date_begin beginning datetime of the shift
* @returns JQuery node object of the formatted template * @returns JQuery node object of the formatted template
*/ */
...@@ -123,8 +123,9 @@ function prepare_shift_line_template(date_begin) { ...@@ -123,8 +123,9 @@ function prepare_shift_line_template(date_begin) {
let datetime_shift_start = new Date(date_begin); let datetime_shift_start = new Date(date_begin);
let f_date_shift_start = datetime_shift_start.toLocaleDateString("fr-fr", date_options); let f_date_shift_start = datetime_shift_start.toLocaleDateString("fr-fr", date_options);
f_date_shift_start = f_date_shift_start.charAt(0).toUpperCase() + f_date_shift_start.slice(1); f_date_shift_start = f_date_shift_start.charAt(0).toUpperCase() + f_date_shift_start.slice(1);
shift_line_template.find(".shift_line_date").text(f_date_shift_start); shift_line_template.find(".shift_line_date").text(f_date_shift_start);
shift_line_template.find(".shift_line_time").text(datetime_shift_start.toLocaleTimeString("fr-fr")); shift_line_template.find(".shift_line_time").text(datetime_shift_start.toLocaleTimeString("fr-fr"));
...@@ -148,7 +149,7 @@ function init_my_info_data() { ...@@ -148,7 +149,7 @@ function init_my_info_data() {
.addClass("member_status_" + partner_data.cooperative_state); .addClass("member_status_" + partner_data.cooperative_state);
if (partner_data.cooperative_state === 'delay' && partner_data.date_delay_stop !== 'False') { if (partner_data.cooperative_state === 'delay' && partner_data.date_delay_stop !== 'False') {
const d = new Date (Date.parse(partner_data.date_delay_stop)); const d = new Date(Date.parse(partner_data.date_delay_stop));
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);
...@@ -165,14 +166,13 @@ function init_my_info_data() { ...@@ -165,14 +166,13 @@ function init_my_info_data() {
}); });
}); });
} }
if (partner_data.makeups_to_do > 0) { if (partner_data.makeups_to_do > 0) {
$(".choose_makeups").show(); $(".choose_makeups").show();
if ( if (
partner_data.cooperative_state === 'suspended' partner_data.cooperative_state === 'suspended'
&& partner_data.date_delay_stop === 'False') && partner_data.date_delay_stop === 'False') {
{
// If the member is suspended & doesn't have a delay // If the member is suspended & doesn't have a delay
$(".choose_makeups").on('click', () => { $(".choose_makeups").on('click', () => {
// Create 6 month delay // Create 6 month delay
...@@ -180,7 +180,7 @@ function init_my_info_data() { ...@@ -180,7 +180,7 @@ function init_my_info_data() {
.then(() => { .then(() => {
// Then redirect to calendar // Then redirect to calendar
goto('echange-de-services'); goto('echange-de-services');
}) });
}); });
} else { } else {
$(".choose_makeups").on('click', () => { $(".choose_makeups").on('click', () => {
......
...@@ -1264,9 +1264,9 @@ function _compute_product_data(product) { ...@@ -1264,9 +1264,9 @@ function _compute_product_data(product) {
days_covered = (product.qty_available + product.incoming_qty + purchase_qty) / product.daily_conso; days_covered = (product.qty_available + product.incoming_qty + purchase_qty) / product.daily_conso;
days_covered = Math.floor(days_covered); days_covered = Math.floor(days_covered);
} }
item.qty_not_covered = qty_not_covered; item.qty_not_covered = qty_not_covered;
item.days_covered = days_covered; item.days_covered = days_covered;
return item; return item;
} }
......
...@@ -118,6 +118,10 @@ ...@@ -118,6 +118,10 @@
If True, in shift_template calendar choice view, "Volant" button is included If True, in shift_template calendar choice view, "Volant" button is included
- USE_STANDARD_SHIFT = True (by default)
La Cagette use False to implement custom rules
### Scales and labels files generation ### Scales and labels files generation
- DAV_PATH = '/data/dav/cagette' - DAV_PATH = '/data/dav/cagette'
......
...@@ -35,7 +35,7 @@ function get_shift_name(s_data) { ...@@ -35,7 +35,7 @@ function get_shift_name(s_data) {
if (s_data && s_data.week) { if (s_data && s_data.week) {
shift_name = weeks_name[s_data.week]; shift_name = weeks_name[s_data.week];
if (s_data.type == 2) { if (s_data.type == 2 && typeof manage_ftop != "undefined" && manage_ftop == true) {
shift_name = 'Volant'; shift_name = 'Volant';
} else { } else {
shift_name += s_data.day + ' - ' + s_data.begin; shift_name += s_data.day + ' - ' + s_data.begin;
......
...@@ -122,6 +122,8 @@ class CagetteShift(models.Model): ...@@ -122,6 +122,8 @@ class CagetteShift(models.Model):
def get_shift_ticket(self,idShift, in_ftop_team): def get_shift_ticket(self,idShift, in_ftop_team):
"""Récupérer le shift_ticket suivant le membre et flotant ou pas""" """Récupérer le shift_ticket suivant le membre et flotant ou pas"""
if getattr(settings, 'USE_STANDARD_SHIFT', True) == False:
in_ftop_team = "True"
fields = ['shift_ticket_ids'] fields = ['shift_ticket_ids']
cond = [['id', "=", idShift]] cond = [['id', "=", idShift]]
listeTicket = self.o_api.search_read('shift.shift', cond, fields) listeTicket = self.o_api.search_read('shift.shift', cond, fields)
...@@ -134,11 +136,14 @@ class CagetteShift(models.Model): ...@@ -134,11 +136,14 @@ class CagetteShift(models.Model):
"""Shift registration""" """Shift registration"""
st_r_id = False st_r_id = False
try: try:
shift_type = "standard"
if data['in_ftop_team'] == "True" or getattr(settings, 'USE_STANDARD_SHIFT', True) == False:
shift_type = "ftop"
fieldsDatas = { "partner_id": data['idPartner'], fieldsDatas = { "partner_id": data['idPartner'],
"shift_id": data['idShift'], "shift_id": data['idShift'],
"shift_ticket_id": self.get_shift_ticket(data['idShift'], data['in_ftop_team']), "shift_ticket_id": self.get_shift_ticket(data['idShift'], data['in_ftop_team']),
"shift_type": "standard", # ftop "shift_type": shift_type,
"related_shift_state": 'confirm', "origin": 'memberspace',
"state": 'open'} "state": 'open'}
st_r_id = self.o_api.create('shift.registration', fieldsDatas) st_r_id = self.o_api.create('shift.registration', fieldsDatas)
......
...@@ -137,7 +137,7 @@ function changeShift(idOldRegister, idNewShift) { ...@@ -137,7 +137,7 @@ function changeShift(idOldRegister, idNewShift) {
closeModal(); closeModal();
if (error.status === 400) { if (error.status === 400) {
alert(`Désolé ! Le service que vous souhaitez échanger démarre dans moins de 24h. Il n'est plus possible de l'échanger.`) alert(`Désolé ! Le service que vous souhaitez échanger démarre dans moins de 24h. Il n'est plus possible de l'échanger.`);
} else { } else {
alert('Une erreur est survenue. Il est néanmoins possible que la requête ait abouti, veuillez patienter quelques secondes puis vérifier vos services enregistrés.'); alert('Une erreur est survenue. Il est néanmoins possible que la requête ait abouti, veuillez patienter quelques secondes puis vérifier vos services enregistrés.');
......
...@@ -108,7 +108,7 @@ def get_list_shift_calendar(request, partner_id): ...@@ -108,7 +108,7 @@ def get_list_shift_calendar(request, partner_id):
events = [] events = []
for value in listService: for value in listService:
events.append(value) events.append(value)
if value['shift_type_id'][0] == 1: if value['shift_type_id'][0] == 1 or getattr(settings, 'USE_STANDARD_SHIFT', True) is False:
l = set(value['registration_ids']) & set(listRegisterPartner) l = set(value['registration_ids']) & set(listRegisterPartner)
# if (int(value['seats_reserved']) == int(value['seats_max']) and len(l) > 0 ) or (int(value['seats_reserved']) < int(value['seats_max'])): # if (int(value['seats_reserved']) == int(value['seats_max']) and len(l) > 0 ) or (int(value['seats_reserved']) < int(value['seats_max'])):
if (int(value['seats_available']) > 0 or len(l) > 0 ): if (int(value['seats_available']) > 0 or len(l) > 0 ):
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
{% if open_on_sunday %} {% if open_on_sunday %}
let open_on_sunday = true let open_on_sunday = true
{% endif %} {% endif %}
let manage_ftop = {% if show_ftop_button %}true{% else %}false{% endif %};
</script> </script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<script type="text/javascript"> <script type="text/javascript">
var type = 2; var type = 2;
var context = 'validation'; var context = 'validation';
let manage_ftop = {% if show_ftop_button %}true{% else %}false{% endif %};
</script> </script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
history.pushState(null, null, location.pathname) history.pushState(null, null, location.pathname)
} }
var coop = {{coop|safe}}; var coop = {{coop|safe}};
let manage_ftop = {% if show_ftop_button %}true{% else %}false{% endif %};
</script> </script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
......
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