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
33dd5142
Commit
33dd5142
authored
Feb 24, 2022
by
Etienne Freiss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lint js
parent
e19a7a25
Pipeline
#1846
passed with stage
in 1 minute 26 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
83 deletions
+73
-83
members-space-my-shifts.js
members_space/static/js/members-space-my-shifts.js
+39
-41
members-space-shifts-exchange.js
members_space/static/js/members-space-shifts-exchange.js
+34
-42
No files found.
members_space/static/js/members-space-my-shifts.js
View file @
33dd5142
...
...
@@ -66,29 +66,29 @@ function prepare_server_data(data) {
}
}
if
(
history_item
.
associate_registered
==
false
||
history_item
.
associate_registered
==
undefined
)
{
history_item
.
associate_registered
=
""
if
(
history_item
.
associate_registered
==
false
||
history_item
.
associate_registered
==
undefined
)
{
history_item
.
associate_registered
=
""
;
}
else
{
if
(
partner_data
.
associated_partner_id
!=
"False"
)
{
if
(
history_item
.
associate_registered
===
"partner"
)
{
history_item
.
associate_registered
=
partner_data
.
name
}
else
if
(
history_item
.
associate_registered
===
"associate"
)
{
history_item
.
associate_registered
=
partner_data
.
associated_partner_name
}
else
if
(
history_item
.
associate_registered
===
"both"
)
{
history_item
.
associate_registered
=
"Les deux"
}
else
{
history_item
.
associate_registered
=
""
else
{
if
(
partner_data
.
associated_partner_id
!=
"False"
)
{
if
(
history_item
.
associate_registered
===
"partner"
)
{
history_item
.
associate_registered
=
partner_data
.
name
;
}
else
if
(
history_item
.
associate_registered
===
"associate"
)
{
history_item
.
associate_registered
=
partner_data
.
associated_partner_name
;
}
else
if
(
history_item
.
associate_registered
===
"both"
)
{
history_item
.
associate_registered
=
"Les deux"
;
}
else
{
history_item
.
associate_registered
=
""
;
}
}
else
if
(
partner_data
.
parent_id
!=
"False"
)
{
if
(
history_item
.
associate_registered
===
"partner"
)
{
history_item
.
associate_registered
=
partner_data
.
parent_name
}
else
if
(
history_item
.
associate_registered
===
"associate"
)
{
history_item
.
associate_registered
=
partner_data
.
name
}
else
if
(
history_item
.
associate_registered
===
"both"
)
{
history_item
.
associate_registered
=
"Les deux"
}
else
{
history_item
.
associate_registered
=
""
}
else
if
(
partner_data
.
parent_id
!=
"False"
)
{
if
(
history_item
.
associate_registered
===
"partner"
)
{
history_item
.
associate_registered
=
partner_data
.
parent_name
;
}
else
if
(
history_item
.
associate_registered
===
"associate"
)
{
history_item
.
associate_registered
=
partner_data
.
name
;
}
else
if
(
history_item
.
associate_registered
===
"both"
)
{
history_item
.
associate_registered
=
"Les deux"
;
}
else
{
history_item
.
associate_registered
=
""
;
}
}
}
...
...
@@ -187,30 +187,28 @@ function init_incoming_shifts() {
for
(
shift
of
incoming_shifts
)
{
let
shift_line_template
=
prepare_shift_line_template
(
shift
.
date_begin
);
if
(
partner_data
.
associated_partner_id
!=
"False"
)
{
if
(
shift
.
associate_registered
===
"partner"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
name
+
''
)
}
else
if
(
shift
.
associate_registered
===
"associate"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
associated_partner_name
+
''
)
}
else
if
(
shift
.
associate_registered
===
"both"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - Les deux'
)
}
else
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
'A définir'
)
if
(
partner_data
.
associated_partner_id
!=
"False"
)
{
if
(
shift
.
associate_registered
===
"partner"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
name
+
''
)
;
}
else
if
(
shift
.
associate_registered
===
"associate"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
associated_partner_name
+
''
)
;
}
else
if
(
shift
.
associate_registered
===
"both"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - Les deux'
)
;
}
else
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
'A définir'
)
;
}
}
else
if
(
partner_data
.
parent_id
!=
"False"
)
{
if
(
shift
.
associate_registered
===
"partner"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
parent_name
+
''
)
}
else
if
(
shift
.
associate_registered
===
"associate"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
name
+
''
)
}
else
if
(
shift
.
associate_registered
===
"both"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - Les deux'
)
}
else
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
'A définir'
)
}
else
if
(
partner_data
.
parent_id
!=
"False"
)
{
if
(
shift
.
associate_registered
===
"partner"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
parent_name
+
''
)
;
}
else
if
(
shift
.
associate_registered
===
"associate"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - '
+
partner_data
.
name
+
''
)
;
}
else
if
(
shift
.
associate_registered
===
"both"
)
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
' - Les deux'
)
;
}
else
{
shift_line_template
.
find
(
".shift_line_associate"
).
text
(
'A définir'
)
;
}
}
$
(
"#incoming_shifts"
).
append
(
shift_line_template
.
html
());
}
}
...
...
members_space/static/js/members-space-shifts-exchange.js
View file @
33dd5142
...
...
@@ -142,27 +142,27 @@ function init_shifts_list() {
shift_line_template
.
find
(
".checkbox"
).
prop
(
"value"
,
shift
.
id
);
}
if
(
partner_data
.
associated_partner_id
===
"False"
&&
partner_data
.
parent_id
===
"False"
)
{
if
(
partner_data
.
associated_partner_id
===
"False"
&&
partner_data
.
parent_id
===
"False"
)
{
shift_line_template
.
find
(
'.affect_associate_reistered'
).
hide
();
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
attr
(
'id'
,
'shidt_id_'
+
shift
.
id
)
if
(
shift
.
associate_registered
===
"both"
){
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
"Les deux"
)
}
else
if
(
shift
.
associate_registered
===
"partner"
)
{
if
(
partner_data
.
associated_partner_id
!==
"False"
)
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
name
)
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
parent_name
)
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
attr
(
'id'
,
'shidt_id_'
+
shift
.
id
);
if
(
shift
.
associate_registered
===
"both"
)
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
"Les deux"
)
;
}
else
if
(
shift
.
associate_registered
===
"partner"
)
{
if
(
partner_data
.
associated_partner_id
!==
"False"
)
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
name
)
;
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
parent_name
)
;
}
}
else
if
(
shift
.
associate_registered
===
"associate"
)
{
if
(
partner_data
.
associated_partner_id
!==
"False"
)
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
associated_partner_name
)
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
name
)
}
else
if
(
shift
.
associate_registered
===
"associate"
)
{
if
(
partner_data
.
associated_partner_id
!==
"False"
)
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
associated_partner_name
)
;
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
partner_data
.
name
)
;
}
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
"A déterminer"
)
}
else
{
shift_line_template
.
find
(
'.affect_associate_registered'
).
text
(
"A déterminer"
)
;
}
}
...
...
@@ -196,26 +196,21 @@ function init_shifts_list() {
}
});
$
(
".affect_associate_registered"
).
on
(
"click"
,
function
(
e
)
{
$
(
".affect_associate_registered"
).
on
(
"click"
,
function
()
{
// Display modal
id
=
$
(
this
).
attr
(
'id'
).
split
(
'_'
)[
2
]
id
=
$
(
this
).
attr
(
'id'
)
.
split
(
'_'
)[
2
];
let
modal_template
=
$
(
"#modal_affect_shift"
);
if
(
partner_data
.
associated_partner_id
!=
"False"
)
{
if
(
partner_data
.
associated_partner_id
!=
"False"
)
{
modal_template
.
find
(
"#shift_partner"
).
text
(
partner_data
.
name
);
modal_template
.
find
(
"#shift_associate"
).
text
(
partner_data
.
associated_partner_name
);
}
else
{
}
else
{
modal_template
.
find
(
"#shift_partner"
).
text
(
partner_data
.
associated_partner_name
);
modal_template
.
find
(
"#shift_associate"
).
text
(
partner_data
.
parent_name
);
}
openModal
(
modal_template
.
html
(),
()
=>
{
...
...
@@ -223,17 +218,17 @@ function init_shifts_list() {
"Valider"
);
modal
.
find
(
'#shift_partner'
).
on
(
"click"
,
function
(
e
)
{
affect_shift
(
"partner"
,
id
)
modal
.
find
(
'#shift_partner'
).
on
(
"click"
,
function
()
{
affect_shift
(
"partner"
,
id
);
});
modal
.
find
(
'#shift_associate'
).
on
(
"click"
,
function
(
e
)
{
affect_shift
(
"associate"
,
id
)
modal
.
find
(
'#shift_associate'
).
on
(
"click"
,
function
()
{
affect_shift
(
"associate"
,
id
);
});
modal
.
find
(
'#shift_both'
).
on
(
"click"
,
function
(
e
)
{
affect_shift
(
"both"
,
id
)
modal
.
find
(
'#shift_both'
).
on
(
"click"
,
function
()
{
affect_shift
(
"both"
,
id
);
});
modal
.
find
(
".btn-modal-ok"
).
hide
()
modal
.
find
(
".btn-modal-ok"
).
hide
()
;
});
}
}
...
...
@@ -244,8 +239,7 @@ function init_shifts_list() {
* @param {string} partner
* @param {string} shift_id
*/
function
affect_shift
(
partner
,
shift_id
)
{
function
affect_shift
(
partner
,
shift_id
)
{
tData
=
'idShiftRegistration='
+
shift_id
+
'&idPartner='
+
partner_data
.
partner_id
...
...
@@ -254,28 +248,26 @@ function init_shifts_list() {
tUrl
=
'/shifts/affect_shift'
;
$
.
ajax
({
type
:
'POST'
,
url
:
tUrl
,
dataType
:
"json"
,
data
:
tData
,
timeout
:
3000
,
success
:
function
(
data
)
{
success
:
function
()
{
load_partner_shifts
(
partner_data
.
concerned_partner_id
)
.
then
(()
=>
{
init_shifts_list
();
closeModal
();
});
},
error
:
function
(
error
)
{
error
:
function
()
{
init_shifts_list
();
closeModal
();
alert
(
`Une erreur est survenue. `
+
`Il est néanmoins possible que la requête ait abouti, `
+
`veuillez patienter quelques secondes puis vérifier vos services enregistrés.`
);
}
});
...
...
@@ -508,7 +500,6 @@ function init_read_only_calendar_page() {
const
hidden_days
=
days_to_hide
.
length
>
0
?
$
.
map
(
days_to_hide
.
split
(
", "
),
Number
)
:
[];
const
calendarEl
=
document
.
getElementById
(
'read_only_calendar'
);
console
.
log
(
calendarEl
)
calendar
=
new
FullCalendar
.
Calendar
(
calendarEl
,
{
locale
:
'fr'
,
...
...
@@ -576,6 +567,7 @@ function init_shifts_exchange() {
}
else
if
(
partner_data
.
comite
===
"True"
)
{
let
msg_template
=
$
(
"#comite_template"
);
$
(
".comite_content_msg"
).
html
(
msg_template
.
html
());
$
(
"#comite_content"
).
show
();
init_read_only_calendar_page
();
...
...
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