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
ab49214a
Commit
ab49214a
authored
Mar 08, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent deleting a makeup
parent
23109cf5
Pipeline
#1879
passed with stage
in 1 minute 28 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
10 deletions
+26
-10
members-space-shifts-exchange.js
members_space/static/js/members-space-shifts-exchange.js
+21
-7
models.py
shifts/models.py
+1
-1
index.html
templates/members_space/index.html
+4
-2
No files found.
members_space/static/js/members-space-shifts-exchange.js
View file @
ab49214a
...
...
@@ -265,6 +265,9 @@ function offer_extra_shift() {
timeout
:
3000
,
success
:
function
()
{
$
(
"#can_delete_future_registrations_area"
).
hide
();
$
(
".delete_registration_button"
).
off
();
$
(
".delete_registration_button"
).
hide
();
closeModal
();
alert
(
"Don de service effectué"
);
},
...
...
@@ -287,17 +290,17 @@ function init_shifts_list() {
}
else
{
$
(
"#shifts_list"
).
empty
();
for
(
shift
of
incoming_shifts
)
{
for
(
let
shift
of
incoming_shifts
)
{
let
shift_line_template
=
$
(
"#selectable_shift_line_template"
);
let
datetime_shift_start
=
new
Date
(
shift
.
date_begin
.
replace
(
/
\s
/
,
'T'
));
let
f_date_shift_start
=
datetime_shift_start
.
toLocaleDateString
(
"fr-fr"
,
date_options
);
f_date_shift_start
=
f_date_shift_start
.
charAt
(
0
).
toUpperCase
()
+
f_date_shift_start
.
slice
(
1
);
shift_line_template
.
find
(
".shift_line_date"
).
text
(
f_date_shift_start
);
shift_line_template
.
find
(
".shift_line_time"
).
text
(
datetime_shift_start
.
toLocaleTimeString
(
"fr-fr"
,
time_options
));
// Disable or not
if
(
!
can_exchange_shifts
()
&&
block_actions_for_attached_people
===
"True"
)
{
shift_line_template
.
find
(
".selectable_shift_line"
).
removeClass
(
"btn--primary"
);
shift_line_template
.
find
(
".selectable_shift_line"
).
addClass
(
"btn"
);
...
...
@@ -309,6 +312,7 @@ function init_shifts_list() {
shift_line_template
.
find
(
".checkbox"
).
prop
(
"value"
,
shift
.
id
);
}
// Set assign shift button
if
(
partner_data
.
associated_partner_id
===
"False"
&&
partner_data
.
parent_id
===
"False"
)
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
hide
();
}
else
{
...
...
@@ -333,6 +337,16 @@ function init_shifts_list() {
}
}
// Set delete registration button if shift isn't a makeup
if
(
partner_data
.
extra_shift_done
>
0
&&
shift
.
is_makeup
===
false
)
{
if
(
shift_line_template
.
find
(
".delete_registration_button"
).
length
===
0
)
{
let
delete_reg_button_template
=
$
(
"#delete_registration_button_template"
);
shift_line_template
.
find
(
".shift_line_container"
).
append
(
delete_reg_button_template
.
html
());
}
}
else
{
shift_line_template
.
find
(
".delete_registration_button"
).
remove
();
}
$
(
"#shifts_list"
).
append
(
shift_line_template
.
html
());
}
...
...
@@ -446,7 +460,7 @@ function init_calendar_page() {
$
(
"#offer_extra_shift"
).
on
(
"click"
,
()
=>
{
openModal
(
"
Je ne souhaite pas supprimer un service futur.
"
,
"
<p>Je ne souhaite pas supprimer un service futur.</p>
"
,
offer_extra_shift
,
"Confirmer"
,
false
...
...
@@ -681,8 +695,6 @@ function init_read_only_calendar_page() {
}
function
init_delete_registration_buttons
()
{
$
(
".delete_registration_button"
).
css
(
'display'
,
'flex'
);
$
(
".delete_registration_button"
).
off
();
$
(
".delete_registration_button"
).
on
(
"click"
,
function
()
{
let
shift_name
=
$
(
this
).
closest
(
"div"
).
siblings
(
".selectable_shift_line"
).
text
().
trim
();
...
...
@@ -690,14 +702,16 @@ function init_delete_registration_buttons() {
.
split
(
'_'
)[
2
];
openModal
(
`
Je m'apprête supprimer ma présence au service du <b>
${
shift_name
}
</b
>`
,
`
<p>Je m'apprête supprimer ma présence au service du <b>
${
shift_name
}
</b></p
>`
,
()
=>
{
delete_shift_registration
(
shift_id
);
},
"Confirmer"
,
false
)
)
;
});
$
(
".delete_registration_button"
).
css
(
'display'
,
'flex'
);
}
function
init_shifts_exchange
()
{
...
...
shifts/models.py
View file @
ab49214a
...
...
@@ -92,7 +92,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"
,
"associate_registered"
]
# res.partner
'shift_id'
,
'shift_type'
,
'partner_id'
,
"id"
,
"associate_registered"
,
"is_makeup"
]
# 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 @
ab49214a
...
...
@@ -44,9 +44,12 @@
</div>
</div>
<div
class=
"affect_associate_registered button--warning"
></div>
<div
class=
"delete_registration_button"
><i
class=
"fas fa-lg fa-trash"
></i></div>
</div>
</div>
<div
id=
"delete_registration_button_template"
>
<div
class=
"delete_registration_button"
><i
class=
"fas fa-lg fa-trash"
></i></div>
</div>
<div
id=
"modal_affect_shift"
>
<div>
Qui sera présent.e ?
</div>
...
...
@@ -57,7 +60,6 @@
<div
id=
"shift_both"
class=
" 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