Commit a479186a by Damien Moulard

my info page

parent 2b847e89
/* We override styles defined on the home page for the specific needs of the My Info page */
#my_info {
font-size: 2rem;
}
#my_info {
display: flex;
flex-direction: column;
}
.my_info_line {
display: flex;
width: 100%;
padding: 1.5rem 0;
}
.my_info_line_left {
width: 50%;
text-align: right;
padding-right: 2rem;
font-weight: bold;
}
.my_info_line_right {
width: 50%;
padding-left: 2rem;
}
#my_info #member_status_action,
#my_info .member_shift_name_area,
#my_info .member_coop_number_area {
margin-bottom: 0;
}
.member_email {
max-width: 100%;
word-break: break-all;
}
@media screen and (max-width: 768px) {
#my_info {
font-size: 1.7rem;
}
.my_info_line_left {
width: 30%;
padding-right: 1rem;
}
.my_info_line_right {
width: 70%;
padding-left: 1rem;
}
#my_info .choose_makeups,
#my_info .unsuscribed_form_link {
white-space: normal;
}
#my_info .delay_date_stop_container {
white-space: nowrap;
}
#my_info .member_coop_number_area,
#my_info .member_shift_name_area {
align-items: flex-start;
}
}
\ No newline at end of file
...@@ -64,10 +64,6 @@ body { ...@@ -64,10 +64,6 @@ body {
flex-direction: column; flex-direction: column;
} }
#home_go_to_shift_history {
margin-top: 30px;
}
.shift_line { .shift_line {
margin-left: 15px; margin-left: 15px;
line-height: 2; line-height: 2;
...@@ -78,7 +74,22 @@ body { ...@@ -78,7 +74,22 @@ body {
margin-right: 5px; margin-right: 5px;
} }
/* -- My Info tile*/ #go_to_shift_history_area {
width: 100%;
display: flex;
justify-content: center;
}
#home_go_to_shift_history {
width: 80%;
margin-top: 30px;
}
/* -- My Info tile */
#home_tile_my_info {
position: relative;
}
.tile_icon { .tile_icon {
margin-right: 15px; margin-right: 15px;
...@@ -97,23 +108,23 @@ body { ...@@ -97,23 +108,23 @@ body {
font-weight: bold; font-weight: bold;
} }
#home_member_status_action { #member_status_action {
margin-bottom:20px; margin-bottom:20px;
font-size: 1.8rem;;
} }
#home_choose_makeups { .choose_makeups {
display: none; display: none;
font-size: 1.8rem;
} }
#home_unsuscribed_form_link { .unsuscribed_form_link {
display: none; display: none;
text-decoration: none; text-decoration: none;
/* margin-bottom: 10px; */ font-size: 1.7rem;
} }
#home_unsuscribed_form_link:hover, .unsuscribed_form_link:hover {
#home_unsuscribed_form_link:active { text-decoration: none;
color: white !important;
} }
.member_status_up_to_date, .member_status_up_to_date,
...@@ -129,23 +140,46 @@ body { ...@@ -129,23 +140,46 @@ body {
color: #d9534f; color: #d9534f;
} }
#home_member_shift_name_area, .member_shift_name_area,
#home_member_coop_number_area { .member_coop_number_area {
margin-bottom: 10px; margin-bottom: 10px;
} }
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
#home_member_shift_name_area, .member_shift_name_area,
#home_member_coop_number_area { .member_coop_number_area {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
} }
} }
#home_delay_date_stop_container { .delay_date_stop_container {
color: #f0ad4e; color: #f0ad4e;
margin-top: -1rem; margin-top: -1rem;
margin-bottom: 1rem; margin-bottom: 1rem;
display: none; display: none;
}
#see_more_info {
position: absolute;
bottom: 2rem;
right: 4rem;
}
#see_more_info_link {
color: #0275d8 !important;
}
/* --Shifts exchange tile tile */
#go_to_shifts_calendar_area {
width: 100%;
display: flex;
justify-content: center;
}
#go_to_shifts_calendar {
width: 80%;
margin-top: 20px;
white-space: normal;
} }
\ No newline at end of file
...@@ -12,22 +12,26 @@ function toggleHeader() { ...@@ -12,22 +12,26 @@ function toggleHeader() {
$(document).ready(function() { $(document).ready(function() {
// Navbar redirections // Navbar redirections
$('#nav_home').on('click', function() { $('#nav_home').on('click', (e) => {
e.preventDefault();
if (current_location !== "home") { if (current_location !== "home") {
goto('home'); goto('home');
} }
}); });
$('#nav_my_info').on('click', function() { $('#nav_my_info').on('click', (e) => {
e.preventDefault();
if (current_location !== "my_info") { if (current_location !== "my_info") {
goto('mes-infos'); goto('mes-infos');
} }
}); });
$('#nav_my_shifts').on('click', function() { $('#nav_my_shifts').on('click', (e) => {
e.preventDefault();
if (current_location !== "my_shifts") { if (current_location !== "my_shifts") {
goto('mes-services'); goto('mes-services');
} }
}); });
$('#nav_shifts_exchange').on('click', function() { $('#nav_shifts_exchange').on('click', (e) => {
e.preventDefault();
if (current_location !== "shifts_exchange") { if (current_location !== "shifts_exchange") {
goto('echange-de-services'); goto('echange-de-services');
} }
......
...@@ -72,71 +72,20 @@ function init_my_shifts_tile() { ...@@ -72,71 +72,20 @@ function init_my_shifts_tile() {
} }
} }
function init_my_info_tile() {
$("#home_choose_makeups").off();
$("#home_member_shift_name").text(partner_data.regular_shift_name);
// Status related
$("#home_member_status")
.text(possible_cooperative_state[partner_data.cooperative_state])
.addClass("member_status_" + partner_data.cooperative_state);
if (partner_data.cooperative_state === 'delay' && partner_data.date_delay_stop !== 'False') {
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();
$("#home_delay_date_stop").text(f_date_delay_stop);
$("#home_delay_date_stop_container").show();
} else if (partner_data.cooperative_state === 'unsubscribed') {
$("#home_member_shift_name").text('X');
$("#home_unsuscribed_form_link")
.show()
.attr('href', unsuscribe_form_link)
.on('click', function() {
setTimeout(500, () => {
$(this).removeClass('active');
});
});
}
if (partner_data.makeups_to_do > 0) {
$("#home_choose_makeups").show();
if (
partner_data.cooperative_state === 'suspended'
&& partner_data.date_delay_stop === 'False')
{
// If the member is suspended & doesn't have a delay
$("#home_choose_makeups").on('click', () => {
// Create 6 month delay
request_delay()
.then(() => {
// Then redirect to calendar
goto('echange-de-services');
})
});
} else {
$("#home_choose_makeups").on('click', () => {
goto('echange-de-services');
});
}
}
// TODO coop number for attached people ??
$("#home_member_coop_number").text(partner_data.barcode_base);
}
function init_home() { function init_home() {
$("#go_to_calendar_button").on("click", () => { $("#go_to_shifts_calendar").on("click", () => {
goto('echange-de-services'); goto('echange-de-services');
}); });
$("#home_go_to_shift_history").on("click", () => { $("#home_go_to_shift_history").on("click", () => {
goto('mes-services'); goto('mes-services');
}); });
$("#see_more_info_link").on('click', (e) => {
e.preventDefault();
goto('mes-infos');
})
init_my_info_tile(); // Init my info tile
init_my_info_data();
if (incoming_shifts !== null) { if (incoming_shifts !== null) {
init_my_shifts_tile(); init_my_shifts_tile();
......
function init_my_info() { function init_my_info() {
console.log('hello my info'); init_my_info_data();
console.log(partner_data);
$(".member_email").text(partner_data.email);
if (partner_data.street !== "") {
$(".member_address")
.append(partner_data.street + "<br/>");
if (partner_data.street2 !== "") {
$(".member_address")
.append(partner_data.street2 + "<br/>");
}
$(".member_address")
.append(partner_data.zip + " " + partner_data.city);
} else {
$(".member_address_line").hide();
}
if (partner_data.mobile !== "") {
$(".member_mobile")
.append(partner_data.mobile);
} else {
$(".member_mobile_line").hide();
}
if (partner_data.phone !== "") {
$(".member_phone")
.append(partner_data.phone);
} else {
$(".member_phone_line").hide();
}
} }
\ No newline at end of file
...@@ -131,9 +131,75 @@ function prepare_shift_line_template(date_begin) { ...@@ -131,9 +131,75 @@ function prepare_shift_line_template(date_begin) {
return shift_line_template; return shift_line_template;
} }
/* - Member info */
/**
* Init common personal data between screens
*/
function init_my_info_data() {
$(".choose_makeups").off();
$(".unsuscribed_form_link").off();
$(".member_shift_name").text(partner_data.regular_shift_name);
// Status related
$(".member_status")
.text(possible_cooperative_state[partner_data.cooperative_state])
.addClass("member_status_" + partner_data.cooperative_state);
if (partner_data.cooperative_state === 'delay' && partner_data.date_delay_stop !== 'False') {
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();
$(".delay_date_stop").text(f_date_delay_stop);
$(".delay_date_stop_container").show();
} else if (partner_data.cooperative_state === 'unsubscribed') {
$(".member_shift_name").text('X');
$(".unsuscribed_form_link")
.show()
.attr('href', unsuscribe_form_link)
.on('click', function() {
setTimeout(500, () => {
$(this).removeClass('active');
});
});
}
if (partner_data.makeups_to_do > 0) {
$(".choose_makeups").show();
if (
partner_data.cooperative_state === 'suspended'
&& partner_data.date_delay_stop === 'False')
{
// If the member is suspended & doesn't have a delay
$(".choose_makeups").on('click', () => {
// Create 6 month delay
request_delay()
.then(() => {
// Then redirect to calendar
goto('echange-de-services');
})
});
} else {
$(".choose_makeups").on('click', () => {
goto('echange-de-services');
});
}
}
// TODO coop number for attached people ??
$(".member_coop_number").text(partner_data.barcode_base);
}
$(document).ready(function() { $(document).ready(function() {
$.ajaxSetup({ headers: { "X-CSRFToken": getCookie('csrftoken') } }); $.ajaxSetup({ headers: { "X-CSRFToken": getCookie('csrftoken') } });
base_location = (app_env === 'dev') ? '/members_space/' : '/'; base_location = (app_env === 'dev') ? '/members_space/' : '/';
update_dom(); update_dom();
window.onpopstate = function() {
update_dom();
};
}); });
...@@ -36,7 +36,8 @@ class CagetteShift(models.Model): ...@@ -36,7 +36,8 @@ class CagetteShift(models.Model):
fields = ['display_name', 'display_std_points', fields = ['display_name', 'display_std_points',
'shift_type', 'date_alert_stop', 'date_delay_stop', 'extension_ids', 'shift_type', 'date_alert_stop', 'date_delay_stop', 'extension_ids',
'cooperative_state', 'final_standard_point', 'create_date', 'cooperative_state', 'final_standard_point', 'create_date',
'final_ftop_point', 'in_ftop_team', 'leave_ids', 'makeups_to_do', 'barcode_base'] 'final_ftop_point', 'in_ftop_team', 'leave_ids', 'makeups_to_do', 'barcode_base',
'street', 'street ,' 'zip', 'city', 'mobile', 'phone', 'email']
partnerData = self.o_api.search_read('res.partner', cond, fields, 1) partnerData = self.o_api.search_read('res.partner', cond, fields, 1)
if partnerData: if partnerData:
partnerData = partnerData[0] partnerData = partnerData[0]
......
...@@ -9,27 +9,30 @@ ...@@ -9,27 +9,30 @@
Mes Infos Mes Infos
</div> </div>
<div class="tile_content"> <div class="tile_content">
<p>Mon statut : <span id="home_member_status" class="home_member_info"></span></p> <p>Mon statut : <span class="member_info member_status"></span></p>
<div id="home_delay_date_stop_container"> <div class="delay_date_stop_container">
( jusqu'au <span id="home_delay_date_stop"></span> ) ( jusqu'au <span class="delay_date_stop"></span> )
</div> </div>
<div id="home_member_status_action"> <div id="member_status_action">
<a href="#" target="_blank" class="btn--primary" id="home_unsuscribed_form_link"> <a href="#" target="_blank" class="btn--warning unsuscribed_form_link">
J'accède au formulaire J'accède au formulaire
</a> </a>
<button type="button" class="btn--danger" id="home_choose_makeups"> <button type="button" class="btn--danger choose_makeups">
Je sélectionne mes rattrapages Je sélectionne mes rattrapages
</button> </button>
</div> </div>
<div id="home_member_shift_name_area"> <div class="member_shift_name_area">
<span>Mon créneau : </span> <span>Mon créneau : </span>
<span id="home_member_shift_name" class="home_member_info"></span> <span class="member_shift_name member_info"></span>
</div> </div>
<div id="home_member_coop_number_area"> <div class="member_coop_number_area">
<span>Mon numéro de coop : </span> <span>Mon numéro de coop : </span>
<span id="home_member_coop_number" class="home_member_info"></span> <span class="member_coop_number member_info"></span>
</div> </div>
</div> </div>
<div id="see_more_info">
<a href="#" id="see_more_info_link">Voir plus ></a>
</div>
</div> </div>
<div class="tile" id="home_tile_my_services"> <div class="tile" id="home_tile_my_services">
<div class="tile_title"> <div class="tile_title">
...@@ -41,9 +44,11 @@ ...@@ -41,9 +44,11 @@
<div id="home_incoming_services"> <div id="home_incoming_services">
<i class="fas fa-spinner fa-spin fa-lg"></i> <i class="fas fa-spinner fa-spin fa-lg"></i>
</div> </div>
<button type="button", class="btn btn--primary" id="home_go_to_shift_history"> <div id="go_to_shift_history_area">
Accéder à mon historique <button type="button", class="btn btn--primary" id="home_go_to_shift_history">
</button> Accéder à mon historique
</button>
</div>
</div> </div>
</div> </div>
<div class="tile" id="home_tile_services_exchange"> <div class="tile" id="home_tile_services_exchange">
...@@ -52,9 +57,11 @@ ...@@ -52,9 +57,11 @@
Échange de services Échange de services
</div> </div>
<div class="tile_content"> <div class="tile_content">
<button type="button" class="btn--primary" id="go_to_calendar_button"> <div id="go_to_shifts_calendar_area">
Accéder au calendrier d'échange de services <button type="button" class="btn--primary" id="go_to_shifts_calendar">
</button> Accéder au calendrier d'échange de services
</button>
</div>
</div> </div>
</div> </div>
<div class="tile" id="home_tile_help"> <div class="tile" id="home_tile_help">
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<link rel="stylesheet" href="{% static 'css/datatables/responsive.dataTables.min.css' %}"> <link rel="stylesheet" href="{% static 'css/datatables/responsive.dataTables.min.css' %}">
<link rel="stylesheet" href="{% static "css/members-space.css" %}?v="> <link rel="stylesheet" href="{% static "css/members-space.css" %}?v=">
<link rel="stylesheet" href="{% static "css/members-space-my-shifts.css" %}?v="> <link rel="stylesheet" href="{% static "css/members-space-my-shifts.css" %}?v=">
<link rel="stylesheet" href="{% static "css/members-space-my-info.css" %}?v=">
{% endblock %} {% endblock %}
{% block additionnal_scripts %} {% block additionnal_scripts %}
...@@ -51,6 +52,13 @@ ...@@ -51,6 +52,13 @@
"verif_token" : "{{partnerData.verif_token}}", "verif_token" : "{{partnerData.verif_token}}",
"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}}",
"street2" : "{{partnerData.street2}}",
"zip" : "{{partnerData.zip}}",
"city" : "{{partnerData.city}}",
"mobile" : "{{partnerData.mobile}}",
"phone" : "{{partnerData.phone}}",
"email" : "{{partnerData.email}}",
} }
</script> </script>
<script src="{% static "js/all_common.js" %}?v="></script> <script src="{% static "js/all_common.js" %}?v="></script>
......
<div id="my_info">
<div>À venir...</div> <div class="page_title txtcenter">
<h1>Mes Infos Perso</h1>
</div>
<div class="tiles_container">
<div class="tile full_width_tile" id="my_info_area">
<div class="tile_content" id="my_info">
<div class="my_info_line">
<div class="my_info_line_left">
Statut
</div>
<div class="my_info_line_right">
<p class="member_info member_status"></p>
<div class="delay_date_stop_container">
( jusqu'au <span class="delay_date_stop"></span> )
</div>
<div id="member_status_action">
<a href="#" target="_blank" class="btn--warning unsuscribed_form_link">
J'accède au formulaire
</a>
<button type="button" class="btn--danger choose_makeups">
Je sélectionne mes rattrapages
</button>
</div>
</div>
</div>
<div class="my_info_line">
<div class="my_info_line_left">
Créneau
</div>
<div class="my_info_line_right member_shift_name_area">
<span class="member_shift_name member_info"></span>
</div>
</div>
<div class="my_info_line">
<div class="my_info_line_left">
Numéro de coop
</div>
<div class="my_info_line_right member_coop_number_area">
<div class="member_coop_number_area">
<span class="member_coop_number member_info"></span>
</div>
</div>
</div>
<div class="my_info_line member_email_line">
<div class="my_info_line_left">
Email
</div>
<div class="my_info_line_right member_email_area">
<span class="member_email member_info"></span>
</div>
</div>
<div class="my_info_line member_address_line">
<div class="my_info_line_left">
Adresse
</div>
<div class="my_info_line_right member_address_area">
<span class="member_address member_info"></span>
</div>
</div>
<div class="my_info_line member_mobile_line">
<div class="my_info_line_left">
Téléphone mobile
</div>
<div class="my_info_line_right member_mobile_area">
<span class="member_mobile member_info"></span>
</div>
</div>
<div class="my_info_line member_phone_line">
<div class="my_info_line_left">
Téléphone fixe
</div>
<div class="my_info_line_right member_phone_area">
<span class="member_phone member_info"></span>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
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