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
5855d9b0
Commit
5855d9b0
authored
Nov 19, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ticket_1330' into 'evolution_bdm'
Ticket 1330 See merge request
!64
parents
1ab954f6
f03b374e
Pipeline
#1491
passed with stage
in 1 minute 31 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
180 additions
and
24 deletions
+180
-24
.gitignore
.gitignore
+1
-2
models.py
members/models.py
+19
-11
urls.py
members/urls.py
+3
-0
views.py
members/views.py
+20
-0
members-space-my-info.css
members_space/static/css/members-space-my-info.css
+22
-1
members-space-my-info.js
members_space/static/js/members-space-my-info.js
+94
-5
my_info.html
templates/members_space/my_info.html
+21
-5
No files found.
.gitignore
View file @
5855d9b0
...
...
@@ -18,4 +18,4 @@ shop/shop_admin_settings.json
shop/errors.log
.idea
members/settings.json
.DS_Store
\ No newline at end of file
.DS_Store
members/models.py
View file @
5855d9b0
...
...
@@ -63,19 +63,26 @@ class CagetteMember(models.Model):
# def update_member_points(self, status):
# fields = {'name': reason,
# 'shift_id': False,
# 'type': stype,
# 'partner_id': self.id,
# 'point_qty': pts
# }
# return self.o_api.create('shift.counter.event', fields)
# fields = {'name': reason,
# 'shift_id': False,
# 'type': stype,
# 'partner_id': self.id,
# 'point_qty': pts
# }
# return self.o_api.create('shift.counter.event', fields)
# if status not in ["suspended", "delay", "up_to_date", "unsuscribed", "alert"]:
# raise Exception("Bad status")
# if status not in ["suspended", "delay", "up_to_date", "unsuscribed", "alert"]:
# raise Exception("Bad status")
# f = { 'cooperative_state': "delay" }
# return self.o_api.update('res.partner', [self.id], f)
# # # BDM
def
save_partner_info
(
self
,
partner_id
,
fieldsDatas
):
print
(
fieldsDatas
)
return
self
.
o_api
.
update
(
'res.partner'
,
partner_id
,
fieldsDatas
)
# f = { 'cooperative_state': "delay" }
# return self.o_api.update('res.partner', [self.id], f)
@staticmethod
def
retrieve_data_according_keys
(
keys
,
full
=
False
):
...
...
@@ -1441,3 +1448,4 @@ class CagetteUser(models.Model):
pass
return
answer
members/urls.py
View file @
5855d9b0
...
...
@@ -49,6 +49,9 @@ urlpatterns = [
url
(
r'^easy_validate_shift_presence$'
,
views
.
easy_validate_shift_presence
),
# conso / groupe recherche / socio
url
(
r'^panel_get_purchases$'
,
views
.
panel_get_purchases
),
# BDM
url
(
r'^save_partner_info$'
,
views
.
save_partner_info
),
# BDM - members admin
url
(
r'^admin$'
,
admin
.
admin
),
url
(
r'^get_makeups_members$'
,
admin
.
get_makeups_members
),
...
...
members/views.py
View file @
5855d9b0
...
...
@@ -390,3 +390,23 @@ def panel_get_purchases(request):
message
+=
' '
+
str
(
res
[
'params'
])
response
=
HttpResponse
(
message
)
return
response
# # # BDM # # #
def
save_partner_info
(
request
):
""" Endpoint the front-end will call for saving partner information """
res
=
{}
credentials
=
CagetteMember
.
get_credentials
(
request
)
if
(
'success'
in
credentials
):
data
=
{}
for
post
in
request
.
POST
:
if
post
!=
"idPartner"
and
data
!=
"verif_token"
:
data
[
post
]
=
request
.
POST
[
post
]
cm
=
CagetteMember
(
int
(
request
.
POST
[
'idPartner'
]))
result
=
cm
.
save_partner_info
(
int
(
request
.
POST
[
'idPartner'
]),
data
)
res
[
'success'
]
=
result
return
JsonResponse
(
res
)
else
:
res
[
'error'
]
=
"Forbidden"
return
JsonResponse
(
res
,
safe
=
False
)
members_space/static/css/members-space-my-info.css
View file @
5855d9b0
...
...
@@ -19,7 +19,7 @@
@media
screen
and
(
min-width
:
351px
)
and
(
max-width
:
435px
)
{
.my_info_line
{
font-size
:
8
0%
;
font-size
:
9
0%
;
padding
:
2vw
0
;
}
}
...
...
@@ -52,6 +52,9 @@
margin-bottom
:
0
;
}
#my_info
.member_shift_name_area
{
margin-top
:
0
;
}
#attached_info
{
display
:
flex
;
flex-direction
:
column
;
...
...
@@ -63,6 +66,24 @@
gap
:
10px
;
}
.edit-btn
{
cursor
:
pointer
;
}
#edit_address_form
{
display
:
none
;
}
#edit_address_form
#zip_form
{
margin
:
5px
0
;
}
#edit_phone_form
{
display
:
none
;
}
#edit_phone_form
#mobile_form
{
margin
:
5px
0
;
}
@media
screen
and
(
max-width
:
992px
)
{
#my_info
{
font-size
:
1.7rem
;
...
...
members_space/static/js/members-space-my-info.js
View file @
5855d9b0
...
...
@@ -13,10 +13,11 @@ function init_my_info() {
$
(
".attached_partner_name"
).
text
(
partner_data
.
associated_partner_name
);
}
if
(
partner_data
.
street
!==
""
)
{
$
(
".member_address"
).
empty
();
if
(
partner_data
.
street
!==
""
&&
partner_data
.
street
!==
"False"
)
{
$
(
".member_address"
)
.
append
(
partner_data
.
street
+
"<br/>"
);
if
(
partner_data
.
street2
!==
""
)
{
if
(
partner_data
.
street2
!==
""
&&
partner_data
.
street2
!==
"False"
)
{
$
(
".member_address"
)
.
append
(
partner_data
.
street2
+
"<br/>"
);
}
...
...
@@ -26,17 +27,20 @@ function init_my_info() {
$
(
".member_address_line"
).
hide
();
}
$
(
".member_mobile"
).
empty
();
if
(
partner_data
.
mobile
!==
""
&&
partner_data
.
mobile
!==
"False"
&&
partner_data
.
mobile
!==
false
&&
partner_data
.
mobile
!==
null
)
{
$
(
".member_mobile"
)
.
append
(
partner_data
.
mobile
);
.
append
(
partner_data
.
mobile
)
.
show
();
}
else
{
$
(
".member_mobile"
).
hide
();
}
$
(
".member_phone"
).
empty
();
if
(
partner_data
.
phone
!==
""
&&
partner_data
.
phone
!==
"False"
&&
partner_data
.
phone
!==
false
&&
partner_data
.
phone
!==
null
)
{
$
(
".member_phone"
)
.
append
(
partner_data
.
phone
);
.
append
(
partner_data
.
phone
)
.
show
();
}
else
{
$
(
".member_phone"
).
hide
();
}
...
...
@@ -44,4 +48,88 @@ function init_my_info() {
if
(
$
(
".member_mobile"
).
text
()
===
""
&&
$
(
".member_phone"
).
text
()
===
""
)
{
$
(
".member_phone_line"
).
hide
();
}
$
(
'#edit_address'
).
off
(
'click'
)
.
on
(
'click'
,
()
=>
{
$
(
"#street_form"
).
val
(
partner_data
.
street
);
// $("#street2_form").val(partner_data.street2);
$
(
"#zip_form"
).
val
(
partner_data
.
zip
);
$
(
"#city_form"
).
val
(
partner_data
.
city
);
$
(
'#edit_address_value'
).
hide
();
$
(
'#edit_address_form'
).
show
();
});
$
(
'#cancel_edit_address'
).
on
(
'click'
,
()
=>
{
$
(
'#edit_address_form'
).
hide
();
$
(
'#edit_address_value'
).
show
();
});
$
(
'#save_edit_address'
).
off
(
'click'
)
.
on
(
'click'
,
()
=>
{
data
=
[];
data
[
'street'
]
=
$
(
"#street_form"
).
val
();
// data['street2']= $("#street2_form").val();
data
[
'zip'
]
=
$
(
"#zip_form"
).
val
();
data
[
'city'
]
=
$
(
"#city_form"
).
val
();
saveInfo
(
data
,
'address'
);
});
$
(
'#edit_phone'
).
off
(
'click'
)
.
on
(
'click'
,
()
=>
{
if
(
partner_data
.
phone
===
"False"
)
partner_data
.
phone
=
""
;
if
(
partner_data
.
mobile
===
"False"
)
partner_data
.
mobile
=
""
;
$
(
"#phone_form"
).
val
(
partner_data
.
phone
);
$
(
"#mobile_form"
).
val
(
partner_data
.
mobile
);
$
(
'#edit_phone_value'
).
hide
();
$
(
'#edit_phone_form'
).
show
();
});
$
(
'#cancel_edit_phone'
).
off
(
'click'
)
.
on
(
'click'
,
()
=>
{
$
(
'#edit_phone_form'
).
hide
();
$
(
'#edit_phone_value'
).
show
();
});
$
(
'#save_edit_phone'
).
off
(
'click'
)
.
on
(
'click'
,
()
=>
{
console
.
log
(
'ici'
);
data
=
[];
data
[
'phone'
]
=
$
(
"#phone_form"
).
val
();
data
[
'mobile'
]
=
$
(
"#mobile_form"
).
val
();
saveInfo
(
data
,
'phone'
);
});
}
function
saveInfo
(
data
,
field
)
{
tData
=
'&idPartner='
+
partner_data
.
partner_id
+
'&shift_type='
+
partner_data
.
shift_type
+
'&verif_token='
+
partner_data
.
verif_token
;
for
(
d
in
data
)
{
tData
+=
"&"
+
d
+
"="
+
data
[
d
];
}
tUrl
=
'/members/save_partner_info'
;
$
.
ajax
({
type
:
'POST'
,
url
:
tUrl
,
dataType
:
"json"
,
data
:
tData
,
timeout
:
3000
,
success
:
function
()
{
for
(
d
in
data
)
{
partner_data
[
d
]
=
data
[
d
];
}
init_my_info
();
if
(
field
==
'address'
)
{
$
(
'#edit_address_form'
).
hide
();
$
(
'#edit_address_value'
).
show
();
}
if
(
field
==
'phone'
)
{
$
(
'#edit_phone_form'
).
hide
();
$
(
'#edit_phone_value'
).
show
();
}
},
error
:
function
(
error
)
{
console
.
log
(
error
);
}
});
}
\ No newline at end of file
templates/members_space/my_info.html
View file @
5855d9b0
...
...
@@ -5,7 +5,7 @@
<div
class=
"tiles_container"
>
<div
class=
"tile full_width_tile"
id=
"my_info_area"
>
<div
class=
"tile_title"
>
<i
class=
"fas fa-user tile_icon"
></i>
<i
class=
"fas fa-user tile_icon"
></i>
<span
class=
"member_info member_name"
></span>
</div>
<div
class=
"tile_content"
id=
"my_info_content"
>
...
...
@@ -56,19 +56,35 @@
</div>
<div
class=
"my_info_line member_address_line"
>
<div
class=
"my_info_line_left"
>
Adresse
Adresse
</div>
<div
class=
"my_info_line_right member_address_area"
>
<span
class=
"member_address member_info"
></span>
<div
class=
"my_info_line_right member_address_area"
id=
"edit_address_value"
>
<span
class=
"member_address member_info"
></span><br>
<span
id=
"edit_address"
><i
class=
"fas fa-edit tile_icon edit-btn"
></i></span>
</div>
<div
class=
"my_info_line_right member_address_area1"
id=
"edit_address_form"
>
<input
type=
"text"
name=
"street_form"
id=
"street_form"
placeholder=
"Rue"
>
<br>
<!-- <input type="text" name="street2_form" id="street2_form" placeholder="Complément"> -->
<input
type=
"text"
name=
"zip_form"
id=
"zip_form"
placeholder=
"Code postal"
>
<br>
<input
type=
"text"
name=
"city_form"
id=
"city_form"
placeholder=
"Ville"
>
<br>
<span
id=
"cancel_edit_address"
><i
class=
"fas fa-times tile_icon edit-btn"
></i></span>
<span
id=
"save_edit_address"
><i
class=
"fas fa-check tile_icon edit-btn"
></i></span>
</div>
</div>
<div
class=
"my_info_line member_phone_line"
>
<div
class=
"my_info_line_left"
>
Téléphone
</div>
<div
class=
"my_info_line_right member_phone_area"
>
<div
class=
"my_info_line_right member_phone_area"
id=
"edit_phone_value"
>
<span
class=
"member_phone member_info"
></span>
<span
class=
"member_mobile member_info"
></span>
<span
id=
"edit_phone"
><i
class=
"fas fa-edit tile_icon edit-btn"
></i></span>
</div>
<div
class=
"my_info_line_right member_phone_area1"
id=
"edit_phone_form"
>
<input
type=
"text"
name=
"phone"
id=
"phone_form"
placeholder=
"Tel fixe"
>
<br>
<input
type=
"text"
name=
"mobile"
id=
"mobile_form"
placeholder=
"Tel mobile"
><br>
<span
id=
"cancel_edit_phone"
><i
class=
"fas fa-times tile_icon edit-btn"
></i></span>
<span
id=
"save_edit_phone"
><i
class=
"fas fa-check tile_icon edit-btn"
></i></span>
</div>
</div>
</div>
...
...
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