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
2e87daab
Commit
2e87daab
authored
Oct 03, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some shift calendar bugs
parent
e08214b3
Pipeline
#2401
passed with stage
in 1 minute 25 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
27 deletions
+28
-27
manage_regular_shifts.js
members/static/js/admin/manage_regular_shifts.js
+6
-10
inscriptions.js
members/static/js/inscriptions.js
+1
-1
members-space-home.js
members_space/static/js/members-space-home.js
+3
-4
common.js
outils/static/js/common.js
+18
-12
No files found.
members/static/js/admin/manage_regular_shifts.js
View file @
2e87daab
...
...
@@ -185,15 +185,12 @@ function display_member_info() {
* Set calendar and associated listeners.
*/
function
set_subscription_area
()
{
retrieve_and_draw_shift_tempates
();
retrieve_and_draw_shift_tempates
(
{
shift_listener
:
false
}
);
$
(
"#shifts_calendar_area"
).
show
();
// Wait for listeners to be set in common.js
// TODO use "signals" to avoid waiting an arbitrary time
setTimeout
(()
=>
{
// Cancel listeners from subscription page & set custom listeners
$
(
"#shifts_calendar_area button[data-select='Volant']"
).
off
(
"click
"
);
$
(
"#shifts_calendar_area button[data-select='Volant']"
).
on
(
"click
"
,
function
()
{
$
(
document
).
off
(
"click"
,
"#shifts_calendar_area button[data-select='Volant']
"
);
$
(
document
).
on
(
"click"
,
"#shifts_calendar_area button[data-select='Volant']
"
,
function
()
{
// Subscribe to comitee/ftop shift
msg
=
(
has_committe_shift
===
"True"
)
?
`Inscrire
${
selected_member
.
name
}
au service des Comités ?`
...
...
@@ -208,9 +205,8 @@ function set_subscription_area() {
false
);
});
$
(
".shift"
).
off
(
"click"
);
$
(
".shift"
).
on
(
"click"
,
function
()
{
$
(
document
).
off
(
"click"
,
".shift"
);
$
(
document
).
on
(
"click"
,
".shift"
,
function
()
{
// Subscribe to shift template
let
shift_template_id
=
select_shift_among_compact
(
null
,
this
,
false
);
// method from common.js
let
shift_template_data
=
shift_templates
[
shift_template_id
].
data
;
// shift_templates: var from common.js
...
...
@@ -225,7 +221,7 @@ function set_subscription_area() {
false
);
});
},
1000
);
}
/**
...
...
members/static/js/inscriptions.js
View file @
2e87daab
...
...
@@ -38,7 +38,7 @@ sync.on('change', function (info) {
});
if
(
need_reload
==
true
)
{
//On recharge depuis Odoo et on traite les enregistrements depuis CouchDB
retrieve_and_draw_shift_tempates
(
'without_modal'
);
retrieve_and_draw_shift_tempates
(
{
without_modal
:
true
,
shift_listener
:
true
}
);
}
}
...
...
members_space/static/js/members-space-home.js
View file @
2e87daab
...
...
@@ -95,8 +95,7 @@ function process_asked_shift_template_change(shift_t_id) {
}
function
edit_shift_template_registration
()
{
let
external
=
true
;
const
calendar_params
=
{
external
:
true
,
without_modal
:
true
,
shift_listener
:
true
};
if
(
calendar
==
null
)
calendar
=
$
(
'#modal-calendar-choice'
).
clone
();
if
(
$
(
'#modal-calendar-choice'
).
html
().
length
>
0
)
{
$
(
'#modal-calendar-choice'
).
empty
();
...
...
@@ -106,9 +105,9 @@ function edit_shift_template_registration() {
displayMsg
(
calendar
.
html
());
$
(
'#week_types'
).
find
(
'input'
)
.
change
(()
=>
{
filter_weeks
(
external
);
filter_weeks
(
calendar_params
);
});
retrieve_and_draw_shift_tempates
(
external
);
retrieve_and_draw_shift_tempates
(
calendar_params
);
}
...
...
outils/static/js/common.js
View file @
2e87daab
...
...
@@ -181,8 +181,11 @@ function draw_table(begin_hours, callback) {
}
function
draw_shift_templates
(
external
)
{
if
(
typeof
external
!==
"undefined"
&&
external
==
true
)
shift_table
=
$
(
'#shift_choice table'
);
function
draw_shift_templates
(
params
)
{
if
(
params
&&
typeof
params
.
external
!==
"undefined"
&&
params
.
external
==
true
){
// Simplified calendar loaded in modal (members_space for ex.)
shift_table
=
$
(
'#shift_choice table'
);
}
var
existing_shifts
=
shift_table
.
find
(
'.shift'
);
existing_shifts
.
off
(
"click"
,
single_shift_click
);
...
...
@@ -291,7 +294,9 @@ function draw_shift_templates(external) {
});
if
(
type
==
1
)
{
shift_table
.
find
(
'.shift'
).
on
(
"click"
,
single_shift_click
);
if
(
!
params
||
(
typeof
params
.
shift_listener
!==
"undefined"
&&
params
.
shift_listener
==
true
)){
shift_table
.
find
(
'.shift'
).
on
(
"click"
,
single_shift_click
);
}
}
if
(
type
==
2
)
{
for
(
k
in
boxes
)
{
...
...
@@ -315,13 +320,15 @@ function draw_shift_templates(external) {
}
}
shift_table
.
find
(
'.shift'
).
on
(
"click"
,
select_shift_among_compact
);
if
(
!
params
||
(
typeof
params
.
shift_listener
!==
"undefined"
&&
params
.
shift_listener
==
true
)){
shift_table
.
find
(
'.shift'
).
on
(
"click"
,
select_shift_among_compact
);
}
}
sc_lat
.
find
(
'.info'
).
html
(
dispo
+
' places disponibles<br />(/'
+
max
+
')'
);
if
(
typeof
external
==
"undefined"
)
{
if
(
!
params
||
typeof
params
.
without_modal
===
"undefined"
||
(
typeof
params
.
without_modal
!==
"undefined"
&&
params
.
without_modal
==
false
)
)
{
closeModal
();
}
});
...
...
@@ -329,13 +336,12 @@ function draw_shift_templates(external) {
}
function
retrieve_and_draw_shift_tempates
(
external
)
{
function
retrieve_and_draw_shift_tempates
(
params
)
{
if
(
shift_table
.
length
==
0
)
shift_table
=
$
(
'#shift_choice table'
);
if
(
!
external
)
{
if
(
!
params
||
typeof
params
.
without_modal
===
"undefined"
||
(
typeof
params
.
without_modal
!==
"undefined"
&&
params
.
without_modal
==
false
)
)
{
openModal
();
}
shift_table
.
find
(
'.shift'
).
remove
();
$
.
ajax
({
url
:
st_url
,
dataType
:
'json'
...
...
@@ -374,10 +380,10 @@ function retrieve_and_draw_shift_tempates(external) {
}
});
draw_shift_templates
(
external
);
draw_shift_templates
(
params
);
});
}
else
{
draw_shift_templates
(
external
);
draw_shift_templates
(
params
);
}
...
...
@@ -385,7 +391,7 @@ function retrieve_and_draw_shift_tempates(external) {
});
}
function
filter_weeks
(
external
)
{
function
filter_weeks
(
params
)
{
var
clicked
=
$
(
this
);
var
week_types
=
$
(
'#week_types'
);
var
parent_div
=
clicked
.
closest
(
'div'
);
...
...
@@ -430,7 +436,7 @@ function filter_weeks(external) {
if
(
!
w2
.
is
(
':checked'
)
||
!
w4
.
is
(
':checked'
))
{
$
(
'#odd_weeks'
).
prop
(
'checked'
,
false
);
}
draw_shift_templates
(
external
);
draw_shift_templates
(
params
);
}
function
shift_loc_selection
()
{
...
...
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