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
eb296715
Commit
eb296715
authored
Mar 10, 2022
by
Thibault Grandjean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete pair front
parent
7fb3c6f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
4 deletions
+47
-4
manage_attached.js
members/static/js/admin/manage_attached.js
+47
-4
No files found.
members/static/js/admin/manage_attached.js
View file @
eb296715
...
...
@@ -73,7 +73,6 @@ function display_member_infos(divId, memberData) {
* Load attached members
*/
function
load_attached_members
()
{
console
.
log
(
get_attached_members
)
$
.
ajax
({
type
:
'GET'
,
url
:
"/members/get_attached_members"
,
...
...
@@ -130,6 +129,17 @@ function display_member_infos(divId, memberData) {
{
data
:
"name"
,
title
:
"en binôme avec"
,
},
{
data
:
"action"
,
title
:
"Action"
,
width
:
"10%"
,
render
:
function
(
data
,
type
,
full
)
{
return
`
<button class="delete_pair btn--danger" id="delete_pair_
${
full
.
id
}
">
Désolidariser
</button>`
;
}
}
],
aLengthMenu
:
[
...
...
@@ -173,11 +183,36 @@ function display_member_infos(divId, memberData) {
"1"
:
"1 ligne séléctionnée"
}
}
}
},
});
}
function
delete_pair
(
childId
)
{
var
payload
=
{
"child"
:
{
"id"
:
childId
}}
$
.
ajax
({
type
:
"POST"
,
url
:
'/members/admin/manage_attached/delete_pair'
,
dataType
:
'json'
,
contentType
:
"application/json; charset=utf-8"
,
data
:
JSON
.
stringify
(
payload
),
success
:
function
()
{
alert
(
"binôme désolidarisé"
)},
error
:
function
(
data
)
{
err
=
{
msg
:
"erreur serveur lors de la récupération des membres avec rattrapage"
,
ctx
:
'load_makeups_members'
};
if
(
typeof
data
.
responseJSON
!=
'undefined'
&&
typeof
data
.
responseJSON
.
error
!=
'undefined'
)
{
err
.
msg
+=
' : '
+
data
.
responseJSON
.
error
;
}
report_JS_error
(
err
,
'orders'
);
closeModal
();
alert
(
'Erreur serveur lors de la désolidarisation du binôme. Ré-essayez plus tard.'
);
}
})
}
$
(
document
).
ready
(
function
()
{
if
(
coop_is_connected
())
{
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
...
...
@@ -307,7 +342,6 @@ $(document).ready(function() {
contentType
:
"application/json; charset=utf-8"
,
data
:
JSON
.
stringify
(
payload
),
success
:
function
(
data
)
{
console
.
log
(
data
)
alert
(
"binôme créé"
)
},
error
:
function
(
data
)
{
...
...
@@ -323,5 +357,14 @@ $(document).ready(function() {
alert
(
message
);
}
})
})
});
if
(
$
(
"#attached_members_table"
)
!=
"undefined"
)
{
load_attached_members
()
}
$
(
document
).
on
(
'click'
,
'.delete_pair'
,
function
(
event
)
{
var
childId
=
event
.
target
.
id
.
split
(
'_'
).
slice
(
-
1
)[
0
]
delete_pair
(
childId
)
})
})
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