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
b6673825
Commit
b6673825
authored
Mar 10, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display member in shift template management
parent
52bf5444
Pipeline
#1926
passed with stage
in 1 minute 27 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
23 deletions
+89
-23
models.py
members/models.py
+20
-4
manage_regular_shifts.css
members/static/css/admin/manage_regular_shifts.css
+24
-2
manage_regular_shifts.js
members/static/js/admin/manage_regular_shifts.js
+32
-12
index.html
templates/members/admin/index.html
+4
-4
manage_regular_shifts.html
templates/members/admin/manage_regular_shifts.html
+9
-1
No files found.
members/models.py
View file @
b6673825
...
...
@@ -26,8 +26,7 @@ class CagetteMember(models.Model):
'display_ftop_points'
,
'display_std_points'
,
'is_exempted'
,
'cooperative_state'
,
'date_alert_stop'
]
m_shoft_default_fields
=
[
'name'
,
'barcode_base'
,
'total_partner_owned_share'
,
'amount_subscription'
]
m_short_default_fields
=
[
'name'
,
'barcode_base'
]
def
__init__
(
self
,
id
):
"""Init with odoo id."""
...
...
@@ -96,7 +95,6 @@ class CagetteMember(models.Model):
# # # BDM
def
save_partner_info
(
self
,
partner_id
,
fieldsDatas
):
print
(
fieldsDatas
)
return
self
.
o_api
.
update
(
'res.partner'
,
partner_id
,
fieldsDatas
)
...
...
@@ -775,8 +773,26 @@ class CagetteMember(models.Model):
members
.
append
(
m
)
return
CagetteMember
.
add_next_shifts_to_members
(
members
)
elif
search_type
==
"shift_template_data"
:
fields
=
CagetteMember
.
m_short_default_fields
fields
=
fields
+
[
'id'
,
'makeups_to_do'
,
'cooperative_state'
]
res
=
api
.
search_read
(
'res.partner'
,
cond
,
fields
)
if
res
:
c
=
[[
'partner_id'
,
'='
,
int
(
res
[
0
][
'id'
])]]
f
=
[
'shift_template_id'
]
shift_template_reg
=
api
.
search_read
(
'shift.template.registration'
,
c
,
f
)
if
shift_template_reg
:
res
[
0
][
'shift_template_name'
]
=
shift_template_reg
[
0
][
'shift_template_id'
][
1
]
else
:
res
[
0
][
'shift_template_name'
]
=
None
return
res
else
:
fields
=
CagetteMember
.
m_shoft_default_fields
# TODO differentiate short & subscription_data searches
fields
=
CagetteMember
.
m_short_default_fields
fields
=
fields
+
[
'total_partner_owned_share'
,
'amount_subscription'
]
res
=
api
.
search_read
(
'res.partner'
,
cond
,
fields
)
return
res
...
...
members/static/css/admin/manage_regular_shifts.css
View file @
b6673825
...
...
@@ -49,4 +49,27 @@
.btn_possible_member
{
margin
:
0.5rem
1rem
;
}
\ No newline at end of file
}
/* Member info area */
#partner_data_area
{
width
:
80%
;
display
:
none
;
flex-direction
:
column
;
align-items
:
center
;
border-radius
:
30px
;
margin
:
30px
auto
;
padding
:
15px
;
box-shadow
:
2px
2px
3px
rgba
(
10
,
10
,
10
,
.1
),
0
0
0
1px
rgba
(
10
,
10
,
10
,
.1
);
}
.member_name_container
{
margin
:
1rem
0
2rem
0
;
}
.member_name_icon
{
color
:
#00a573
;
margin-right
:
5px
;
}
.member_info
{
font-weight
:
bold
;
}
members/static/js/admin/manage_regular_shifts.js
View file @
b6673825
var
selected_member
=
null
,
possible_cooperative_state
=
{
suspended
:
"Rattrapage"
,
exempted
:
"Exempté.e"
,
alert
:
"En alerte"
,
up_to_date
:
"À jour"
,
unsubscribed
:
"Désinscrit.e des créneaux"
,
delay
:
"En délai"
,
gone
:
"Parti.e"
};
/**
* When a member is selected, display the selected member relevant info
*/
function
display_member_info
()
{
$
(
'.member_name'
).
text
(
`
${
selected_member
.
barcode_base
}
-
${
selected_member
.
name
}
`
);
$
(
'.member_shift'
).
text
(
selected_member
.
shift_template_name
);
$
(
'.member_status'
).
text
(
possible_cooperative_state
[
selected_member
.
cooperative_state
]);
$
(
'.member_makeups'
).
text
(
selected_member
.
makeups_to_do
);
$
(
'#search_member_input'
).
val
();
$
(
'#partner_data_area'
).
css
(
'display'
,
'flex'
);
}
/**
* Display the members from the search result
*/
...
...
@@ -27,8 +51,7 @@
for
(
member
of
members_search_results
)
{
if
(
member
.
id
==
$
(
this
).
attr
(
'member_id'
))
{
selected_member
=
member
;
// TODO display member
display_member_info
();
$
(
'.search_member_results'
).
empty
();
$
(
'.search_member_results_area'
).
hide
();
...
...
@@ -51,7 +74,6 @@
$
(
document
).
ready
(
function
()
{
if
(
coop_is_connected
())
{
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
$
(
".page_content"
).
show
();
}
else
{
$
(
".page_content"
).
hide
();
...
...
@@ -67,18 +89,16 @@ $(document).ready(function() {
let
search_str
=
$
(
'#search_member_input'
).
val
();
$
.
ajax
({
url
:
'/members/search/'
+
search_str
,
url
:
`/members/search/
${
search_str
}
?search_type=shift_template_data`
,
dataType
:
'json'
,
success
:
function
(
data
)
{
members_search_results
=
[];
for
(
member
of
data
.
res
)
{
if
(
member
.
is_member
||
member
.
is_associated_people
)
{
members_search_results
.
push
(
member
)
;
}
if
(
data
.
res
.
length
===
1
)
{
selected_member
=
data
.
res
[
0
];
display_member_info
();
}
else
{
members_search_results
=
data
.
res
;
display_possible_members
();
}
display_possible_members
();
},
error
:
function
()
{
err
=
{
...
...
templates/members/admin/index.html
View file @
b6673825
...
...
@@ -34,15 +34,15 @@
<span
class=
"management_type_button_icons"
><i
class=
"fas fa-wrench"
></i></span>
{#
<span
class=
"management_type_button_icons"
><i
class=
"fas fa-arrow-right"
></i></span>
#}
</button><br>
<button
type=
"button"
class=
"btn--primary management_type_button"
id=
"manage_regular_shifts_button"
>
Gestion des créneaux
<span
class=
"management_type_button_icons"
><i
class=
"fas fa-arrow-right"
></i></span>
</button><br>
<button
type=
"button"
class=
"btn--primary management_type_button"
id=
"manage_leaves_button"
disabled
>
Gestion des congés
<span
class=
"management_type_button_icons"
><i
class=
"fas fa-wrench"
></i></span>
{#
<span
class=
"management_type_button_icons"
><i
class=
"fas fa-arrow-right"
></i></span>
#}
</button><br>
<button
type=
"button"
class=
"btn--primary management_type_button"
id=
"manage_regular_shifts_button"
>
Gestion des créneaux
<span
class=
"management_type_button_icons"
><i
class=
"fas fa-arrow-right"
></i></span>
</button><br>
</div>
</div>
</div>
...
...
templates/members/admin/manage_regular_shifts.html
View file @
b6673825
...
...
@@ -42,7 +42,15 @@
<div
class=
"search_member_results"
></div>
</div>
</div>
<div
id=
"partner_data_area"
>
<h4
class=
"member_name_container"
>
<i
class=
"fas fa-user member_name_icon"
></i>
<span
class=
"member_info member_name"
></span>
</h4>
<p
class=
"shift_name_container"
>
Créneau :
<span
class=
"member_info member_shift"
></span></p>
<p
class=
"status_container"
>
Statut :
<span
class=
"member_info member_status"
></span></p>
<p
class=
"makeups_container"
>
Nb rattrapage(s) :
<span
class=
"member_info member_makeups"
></span></p>
</div>
</div>
<div
id=
"templates"
style=
"display:none;"
></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