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 {
flex-direction: column;
}
#home_go_to_shift_history {
margin-top: 30px;
}
.shift_line {
margin-left: 15px;
line-height: 2;
......@@ -78,7 +74,22 @@ body {
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 {
margin-right: 15px;
......@@ -97,23 +108,23 @@ body {
font-weight: bold;
}
#home_member_status_action {
#member_status_action {
margin-bottom:20px;
font-size: 1.8rem;;
}
#home_choose_makeups {
.choose_makeups {
display: none;
font-size: 1.8rem;
}
#home_unsuscribed_form_link {
.unsuscribed_form_link {
display: none;
text-decoration: none;
/* margin-bottom: 10px; */
font-size: 1.7rem;
}
#home_unsuscribed_form_link:hover,
#home_unsuscribed_form_link:active {
color: white !important;
.unsuscribed_form_link:hover {
text-decoration: none;
}
.member_status_up_to_date,
......@@ -129,23 +140,46 @@ body {
color: #d9534f;
}
#home_member_shift_name_area,
#home_member_coop_number_area {
.member_shift_name_area,
.member_coop_number_area {
margin-bottom: 10px;
}
@media screen and (max-width: 768px) {
#home_member_shift_name_area,
#home_member_coop_number_area {
.member_shift_name_area,
.member_coop_number_area {
display: flex;
flex-direction: column;
align-items: center;
}
}
#home_delay_date_stop_container {
.delay_date_stop_container {
color: #f0ad4e;
margin-top: -1rem;
margin-bottom: 1rem;
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() {
$(document).ready(function() {
// Navbar redirections
$('#nav_home').on('click', function() {
$('#nav_home').on('click', (e) => {
e.preventDefault();
if (current_location !== "home") {
goto('home');
}
});
$('#nav_my_info').on('click', function() {
$('#nav_my_info').on('click', (e) => {
e.preventDefault();
if (current_location !== "my_info") {
goto('mes-infos');
}
});
$('#nav_my_shifts').on('click', function() {
$('#nav_my_shifts').on('click', (e) => {
e.preventDefault();
if (current_location !== "my_shifts") {
goto('mes-services');
}
});
$('#nav_shifts_exchange').on('click', function() {
$('#nav_shifts_exchange').on('click', (e) => {
e.preventDefault();
if (current_location !== "shifts_exchange") {
goto('echange-de-services');
}
......
......@@ -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() {
$("#go_to_calendar_button").on("click", () => {
$("#go_to_shifts_calendar").on("click", () => {
goto('echange-de-services');
});
$("#home_go_to_shift_history").on("click", () => {
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) {
init_my_shifts_tile();
......
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) {
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() {
$.ajaxSetup({ headers: { "X-CSRFToken": getCookie('csrftoken') } });
base_location = (app_env === 'dev') ? '/members_space/' : '/';
update_dom();
window.onpopstate = function() {
update_dom();
};
});
......@@ -36,7 +36,8 @@ class CagetteShift(models.Model):
fields = ['display_name', 'display_std_points',
'shift_type', 'date_alert_stop', 'date_delay_stop', 'extension_ids',
'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)
if partnerData:
partnerData = partnerData[0]
......
......@@ -9,27 +9,30 @@
Mes Infos
</div>
<div class="tile_content">
<p>Mon statut : <span id="home_member_status" class="home_member_info"></span></p>
<div id="home_delay_date_stop_container">
( jusqu'au <span id="home_delay_date_stop"></span> )
<p>Mon statut : <span class="member_info member_status"></span></p>
<div class="delay_date_stop_container">
( jusqu'au <span class="delay_date_stop"></span> )
</div>
<div id="home_member_status_action">
<a href="#" target="_blank" class="btn--primary" id="home_unsuscribed_form_link">
<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" id="home_choose_makeups">
<button type="button" class="btn--danger choose_makeups">
Je sélectionne mes rattrapages
</button>
</div>
<div id="home_member_shift_name_area">
<div class="member_shift_name_area">
<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 id="home_member_coop_number_area">
<div class="member_coop_number_area">
<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 id="see_more_info">
<a href="#" id="see_more_info_link">Voir plus ></a>
</div>
</div>
<div class="tile" id="home_tile_my_services">
<div class="tile_title">
......@@ -41,22 +44,26 @@
<div id="home_incoming_services">
<i class="fas fa-spinner fa-spin fa-lg"></i>
</div>
<div id="go_to_shift_history_area">
<button type="button", class="btn btn--primary" id="home_go_to_shift_history">
Accéder à mon historique
</button>
</div>
</div>
</div>
<div class="tile" id="home_tile_services_exchange">
<div class="tile_title">
<i class="fas fa-exchange-alt tile_icon"></i>
Échange de services
</div>
<div class="tile_content">
<button type="button" class="btn--primary" id="go_to_calendar_button">
<div id="go_to_shifts_calendar_area">
<button type="button" class="btn--primary" id="go_to_shifts_calendar">
Accéder au calendrier d'échange de services
</button>
</div>
</div>
</div>
<div class="tile" id="home_tile_help">
<div class="tile_title">
<i class="fas fa-question-circle tile_icon"></i>
......
......@@ -6,6 +6,7 @@
<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-my-shifts.css" %}?v=">
<link rel="stylesheet" href="{% static "css/members-space-my-info.css" %}?v=">
{% endblock %}
{% block additionnal_scripts %}
......@@ -51,6 +52,13 @@
"verif_token" : "{{partnerData.verif_token}}",
"makeups_to_do" : "{{partnerData.makeups_to_do}}",
"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 src="{% static "js/all_common.js" %}?v="></script>
......
<div>À venir...</div>
<div id="my_info">
<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