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
2b533018
Commit
2b533018
authored
Sep 02, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add availability to make member adding new shifts
parent
2546a5fa
Pipeline
#2353
passed with stage
in 1 minute 29 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
8 deletions
+58
-8
members-space-shifts-exchange.css
members_space/static/css/members-space-shifts-exchange.css
+1
-0
members-space-shifts-exchange.js
members_space/static/js/members-space-shifts-exchange.js
+42
-7
views.py
members_space/views.py
+3
-0
config.md
outils/config.md
+4
-0
views.py
shifts/views.py
+4
-1
index.html
templates/members_space/index.html
+1
-0
shifts_exchange.html
templates/members_space/shifts_exchange.html
+3
-0
No files found.
members_space/static/css/members-space-shifts-exchange.css
View file @
2b533018
...
...
@@ -39,6 +39,7 @@
justify-content
:
space-between
;
}
@media
screen
and
(
max-width
:
992px
)
{
#calendar_top_info
{
display
:
flex
;
...
...
members_space/static/js/members-space-shifts-exchange.js
View file @
2b533018
var
calendar
=
null
,
selected_shift
=
null
,
vw
=
null
;
vw
=
null
,
adding_mode
=
false
;
/* - Logic */
...
...
@@ -51,6 +52,9 @@ function add_or_change_shift(new_shift_id) {
if
(
selected_shift
===
null
)
{
tUrl
=
'/shifts/add_shift'
;
if
(
partner_data
.
makeups_to_do
>
0
)
{
tData
+=
'&is_makeup=1'
;
}
}
else
{
tUrl
=
'/shifts/change_shift'
;
tData
=
tData
+
'&idOldShift='
+
selected_shift
.
shift_id
[
0
]
+
'&idRegister='
+
selected_shift
.
id
;
...
...
@@ -143,6 +147,8 @@ function add_or_change_shift(new_shift_id) {
},
300
);
}
});
adding_mode
=
false
;
$
(
'#start_adding_shift'
).
prop
(
'disabled'
,
false
);
}
return
null
;
...
...
@@ -315,6 +321,7 @@ function init_shifts_list() {
if
(
!
can_exchange_shifts
())
{
shift_line_template
.
find
(
".selectable_shift_line"
).
addClass
(
"btn"
);
shift_line_template
.
find
(
".checkbox"
).
prop
(
"disabled"
,
"disabled"
);
$
(
'#start_adding_shift'
).
prop
(
'disabled'
,
true
);
}
else
{
if
(
shift
.
is_makeup
==
true
)
{
shift_line_template
.
find
(
".selectable_shift_line"
).
addClass
(
"btn--warning"
);
...
...
@@ -577,12 +584,27 @@ function init_calendar_page() {
"Valider"
);
}
else
if
(
selected_shift
===
null
&&
can_exchange_shifts
())
{
/* could exchange shift but no old shift selected */
openModal
(
"Je dois sélectionner un service à échanger."
,
closeModal
,
"J'ai compris"
);
if
(
adding_mode
===
false
)
{
/* could exchange shift but no old shift selected */
openModal
(
"Je dois sélectionner un service à échanger."
,
closeModal
,
"J'ai compris"
);
}
else
{
// Display modal
let
modal_template
=
$
(
"#modal_add_shift_template"
);
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"
);
}
}
else
if
(
should_select_makeup
())
{
/* choose a makeup service */
// Check if selected new shift is in less than 6 months
...
...
@@ -811,6 +833,19 @@ function init_shifts_exchange() {
init_calendar_page
();
}
$
(
'#start_adding_shift'
).
click
((
c
)
=>
{
openModal
(
"<p>Je souhaite sélectionner un service supplémentaire.</p>"
,
()
=>
{
$
(
c
.
target
).
prop
(
'disabled'
,
true
);
adding_mode
=
true
;
closeModal
();
},
"Confirmer"
,
false
);
});
$
(
window
).
smartresize
(
function
()
{
// only apply if a width threshold is passed
if
(
...
...
members_space/views.py
View file @
2b533018
...
...
@@ -130,6 +130,8 @@ def index(request, exception=None):
if
hasattr
(
settings
,
'SHIFT_EXCHANGE_DAYS_TO_HIDE'
):
days_to_hide
=
settings
.
SHIFT_EXCHANGE_DAYS_TO_HIDE
context
[
'daysToHide'
]
=
days_to_hide
can_add_shift
=
getattr
(
settings
,
'CAN_ADD_SHIFT'
,
False
)
context
[
'canAddShift'
]
=
"true"
if
can_add_shift
is
True
else
"false"
msettings
=
MConfig
.
get_settings
(
'members'
)
context
[
'forms_link'
]
=
msettings
[
'forms_link'
][
'value'
]
if
'forms_link'
in
msettings
else
''
...
...
@@ -203,6 +205,7 @@ def shifts_exchange(request):
template
=
loader
.
get_template
(
'members_space/shifts_exchange.html'
)
context
=
{
'title'
:
'Échange de Services'
,
'canAddShift'
:
getattr
(
settings
,
'CAN_ADD_SHIFT'
,
False
)
}
return
HttpResponse
(
template
.
render
(
context
,
request
))
...
...
outils/config.md
View file @
2b533018
...
...
@@ -342,6 +342,10 @@
-
BLOCK_ACTIONS_FOR_ATTACHED_PEOPLE = False
Attached people can or not change his services
-
CAN_ADD_SHIFT = True
By default, False. Set if coop can or not add shifts in their memberspace calendar
### Reception
-
RECEPTION_ADD_ADMIN_MODE = True
...
...
shifts/views.py
View file @
2b533018
...
...
@@ -281,8 +281,11 @@ def add_shift(request):
"idPartner"
:
int
(
request
.
POST
[
'idPartner'
]),
"idShift"
:
int
(
request
.
POST
[
'idNewShift'
]),
"shift_type"
:
request
.
POST
[
'shift_type'
],
"is_makeup"
:
Tru
e
"is_makeup"
:
Fals
e
}
if
'is_makeup'
in
request
.
POST
and
request
.
POST
[
'is_makeup'
]
==
"1"
:
data
[
'is_makeup'
]
=
True
#Insertion du nouveau shift
st_r_id
=
False
...
...
templates/members_space/index.html
View file @
2b533018
...
...
@@ -153,6 +153,7 @@
"extra_shift_done"
:
parseInt
(
"{{partnerData.extra_shift_done}}"
,
10
)
};
var
block_actions_for_attached_people
=
'{{block_actions_for_attached_people}}'
;
const
canAddShift
=
{{
canAddShift
}};
</script>
<script
src=
"{% static "
js
/
all_common
.
js
"
%}?
v=
1651853225"
></script>
<script
src=
"{% static "
js
/
members-space-home
.
js
"
%}?
v=
1651853225"
></script>
...
...
templates/members_space/shifts_exchange.html
View file @
2b533018
...
...
@@ -50,6 +50,9 @@
<i
class=
"fas fa-spinner fa-spin fa-lg"
></i>
</div>
<div
id=
"shifts_list"
></div>
{% if canAddShift %}
<button
class=
"btn--primary selectable_shift_line"
id=
"start_adding_shift"
><strong>
+ Ajouter un service
</strong></button>
{% endif %}
</div>
<div
id=
"calendar_explaination_area"
></div>
<button
id=
"calendar_explaination_button"
class=
"btn--success"
>
Légende du calendrier
</button>
...
...
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