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
619a82ca
Commit
619a82ca
authored
Oct 01, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
linting
parent
a58dde81
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
43 deletions
+43
-43
inscriptions.js
members/static/js/inscriptions.js
+4
-7
manage_mess.js
members/static/js/manage_mess.js
+4
-4
members.js
members/static/js/members.js
+5
-6
members_admin.js
members/static/js/members_admin.js
+24
-19
prepa_odoo.js
members/static/js/prepa_odoo.js
+4
-5
subscription_validation.js
members/static/js/subscription_validation.js
+2
-2
No files found.
members/static/js/inscriptions.js
View file @
619a82ca
...
...
@@ -55,10 +55,10 @@ sync.on('change', function (info) {
update_completed_count
();
online
=
true
;
})
.
on
(
'denied'
,
function
(
err
)
{
.
on
(
'denied'
,
function
()
{
// a document failed to replicate (e.g. due to permissions)
})
.
on
(
'complete'
,
function
(
info
)
{
.
on
(
'complete'
,
function
()
{
// handle complete
})
.
on
(
'error'
,
function
(
err
)
{
...
...
@@ -87,9 +87,7 @@ function new_coop_validation() {
coop_list_view
.
hide
();
schoice_view
.
hide
();
ncoop_view
.
hide
();
var
barcode_base
=
current_coop
.
barcode_base
;
var
st
=
get_shift_name
(
current_coop
.
shift_template
.
data
);
//coop_registration_details.find('.numbox').text('N° '+ barcode_base);
coop_registration_details
.
find
(
'.shift_template'
).
text
(
st
);
process_state
.
html
(
current_coop
.
firstname
+
' '
+
current_coop
.
lastname
);
...
...
@@ -148,12 +146,11 @@ function _really_save_new_coop(email, fname, lname, cap, pm, cn, bc, msex) {
if
(
email
!=
current_email
)
{
//delete current_coop after copying revelant data
dbc
.
remove
(
current_email
,
coop
.
_rev
,
function
(
err
,
response
)
{
dbc
.
remove
(
current_email
,
coop
.
_rev
,
function
(
err
)
{
if
(
err
)
{
return
console
.
log
(
err
);
}
//console.log(response);
});
delete
coop
.
_rev
;
...
...
@@ -461,7 +458,7 @@ function setLocalInProcess(lip) {
localStorage
.
setItem
(
"in_process"
,
JSON
.
stringify
(
lip
));
}
function
keep_in_process_work
(
event
)
{
function
keep_in_process_work
()
{
//If data registration is in process, save it in localStorage
if
(
current_coop
!=
null
&&
typeof
(
current_coop
.
shift_template
)
==
"undefined"
)
{
local_in_process
=
getLocalInProcess
();
...
...
members/static/js/manage_mess.js
View file @
619a82ca
...
...
@@ -9,7 +9,7 @@ if (coop_is_connected()) {
env_template
=
$
(
'#templates [data-type="envelops"]'
);
// PouchDB sync actions listeners
sync
.
on
(
'change'
,
function
(
info
)
{
sync
.
on
(
'change'
,
function
()
{
// handle change
...
...
@@ -27,10 +27,10 @@ if (coop_is_connected()) {
//update_completed_count();
online
=
true
;
})
.
on
(
'denied'
,
function
(
err
)
{
.
on
(
'denied'
,
function
()
{
// a document failed to replicate (e.g. due to permissions)
})
.
on
(
'complete'
,
function
(
info
)
{
.
on
(
'complete'
,
function
()
{
// handle complete
})
.
on
(
'error'
,
function
(
err
)
{
...
...
@@ -333,7 +333,7 @@ if (coop_is_connected()) {
dsha1
=
sha1
(
jss
),
member
=
{
_id
:
dsha1
,
data
:
data
,
hash
:
dsha1
};
dbc
.
put
(
member
,
function
callback
(
err
,
result
)
{
dbc
.
put
(
member
,
function
callback
(
err
)
{
if
(
!
err
)
{
closeModal
();
page_cleaning
();
...
...
members/static/js/members.js
View file @
619a82ca
...
...
@@ -33,7 +33,6 @@ var shift_members = $('#current_shift_members');
var
service_validation
=
$
(
'#service_validation'
);
var
validation_last_call
=
0
;
var
rattrapage_wanted
=
$
(
'[data-next="rattrapage_1"]'
);
var
rattrapage_validation
=
$
(
'#rattrapage_validation'
);
var
webcam_is_attached
=
false
;
var
photo_advice
=
$
(
'#photo_advice'
);
var
photo_studio
=
$
(
'#photo_studio'
);
...
...
@@ -637,7 +636,7 @@ shift_members.on("click", '.btn[data-rid]', function() {
});
pages
.
shopping_entry
.
on
(
'css'
,
function
(
e
)
{
pages
.
shopping_entry
.
on
(
'css'
,
function
()
{
photo_advice
.
hide
();
photo_studio
.
hide
();
search_box_clear_html_elts
();
...
...
@@ -645,14 +644,14 @@ pages.shopping_entry.on('css', function(e) {
move_search_box
(
pages
.
rattrapage_1
,
pages
.
shopping_entry
);
});
pages
.
service_entry
.
on
(
'css'
,
function
(
e
)
{
pages
.
service_entry
.
on
(
'css'
,
function
()
{
photo_advice
.
hide
();
photo_studio
.
hide
();
clean_service_entry
();
get_service_entry_data
();
});
pages
.
rattrapage_1
.
on
(
'css'
,
function
(
e
)
{
pages
.
rattrapage_1
.
on
(
'css'
,
function
()
{
search_box_clear_html_elts
();
var
msg
=
"Vous venez pour un rattrapage."
;
...
...
@@ -682,7 +681,7 @@ function ask_for_easy_shift_validation() {
{
coop_id
:
operator
.
id
},
function
(
err
,
result
)
{
function
(
err
)
{
if
(
!
err
)
{
alert
(
"1 point volant vient d'être ajouté."
);
clean_search_for_easy_validate_zone
();
...
...
@@ -798,7 +797,7 @@ $(document).ready(function() {
display_possible_members
();
},
error
:
function
(
data
)
{
error
:
function
()
{
err
=
{
msg
:
"erreur serveur lors de la recherche de membres"
,
ctx
:
'easy_validate.search_members'
...
...
members/static/js/members_admin.js
View file @
619a82ca
var
makeups_members_table
=
null
,
makeups_members
=
null
,
selected_rows
=
[];
// Contain members id
selected_rows
=
[];
// Contain members id
function
switch_active_tab
()
{
// Set tabs
...
...
@@ -11,6 +11,7 @@ function switch_active_tab() {
$
(
'.tab_content'
).
hide
();
let
tab
=
$
(
this
).
attr
(
'id'
);
if
(
tab
==
'tab_makeups'
)
{
$
(
'#tab_makeups_content'
).
show
();
}
...
...
@@ -23,6 +24,7 @@ function switch_active_tab() {
*/
function
load_tab_data
()
{
let
current_tab
=
$
(
'.tab .active'
).
attr
(
'id'
);
if
(
current_tab
===
'tab_makeups'
&&
makeups_members
===
null
)
{
load_makeups_members
();
}
...
...
@@ -66,13 +68,13 @@ function display_makeups_members() {
}
// Remove members with 0 makeups to do
ids_to_remove
=
[]
ids_to_remove
=
[]
;
for
(
member_item
of
makeups_members
)
{
if
(
member_item
.
makeups_to_do
==
0
)
{
ids_to_remove
.
push
(
member_item
.
id
)
ids_to_remove
.
push
(
member_item
.
id
)
;
}
}
makeups_members
=
makeups_members
.
filter
(
m
=>
!
ids_to_remove
.
includes
(
m
.
id
))
makeups_members
=
makeups_members
.
filter
(
m
=>
!
ids_to_remove
.
includes
(
m
.
id
))
;
// TODO : select multiple and grouped action
makeups_members_table
=
$
(
'#makeups_members_table'
).
DataTable
({
...
...
@@ -90,7 +92,7 @@ function display_makeups_members() {
},
{
data
:
"name"
,
title
:
"Nom"
,
title
:
"Nom"
},
{
data
:
"makeups_to_do"
,
...
...
@@ -102,7 +104,7 @@ function display_makeups_members() {
<button class="decrement_makeup btn--primary" id="decrement_member_
${
full
.
id
}
">
<i class="fas fa-arrow-down"></i>
</button>`
;
}
,
}
}
],
aLengthMenu
:
[
...
...
@@ -118,11 +120,12 @@ function display_makeups_members() {
]
],
iDisplayLength
:
-
1
,
language
:
{
url
:
'/static/js/datatables/french.json'
}
,
language
:
{
url
:
'/static/js/datatables/french.json'
}
});
$
(
'#makeups_members_table'
).
on
(
'click'
,
'tbody td .decrement_makeup'
,
function
()
{
const
button_id
=
$
(
this
).
prop
(
'id'
).
split
(
'_'
);
const
button_id
=
$
(
this
).
prop
(
'id'
)
.
split
(
'_'
);
const
member_id
=
button_id
[
button_id
.
length
-
1
];
const
member
=
makeups_members
.
find
(
m
=>
m
.
id
==
member_id
);
...
...
@@ -134,7 +137,7 @@ function display_makeups_members() {
},
"Confirmer"
,
false
)
)
;
});
$
(
'#makeups_members_table'
).
on
(
'click'
,
'tbody td .select_member_cb'
,
function
()
{
...
...
@@ -149,6 +152,7 @@ function display_makeups_members() {
selected_rows
.
push
(
m_id
);
}
else
{
const
i
=
selected_rows
.
findIndex
(
id
=>
id
==
m_id
);
selected_rows
.
splice
(
i
,
1
);
}
...
...
@@ -163,23 +167,24 @@ function display_makeups_members() {
},
"Confirmer"
,
false
)
)
;
});
}
}
else
{
$
(
"#decrement_selected_members_makeups"
).
off
().
hide
();
$
(
"#decrement_selected_members_makeups"
).
off
()
.
hide
();
}
});
}
/**
* Send request to update members nb of makeups to do
* @param {Array} member_ids
* @param {Array} member_ids
*/
function
decrement_makeups
(
member_ids
)
{
openModal
();
data
=
[]
data
=
[]
;
for
(
mid
of
member_ids
)
{
member_index
=
makeups_members
.
findIndex
(
m
=>
m
.
id
==
mid
);
makeups_members
[
member_index
].
makeups_to_do
-=
1
;
...
...
@@ -187,7 +192,7 @@ function decrement_makeups(member_ids) {
data
.
push
({
member_id
:
mid
,
target_makeups_nb
:
makeups_members
[
member_index
].
makeups_to_do
})
})
;
}
$
.
ajax
({
...
...
@@ -197,10 +202,10 @@ function decrement_makeups(member_ids) {
dataType
:
"json"
,
traditional
:
true
,
contentType
:
"application/json; charset=utf-8"
,
success
:
function
(
data
)
{
success
:
function
()
{
selected_rows
=
[];
display_makeups_members
();
closeModal
()
closeModal
()
;
},
error
:
function
(
data
)
{
err
=
{
msg
:
"erreur serveur pour décrémenter les rattrapages"
,
ctx
:
'load_makeups_members'
};
...
...
@@ -217,11 +222,11 @@ function decrement_makeups(member_ids) {
$
(
document
).
ready
(
function
()
{
if
(
coop_is_connected
())
{
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
$
(
".page_content"
).
show
();
load_makeups_members
();
$
(
".tabs .tab"
).
on
(
'click'
,
switch_active_tab
);
}
else
{
$
(
".page_content"
).
hide
();
...
...
members/static/js/prepa_odoo.js
View file @
619a82ca
...
...
@@ -46,10 +46,10 @@ sync.on('change', function (info) {
// replicate resumed (e.g. new changes replicating, user went back online)
online
=
true
;
})
.
on
(
'denied'
,
function
(
err
)
{
.
on
(
'denied'
,
function
()
{
// a document failed to replicate (e.g. due to permissions)
})
.
on
(
'complete'
,
function
(
info
)
{
.
on
(
'complete'
,
function
()
{
// handle complete
})
.
on
(
'error'
,
function
(
err
)
{
...
...
@@ -113,7 +113,7 @@ function put_current_coop_in_buffer_db(callback) {
var
can_continue
=
true
;
if
(
typeof
current_coop
.
_old_id
!=
"undefined"
)
{
dbc
.
remove
(
current_coop
.
_old_id
,
current_coop
.
_rev
,
function
(
err
,
response
)
{
dbc
.
remove
(
current_coop
.
_old_id
,
current_coop
.
_rev
,
function
(
err
)
{
if
(
err
)
{
console
.
log
(
err
);
can_continue
=
false
;
}
...
...
@@ -131,7 +131,6 @@ function put_current_coop_in_buffer_db(callback) {
function
process_new_warning
(
event
)
{
event
.
preventDefault
();
var
msg
=
warning_msg
.
val
();
var
btn
=
$
(
event
.
target
).
find
(
'button'
);
openModal
();
if
(
msg
.
length
>
0
)
{
...
...
@@ -208,7 +207,7 @@ function submit_full_coop_form() {
}
post_form
(
'/members/coop_validated_data'
,
form_data
,
function
(
err
,
result
)
{
function
(
err
)
{
if
(
!
err
)
{
setTimeout
(
after_save
,
1500
);
}
else
{
...
...
members/static/js/subscription_validation.js
View file @
619a82ca
...
...
@@ -92,7 +92,7 @@ function process_form_submission(event) {
openModal
();
post_form
(
'/members/coop_validated_data'
,
form_data
,
function
(
err
,
result
)
{
function
(
err
)
{
closeModal
();
if
(
!
err
)
{
...
...
@@ -119,7 +119,7 @@ function process_form_submission(event) {
openModal
();
post_form
(
'/members/coop_warning_msg'
,
data
,
function
(
err
,
result
)
{
function
(
err
)
{
closeModal
();
if
(
!
err
)
{
$
(
'#main_content'
).
remove
();
...
...
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