Commit f6c1a2be by Damien Moulard

display info for attached members

parent f8e05261
/* We override styles defined on the home page for the specific needs of the My Info page */
/* We override some styles defined on the home page for the specific needs of the My Info page */
#my_info {
font-size: 2rem;
}
#my_info {
#my_info_content {
display: flex;
flex-direction: column;
}
.my_info_line {
display: flex;
flex-wrap: wrap;
width: 100%;
padding: 1.5rem 0;
}
......@@ -24,6 +25,8 @@
.my_info_line_right {
width: 50%;
padding-left: 2rem;
max-width: 100%;
word-break: break-all;
}
#my_info #member_status_action,
......@@ -32,9 +35,16 @@
margin-bottom: 0;
}
.member_email {
max-width: 100%;
word-break: break-all;
#attached_info {
display: flex;
flex-direction: column;
}
.pairs_info {
background-color: #00a573;
color: white;
padding: 1.5rem 1.2rem;
margin: 2rem 0;
}
@media screen and (max-width: 768px) {
......@@ -50,6 +60,16 @@
padding-left: 1rem;
}
#attached_info .my_info_line_left {
width: 100%;
text-align: left;
padding: 0;
}
#attached_info .my_info_line_right {
width: 100%;
padding: 0;
}
#my_info .choose_makeups,
#my_info .unsuscribed_form_link {
white-space: normal;
......
......@@ -93,7 +93,7 @@ function init_home() {
if (incoming_shifts !== null) {
init_my_shifts_tile();
} else {
load_partner_shifts(partner_data.partner_id)
load_partner_shifts(partner_data.concerned_partner_id)
.then(init_my_shifts_tile);
}
}
\ No newline at end of file
function init_my_info() {
init_my_info_data();
console.log(partner_data);
$(".member_email").text(partner_data.email);
if (partner_data.is_associated_people === "False") {
$("#attached_info_area").hide();
} else {
$(".attached_partner_name").text(partner_data.parent_name);
}
if (partner_data.street !== "") {
$(".member_address")
.append(partner_data.street + "<br/>");
......
......@@ -11,7 +11,7 @@ function load_partner_history(offset = 0) {
type: 'GET',
url: "/members_space/get_points_history",
data: {
partner_id: partner_data.partner_id,
partner_id: partner_data.concerned_partner_id,
verif_token: partner_data.verif_token,
limit: history_items_limit,
offset: offset
......@@ -173,7 +173,7 @@ function init_my_shifts() {
if (incoming_shifts !== null) {
init_incoming_shifts();
} else {
load_partner_shifts(partner_data.partner_id)
load_partner_shifts(partner_data.concerned_partner_id)
.then(init_incoming_shifts);
}
......
function init_shifts_exchange() {
console.log('hello my services');
// TODO : block everything if is_associated_people
}
\ No newline at end of file
......@@ -13,7 +13,7 @@ var date_options = {weekday: "long", year: "numeric", month: "long", day: "numer
/**
* Load the shifts the member is registered to
* @param {int} partner_id
* @param {int} partner_id either the members id, or its parent's if s.he's attached
*/
function load_partner_shifts(partner_id) {
return new Promise((resolve) => {
......@@ -167,7 +167,7 @@ function init_my_info_data() {
});
}
if (partner_data.makeups_to_do > 0) {
if (partner_data.makeups_to_do > 0 && partner_data.is_associated_people === "False") {
$(".choose_makeups").show();
if (
......@@ -189,13 +189,18 @@ function init_my_info_data() {
}
}
// TODO coop number for attached people ??
$(".member_coop_number").text(partner_data.barcode_base);
}
$(document).ready(function() {
$.ajaxSetup({ headers: { "X-CSRFToken": getCookie('csrftoken') } });
// If partner is associated (attached), display the pair's main partner shift data
partner_data.concerned_partner_id =
(partner_data.is_associated_people === "True")
? partner_data.parent_id
: partner_data.partner_id;
base_location = (app_env === 'dev') ? '/members_space/' : '/';
update_dom();
......
......@@ -91,6 +91,13 @@ def index(request, exception=None):
context['partnerData'] = partnerData
# TODO test with partner who's not attached
if partnerData["parent_id"] is not False:
partnerData["parent_name"] = partnerData["parent_id"][1]
partnerData["parent_id"] = partnerData["parent_id"][0]
else:
partnerData["parent_name"] = False
# Days to hide in the calendar
days_to_hide = "0"
context['ADDITIONAL_INFO_SHIFT_PAGE'] = getattr(settings, 'ADDITIONAL_INFO_SHIFT_PAGE', '')
......@@ -142,15 +149,11 @@ def get_points_history(request):
res = {}
partner_id = int(request.GET.get('partner_id'))
if 'verif_token' in request.GET and Verification.verif_token(request.GET.get('verif_token'), partner_id) is True:
m = CagetteMembersSpace()
m = CagetteMembersSpace()
limit = int(request.GET.get('limit'))
offset = int(request.GET.get('offset'))
date_from = getattr(settings, 'START_DATE_FOR_POINTS_HISTORY', '2018-01-01')
res["data"] = m.get_points_history(partner_id, limit, offset, date_from)
else:
return JsonResponse(res, status=403)
limit = int(request.GET.get('limit'))
offset = int(request.GET.get('offset'))
date_from = getattr(settings, 'START_DATE_FOR_POINTS_HISTORY', '2018-01-01')
res["data"] = m.get_points_history(partner_id, limit, offset, date_from)
return JsonResponse(res)
\ No newline at end of file
......@@ -61,6 +61,7 @@
"email" : "{{partnerData.email}}",
"is_associated_people" : "{{partnerData.is_associated_people}}",
"parent_id" : "{{partnerData.parent_id}}",
"parent_name" : "{{partnerData.parent_name}}",
}
</script>
<script src="{% static "js/all_common.js" %}?v="></script>
......
......@@ -3,78 +3,103 @@
<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 class="tile full_width_tile" id="my_info_area">
<div class="tile_content" id="my_info_content">
<div class="my_info_line">
<div class="my_info_line_left">
Statut
</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 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>
<div class="my_info_line member_email_line">
<div class="my_info_line_left">
Email
<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_right member_email_area">
<span class="member_email member_info"></span>
<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>
<div class="my_info_line member_address_line">
<div class="my_info_line_left">
Adresse
<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_right member_address_area">
<span class="member_address member_info"></span>
<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>
<div class="my_info_line member_mobile_line">
<div class="my_info_line_left">
Téléphone mobile
<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_right member_mobile_area">
<span class="member_mobile member_info"></span>
<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 class="my_info_line member_phone_line">
<div class="my_info_line_left">
Téléphone fixe
</div>
<div class="tile full_width_tile" id="attached_info_area">
<div class="tile_title">
Mon Binôme
</div>
<div class="tile_content" id="attached_info">
<div class="my_info_line attached_partne_name_line">
<div class="my_info_line_left">
Je suis en binôme avec :
</div>
<div class="my_info_line_right attached_partne_name_area">
<span class="attached_partner_name member_info"></span>
</div>
</div>
<div class="my_info_line_right member_phone_area">
<span class="member_phone member_info"></span>
<div class="my_info_line pairs_info">
<span>
Attention : Toutes les actions (changement de service, choix d'un rattrapage...)
ne sont faisables que sur l'espace membre du <b>binôme principal</b>.
</span>
<br>
<span>
Dans mon espace membre, les infos ne sont visibles qu'en lecture seule.
</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