Commit 455757da by François

Merge branch 'evolution_bdm' of…

Merge branch 'evolution_bdm' of https://gl.cooperatic.fr/cooperatic-foodcoops/third-party into evolution_bdm
parents 7b266f4d f84ff8b4
Pipeline #1374 failed with stage
in 1 minute 50 seconds
...@@ -24,6 +24,21 @@ default_msettings = {'msg_accueil': {'title': 'Message borne accueil', ...@@ -24,6 +24,21 @@ default_msettings = {'msg_accueil': {'title': 'Message borne accueil',
'title': 'Lien vers le calendrier ABCD', 'title': 'Lien vers le calendrier ABCD',
'type': 'text', 'type': 'text',
'value': '' 'value': ''
},
'forms_link' : {
'title': 'Lien vers la page des formulaires',
'type': 'text',
'value': ''
},
'unsuscribe_form_link' : {
'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': ''
} }
} }
...@@ -199,4 +214,32 @@ def create_envelops(request): ...@@ -199,4 +214,32 @@ def create_envelops(request):
response = JsonResponse(res, safe=False) response = JsonResponse(res, safe=False)
else: else:
response = JsonResponse(res, status=403) response = JsonResponse(res, status=403)
return response return response
\ No newline at end of file
# # # ADMIN / BDM # # #
def admin(request):
""" Administration des membres """
template = loader.get_template('members/admin/index.html')
context = {'title': 'BDM',
'module': 'Membres'}
return HttpResponse(template.render(context, request))
def get_makeups_members(request):
""" Récupération des membres qui doivent faire des rattrapages """
res = CagetteMembers.get_makeups_members()
return JsonResponse({ 'res' : res })
def update_members_makeups(request):
""" Décrémente les rattrapages des membres passés dans la requête """
res = {}
is_connected_user = CagetteUser.are_credentials_ok(request)
if is_connected_user is True:
members_data = json.loads(request.body.decode())
res["res"] = CagetteMembers.update_members_makeups(members_data)
response = JsonResponse(res)
else:
res["message"] = "Unauthorized"
response = JsonResponse(res, status=403)
return response
...@@ -1015,7 +1015,28 @@ class CagetteMembers(models.Model): ...@@ -1015,7 +1015,28 @@ class CagetteMembers(models.Model):
res['error'] = str(e) res['error'] = str(e)
return res return res
@staticmethod
def get_makeups_members():
api = OdooAPI()
cond = [['makeups_to_do','>', 0]]
fields = ['id', 'name', 'makeups_to_do']
res = api.search_read('res.partner', cond, fields)
return res
@staticmethod
def update_members_makeups(members_data):
api = OdooAPI()
res = []
for member_data in members_data:
member_id = int(member_data["member_id"])
f = { 'makeups_to_do': int(member_data["target_makeups_nb"]) }
res_item = api.update('res.partner', [member_id], f)
res.append({
'mid': member_id,
'update': res_item
})
return res
class CagetteServices(models.Model): class CagetteServices(models.Model):
"""Class to handle cagette Odoo services.""" """Class to handle cagette Odoo services."""
......
.page_body{
position: relative;
}
.header {
margin: 1.5rem 0;
}
.login_area {
position: absolute;
top: 0;
left: 0;
right: 0;
}
.tabs {
margin-top: 1em;
margin-bottom: 1em;
overflow: hidden;
}
.tabs .tab {
background-color: #f1f1f1;
border: 1px solid #ccc;
outline: none;
cursor: pointer;
padding: 14px 16px;
transition: 0.3s;
}
.tabs .tab:hover {
background-color: #ccc;
}
.tabs .active {
background-color: transparent;
border: 1px solid #ccc;
border-width: 1px 0 0 0;
}
.tabs .active:hover {
background-color: white;
}
.tab_content {
animation: fadeEffect 1s; /* Fading effect takes 1 second */
}
/* Go from zero to full opacity */
@keyframes fadeEffect {
from {opacity: 0;}
to {opacity: 1;}
}
#tab_makeups_content {
padding: 2rem 0;
}
#table_top_area {
display: flex;
justify-content: space-between;
}
#decrement_selected_members_makeups {
display: none;
}
.table_area {
margin-top: 20px;
}
.decrement_makeup {
padding: 0.4rem 1.25rem;
margin-left: 10px;
}
.select_member_cb {
cursor: pointer;
}
\ No newline at end of file
...@@ -55,10 +55,10 @@ sync.on('change', function (info) { ...@@ -55,10 +55,10 @@ sync.on('change', function (info) {
update_completed_count(); update_completed_count();
online = true; online = true;
}) })
.on('denied', function (err) { .on('denied', function () {
// a document failed to replicate (e.g. due to permissions) // a document failed to replicate (e.g. due to permissions)
}) })
.on('complete', function (info) { .on('complete', function () {
// handle complete // handle complete
}) })
.on('error', function (err) { .on('error', function (err) {
...@@ -87,9 +87,7 @@ function new_coop_validation() { ...@@ -87,9 +87,7 @@ function new_coop_validation() {
coop_list_view.hide(); coop_list_view.hide();
schoice_view.hide(); schoice_view.hide();
ncoop_view.hide(); ncoop_view.hide();
var barcode_base = current_coop.barcode_base;
var st = get_shift_name(current_coop.shift_template.data); var st = get_shift_name(current_coop.shift_template.data);
//coop_registration_details.find('.numbox').text('N° '+ barcode_base);
coop_registration_details.find('.shift_template').text(st); coop_registration_details.find('.shift_template').text(st);
process_state.html(current_coop.firstname + ' ' +current_coop.lastname); process_state.html(current_coop.firstname + ' ' +current_coop.lastname);
...@@ -148,12 +146,11 @@ function _really_save_new_coop(email, fname, lname, cap, pm, cn, bc, msex) { ...@@ -148,12 +146,11 @@ function _really_save_new_coop(email, fname, lname, cap, pm, cn, bc, msex) {
if (email != current_email) { if (email != current_email) {
//delete current_coop after copying revelant data //delete current_coop after copying revelant data
dbc.remove(current_email, coop._rev, function(err, response) { dbc.remove(current_email, coop._rev, function(err) {
if (err) { if (err) {
return console.log(err); return console.log(err);
} }
//console.log(response);
}); });
delete coop._rev; delete coop._rev;
...@@ -461,7 +458,7 @@ function setLocalInProcess(lip) { ...@@ -461,7 +458,7 @@ function setLocalInProcess(lip) {
localStorage.setItem("in_process", JSON.stringify(lip)); localStorage.setItem("in_process", JSON.stringify(lip));
} }
function keep_in_process_work(event) { function keep_in_process_work() {
//If data registration is in process, save it in localStorage //If data registration is in process, save it in localStorage
if (current_coop != null && typeof (current_coop.shift_template) == "undefined") { if (current_coop != null && typeof (current_coop.shift_template) == "undefined") {
local_in_process = getLocalInProcess(); local_in_process = getLocalInProcess();
......
...@@ -9,7 +9,7 @@ if (coop_is_connected()) { ...@@ -9,7 +9,7 @@ if (coop_is_connected()) {
env_template = $('#templates [data-type="envelops"]'); env_template = $('#templates [data-type="envelops"]');
// PouchDB sync actions listeners // PouchDB sync actions listeners
sync.on('change', function (info) { sync.on('change', function () {
// handle change // handle change
...@@ -27,10 +27,10 @@ if (coop_is_connected()) { ...@@ -27,10 +27,10 @@ if (coop_is_connected()) {
//update_completed_count(); //update_completed_count();
online = true; online = true;
}) })
.on('denied', function (err) { .on('denied', function () {
// a document failed to replicate (e.g. due to permissions) // a document failed to replicate (e.g. due to permissions)
}) })
.on('complete', function (info) { .on('complete', function () {
// handle complete // handle complete
}) })
.on('error', function (err) { .on('error', function (err) {
...@@ -333,7 +333,7 @@ if (coop_is_connected()) { ...@@ -333,7 +333,7 @@ if (coop_is_connected()) {
dsha1 = sha1(jss), dsha1 = sha1(jss),
member = {_id: dsha1, data: data, hash: dsha1 }; member = {_id: dsha1, data: data, hash: dsha1 };
dbc.put(member, function callback(err, result) { dbc.put(member, function callback(err) {
if (!err) { if (!err) {
closeModal(); closeModal();
page_cleaning(); page_cleaning();
......
...@@ -33,7 +33,6 @@ var shift_members = $('#current_shift_members'); ...@@ -33,7 +33,6 @@ var shift_members = $('#current_shift_members');
var service_validation = $('#service_validation'); var service_validation = $('#service_validation');
var validation_last_call = 0; var validation_last_call = 0;
var rattrapage_wanted = $('[data-next="rattrapage_1"]'); var rattrapage_wanted = $('[data-next="rattrapage_1"]');
var rattrapage_validation = $('#rattrapage_validation');
var webcam_is_attached = false; var webcam_is_attached = false;
var photo_advice = $('#photo_advice'); var photo_advice = $('#photo_advice');
var photo_studio = $('#photo_studio'); var photo_studio = $('#photo_studio');
...@@ -637,7 +636,7 @@ shift_members.on("click", '.btn[data-rid]', function() { ...@@ -637,7 +636,7 @@ shift_members.on("click", '.btn[data-rid]', function() {
}); });
pages.shopping_entry.on('css', function(e) { pages.shopping_entry.on('css', function() {
photo_advice.hide(); photo_advice.hide();
photo_studio.hide(); photo_studio.hide();
search_box_clear_html_elts(); search_box_clear_html_elts();
...@@ -645,14 +644,14 @@ pages.shopping_entry.on('css', function(e) { ...@@ -645,14 +644,14 @@ pages.shopping_entry.on('css', function(e) {
move_search_box(pages.rattrapage_1, pages.shopping_entry); move_search_box(pages.rattrapage_1, pages.shopping_entry);
}); });
pages.service_entry.on('css', function(e) { pages.service_entry.on('css', function() {
photo_advice.hide(); photo_advice.hide();
photo_studio.hide(); photo_studio.hide();
clean_service_entry(); clean_service_entry();
get_service_entry_data(); get_service_entry_data();
}); });
pages.rattrapage_1.on('css', function(e) { pages.rattrapage_1.on('css', function() {
search_box_clear_html_elts(); search_box_clear_html_elts();
var msg = "Vous venez pour un rattrapage."; var msg = "Vous venez pour un rattrapage.";
...@@ -682,7 +681,7 @@ function ask_for_easy_shift_validation() { ...@@ -682,7 +681,7 @@ function ask_for_easy_shift_validation() {
{ {
coop_id: operator.id coop_id: operator.id
}, },
function(err, result) { function(err) {
if (!err) { if (!err) {
alert("1 point volant vient d'être ajouté."); alert("1 point volant vient d'être ajouté.");
clean_search_for_easy_validate_zone(); clean_search_for_easy_validate_zone();
...@@ -798,7 +797,7 @@ $(document).ready(function() { ...@@ -798,7 +797,7 @@ $(document).ready(function() {
display_possible_members(); display_possible_members();
}, },
error: function(data) { error: function() {
err = { err = {
msg: "erreur serveur lors de la recherche de membres", msg: "erreur serveur lors de la recherche de membres",
ctx: 'easy_validate.search_members' ctx: 'easy_validate.search_members'
......
var makeups_members_table = null,
makeups_members = null,
selected_rows = []; // Contain members id
function switch_active_tab() {
// Set tabs
$('.tab').removeClass('active');
$(this).addClass('active');
// Tabs content
$('.tab_content').hide();
let tab = $(this).attr('id');
if (tab == 'tab_makeups') {
$('#tab_makeups_content').show();
}
load_tab_data();
}
/**
* Load data for the current tab
*/
function load_tab_data() {
let current_tab = $('.tab .active').attr('id');
if (current_tab === 'tab_makeups' && makeups_members === null) {
load_makeups_members();
}
}
/**
* Load partners who have makeups to do
*/
function load_makeups_members() {
$.ajax({
type: 'GET',
url: "/members/get_makeups_members",
dataType:"json",
traditional: true,
contentType: "application/json; charset=utf-8",
success: function(data) {
makeups_members = data.res;
display_makeups_members();
},
error: function(data) {
err = {msg: "erreur serveur lors de la récupération des membres avec rattrapage", ctx: 'load_makeups_members'};
if (typeof data.responseJSON != 'undefined' && typeof data.responseJSON.error != 'undefined') {
err.msg += ' : ' + data.responseJSON.error;
}
report_JS_error(err, 'orders');
closeModal();
alert('Erreur serveur lors de la récupération des membres avec rattrapage. Ré-essayez plus tard.');
}
});
}
/**
* (Re)Display table of makeup members
*/
function display_makeups_members() {
if (makeups_members_table) {
$('#makeups_members_table').off();
makeups_members_table.clear().destroy();
$('#makeups_members_table').empty();
}
// Remove members with 0 makeups to do
ids_to_remove = [];
for (member_item of makeups_members) {
if (member_item.makeups_to_do == 0) {
ids_to_remove.push(member_item.id);
}
}
makeups_members = makeups_members.filter(m => !ids_to_remove.includes(m.id));
// TODO : select multiple and grouped action
makeups_members_table = $('#makeups_members_table').DataTable({
data: makeups_members,
columns: [
{
data: "id",
title: '',
className: "dt-body-center",
orderable: false,
render: function (data) {
return `<input type="checkbox" class="select_member_cb" id="select_member_${data}" value="${data}">`;
},
width: "3%"
},
{
data: "name",
title: "Nom"
},
{
data: "makeups_to_do",
title: "Nb rattrapages",
className: "dt-body-center",
width: "10%",
render: function (data, type, full) {
return `<b>${data}</b>
<button class="decrement_makeup btn--primary" id="decrement_member_${full.id}">
<i class="fas fa-arrow-down"></i>
</button>`;
}
}
],
aLengthMenu: [
[
25,
50,
-1
],
[
25,
50,
"Tout"
]
],
iDisplayLength: -1,
language: {url : '/static/js/datatables/french.json'}
});
$('#makeups_members_table').on('click', 'tbody td .decrement_makeup', function () {
const button_id = $(this).prop('id')
.split('_');
const member_id = button_id[button_id.length - 1];
const member = makeups_members.find(m => m.id == member_id);
openModal(
`Enlever un rattrapage à ${member.name} ?`,
() => {
decrement_makeups([member_id]);
},
"Confirmer",
false
);
});
$('#makeups_members_table').on('click', 'tbody td .select_member_cb', function () {
$(this).closest('tr')
.toggleClass('selected');
// Save / unsave selected row
const m_id = makeups_members_table.row($(this).closest('tr')).data().id;
const first_select = selected_rows.length === 0;
if (this.checked) {
selected_rows.push(m_id);
} else {
const i = selected_rows.findIndex(id => id == m_id);
selected_rows.splice(i, 1);
}
if (selected_rows.length > 0) {
$("#decrement_selected_members_makeups").show();
if (first_select) {
$("#decrement_selected_members_makeups").on("click", () => {
openModal(
`Enlever un rattrapage aux membres sélectionnés ?`,
() => {
decrement_makeups(selected_rows);
},
"Confirmer",
false
);
});
}
} else {
$("#decrement_selected_members_makeups").off()
.hide();
}
});
}
/**
* Send request to update members nb of makeups to do
* @param {Array} member_ids
*/
function decrement_makeups(member_ids) {
openModal();
data = [];
for (mid of member_ids) {
member_index = makeups_members.findIndex(m => m.id == mid);
makeups_members[member_index].makeups_to_do -= 1;
data.push({
member_id: mid,
target_makeups_nb: makeups_members[member_index].makeups_to_do
});
}
$.ajax({
type: 'POST',
url: "/members/update_members_makeups",
data: JSON.stringify(data),
dataType:"json",
traditional: true,
contentType: "application/json; charset=utf-8",
success: function() {
selected_rows = [];
display_makeups_members();
closeModal();
},
error: function(data) {
err = {msg: "erreur serveur pour décrémenter les rattrapages", ctx: 'load_makeups_members'};
if (typeof data.responseJSON != 'undefined' && typeof data.responseJSON.error != 'undefined') {
err.msg += ' : ' + data.responseJSON.error;
}
report_JS_error(err, 'orders');
closeModal();
alert('Erreur serveur lors de la récupération des membres avec rattrapage. Ré-essayez plus tard.');
}
});
}
$(document).ready(function() {
if (coop_is_connected()) {
$.ajaxSetup({ headers: { "X-CSRFToken": getCookie('csrftoken') } });
$(".page_content").show();
load_makeups_members();
$(".tabs .tab").on('click', switch_active_tab);
} else {
$(".page_content").hide();
}
});
...@@ -46,10 +46,10 @@ sync.on('change', function (info) { ...@@ -46,10 +46,10 @@ sync.on('change', function (info) {
// replicate resumed (e.g. new changes replicating, user went back online) // replicate resumed (e.g. new changes replicating, user went back online)
online = true; online = true;
}) })
.on('denied', function (err) { .on('denied', function () {
// a document failed to replicate (e.g. due to permissions) // a document failed to replicate (e.g. due to permissions)
}) })
.on('complete', function (info) { .on('complete', function () {
// handle complete // handle complete
}) })
.on('error', function (err) { .on('error', function (err) {
...@@ -113,7 +113,7 @@ function put_current_coop_in_buffer_db(callback) { ...@@ -113,7 +113,7 @@ function put_current_coop_in_buffer_db(callback) {
var can_continue = true; var can_continue = true;
if (typeof current_coop._old_id != "undefined") { if (typeof current_coop._old_id != "undefined") {
dbc.remove(current_coop._old_id, current_coop._rev, function(err, response) { dbc.remove(current_coop._old_id, current_coop._rev, function(err) {
if (err) { if (err) {
console.log(err); can_continue = false; console.log(err); can_continue = false;
} }
...@@ -131,7 +131,6 @@ function put_current_coop_in_buffer_db(callback) { ...@@ -131,7 +131,6 @@ function put_current_coop_in_buffer_db(callback) {
function process_new_warning(event) { function process_new_warning(event) {
event.preventDefault(); event.preventDefault();
var msg = warning_msg.val(); var msg = warning_msg.val();
var btn = $(event.target).find('button');
openModal(); openModal();
if (msg.length > 0) { if (msg.length > 0) {
...@@ -208,7 +207,7 @@ function submit_full_coop_form() { ...@@ -208,7 +207,7 @@ function submit_full_coop_form() {
} }
post_form( post_form(
'/members/coop_validated_data', form_data, '/members/coop_validated_data', form_data,
function(err, result) { function(err) {
if (!err) { if (!err) {
setTimeout(after_save, 1500); setTimeout(after_save, 1500);
} else { } else {
......
...@@ -92,7 +92,7 @@ function process_form_submission(event) { ...@@ -92,7 +92,7 @@ function process_form_submission(event) {
openModal(); openModal();
post_form( post_form(
'/members/coop_validated_data', form_data, '/members/coop_validated_data', form_data,
function(err, result) { function(err) {
closeModal(); closeModal();
if (!err) { if (!err) {
...@@ -119,7 +119,7 @@ function process_form_submission(event) { ...@@ -119,7 +119,7 @@ function process_form_submission(event) {
openModal(); openModal();
post_form( post_form(
'/members/coop_warning_msg', data, '/members/coop_warning_msg', data,
function(err, result) { function(err) {
closeModal(); closeModal();
if (!err) { if (!err) {
$('#main_content').remove(); $('#main_content').remove();
......
...@@ -49,4 +49,8 @@ urlpatterns = [ ...@@ -49,4 +49,8 @@ urlpatterns = [
url(r'^easy_validate_shift_presence$', views.easy_validate_shift_presence), url(r'^easy_validate_shift_presence$', views.easy_validate_shift_presence),
# conso / groupe recherche / socio # conso / groupe recherche / socio
url(r'^panel_get_purchases$', views.panel_get_purchases), url(r'^panel_get_purchases$', views.panel_get_purchases),
# BDM - members admin
url(r'^admin$', admin.admin),
url(r'^get_makeups_members$', admin.get_makeups_members),
url(r'^update_members_makeups$', admin.update_members_makeups),
] ]
...@@ -13,10 +13,25 @@ ...@@ -13,10 +13,25 @@
text-align: center; 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; 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 screen, area on top of the calendar */
#calendar_top_info { #calendar_top_info {
......
...@@ -19,17 +19,14 @@ body { ...@@ -19,17 +19,14 @@ body {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
border-radius: 30px; border-radius: 30px;
min-height: 350px;
margin: 1rem 1rem; margin: 1rem 1rem;
box-shadow: 2px 2px 3px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1); box-shadow: 2px 2px 3px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);
} }
.high_tile {
.subtile { min-height: 350px;
} }
.small_tile {
.subtile.two { min-height: 250px;
max-width: 45%;
} }
.full_width_tile { .full_width_tile {
...@@ -46,12 +43,18 @@ body { ...@@ -46,12 +43,18 @@ body {
padding: 2rem 0; padding: 2rem 0;
width: 80%; width: 80%;
} }
@media screen and (max-width: 768px) {
.tile_title {
font-size: 2.5rem;
}
}
.tile_content { .tile_content {
position: relative; position: relative;
margin: 3rem 0; margin: 3rem 0;
width: 80%; width: 80%;
display: flex; display: flex;
height: 100%;
} }
#home_tile_services_exchange .tile_content { #home_tile_services_exchange .tile_content {
...@@ -64,6 +67,13 @@ body { ...@@ -64,6 +67,13 @@ body {
#home_tile_my_services .tile_content { #home_tile_my_services .tile_content {
height: 100%; height: 100%;
flex-direction: column; flex-direction: column;
margin: auto;
padding: 2rem 0;
}
@media screen and (min-width: 769px) {
#home_tile_my_services .tile_content {
width: 50%;
}
} }
#home_incoming_services { #home_incoming_services {
...@@ -89,7 +99,7 @@ body { ...@@ -89,7 +99,7 @@ body {
} }
#home_go_to_shift_history { #home_go_to_shift_history {
width: 80%; width: 100%;
margin-top: 30px; margin-top: 30px;
} }
...@@ -108,16 +118,25 @@ body { ...@@ -108,16 +118,25 @@ body {
height: 100%; height: 100%;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
font-size: 2.3rem; font-size: 2.2rem;
}
@media screen and (max-width: 768px) {
#home_tile_my_info .tile_content {
font-size: 1.9rem;
}
} }
.home_member_info { #home .member_info {
font-size: 2rem;
font-weight: bold; font-weight: bold;
} }
#member_status_action { #member_status_action {
margin-bottom:20px; margin-bottom: 20px;
}
@media screen and (max-width: 768px) {
#member_status_action {
margin-bottom: 10px;
}
} }
.choose_makeups { .choose_makeups {
...@@ -180,14 +199,95 @@ body { ...@@ -180,14 +199,95 @@ body {
/* --Shifts exchange tile tile */ /* --Shifts exchange tile tile */
#go_to_shifts_calendar_area { .home_link_button_area {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
height: 100%;
} }
#go_to_shifts_calendar { .home_link_button {
width: 80%; width: 80%;
margin-top: 20px; margin: 30px auto auto auto;
white-space: normal; white-space: normal;
}
/* -- I have a question tile */
#go_to_forms {
text-decoration: none;
}
#go_to_forms:hover {
color: white;
}
#go_to_forms.active {
color: white !important;
}
/* -- Shop info tile */
#shop_info_content {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
width: 80%;
margin: auto;
}
.shop_info_item {
width: 50%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 2rem;
flex: 1 0 50%;
}
.shop_info_item h1,h2,h3,h4,h5,h6 {
font-size: 2rem;
}
.opening_hours_title {
margin-bottom: 10px;
font-size: 2.3rem;
font-weight: bold;
}
.shop_message_content {
text-align: center;
}
@media screen and (min-width: 769px) {
.shop_info_item {
padding: 0 4rem;
}
.shop_message {
border-left: 1px solid #e7e9ed;
margin: 3rem 0;
}
}
@media screen and (max-width: 768px) {
#shop_info_content {
flex-direction: column;
}
.shop_info_item {
flex: 1 0 50%;
width: 100%;
font-size: 1.6rem;
padding: 1.5rem 0;
}
.shop_info_item h1,h2,h3,h4,h5,h6 {
font-size: 1.6rem;
}
.opening_hours_title {
font-size: 1.9rem;
}
.shop_message {
border-top: 1px solid #e7e9ed;
}
.shop_message_content {
width: 90%;
}
} }
\ No newline at end of file
...@@ -30,7 +30,7 @@ function request_delay() { ...@@ -30,7 +30,7 @@ function request_delay() {
verif_token: partner_data.verif_token, verif_token: partner_data.verif_token,
idPartner: partner_data.partner_id, idPartner: partner_data.partner_id,
start_date: delay_start, start_date: delay_start,
duration: diff_days, duration: diff_days
}, },
success: function() { success: function() {
partner_data.cooperative_state = 'delay'; partner_data.cooperative_state = 'delay';
...@@ -43,9 +43,18 @@ function request_delay() { ...@@ -43,9 +43,18 @@ function request_delay() {
&& typeof data.responseJSON != 'undefined' && typeof data.responseJSON != 'undefined'
&& data.responseJSON.message === "delays limit reached") { && data.responseJSON.message === "delays limit reached") {
closeModal(); closeModal();
alert("Vous avez mis plus de 6 mois pour rattraper un service, " +
"vous ne pouvez plus rien faire depuis l'espace membre. " + let msg_template = $("#cant_have_delay_msg_template");
"Merci de contacter le BDM.");
openModal(
msg_template.html(),
() => {
window.location =member_cant_have_delay_form_link;
},
"J'accède au formulaire",
true,
false
);
} else { } else {
err = {msg: "erreur serveur lors de la création du délai", ctx: 'request_delay'}; 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') { if (typeof data.responseJSON != 'undefined' && typeof data.responseJSON.error != 'undefined') {
...@@ -95,6 +104,7 @@ function init_home() { ...@@ -95,6 +104,7 @@ function init_home() {
e.preventDefault(); e.preventDefault();
goto('mes-infos'); goto('mes-infos');
}); });
$("#go_to_forms").prop("href", forms_link);
// Init my info tile // Init my info tile
init_my_info_data(); init_my_info_data();
......
...@@ -106,12 +106,6 @@ function init_history() { ...@@ -106,12 +106,6 @@ function init_history() {
responsivePriority: 1 responsivePriority: 1
}, },
{ {
data: "created_by",
title: "Créé par",
responsivePriority: 20000,
className: "desktop tablet-l"
},
{
data: "shift_name", data: "shift_name",
title: "Service" title: "Service"
}, },
...@@ -119,13 +113,6 @@ function init_history() { ...@@ -119,13 +113,6 @@ function init_history() {
data: "name", data: "name",
title: "Détails", title: "Détails",
responsivePriority: 3 responsivePriority: 3
},
{
data: "point_qty",
title: (viewportWidth <= 768) ? "Mvmt de points" : "Mouvement de points",
responsivePriority: 2,
width: "10%",
className: (viewportWidth <= 768) ? "dt-body-center" : ''
} }
], ],
iDisplayLength: -1, iDisplayLength: -1,
......
...@@ -13,12 +13,12 @@ function can_exchange_shifts() { ...@@ -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 has makeups to do
* - s.he's not an associated partner * - s.he's not an associated partner
* @returns boolean * @returns boolean
*/ */
function can_select_makeup() { function should_select_makeup() {
return partner_data.makeups_to_do > 0 && partner_data.is_associated_people === "False"; return partner_data.makeups_to_do > 0 && partner_data.is_associated_people === "False";
} }
...@@ -187,8 +187,8 @@ function init_calendar_page() { ...@@ -187,8 +187,8 @@ function init_calendar_page() {
template_explanations.html(), template_explanations.html(),
closeModal, closeModal,
"J'ai compris" "J'ai compris"
) );
}) });
} else { } else {
$("#calendar_explaination_button").hide(); $("#calendar_explaination_button").hide();
$("#calendar_explaination_area").html(template_explanations.html()); $("#calendar_explaination_area").html(template_explanations.html());
...@@ -201,7 +201,7 @@ function init_calendar_page() { ...@@ -201,7 +201,7 @@ function init_calendar_page() {
.then(init_shifts_list); .then(init_shifts_list);
} }
if (can_select_makeup()) { if (should_select_makeup()) {
$(".makeups_nb").text(partner_data.makeups_to_do); $(".makeups_nb").text(partner_data.makeups_to_do);
$("#need_to_select_makeups_message").show(); $("#need_to_select_makeups_message").show();
} }
...@@ -283,15 +283,17 @@ function init_calendar_page() { ...@@ -283,15 +283,17 @@ function init_calendar_page() {
closeModal, closeModal,
"J'ai compris" "J'ai compris"
); );
} else if (can_select_makeup()) { } else if (should_select_makeup()) {
/* choose a makeup service */ /* choose a makeup service */
// Check if selected new shift is in less than 6 months // Check if selected new shift is in less than 6 months
if (partner_data.date_delay_stop !== 'False') { if (partner_data.date_delay_stop !== 'False') {
date_partner_delay_stop = new Date(partner_data.date_delay_stop); date_partner_delay_stop = new Date(partner_data.date_delay_stop);
if ( datetime_new_shift > date_partner_delay_stop ) { if (datetime_new_shift > date_partner_delay_stop) {
let msg = `Vous avez jusqu'au ${date_partner_delay_stop.toLocaleDateString("fr-fr", date_options)} ` + let msg = `Vous avez jusqu'au ${date_partner_delay_stop.toLocaleDateString("fr-fr", date_options)} ` +
`pour sélectionner un rattrapage (soit une période de 6 mois depuis votre absence).`; `pour sélectionner un rattrapage (soit une période de 6 mois depuis votre absence).`;
alert(msg); alert(msg);
return; return;
} }
} }
...@@ -339,6 +341,22 @@ function init_shifts_exchange() { ...@@ -339,6 +341,22 @@ function init_shifts_exchange() {
$(this).removeClass('active'); $(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' } else if (partner_data.cooperative_state === 'suspended'
&& partner_data.date_delay_stop === 'False') { && partner_data.date_delay_stop === 'False') {
$("#suspended_content").show(); $("#suspended_content").show();
......
...@@ -28,8 +28,8 @@ def index(request, exception=None): ...@@ -28,8 +28,8 @@ def index(request, exception=None):
context = { context = {
'title': 'Espace Membre', 'title': 'Espace Membre',
'unsuscribe_form_link': getattr(settings, 'UNSUBSCRIBED_FORM_LINK', ''),
} }
template = loader.get_template('members_space/index.html') template = loader.get_template('members_space/index.html')
if ('failure' in credentials): if ('failure' in credentials):
...@@ -89,14 +89,16 @@ def index(request, exception=None): ...@@ -89,14 +89,16 @@ def index(request, exception=None):
except: except:
pass pass
context['partnerData'] = partnerData
if partnerData["parent_id"] is not False: if partnerData["parent_id"] is not False:
partnerData["parent_name"] = partnerData["parent_id"][1] partnerData["parent_name"] = partnerData["parent_id"][1]
partnerData["parent_id"] = partnerData["parent_id"][0] partnerData["parent_id"] = partnerData["parent_id"][0]
else: else:
partnerData["parent_name"] = False 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 in the calendar
days_to_hide = "0" days_to_hide = "0"
context['ADDITIONAL_INFO_SHIFT_PAGE'] = getattr(settings, 'ADDITIONAL_INFO_SHIFT_PAGE', '') context['ADDITIONAL_INFO_SHIFT_PAGE'] = getattr(settings, 'ADDITIONAL_INFO_SHIFT_PAGE', '')
...@@ -105,9 +107,17 @@ def index(request, exception=None): ...@@ -105,9 +107,17 @@ def index(request, exception=None):
context['daysToHide'] = days_to_hide context['daysToHide'] = days_to_hide
msettings = MConfig.get_settings('members') msettings = MConfig.get_settings('members')
if 'abcd_calendar_link' in msettings: context['forms_link'] = msettings['forms_link']['value'] if 'forms_link' in msettings else ''
context['abcd_calendar_link'] = msettings['abcd_calendar_link']['value'] 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: else:
# may arrive when switching database without cleaning cookie # may arrive when switching database without cleaning cookie
return redirect('/website/deconnect') return redirect('/website/deconnect')
......
{% extends "base.html" %}
{% load static %}
{% block additionnal_css %}
<link rel="stylesheet" href="{% static 'css/datatables/datatables.min.css' %}">
<link rel="stylesheet" href="{% static 'css/members_admin.css' %}">
<link rel="stylesheet" href="{% static 'jquery-ui-1.12.1/jquery-ui.min.css' %}">
{% endblock %}
{% block additionnal_scripts %}
<script type="text/javascript" src="{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/datatables/datatables.min.js' %}"></script>
{% endblock %}
{% block content %}
<div class="page_body">
<div class="login_area">
{% include "common/conn_admin.html" %}
</div>
<div class="header txtcenter">
<h1>Bureau des membres</h1>
</div>
<div class="page_content">
<section class="tabs autogrid">
<div class="button tab active" id="tab_makeups"><h5>Rattrapages</h5></div>
</section>
<div id="tab_makeups_content" class="tab_content">
<div id="table_top_area">
<h3>Liste des membres devant effectuer un rattrapage</h3>
<div class="table_grouped_action">
<button type="button" class="btn--primary" id="decrement_selected_members_makeups">
-1 rattrapage pour les membres sélectionnés
</button>
</div>
</div>
<div class="table_area">
<table id="makeups_members_table" class="display" cellspacing="0" width="100%"></table>
</div>
</div>
</div>
<div id="templates" style="display:none;"></div>
</div>
<script src='{% static "js/all_common.js" %}?v='></script>
<script src='{% static "js/members_admin.js" %}?v='></script>
{% endblock %}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<h1>Mon espace membre</h1> <h1>Mon espace membre</h1>
</div> </div>
<div class="tiles_container"> <div class="tiles_container">
<div class="tile" id="home_tile_my_info"> <div class="tile high_tile" id="home_tile_my_info">
<div class="tile_title"> <div class="tile_title">
<i class="fas fa-user tile_icon"></i> <i class="fas fa-user tile_icon"></i>
Mes Infos Mes Infos
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<a href="#" id="see_more_info_link">Voir plus ></a> <a href="#" id="see_more_info_link">Voir plus ></a>
</div> </div>
</div> </div>
<div class="tile" id="home_tile_my_services"> <div class="tile high_tile" id="home_tile_my_services">
<div class="tile_title"> <div class="tile_title">
<i class="fas fa-clipboard tile_icon"></i> <i class="fas fa-clipboard tile_icon"></i>
Mes Services Mes Services
...@@ -51,38 +51,59 @@ ...@@ -51,38 +51,59 @@
</div> </div>
</div> </div>
</div> </div>
<div class="tile" id="home_tile_services_exchange"> <div class="tile small_tile" id="home_tile_services_exchange">
<div class="tile_title"> <div class="tile_title">
<i class="fas fa-exchange-alt tile_icon"></i> <i class="fas fa-exchange-alt tile_icon"></i>
Échange de services Échange de services
</div> </div>
<div class="tile_content"> <div class="tile_content">
<div id="go_to_shifts_calendar_area"> <div class="home_link_button_area">
<button type="button" class="btn--primary" id="go_to_shifts_calendar"> <button type="button" class="btn--primary home_link_button" id="go_to_shifts_calendar">
Accéder au calendrier d'échange de services Accéder au calendrier d'échange de services
</button> </button>
</div> </div>
</div> </div>
</div> </div>
<div class="tile" id="home_tile_help"> <div class="tile small_tile" id="home_tile_help">
<div class="tile_title"> <div class="tile_title">
<i class="fas fa-question-circle tile_icon"></i> <i class="fas fa-question-circle tile_icon"></i>
J'ai une demande J'ai une demande
</div> </div>
<div class="tile_content"> <div class="tile_content">
À venir... <div class="home_link_button_area">
<a
href="javascript:void(0);"
target="_blank"
type="button"
class="btn--primary home_link_button"
id="go_to_forms"
>
Accéder aux formulaires
</a>
</div>
</div> </div>
</div> </div>
<div class="tile" id="home_tile_message"> <div class="tile small_tile" id="home_tile_shop_info">
<div class="tile_title"> <div class="tile_title">
<i class="fas fa-newspaper tile_icon"></i> <i class="fas fa-newspaper tile_icon"></i>
Informations magasins Informations magasins
</div> </div>
<div class="subtile"> <div id="shop_info_content">
{{msg_accueil|safe}} <div class="shop_info_item shop_opening_hours">
</div> <div class="shop_info_item_content">
<div class="subtile"> <div class="opening_hours_title">
{{shop_opening_hours|safe}} Horaires du magasin :
</div>
<div class="opening_hours_content">
{{shop_opening_hours|safe}}
</div>
</div>
</div>
<div class="shop_info_item shop_message">
<div class="shop_info_item_content shop_message_content">
{{msg_accueil|safe}}
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -63,19 +63,30 @@ ...@@ -63,19 +63,30 @@
<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. <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> <b>Plus le chiffre de gauche est petit, plus on a besoin de coopérateurs.rices à ce service !</b></p>
</div> </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>
</div> </div>
<script> <script>
var app_env = '{{app_env}}'; var app_env = '{{app_env}}';
var forms_link = '{{forms_link}}';
var unsuscribe_form_link = '{{unsuscribe_form_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 = { var partner_data = {
"partner_id":"{{partnerData.id}}", "partner_id":"{{partnerData.id}}",
"name":"{{partnerData.display_name}}", "name":"{{partnerData.display_name}}",
"in_ftop_team":"{{partnerData.in_ftop_team}}", "in_ftop_team":"{{partnerData.in_ftop_team}}",
"date_delay_stop":"{{partnerData.date_delay_stop}}", "date_delay_stop":"{{partnerData.date_delay_stop}}",
"cooperative_state":"{{partnerData.cooperative_state}}", "cooperative_state":"{{partnerData.cooperative_state}}",
"verif_token" : "{{partnerData.verif_token}}", "regular_shift_name":"{{partnerData.regular_shift_name}}",
"can_have_delay" : "{{partnerData.can_have_delay}}",
"makeups_to_do" : "{{partnerData.makeups_to_do}}", "makeups_to_do" : "{{partnerData.makeups_to_do}}",
"barcode_base" : "{{partnerData.barcode_base}}", "barcode_base" : "{{partnerData.barcode_base}}",
"street" : "{{partnerData.street}}", "street" : "{{partnerData.street}}",
...@@ -88,9 +99,8 @@ ...@@ -88,9 +99,8 @@
"is_associated_people" : "{{partnerData.is_associated_people}}", "is_associated_people" : "{{partnerData.is_associated_people}}",
"parent_id" : "{{partnerData.parent_id}}", "parent_id" : "{{partnerData.parent_id}}",
"parent_name" : "{{partnerData.parent_name}}", "parent_name" : "{{partnerData.parent_name}}",
"verif_token" : "{{partnerData.verif_token}}",
} }
var days_to_hide = "{{daysToHide}}"
var abcd_calendar_link = "{{abcd_calendar_link}}"
</script> </script>
<script src="{% static "js/all_common.js" %}?v="></script> <script src="{% static "js/all_common.js" %}?v="></script>
<script src="{% static "js/members-space-home.js" %}?v="></script> <script src="{% static "js/members-space-home.js" %}?v="></script>
......
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
J'accède au formulaire J'accède au formulaire
</a> </a>
</div> </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"> <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> <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"> <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