Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
efa1ddd9
Commit
efa1ddd9
authored
Nov 17, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display associated partner for main partner + pairs info under header
parent
24616d3f
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
80 additions
and
24 deletions
+80
-24
models.py
members/models.py
+14
-0
members-space-header.css
members_space/static/css/members-space-header.css
+6
-0
members-space-my-info.css
members_space/static/css/members-space-my-info.css
+0
-7
members-space.css
members_space/static/css/members-space.css
+2
-1
members-space-header.js
members_space/static/js/members-space-header.js
+4
-0
members-space-home.js
members_space/static/js/members-space-home.js
+12
-0
members-space-my-info.js
members_space/static/js/members-space-my-info.js
+6
-2
members-space.js
members_space/static/js/members-space.js
+10
-4
views.py
members_space/views.py
+12
-0
header.html
templates/members_space/header.html
+8
-0
home.html
templates/members_space/home.html
+4
-0
index.html
templates/members_space/index.html
+2
-0
my_info.html
templates/members_space/my_info.html
+0
-10
No files found.
members/models.py
View file @
efa1ddd9
...
...
@@ -799,6 +799,20 @@ class CagetteMember(models.Model):
res
[
'error'
]
=
str
(
e
)
return
res
def
search_associated_people
(
self
):
""" Search for an associated partner """
res
=
{}
c
=
[[
"parent_id"
,
"="
,
self
.
id
]]
f
=
[
"id"
,
"name"
,
"barcode_base"
]
res
=
self
.
o_api
.
search_read
(
'res.partner'
,
c
,
f
)
try
:
return
res
[
0
]
except
:
return
None
class
CagetteMembers
(
models
.
Model
):
"""Class to manage operations on all members or part of them."""
...
...
members_space/static/css/members-space-header.css
View file @
efa1ddd9
...
...
@@ -34,6 +34,12 @@
display
:
none
;
}
.pairs_info
{
background-color
:
#00a573
;
color
:
white
;
padding
:
1.5rem
1.2rem
;
}
@media
screen
and
(
max-width
:
768px
)
{
/* When the screen is less than 768 pixels wide, hide all links, except for the first one ("Home"). Show the link that contains should open and close the topnav (.icon) */
.topnav
a
:not
(
:first-child
)
{
display
:
none
;}
...
...
members_space/static/css/members-space-my-info.css
View file @
efa1ddd9
...
...
@@ -41,13 +41,6 @@
flex-direction
:
column
;
}
.pairs_info
{
background-color
:
#00a573
;
color
:
white
;
padding
:
1.5rem
1.2rem
;
margin
:
2rem
0
;
}
.member_phone_area
{
display
:
flex
;
flex-direction
:
column
;
...
...
members_space/static/css/members-space.css
View file @
efa1ddd9
...
...
@@ -183,7 +183,8 @@ body {
@media
screen
and
(
max-width
:
768px
)
{
.member_shift_name_area
,
.member_coop_number_area
{
.member_coop_number_area
,
.member_associated_partner_area
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
...
...
members_space/static/js/members-space-header.js
View file @
efa1ddd9
...
...
@@ -47,4 +47,8 @@ $(document).ready(function() {
$
(
'#nav_calendar'
).
on
(
'click'
,
()
=>
{
toggleHeader
();
});
if
(
partner_data
.
is_associated_people
!==
"True"
)
{
$
(
".pairs_info"
).
hide
();
}
});
members_space/static/js/members-space-home.js
View file @
efa1ddd9
...
...
@@ -97,6 +97,18 @@ function init_home() {
});
$
(
"#go_to_forms"
).
prop
(
"href"
,
forms_link
);
if
(
partner_data
.
is_in_association
===
false
)
{
$
(
"#home .member_associated_partner_area"
).
hide
();
}
else
{
if
(
partner_data
.
is_associated_people
===
"True"
)
{
$
(
".member_associated_partner"
).
text
(
partner_data
.
parent_name
);
}
else
if
(
partner_data
.
associated_partner_id
!==
"False"
)
{
$
(
".member_associated_partner"
).
text
(
partner_data
.
associated_partner_name
);
}
}
// TODO vérif tile my info avec données binomes + rattrapage et délai
// Init my info tile
init_my_info_data
();
...
...
members_space/static/js/members-space-my-info.js
View file @
efa1ddd9
...
...
@@ -3,10 +3,14 @@ function init_my_info() {
$
(
".member_email"
).
text
(
partner_data
.
email
);
if
(
partner_data
.
is_
associated_people
===
"False"
)
{
if
(
partner_data
.
is_
in_association
===
false
)
{
$
(
"#attached_info_area"
).
hide
();
}
else
{
}
if
(
partner_data
.
is_associated_people
===
"True"
)
{
$
(
".attached_partner_name"
).
text
(
partner_data
.
parent_name
);
}
else
if
(
partner_data
.
associated_partner_id
!==
"False"
)
{
$
(
".attached_partner_name"
).
text
(
partner_data
.
associated_partner_name
);
}
if
(
partner_data
.
street
!==
""
)
{
...
...
members_space/static/js/members-space.js
View file @
efa1ddd9
...
...
@@ -15,7 +15,7 @@ const possible_cooperative_state = {
exempted
:
"Exempté.e"
,
alert
:
"En alerte"
,
up_to_date
:
"À jour"
,
unsubscribed
:
"Désinscrit.e"
,
unsubscribed
:
"Désinscrit.e
des créneaux
"
,
delay
:
"En délai"
};
...
...
@@ -147,15 +147,14 @@ function prepare_shift_line_template(date_begin) {
function
init_my_info_data
()
{
$
(
".choose_makeups"
).
off
();
$
(
".unsuscribed_form_link"
).
off
();
console
.
log
(
partner_data
);
$
(
".member_shift_name"
).
text
(
partner_data
.
regular_shift_name
);
console
.
log
(
partner_data
);
let
pns
=
partner_data
.
name
.
split
(
" - "
);
let
name
=
pns
.
length
>
1
?
pns
[
1
]
:
pns
[
0
];
$
(
".member_name"
).
text
(
name
);
// Status related
$
(
".member_name"
).
text
(
name
);
$
(
".member_status"
)
.
text
(
possible_cooperative_state
[
partner_data
.
cooperative_state
])
.
addClass
(
"member_status_"
+
partner_data
.
cooperative_state
);
...
...
@@ -219,6 +218,13 @@ $(document).ready(function() {
?
partner_data
.
parent_id
:
partner_data
.
partner_id
;
partner_data
.
is_in_association
=
partner_data
.
is_associated_people
===
"True"
||
partner_data
.
associated_partner_id
!==
"False"
;
// For associated people, their parent name is attached in their display name
let
partner_name_split
=
partner_data
.
name
.
split
(
', '
);
partner_data
.
name
=
partner_name_split
[
partner_name_split
.
length
-
1
];
base_location
=
(
app_env
===
'dev'
)
?
'/members_space/'
:
'/'
;
update_dom
();
...
...
members_space/views.py
View file @
efa1ddd9
...
...
@@ -76,6 +76,7 @@ def index(request, exception=None):
partner_id
=
credentials
[
'id'
]
cs
=
CagetteShift
()
partnerData
=
cs
.
get_data_partner
(
partner_id
)
if
'create_date'
in
partnerData
:
...
...
@@ -89,12 +90,23 @@ def index(request, exception=None):
except
:
pass
# look for parent for associated partner
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
# look for associated partner for parents
cm
=
CagetteMember
(
partner_id
)
associated_partner
=
cm
.
search_associated_people
()
partnerData
[
"associated_partner_id"
]
=
False
if
associated_partner
is
None
else
associated_partner
[
"id"
]
partnerData
[
"associated_partner_name"
]
=
False
if
associated_partner
is
None
else
associated_partner
[
"name"
]
if
(
associated_partner
is
not
None
and
partnerData
[
"associated_partner_name"
]
.
find
(
str
(
associated_partner
[
"barcode_base"
]))
==
-
1
):
partnerData
[
"associated_partner_name"
]
=
str
(
associated_partner
[
"barcode_base"
])
+
' - '
+
partnerData
[
"associated_partner_name"
]
partnerData
[
'can_have_delay'
]
=
cs
.
member_can_have_delay
(
int
(
partner_id
))
context
[
'partnerData'
]
=
partnerData
...
...
templates/members_space/header.html
View file @
efa1ddd9
...
...
@@ -24,6 +24,14 @@
<i
class=
"fa fa-bars"
></i>
</a>
</div>
<div
class=
"pairs_info"
>
<span>
<i
class=
"fas fa-exclamation-circle"
></i>
Je suis en binôme.
Toutes les actions (changement de service, choix d'un rattrapage...)
ne sont faisables que sur l'espace membre du
<b>
binôme principal
</b>
.
Dans mon espace membre, les infos ne sont visibles qu'en lecture seule.
</span>
</div>
<script
type=
"text/javascript"
src=
"{% static 'js/members-space-header.js' %}"
></script>
{% endblock %}
templates/members_space/home.html
View file @
efa1ddd9
...
...
@@ -30,6 +30,10 @@
<span>
Mon numéro de coop :
</span>
<span
class=
"member_coop_number member_info"
></span>
</div>
<div
class=
"member_associated_partner_area"
>
<span>
Je suis en binôme avec :
</span>
<span
class=
"member_associated_partner member_info"
></span>
</div>
</div>
<div
id=
"see_more_info"
>
<a
href=
"#"
id=
"see_more_info_link"
>
Voir plus >
</a>
...
...
templates/members_space/index.html
View file @
efa1ddd9
...
...
@@ -99,6 +99,8 @@
"is_associated_people"
:
"{{partnerData.is_associated_people}}"
,
"parent_id"
:
"{{partnerData.parent_id}}"
,
"parent_name"
:
"{{partnerData.parent_name}}"
,
"associated_partner_id"
:
"{{partnerData.associated_partner_id}}"
,
"associated_partner_name"
:
"{{partnerData.associated_partner_name}}"
,
"verif_token"
:
"{{partnerData.verif_token}}"
,
}
</script>
...
...
templates/members_space/my_info.html
View file @
efa1ddd9
...
...
@@ -86,16 +86,6 @@
<span
class=
"attached_partner_name member_info"
></span>
</div>
</div>
<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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment