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
9298c1f1
Commit
9298c1f1
authored
Mar 07, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
can delete future shifts buttons & offer extra shifts
parent
5cfdcae6
Pipeline
#1876
passed with stage
in 1 minute 30 seconds
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
116 additions
and
5 deletions
+116
-5
models.py
members/models.py
+13
-0
members-space-my-info.css
members_space/static/css/members-space-my-info.css
+7
-0
members-space-shifts-exchange.css
members_space/static/css/members-space-shifts-exchange.css
+15
-0
members-space.css
members_space/static/css/members-space.css
+5
-0
members-space-shifts-exchange.js
members_space/static/js/members-space-shifts-exchange.js
+37
-0
members-space.js
members_space/static/js/members-space.js
+8
-0
urls.py
members_space/urls.py
+1
-0
views.py
members_space/views.py
+11
-2
models.py
shifts/models.py
+3
-2
home.html
templates/members_space/home.html
+3
-0
index.html
templates/members_space/index.html
+2
-1
my_info.html
templates/members_space/my_info.html
+3
-0
shifts_exchange.html
templates/members_space/shifts_exchange.html
+8
-0
No files found.
members/models.py
View file @
9298c1f1
...
...
@@ -864,6 +864,19 @@ class CagetteMember(models.Model):
return
res
def
update_extra_shift_done
(
self
,
value
):
api
=
OdooAPI
()
res
=
{}
f
=
{
'extra_shift_done'
:
value
}
res_item
=
api
.
update
(
'res.partner'
,
[
self
.
id
],
f
)
res
=
{
'mid'
:
self
.
id
,
'update'
:
res_item
}
return
res
class
CagetteMembers
(
models
.
Model
):
"""Class to manage operations on all members or part of them."""
...
...
members_space/static/css/members-space-my-info.css
View file @
9298c1f1
...
...
@@ -54,6 +54,13 @@
margin
:
3rem
0
;
}
#my_info
.choose_makeups
,
#my_info
.unsuscribed_form_link
,
#my_info
.remove_future_registration
{
font-size
:
1.8rem
;
word-break
:
normal
;
}
#my_info
#member_status_action
,
#my_info
.member_shift_name_area
,
#my_info
.member_coop_number_area
{
...
...
members_space/static/css/members-space-shifts-exchange.css
View file @
9298c1f1
...
...
@@ -113,6 +113,21 @@
}
}
/* -- Calendar screen, can delete registrations message */
#can_delete_future_registrations_area
{
display
:
none
;
align-self
:
center
;
margin
:
0
1rem
1rem
1rem
;
padding
:
1rem
1.25rem
;
}
#can_delete_future_registrations_area
button
{
white-space
:
normal
;
word-break
:
normal
;
margin
:
1rem
;
}
/* -- Calendar screen, calendar */
#calendar
{
...
...
members_space/static/css/members-space.css
View file @
9298c1f1
...
...
@@ -166,6 +166,11 @@ body {
font-size
:
1.5rem
;
}
.remove_future_registration
{
display
:
none
;
white-space
:
normal
;
}
.unsuscribed_form_link
{
display
:
none
;
text-decoration
:
none
;
...
...
members_space/static/js/members-space-shifts-exchange.js
View file @
9298c1f1
...
...
@@ -309,6 +309,29 @@ function affect_shift(partner, shift_id) {
}
function
offer_extra_shift
()
{
openModal
();
$
.
ajax
({
type
:
'POST'
,
url
:
"/members_space/offer_extra_shift"
,
dataType
:
"json"
,
data
:
{
partner_id
:
partner_data
.
concerned_partner_id
},
timeout
:
3000
,
success
:
function
()
{
$
(
"#can_delete_future_registrations_area"
).
hide
();
closeModal
();
alert
(
"Don de service effectué"
);
},
error
:
function
()
{
closeModal
();
alert
(
"Une erreur est survenue"
);
}
});
}
/**
* Inits the page when the calendar is displayed
*/
...
...
@@ -344,6 +367,20 @@ function init_calendar_page() {
$
(
".makeups_nb"
).
text
(
partner_data
.
makeups_to_do
);
$
(
"#need_to_select_makeups_message"
).
show
();
}
if
(
partner_data
.
extra_shift_done
>
0
)
{
$
(
".extra_shift_done"
).
text
(
partner_data
.
extra_shift_done
);
$
(
"#can_delete_future_registrations_area"
).
show
();
$
(
"#offer_extra_shift"
).
on
(
"click"
,
()
=>
{
openModal
(
"Je ne souhaite pas supprimer un service futur."
,
offer_extra_shift
,
"Confirmer"
,
false
)
})
}
let
default_initial_view
=
""
;
let
header_toolbar
=
{};
...
...
members_space/static/js/members-space.js
View file @
9298c1f1
...
...
@@ -158,6 +158,7 @@ function prepare_shift_line_template(date_begin) {
*/
function
init_my_info_data
()
{
$
(
".choose_makeups"
).
off
();
$
(
".remove_future_registration"
).
off
();
$
(
".unsuscribed_form_link"
).
off
();
$
(
".member_shift_name"
).
text
(
partner_data
.
regular_shift_name
);
...
...
@@ -223,6 +224,13 @@ function init_my_info_data() {
}
}
if
(
partner_data
.
extra_shift_done
>
0
)
{
$
(
".remove_future_registration"
).
show
();
$
(
".remove_future_registration"
).
on
(
'click'
,
()
=>
{
goto
(
'echange-de-services'
);
});
}
$
(
".member_coop_number"
).
text
(
partner_data
.
barcode_base
);
}
...
...
members_space/urls.py
View file @
9298c1f1
...
...
@@ -12,5 +12,6 @@ urlpatterns = [
url
(
r'^faqBDM$'
,
views
.
faqBDM
),
url
(
r'^no_content$'
,
views
.
no_content
),
url
(
r'^get_shifts_history$'
,
views
.
get_shifts_history
),
url
(
r'^offer_extra_shift$'
,
views
.
offer_extra_shift
),
url
(
r'^.*'
,
views
.
index
)
# Urls unknown from the server will redirect to index
]
members_space/views.py
View file @
9298c1f1
...
...
@@ -99,6 +99,7 @@ def index(request, exception=None):
partnerData
[
"parent_id"
]
=
partnerData
[
"parent_id"
][
0
]
md5_calc
=
hashlib
.
md5
(
partnerData
[
'parent_create_date'
]
.
encode
(
'utf-8'
))
.
hexdigest
()
partnerData
[
'parent_verif_token'
]
=
md5_calc
partnerData
[
'extra_shift_done'
]
=
partnerData
[
"parent_extra_shift_done"
]
else
:
partnerData
[
"parent_name"
]
=
False
...
...
@@ -234,4 +235,13 @@ def get_shifts_history(request):
date_from
=
getattr
(
settings
,
'START_DATE_FOR_SHIFTS_HISTORY'
,
'2018-01-01'
)
res
[
"data"
]
=
m
.
get_shifts_history
(
partner_id
,
limit
,
offset
,
date_from
)
return
JsonResponse
(
res
)
\ No newline at end of file
return
JsonResponse
(
res
)
def
offer_extra_shift
(
request
):
res
=
{}
partner_id
=
int
(
request
.
POST
[
'partner_id'
])
m
=
CagetteMember
(
partner_id
)
res
=
m
.
update_extra_shift_done
(
0
)
return
JsonResponse
(
res
)
shifts/models.py
View file @
9298c1f1
...
...
@@ -38,17 +38,18 @@ class CagetteShift(models.Model):
'cooperative_state'
,
'final_standard_point'
,
'create_date'
,
'final_ftop_point'
,
'shift_type'
,
'leave_ids'
,
'makeups_to_do'
,
'barcode_base'
,
'street'
,
'street2'
,
'zip'
,
'city'
,
'mobile'
,
'phone'
,
'email'
,
'is_associated_people'
,
'parent_id'
]
'is_associated_people'
,
'parent_id'
,
'extra_shift_done'
]
partnerData
=
self
.
o_api
.
search_read
(
'res.partner'
,
cond
,
fields
,
1
)
if
partnerData
:
partnerData
=
partnerData
[
0
]
if
partnerData
[
'is_associated_people'
]:
cond
=
[[
'id'
,
'='
,
partnerData
[
'parent_id'
][
0
]]]
fields
=
[
'create_date'
]
fields
=
[
'create_date'
,
'extra_shift_done'
]
parentData
=
self
.
o_api
.
search_read
(
'res.partner'
,
cond
,
fields
,
1
)
if
parentData
:
partnerData
[
'parent_create_date'
]
=
parentData
[
0
][
'create_date'
]
partnerData
[
'parent_extra_shift_done'
]
=
parentData
[
0
][
'extra_shift_done'
]
if
partnerData
[
'shift_type'
]
==
'standard'
:
partnerData
[
'in_ftop_team'
]
=
False
...
...
templates/members_space/home.html
View file @
9298c1f1
...
...
@@ -21,6 +21,9 @@
<button
type=
"button"
class=
"btn--danger choose_makeups"
>
Je sélectionne mes rattrapages
</button>
<button
type=
"button"
class=
"btn--success remove_future_registration"
>
J'ai validé un service à deux, je peux supprimer une présence
</button>
</div>
<div
class=
"member_shift_name_area"
>
<span>
Mon créneau :
</span>
...
...
templates/members_space/index.html
View file @
9298c1f1
...
...
@@ -140,7 +140,8 @@
"associated_partner_name"
:
"{{partnerData.associated_partner_name}}"
,
"verif_token"
:
"{{partnerData.verif_token}}"
,
"leave_stop_date"
:
"{{partnerData.leave_stop_date}}"
,
"comite"
:
"{{partnerData.comite}}"
"comite"
:
"{{partnerData.comite}}"
,
"extra_shift_done"
:
parseInt
(
"{{partnerData.extra_shift_done}}"
,
10
)
};
var
block_actions_for_attached_people
=
'{{block_actions_for_attached_people}}'
;
</script>
...
...
templates/members_space/my_info.html
View file @
9298c1f1
...
...
@@ -25,6 +25,9 @@
<button
type=
"button"
class=
"btn--danger choose_makeups"
>
Je sélectionne mes rattrapages
</button>
<button
type=
"button"
class=
"btn--success remove_future_registration"
>
J'ai validé un service à deux, je peux supprimer une présence
</button>
</div>
</div>
</div>
...
...
templates/members_space/shifts_exchange.html
View file @
9298c1f1
...
...
@@ -35,6 +35,14 @@
<span
class=
"select_makeups_message_block"
>
Je dois les sélectionner dans le calendrier.
</span>
<span
class=
"select_makeups_message_block"
>
Je ne peux pas échanger de service tant que je n'ai pas choisi mes rattrapages.
</span>
</div>
<div
id=
"can_delete_future_registrations_area"
>
<button
class=
"btn--success can_delete_future_registrations_button"
id=
"delete_future_registration"
>
J'ai validé
<span
class=
"extra_shift_done"
></span>
service(s) à deux, je supprime un service futur
</button>
<button
class=
"btn--success can_delete_future_registrations_button"
id=
"offer_extra_shift"
>
Je souhaite donner
<span
class=
"extra_shift_done"
></span>
service(s) d'avance à la communauté
</button>
</div>
<div
id=
"calendar_top_info"
>
<div
id=
"partner_shifts_list"
>
<h4>
Liste de mes services :
</h4>
...
...
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