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
a58dde81
Commit
a58dde81
authored
Oct 01, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
members admin: batch remove makeups to members
parent
c325b191
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
41 deletions
+102
-41
members_admin.css
members/static/css/members_admin.css
+18
-0
members_admin.js
members/static/js/members_admin.js
+65
-14
members-space-my-shifts.js
members_space/static/js/members-space-my-shifts.js
+0
-13
index.html
templates/members/admin/index.html
+19
-14
No files found.
members/static/css/members_admin.css
View file @
a58dde81
...
...
@@ -2,6 +2,10 @@
position
:
relative
;
}
.header
{
margin
:
1.5rem
0
;
}
.login_area
{
position
:
absolute
;
top
:
0
;
...
...
@@ -52,6 +56,15 @@
padding
:
2rem
0
;
}
#table_top_area
{
display
:
flex
;
justify-content
:
space-between
;
}
#decrement_selected_members_makeups
{
display
:
none
;
}
.table_area
{
margin-top
:
20px
;
}
...
...
@@ -59,4 +72,8 @@
.decrement_makeup
{
padding
:
0.4rem
1.25rem
;
margin-left
:
10px
;
}
.select_member_cb
{
cursor
:
pointer
;
}
\ No newline at end of file
members/static/js/members_admin.js
View file @
a58dde81
var
makeups_members_table
=
null
,
makeups_members
=
null
;
makeups_members
=
null
,
selected_rows
=
[];
// Contain members id
function
switch_active_tab
()
{
// Set tabs
...
...
@@ -10,23 +11,26 @@ function switch_active_tab() {
$
(
'.tab_content'
).
hide
();
let
tab
=
$
(
this
).
attr
(
'id'
);
if
(
tab
==
'tab_settings'
)
{
$
(
'#tab_settings_content'
).
show
();
}
else
{
// Default
if
(
tab
==
'tab_makeups'
)
{
$
(
'#tab_makeups_content'
).
show
();
}
load_tab_data
();
}
/**
* Load data for the current tab
*/
function
load_tab_data
()
{
let
current_tab
=
$
(
'.tab .active'
).
attr
(
'id'
);
if
(
current_tab
===
'tab_makeups'
)
{
if
(
current_tab
===
'tab_makeups'
&&
makeups_members
===
null
)
{
load_makeups_members
();
}
}
/**
* Load partners who have makeups to do
*/
function
load_makeups_members
()
{
$
.
ajax
({
type
:
'GET'
,
...
...
@@ -51,6 +55,9 @@ function load_makeups_members() {
});
}
/**
* (Re)Display table of makeup members
*/
function
display_makeups_members
()
{
if
(
makeups_members_table
)
{
$
(
'#makeups_members_table'
).
off
();
...
...
@@ -60,9 +67,9 @@ function display_makeups_members() {
// Remove members with 0 makeups to do
ids_to_remove
=
[]
for
(
of
in
makeups_members
)
{
if
(
m
akeups_members
[
i
]
.
makeups_to_do
==
0
)
{
ids_to_remove
.
push
(
m
akeups_members
[
i
]
.
id
)
for
(
member_item
of
makeups_members
)
{
if
(
m
ember_item
.
makeups_to_do
==
0
)
{
ids_to_remove
.
push
(
m
ember_item
.
id
)
}
}
makeups_members
=
makeups_members
.
filter
(
m
=>
!
ids_to_remove
.
includes
(
m
.
id
))
...
...
@@ -129,8 +136,46 @@ function display_makeups_members() {
false
)
});
$
(
'#makeups_members_table'
).
on
(
'click'
,
'tbody td .select_member_cb'
,
function
()
{
$
(
this
).
closest
(
'tr'
)
.
toggleClass
(
'selected'
);
// Save / unsave selected row
const
m_id
=
makeups_members_table
.
row
(
$
(
this
).
closest
(
'tr'
)).
data
().
id
;
const
first_select
=
selected_rows
.
length
===
0
;
if
(
this
.
checked
)
{
selected_rows
.
push
(
m_id
);
}
else
{
const
i
=
selected_rows
.
findIndex
(
id
=>
id
==
m_id
);
selected_rows
.
splice
(
i
,
1
);
}
if
(
selected_rows
.
length
>
0
)
{
$
(
"#decrement_selected_members_makeups"
).
show
();
if
(
first_select
)
{
$
(
"#decrement_selected_members_makeups"
).
on
(
"click"
,
()
=>
{
openModal
(
`Enlever un rattrapage aux membres sélectionnés ?`
,
()
=>
{
decrement_makeups
(
selected_rows
);
},
"Confirmer"
,
false
)
});
}
}
else
{
$
(
"#decrement_selected_members_makeups"
).
off
().
hide
();
}
});
}
/**
* Send request to update members nb of makeups to do
* @param {Array} member_ids
*/
function
decrement_makeups
(
member_ids
)
{
openModal
();
...
...
@@ -153,6 +198,7 @@ function decrement_makeups(member_ids) {
traditional
:
true
,
contentType
:
"application/json; charset=utf-8"
,
success
:
function
(
data
)
{
selected_rows
=
[];
display_makeups_members
();
closeModal
()
},
...
...
@@ -170,9 +216,14 @@ function decrement_makeups(member_ids) {
}
$
(
document
).
ready
(
function
()
{
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
load_makeups_members
();
$
(
".tabs .tab"
).
on
(
'click'
,
switch_active_tab
);
if
(
coop_is_connected
())
{
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
$
(
".page_content"
).
show
();
load_makeups_members
();
$
(
".tabs .tab"
).
on
(
'click'
,
switch_active_tab
);
}
else
{
$
(
".page_content"
).
hide
();
}
});
members_space/static/js/members-space-my-shifts.js
View file @
a58dde81
...
...
@@ -106,12 +106,6 @@ function init_history() {
responsivePriority
:
1
},
{
data
:
"created_by"
,
title
:
"Créé par"
,
responsivePriority
:
20000
,
className
:
"desktop tablet-l"
},
{
data
:
"shift_name"
,
title
:
"Service"
},
...
...
@@ -120,13 +114,6 @@ function init_history() {
title
:
"Détails"
,
responsivePriority
:
3
},
{
data
:
"point_qty"
,
title
:
(
viewportWidth
<=
768
)
?
"Mvmt de points"
:
"Mouvement de points"
,
responsivePriority
:
2
,
width
:
"10%"
,
className
:
(
viewportWidth
<=
768
)
?
"dt-body-center"
:
''
}
],
iDisplayLength
:
-
1
,
ordering
:
false
,
...
...
templates/members/admin/index.html
View file @
a58dde81
...
...
@@ -17,26 +17,31 @@
<div
class=
"page_body"
>
<div
class=
"login_area"
>
{% include "common/conn_admin.html" %}
</div>
</div>
<div
class=
"header txtcenter"
>
<h1>
Bureau des membres
</h1>
</div>
<section
class=
"tabs autogrid"
>
<div
class=
"button tab active"
id=
"tab_makeups"
><h5>
Rattrapages
</h5></div>
<div
class=
"button tab"
id=
"tab_settings"
><h5>
Réglages
</h5></div>
</section>
<div
id=
"tab_makeups_content"
class=
"tab_content"
>
<h3>
Liste des membres devant effectuer un rattrapage
</h3>
<div
class=
"table_area"
>
<table
id=
"makeups_members_table"
class=
"display"
cellspacing=
"0"
width=
"100%"
></table>
<div
class=
"page_content"
>
<section
class=
"tabs autogrid"
>
<div
class=
"button tab active"
id=
"tab_makeups"
><h5>
Rattrapages
</h5></div>
</section>
<div
id=
"tab_makeups_content"
class=
"tab_content"
>
<div
id=
"table_top_area"
>
<h3>
Liste des membres devant effectuer un rattrapage
</h3>
<div
class=
"table_grouped_action"
>
<button
type=
"button"
class=
"btn--primary"
id=
"decrement_selected_members_makeups"
>
-1 rattrapage pour les membres sélectionnés
</button>
</div>
</div>
<div
class=
"table_area"
>
<table
id=
"makeups_members_table"
class=
"display"
cellspacing=
"0"
width=
"100%"
></table>
</div>
</div>
</div>
<div
id=
"tab_settings_content"
class=
"tab_content"
style=
"display:none;"
>
...
</div>
<div
id=
"templates"
style=
"display:none;"
></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