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
a2dca96f
Commit
a2dca96f
authored
Oct 25, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow other extension than 6 months in memberspace
parent
06bf7b9c
Pipeline
#2463
passed with stage
in 1 minute 22 seconds
Changes
9
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
33 additions
and
15 deletions
+33
-15
admin.py
members/admin.py
+6
-2
manage_makeups.js
members/static/js/admin/manage_makeups.js
+3
-3
models.py
members_space/models.py
+7
-0
members-space-shifts-exchange.js
members_space/static/js/members-space-shifts-exchange.js
+2
-2
members-space.js
members_space/static/js/members-space.js
+4
-4
views.py
members_space/views.py
+4
-1
manage_makeups.html
templates/members/admin/manage_makeups.html
+4
-1
index.html
templates/members_space/index.html
+2
-1
shifts_exchange.html
templates/members_space/shifts_exchange.html
+1
-1
No files found.
members/admin.py
View file @
a2dca96f
...
@@ -7,6 +7,7 @@ from members.models import CagetteMembers
...
@@ -7,6 +7,7 @@ from members.models import CagetteMembers
from
members.models
import
CagetteMember
from
members.models
import
CagetteMember
from
shifts.models
import
CagetteServices
from
shifts.models
import
CagetteServices
from
shifts.models
import
CagetteShift
from
shifts.models
import
CagetteShift
from
members_space.models
import
CagetteMembersSpace
from
outils.common
import
MConfig
from
outils.common
import
MConfig
from
datetime
import
datetime
,
date
from
datetime
import
datetime
,
date
...
@@ -120,7 +121,7 @@ default_msettings = {'msg_accueil': {'title': 'Message borne accueil',
...
@@ -120,7 +121,7 @@ default_msettings = {'msg_accueil': {'title': 'Message borne accueil',
'sort_order'
:
16
'sort_order'
:
16
},
},
'member_cant_have_delay_form_link'
:
{
'member_cant_have_delay_form_link'
:
{
'title'
:
'Lien vers le formulaire pour les membres n
\'
ayant pas rattrapé leur service après
6 mois
'
,
'title'
:
'Lien vers le formulaire pour les membres n
\'
ayant pas rattrapé leur service après
la durée de l
\'
extension
'
,
'type'
:
'text'
,
'type'
:
'text'
,
'value'
:
''
,
'value'
:
''
,
'class'
:
'link'
,
'class'
:
'link'
,
...
@@ -320,8 +321,11 @@ def admin(request):
...
@@ -320,8 +321,11 @@ def admin(request):
def
manage_makeups
(
request
):
def
manage_makeups
(
request
):
""" Administration des membres """
""" Administration des membres """
template
=
loader
.
get_template
(
'members/admin/manage_makeups.html'
)
template
=
loader
.
get_template
(
'members/admin/manage_makeups.html'
)
m
=
CagetteMembersSpace
()
context
=
{
'title'
:
'BDM - Rattrapages'
,
context
=
{
'title'
:
'BDM - Rattrapages'
,
'module'
:
'Membres'
}
'module'
:
'Membres'
,
'extension_duration'
:
m
.
get_extension_duration
()
}
return
HttpResponse
(
template
.
render
(
context
,
request
))
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
manage_shift_registrations
(
request
):
def
manage_shift_registrations
(
request
):
...
...
members/static/js/admin/manage_makeups.js
View file @
a2dca96f
...
@@ -351,10 +351,10 @@ function extend_member_delay(member) {
...
@@ -351,10 +351,10 @@ function extend_member_delay(member) {
openModal
();
openModal
();
let
today
=
new
Date
();
let
today
=
new
Date
();
let
today_plus_
six_month
=
new
Date
();
let
today_plus_
extension_duration
=
new
Date
();
today_plus_
six_month
.
setMonth
(
today_plus_six_month
.
getMonth
()
+
6
);
today_plus_
extension_duration
.
setMonth
(
today_plus_extension_duration
.
getMonth
()
+
extension_duration
);
const
diff_time
=
Math
.
abs
(
today_
plus_six_month
-
today
);
const
diff_time
=
Math
.
abs
(
today_
extension_duration
-
today
);
const
diff_days
=
Math
.
ceil
(
diff_time
/
(
1000
*
60
*
60
*
24
));
const
diff_days
=
Math
.
ceil
(
diff_time
/
(
1000
*
60
*
60
*
24
));
let
data
=
{
let
data
=
{
...
...
members_space/models.py
View file @
a2dca96f
...
@@ -27,6 +27,13 @@ class CagetteMembersSpace(models.Model):
...
@@ -27,6 +27,13 @@ class CagetteMembersSpace(models.Model):
answer
=
True
answer
=
True
return
answer
return
answer
def
get_extension_duration
(
self
):
"""Return nb of months"""
# TODO : add a unit parameter and convert if not month
extension_duration
=
OdooAPI
()
.
get_system_param
(
'lacagette_membership.extension_duration'
)
nb
,
unit
=
extension_duration
.
split
(
' '
)
return
nb
def
get_shifts_history
(
self
,
partner_id
,
limit
,
offset
,
date_from
):
def
get_shifts_history
(
self
,
partner_id
,
limit
,
offset
,
date_from
):
""" Get partner shifts history """
""" Get partner shifts history """
res
=
[]
res
=
[]
...
...
members_space/static/js/members-space-shifts-exchange.js
View file @
a2dca96f
...
@@ -613,12 +613,12 @@ function init_calendar_page() {
...
@@ -613,12 +613,12 @@ function init_calendar_page() {
}
else
if
(
should_select_makeup
())
{
}
else
if
(
should_select_makeup
())
{
/* choose a makeup service */
/* choose a makeup service */
// Check if selected new shift is in less than
6 months
// Check if selected new shift is in less than
extension end
if
(
partner_data
.
date_delay_stop
!==
'False'
)
{
if
(
partner_data
.
date_delay_stop
!==
'False'
)
{
date_partner_delay_stop
=
new
Date
(
partner_data
.
date_delay_stop
);
date_partner_delay_stop
=
new
Date
(
partner_data
.
date_delay_stop
);
if
(
datetime_new_shift
>
date_partner_delay_stop
)
{
if
(
datetime_new_shift
>
date_partner_delay_stop
)
{
let
msg
=
`Vous avez jusqu'au
${
date_partner_delay_stop
.
toLocaleDateString
(
"fr-fr"
,
date_options
)}
`
+
let
msg
=
`Vous avez jusqu'au
${
date_partner_delay_stop
.
toLocaleDateString
(
"fr-fr"
,
date_options
)}
`
+
`pour sélectionner un rattrapage (soit une période de
6
mois depuis votre absence).`
;
`pour sélectionner un rattrapage (soit une période de
${
extension_duration
}
mois depuis votre absence).`
;
alert
(
msg
);
alert
(
msg
);
...
...
members_space/static/js/members-space.js
View file @
a2dca96f
...
@@ -139,10 +139,10 @@ function request_delay() {
...
@@ -139,10 +139,10 @@ function request_delay() {
const
delay_start
=
today
.
getFullYear
()
+
'-'
+
(
today
.
getMonth
()
+
1
)
+
'-'
+
today
.
getDate
();
const
delay_start
=
today
.
getFullYear
()
+
'-'
+
(
today
.
getMonth
()
+
1
)
+
'-'
+
today
.
getDate
();
let
today_plus_
six_month
=
new
Date
();
let
today_plus_
extension_duration
=
new
Date
();
today_plus_
six_month
.
setMonth
(
today_plus_six_month
.
getMonth
()
+
6
);
today_plus_
extension_duration
.
setMonth
(
today_plus_extension_duration
.
getMonth
()
+
extension_duration
);
const
diff_time
=
Math
.
abs
(
today_
plus_six_month
-
today
);
const
diff_time
=
Math
.
abs
(
today_
extension_duration
-
today
);
const
diff_days
=
Math
.
ceil
(
diff_time
/
(
1000
*
60
*
60
*
24
));
const
diff_days
=
Math
.
ceil
(
diff_time
/
(
1000
*
60
*
60
*
24
));
$
.
ajax
({
$
.
ajax
({
...
@@ -157,7 +157,7 @@ function request_delay() {
...
@@ -157,7 +157,7 @@ function request_delay() {
},
},
success
:
function
()
{
success
:
function
()
{
partner_data
.
cooperative_state
=
'delay'
;
partner_data
.
cooperative_state
=
'delay'
;
partner_data
.
date_delay_stop
=
today_plus_
six_month
.
getFullYear
()
+
'-'
+
(
today_plus_six_month
.
getMonth
()
+
1
)
+
'-'
+
today_plus_six_month
.
getDate
();
partner_data
.
date_delay_stop
=
today_plus_
extension_duration
.
getFullYear
()
+
'-'
+
(
today_plus_extension_duration
.
getMonth
()
+
1
)
+
'-'
+
today_plus_extension_duration
.
getDate
();
resolve
();
resolve
();
},
},
...
...
members_space/views.py
View file @
a2dca96f
...
@@ -121,6 +121,7 @@ def index(request, exception=None):
...
@@ -121,6 +121,7 @@ def index(request, exception=None):
partnerData
[
"associated_partner_name"
]
=
str
(
associated_partner
[
"barcode_base"
])
+
' - '
+
partnerData
[
"associated_partner_name"
]
partnerData
[
"associated_partner_name"
]
=
str
(
associated_partner
[
"barcode_base"
])
+
' - '
+
partnerData
[
"associated_partner_name"
]
m
=
CagetteMembersSpace
()
m
=
CagetteMembersSpace
()
context
[
'extension_duration'
]
=
m
.
get_extension_duration
()
context
[
'show_faq'
]
=
getattr
(
settings
,
'MEMBERS_SPACE_FAQ_TEMPLATE'
,
'members_space/faq.html'
)
context
[
'show_faq'
]
=
getattr
(
settings
,
'MEMBERS_SPACE_FAQ_TEMPLATE'
,
'members_space/faq.html'
)
context
[
'show_abcd_calendar'
]
=
getattr
(
settings
,
'SHOW_ABCD_CALENDAR_TAB'
,
True
)
context
[
'show_abcd_calendar'
]
=
getattr
(
settings
,
'SHOW_ABCD_CALENDAR_TAB'
,
True
)
partnerData
[
"comite"
]
=
m
.
is_comite
(
partner_id
)
partnerData
[
"comite"
]
=
m
.
is_comite
(
partner_id
)
...
@@ -221,9 +222,11 @@ def my_shifts(request):
...
@@ -221,9 +222,11 @@ def my_shifts(request):
def
shifts_exchange
(
request
):
def
shifts_exchange
(
request
):
""" Endpoint the front-end will call to load the "Shifts exchange" page. """
""" Endpoint the front-end will call to load the "Shifts exchange" page. """
template
=
loader
.
get_template
(
'members_space/shifts_exchange.html'
)
template
=
loader
.
get_template
(
'members_space/shifts_exchange.html'
)
m
=
CagetteMembersSpace
()
context
=
{
context
=
{
'title'
:
'Échange de Services'
,
'title'
:
'Échange de Services'
,
'canAddShift'
:
getattr
(
settings
,
'CAN_ADD_SHIFT'
,
False
)
'canAddShift'
:
getattr
(
settings
,
'CAN_ADD_SHIFT'
,
False
),
'extension_duration'
:
m
.
get_extension_duration
()
}
}
return
HttpResponse
(
template
.
render
(
context
,
request
))
return
HttpResponse
(
template
.
render
(
context
,
request
))
...
...
templates/members/admin/manage_makeups.html
View file @
a2dca96f
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
<p>
<p>
Vous vous apprêtez à rallonger le délai de
Vous vous apprêtez à rallonger le délai de
<span
class=
"member_name"
></span>
<span
class=
"member_name"
></span>
pour une durée de
6
mois à partir d'aujourd'hui.
pour une durée de
{{extension_duration}}
mois à partir d'aujourd'hui.
</p>
</p>
</div>
</div>
<div
id=
"modal_incr_makeup_counter"
>
<div
id=
"modal_incr_makeup_counter"
>
...
@@ -84,4 +84,7 @@
...
@@ -84,4 +84,7 @@
<script
src=
'{% static "js/all_common.js" %}?v=1651853225'
></script>
<script
src=
'{% static "js/all_common.js" %}?v=1651853225'
></script>
<script
src=
'{% static "js/admin/manage_makeups.js" %}?v=1651853225'
></script>
<script
src=
'{% static "js/admin/manage_makeups.js" %}?v=1651853225'
></script>
<script>
const
extension_duration
=
{{
extension_duration
}};
</script>
{% endblock %}
{% endblock %}
templates/members_space/index.html
View file @
a2dca96f
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
</div>
</div>
<div
id=
"cant_have_delay_msg_template"
>
<div
id=
"cant_have_delay_msg_template"
>
<h3>
Bonjour, tu avais
6
mois pour rattraper tes services manqués et il semblerait que tu ne l'aies pas fait.
</h3>
<h3>
Bonjour, tu avais
{{extension_duration}}
mois pour rattraper tes services manqués et il semblerait que tu ne l'aies pas fait.
</h3>
<h3>
Tu ne peux plus sélectionner de rattrapages sur ton espace membre pour le moment,
<h3>
Tu ne peux plus sélectionner de rattrapages sur ton espace membre pour le moment,
merci de contacter le bureau des membres pour résoudre ce problème en remplissant ce formulaire :
</h3>
merci de contacter le bureau des membres pour résoudre ce problème en remplissant ce formulaire :
</h3>
</div>
</div>
...
@@ -156,6 +156,7 @@
...
@@ -156,6 +156,7 @@
var
block_actions_for_attached_people
=
'{{block_actions_for_attached_people}}'
;
var
block_actions_for_attached_people
=
'{{block_actions_for_attached_people}}'
;
var
block_service_exchange_24h_before
=
'{{block_service_exchange_24h_before}}'
;
var
block_service_exchange_24h_before
=
'{{block_service_exchange_24h_before}}'
;
const
canAddShift
=
{{
canAddShift
}};
const
canAddShift
=
{{
canAddShift
}};
const
extension_duration
=
{{
extension_duration
}};
</script>
</script>
<script
src=
"{% static "
js
/
all_common
.
js
"
%}?
v=
1651853225"
></script>
<script
src=
"{% static "
js
/
all_common
.
js
"
%}?
v=
1651853225"
></script>
<script
src=
"{% static "
js
/
common
.
js
"
%}?
v=
1651853225"
></script>
<script
src=
"{% static "
js
/
common
.
js
"
%}?
v=
1651853225"
></script>
...
...
templates/members_space/shifts_exchange.html
View file @
a2dca96f
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<div
id=
"suspended_content"
class=
"shifts_exchange_page_content"
>
<div
id=
"suspended_content"
class=
"shifts_exchange_page_content"
>
<h3>
<h3>
J'ai
<span
class=
"makeups_nb"
></span>
rattrapage(s) à effectuer, je dois le(s) sélectionner pour pouvoir refaire mes courses.
J'ai
<span
class=
"makeups_nb"
></span>
rattrapage(s) à effectuer, je dois le(s) sélectionner pour pouvoir refaire mes courses.
J'ai
6
mois de délai pour le(s) rattraper.
J'ai
{{extension_duration}}
mois de délai pour le(s) rattraper.
</h3>
</h3>
<h3>
<h3>
Si besoin, je peux contacter le Bureau des membres via la rubrique "J'ai une demande" pour expliquer ma situation.
Si besoin, je peux contacter le Bureau des membres via la rubrique "J'ai une demande" pour expliquer ma situation.
...
...
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