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
37baee98
Commit
37baee98
authored
Feb 23, 2022
by
Etienne Freiss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work
parent
e6577d4f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
4 deletions
+93
-4
members-space-shifts-exchange.css
members_space/static/css/members-space-shifts-exchange.css
+0
-1
members-space-my-shifts.js
members_space/static/js/members-space-my-shifts.js
+23
-0
members-space-shifts-exchange.js
members_space/static/js/members-space-shifts-exchange.js
+51
-1
members-space.js
members_space/static/js/members-space.js
+0
-0
models.py
shifts/models.py
+1
-1
index.html
templates/members_space/index.html
+18
-1
No files found.
members_space/static/css/members-space-shifts-exchange.css
View file @
37baee98
...
...
@@ -52,7 +52,6 @@
#shifts_list
{
flex-direction
:
column
;
display
:
none
;
width
:
min-content
;
max-width
:
100%
;
white-space
:
nowrap
;
}
...
...
members_space/static/js/members-space-my-shifts.js
View file @
37baee98
...
...
@@ -146,6 +146,7 @@ function init_history() {
* Init the Incoming shifts section: display them
*/
function
init_incoming_shifts
()
{
console
.
log
(
partner_data
)
$
(
".loading-incoming-shifts"
).
hide
();
$
(
"#incoming_shifts"
).
show
();
...
...
@@ -157,6 +158,28 @@ function init_incoming_shifts() {
for
(
shift
of
incoming_shifts
)
{
let
shift_line_template
=
prepare_shift_line_template
(
shift
.
date_begin
);
if
(
partner_data
.
associated_partner_id
!=
"False"
&&
shift
.
associate_registered
===
"partner"
){
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
name
+
''
)
}
else
if
(
partner_data
.
associated_partner_id
!=
"False"
&&
shift
.
associate_registered
===
"associated"
){
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
associated_partner_name
+
''
)
}
else
if
(
partner_data
.
associated_partner_id
!=
"False"
&&
shift
.
associate_registered
===
"both"
){
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - Les deux'
)
}
else
if
(
partner_data
.
parent_id
!=
"False"
&&
shift
.
associate_registered
===
"partner"
){
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
parent_name
+
''
)
}
else
if
(
partner_data
.
parent_id
!=
"False"
&&
shift
.
associate_registered
===
"associated"
){
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
name
+
''
)
}
else
if
(
partner_data
.
parent_id
!=
"False"
&&
shift
.
associate_registered
===
"both"
){
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - Les deux'
)
}
$
(
"#incoming_shifts"
).
append
(
shift_line_template
.
html
());
}
}
...
...
members_space/static/js/members-space-shifts-exchange.js
View file @
37baee98
...
...
@@ -112,6 +112,7 @@ function add_or_change_shift(new_shift_id) {
}
function
init_shifts_list
()
{
console
.
log
(
partner_data
)
$
(
".loading-incoming-shifts"
).
hide
();
$
(
"#shifts_list"
).
show
();
...
...
@@ -142,6 +143,30 @@ function init_shifts_list() {
shift_line_template
.
find
(
".checkbox"
).
prop
(
"value"
,
shift
.
id
);
}
if
(
partner_data
.
associated_partner_id
===
"False"
&&
partner_data
.
parent_id
===
"False"
){
shift_line_template
.
find
(
'.affect_associate_reistered'
).
hide
();
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
attr
(
'id'
,
shift
.
id
)
if
(
shift
.
associate_registered
===
"both"
){
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
"Les deux"
)
}
else
if
(
shift
.
associate_registered
===
"partner"
){
if
(
partner_data
.
associated_partner_id
!==
"False"
){
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
name
)
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
parent_name
)
}
}
else
if
(
shift
.
associate_registered
===
"associate"
){
if
(
partner_data
.
associated_partner_id
!==
"False"
){
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
associated_partner_name
)
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
name
)
}
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
"A déterminer"
)
}
}
$
(
"#shifts_list"
).
append
(
shift_line_template
.
html
());
}
...
...
@@ -171,6 +196,32 @@ function init_shifts_list() {
}
}
});
$
(
".affect_associate_registered"
).
on
(
"click"
,
function
(
e
)
{
// Display modal
let
modal_template
=
$
(
"#modal_affect_shift"
);
console
.
log
(
modal_template
.
find
(
".partner"
).
html
())
if
(
partner_data
.
associated_partner_id
!=
"False"
)
{
modal_template
.
find
(
".partner"
).
text
(
partner_data
.
name
);
modal_template
.
find
(
".associate"
).
text
(
partner_data
.
associated_partner_name
);
}
else
{
modal_template
.
find
(
".partner"
).
text
(
partner_data
.
associated_partner_name
);
modal_template
.
find
(
".associate"
).
text
(
partner_data
.
parent_name
);
}
// modal_template.find(".time_old_shift").text(old_shift_time);
// modal_template.find(".date_new_shift").text(new_shift_date);
// modal_template.find(".time_new_shift").text(new_shift_time);
openModal
(
modal_template
.
html
(),
()
=>
{
// add_or_change_shift(new_shift_id);
},
"Valider"
);
modal
.
find
(
".btn-modal-ok"
).
hide
()
});
}
}
...
...
@@ -480,7 +531,6 @@ function init_shifts_exchange() {
$
(
".select_makeups"
).
on
(
'click'
,
()
=>
{
openModal
();
// Create 6 month delay
request_delay
()
.
then
(()
=>
{
...
...
members_space/static/js/members-space.js
View file @
37baee98
shifts/models.py
View file @
37baee98
...
...
@@ -83,7 +83,7 @@ class CagetteShift(models.Model):
def
get_shift_partner
(
self
,
id
):
"""Récupère les shift du membre"""
fields
=
[
'date_begin'
,
'date_end'
,
'final_standard_point'
,
'shift_id'
,
'shift_type'
,
'partner_id'
,
"id"
]
# res.partner
'shift_id'
,
'shift_type'
,
'partner_id'
,
"id"
,
"associate_registered"
]
# res.partner
cond
=
[[
'partner_id.id'
,
'='
,
id
],[
'state'
,
'='
,
'open'
],
[
'date_begin'
,
'>'
,
datetime
.
datetime
.
now
()
.
isoformat
()]]
shiftData
=
self
.
o_api
.
search_read
(
'shift.registration'
,
cond
,
fields
,
order
=
"date_begin ASC"
)
...
...
templates/members_space/index.html
View file @
37baee98
...
...
@@ -31,17 +31,34 @@
<div
id=
"shift_line_template"
>
<div
class=
"shift_line"
>
<i
class=
"fas fa-chevron-right shift_line_chevron"
></i>
<span
class=
"shift_line_date"
></span>
-
<span
class=
"shift_line_time"
></span>
<span
class=
"shift_line_date"
></span>
-
<span
class=
"shift_line_time"
></span>
<span
class=
"shift_line_associate"
>
</span>
</div>
</div>
<div
id=
"selectable_shift_line_template"
>
<div
class=
"d-flex"
>
<div
class=
"selectable_shift_line btn--primary"
>
<input
type=
"checkbox"
class=
"checkbox"
>
<div
class=
"selectable_shift_line_text"
>
<span
class=
"shift_line_date"
></span>
-
<span
class=
"shift_line_time"
></span>
</div>
</div>
<div
class=
"affect_associate_registered button--warning"
>
</div>
</div>
</div>
<div
id=
"modal_affect_shift"
>
<div>
Qui sera présent ?
</div>
<div
class=
"partner btn--primary"
>
</div>
<div
class=
"associate btn--primary"
>
</div>
<div
class=
"both btn--primary"
>
Les deux
</div>
</div>
<div
id=
"modal_shift_exchange_template"
>
...
...
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