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
0
Merge Requests
0
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
Alexis AOUN
third-party
Commits
45a61456
Unverified
Commit
45a61456
authored
Dec 22, 2020
by
Paul B
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lint: fix errors not automatically fixable from eslint
parent
c2889195
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
104 additions
and
114 deletions
+104
-114
envelops.js
envelops/static/js/envelops.js
+6
-6
manage_mess.js
members/static/js/manage_mess.js
+0
-3
members.js
members/static/js/members.js
+3
-3
RelatedObjectLookups.js
outils/static/admin/js/admin/RelatedObjectLookups.js
+1
-1
core.js
outils/static/admin/js/core.js
+1
-1
popup_response.js
outils/static/admin/js/popup_response.js
+0
-1
all_common.js
outils/static/js/all_common.js
+3
-5
barcodes.js
products/static/js/barcodes.js
+1
-1
products_index.js
products/static/js/products_index.js
+6
-6
reception_index.js
reception/static/js/reception_index.js
+1
-0
reception_produits.js
reception/static/js/reception_produits.js
+37
-34
shelf_inventory.js
shelfs/static/js/shelf_inventory.js
+20
-20
shelfs_admin.js
shelfs/static/js/shelfs_admin.js
+3
-3
shift_exchange.js
shifts/static/js/shift_exchange.js
+0
-1
shop.js
shop/static/js/shop.js
+19
-25
info_perso.js
website/static/js/info_perso.js
+3
-4
No files found.
envelops/static/js/envelops.js
View file @
45a61456
...
...
@@ -74,8 +74,8 @@ function set_envelops(envelops) {
let
split_id
=
envelop
.
_id
.
split
(
'_'
);
let
envelop_date
=
split_id
[
3
]
+
"/"
+
split_id
[
2
]
+
"/"
+
split_id
[
1
];
var
envelop_name
=
'Enveloppe du '
+
envelop_date
;
var
envelop_content_id
=
'content_cash_list_'
+
cash_index
;
let
envelop_name
=
'Enveloppe du '
+
envelop_date
;
let
envelop_content_id
=
'content_cash_list_'
+
cash_index
;
set_envelop_dom
(
envelop
,
envelop_name
,
envelop_content_id
,
cash_index
);
...
...
@@ -83,8 +83,8 @@ function set_envelops(envelops) {
}
else
if
(
envelop
.
type
==
"ch"
)
{
ch_envelops
.
push
(
envelop
);
var
envelop_name
=
'Enveloppe #'
+
envelop
.
display_id
;
var
envelop_content_id
=
'content_ch_list_'
+
ch_index
;
let
envelop_name
=
'Enveloppe #'
+
envelop
.
display_id
;
let
envelop_content_id
=
'content_ch_list_'
+
ch_index
;
set_envelop_dom
(
envelop
,
envelop_name
,
envelop_content_id
,
ch_index
);
...
...
@@ -100,8 +100,8 @@ function set_envelops(envelops) {
// Set accordions
var
acc
=
document
.
getElementsByClassName
(
"accordion"
);
for
(
var
i
=
0
;
i
<
acc
.
length
;
i
++
)
{
acc
[
i
].
addEventListener
(
"click"
,
function
()
{
for
(
var
j
=
0
;
j
<
acc
.
length
;
j
++
)
{
acc
[
j
].
addEventListener
(
"click"
,
function
()
{
/* Toggle between adding and removing the "active" class,
to highlight the button that controls the panel */
this
.
classList
.
toggle
(
"active"
);
...
...
members/static/js/manage_mess.js
View file @
45a61456
...
...
@@ -16,9 +16,6 @@ if (coop_is_connected()) {
$
.
each
(
info
.
change
.
docs
,
function
(
i
,
e
)
{
console
.
log
(
'changement'
);
console
.
log
(
e
);
if
(
false
)
{
need_reload
=
true
;
}
});
if
(
need_reload
==
true
)
{
...
...
members/static/js/members.js
View file @
45a61456
...
...
@@ -210,7 +210,7 @@ function search_member() {
function
get_simple_service_name
(
s
)
{
var
simple_name
=
s
.
name
;
var
reg
=
new
RegExp
(
'([a-z]+)
\
. - [0-9
\
:]+ ?-? ?([a-z]*)'
,
'i'
);
var
reg
=
new
RegExp
(
'([a-z]+)
. - [0-9
:]+ ?-? ?([a-z]*)'
,
'i'
);
if
(
reg
.
exec
(
s
.
name
))
{
var
wd
=
RegExp
.
$1
;
...
...
@@ -324,7 +324,7 @@ function get_service_entry_data() {
var
time_param
=
now
.
toISOString
();
var
offset
=
now
.
getTimezoneOffset
();
if
(
/
([^
\
/]
+
)
$/
.
exec
(
window
.
location
))
{
if
(
/
([^/]
+
)
$/
.
exec
(
window
.
location
))
{
time_param
=
RegExp
.
$1
.
replace
(
'%20'
,
'T'
)
+
'Z'
;
offset
=
0
;
}
...
...
@@ -528,7 +528,7 @@ function save_photo() {
// actually snap photo (from preview freeze) and store it
Webcam
.
snap
(
function
(
data_uri
)
{
if
(
/data
\
:
image
\/
jpeg;base64,
(
.+
)
/
.
exec
(
data_uri
))
{
if
(
/data:image
\/
jpeg;base64,
(
.+
)
/
.
exec
(
data_uri
))
{
image_code
=
RegExp
.
$1
;
if
(
current_displayed_member
!=
null
)
{
cancel_preview
();
...
...
outils/static/admin/js/admin/RelatedObjectLookups.js
View file @
45a61456
...
...
@@ -11,7 +11,7 @@
// element when the popup window is dismissed.
function
id_to_windowname
(
text
)
{
text
=
text
.
replace
(
/
\.
/g
,
'__dot__'
);
text
=
text
.
replace
(
/
\
-
/g
,
'__dash__'
);
text
=
text
.
replace
(
/-/g
,
'__dash__'
);
return
text
;
}
...
...
outils/static/admin/js/core.js
View file @
45a61456
...
...
@@ -215,7 +215,7 @@ function getStyle(oElm, strCssRule) {
if
(
document
.
defaultView
&&
document
.
defaultView
.
getComputedStyle
)
{
strValue
=
document
.
defaultView
.
getComputedStyle
(
oElm
,
""
).
getPropertyValue
(
strCssRule
);
}
else
if
(
oElm
.
currentStyle
)
{
strCssRule
=
strCssRule
.
replace
(
/
\
-(\w)
/g
,
function
(
strMatch
,
p1
)
{
strCssRule
=
strCssRule
.
replace
(
/-
(\w)
/g
,
function
(
strMatch
,
p1
)
{
return
p1
.
toUpperCase
();
});
strValue
=
oElm
.
currentStyle
[
strCssRule
];
...
...
outils/static/admin/js/popup_response.js
View file @
45a61456
/*global opener */
(
function
()
{
'use strict'
;
var
initData
=
JSON
.
parse
(
document
.
getElementById
(
'django-admin-popup-response-constants'
).
dataset
.
popupResponse
);
...
...
outils/static/js/all_common.js
View file @
45a61456
...
...
@@ -3,7 +3,7 @@ var actions_last_dates = {};
function
get_litteral_shift_template_name
(
name
)
{
var
l_name
=
''
;
if
(
/
([
ABCD
]{1})([
A-Za-z
\.]{4})
\-
([
0-9
\
:]
+
)
/
.
exec
(
name
))
{
if
(
/
([
ABCD
]{1})([
A-Za-z
.
]{4})
-
([
0-9
:
]
+
)
/
.
exec
(
name
))
{
try
{
var
week
=
RegExp
.
$1
;
var
day
=
RegExp
.
$2
;
...
...
@@ -31,10 +31,9 @@ function get_litteral_shift_template_name(name) {
}
function
is_time_to
(
action
,
delay
)
{
function
is_time_to
(
action
,
delay
=
5000
)
{
var
answer
=
false
;
var
last_date
=
actions_last_dates
[
action
]
||
0
;
var
delay
=
delay
||
5000
;
var
d
=
new
Date
();
var
now
=
d
.
getTime
();
...
...
@@ -478,4 +477,4 @@ function isMacUser() {
return
(
navigator
.
userAgent
.
indexOf
(
"Mac"
)
!=
-
1
||
navigator
.
userAgent
.
indexOf
(
"like Mac"
)
!=
-
1
);
}
if
(
isMacUser
()
&&
isSafari
())
$
(
'.mac-msg'
).
show
();
\ No newline at end of file
if
(
isMacUser
()
&&
isSafari
())
$
(
'.mac-msg'
).
show
();
products/static/js/barcodes.js
View file @
45a61456
...
...
@@ -48,7 +48,7 @@ IFCBarcodes = {
//0493...{NNDDD} (pattern)
//0493213018809 (bc)
pattern_found
=
true
;
pattern
=
pattern
.
replace
(
/
[^
0-9
\
.
ND
]
/
,
''
);
pattern
=
pattern
.
replace
(
/
[^
0-9.ND
]
/
,
''
);
bc
=
bc
.
slice
(
0
,
-
1
);
// remove original check figure
odoo_bc
=
''
;
// Read pattern character by character
...
...
products/static/js/products_index.js
View file @
45a61456
...
...
@@ -34,10 +34,10 @@ function add_product(product) {
width
:
"50%"
,
render
:
function
(
data
,
type
,
full
,
meta
)
{
// Add tooltip with barcode over product name
let
display_barcode
=
"Aucun"
;
if
(
'barcode'
in
full
)
{
var
display_barcode
=
full
.
barcode
;
}
else
{
var
display_barcode
=
"Aucun"
;
display_barcode
=
full
.
barcode
;
}
return
'<div class="tooltip">'
+
data
...
...
@@ -132,14 +132,14 @@ function add_product(product) {
// Add row to table
var
rowNode
=
products_table
.
row
.
add
(
product
).
draw
(
false
)
.
node
();
let
onAnimationEnd
=
function
()
{
rowNode
.
classList
.
remove
(
'blink_me'
);
};
// Handle blinking effect for newly added row
$
(
rowNode
).
addClass
(
'blink_me'
);
rowNode
.
addEventListener
(
'animationend'
,
onAnimationEnd
);
rowNode
.
addEventListener
(
'webkitAnimationEnd'
,
onAnimationEnd
);
function
onAnimationEnd
(
e
)
{
rowNode
.
classList
.
remove
(
'blink_me'
);
}
}
}
catch
(
e
)
{
err
=
{
msg
:
e
.
name
+
' : '
+
e
.
message
,
ctx
:
'add_product'
};
...
...
reception/static/js/reception_index.js
View file @
45a61456
...
...
@@ -158,6 +158,7 @@ function group_action() {
// Go to products page of order with smallest id
goto
(
min_id
);
}
else
if
(
pswd
==
null
)
{
return
;
}
else
{
alert
(
'Mauvais mot de passe !'
);
}
...
...
reception/static/js/reception_produits.js
View file @
45a61456
...
...
@@ -83,11 +83,11 @@ function select_product_from_bc(barcode) {
if
(
found
.
data
!==
null
)
{
setLineEdition
(
found
.
data
);
if
(
found
.
place
===
'to_process'
)
{
var
row
=
table_to_process
.
row
(
$
(
'#'
+
found
.
data
.
product_id
[
0
]));
let
row
=
table_to_process
.
row
(
$
(
'#'
+
found
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
found
.
data
);
}
else
{
var
row
=
table_processed
.
row
(
$
(
'#'
+
found
.
data
.
product_id
[
0
]));
let
row
=
table_processed
.
row
(
$
(
'#'
+
found
.
data
.
product_id
[
0
]));
remove_from_processed
(
row
,
found
.
data
);
}
...
...
@@ -188,22 +188,22 @@ function initLists() {
// Set lists with local storage content
for
(
var
i
=
0
;
i
<
updatedProducts
.
length
;
i
++
)
{
var
product
=
updatedProducts
[
i
];
let
product
=
updatedProducts
[
i
];
product
[
'row_counter'
]
=
-
1
;
list_processed
.
push
(
product
);
var
toProcess_index
=
list_to_process
.
findIndex
(
x
=>
x
.
id
==
updatedProducts
[
i
][
'id'
]);
let
toProcess_index
=
list_to_process
.
findIndex
(
x
=>
x
.
id
==
updatedProducts
[
i
][
'id'
]);
if
(
toProcess_index
>
-
1
)
{
list_to_process
.
splice
(
toProcess_index
,
1
);
}
}
for
(
var
i
=
0
;
i
<
validProducts
.
length
;
i
++
)
{
var
toProcess_index
=
list_to_process
.
findIndex
(
x
=>
x
.
id
==
validProducts
[
i
]);
for
(
var
j
=
0
;
j
<
validProducts
.
length
;
j
++
)
{
let
toProcess_index
=
list_to_process
.
findIndex
(
x
=>
x
.
id
==
validProducts
[
j
]);
if
(
toProcess_index
>
-
1
)
{
var
product
=
list_to_process
[
toProcess_index
];
let
product
=
list_to_process
[
toProcess_index
];
product
[
'row_counter'
]
=
-
1
;
list_processed
.
push
(
product
);
...
...
@@ -223,10 +223,10 @@ function initLists() {
width
:
"50%"
,
render
:
function
(
data
,
type
,
full
,
meta
)
{
// Add tooltip with barcode over product name
var
display_barcode
=
"Aucun"
;
if
(
'barcode'
in
full
)
{
var
display_barcode
=
full
.
barcode
;
}
else
{
var
display_barcode
=
"Aucun"
;
display_barcode
=
full
.
barcode
;
}
return
'<div class="tooltip">'
+
data
...
...
@@ -286,10 +286,10 @@ function initLists() {
width
:
"60%"
,
render
:
function
(
data
,
type
,
full
,
meta
)
{
// Add tooltip with barcode over product name
var
display_barcode
=
"Aucun"
;
if
(
'barcode'
in
full
)
{
var
display_barcode
=
full
.
barcode
;
}
else
{
var
display_barcode
=
"Aucun"
;
display_barcode
=
full
.
barcode
;
}
return
'<div class="tooltip">'
+
data
...
...
@@ -464,14 +464,14 @@ function add_to_toProcess(product) {
// Add to table (no data binding...)
var
rowNode
=
table_to_process
.
row
.
add
(
product
).
draw
(
false
)
.
node
();
var
onAnimationEnd
=
function
()
{
rowNode
.
classList
.
remove
(
'blink_me'
);
};
// Handle blinking effect for newly added row
$
(
rowNode
).
addClass
(
'blink_me'
);
rowNode
.
addEventListener
(
'animationend'
,
onAnimationEnd
);
rowNode
.
addEventListener
(
'webkitAnimationEnd'
,
onAnimationEnd
);
function
onAnimationEnd
(
e
)
{
rowNode
.
classList
.
remove
(
'blink_me'
);
}
}
catch
(
e
)
{
err
=
{
msg
:
e
.
name
+
' : '
+
e
.
message
,
ctx
:
'add_to_toProcess'
};
console
.
error
(
err
);
...
...
@@ -494,14 +494,14 @@ function add_to_processed(product, withCounter = true) {
// Add to table (no data binding...)
var
rowNode
=
table_processed
.
row
.
add
(
product
).
draw
(
false
)
.
node
();
var
onAnimationEnd
=
function
()
{
rowNode
.
classList
.
remove
(
'blink_me'
);
};
// Handle blinking efect for newly added row
$
(
rowNode
).
addClass
(
'blink_me'
);
rowNode
.
addEventListener
(
'animationend'
,
onAnimationEnd
);
rowNode
.
addEventListener
(
'webkitAnimationEnd'
,
onAnimationEnd
);
function
onAnimationEnd
(
e
)
{
rowNode
.
classList
.
remove
(
'blink_me'
);
}
}
catch
(
e
)
{
err
=
{
msg
:
e
.
name
+
' : '
+
e
.
message
,
ctx
:
'add_to_processed'
};
console
.
error
(
err
);
...
...
@@ -604,12 +604,11 @@ function editProductInfo (productToEdit, value = null) {
// Check if the product is already in the 'updated' list
var
index
=
searchUpdatedProduct
();
var
firstUpdate
=
false
;
let
newValue
=
value
;
// If 'value' parameter not set, get value from edition input
if
(
value
==
null
)
{
var
newValue
=
parseFloat
(
document
.
getElementById
(
'edition_input'
).
value
.
replace
(
','
,
'.'
));
}
else
{
var
newValue
=
value
;
newValue
=
parseFloat
(
document
.
getElementById
(
'edition_input'
).
value
.
replace
(
','
,
'.'
));
}
// If qty edition & Check if qty changed
...
...
@@ -796,13 +795,13 @@ function pre_send(type) {
if
(
list_to_process
.
length
>
0
)
{
alert
(
"Il reste des produits à traiter dans la commande."
);
}
else
{
updateType
=
type
;
let
modal_next_step
=
'#templates #modal_prices_validation'
;
updateType
=
type
;
if
(
type
==
'qty_valid'
)
{
var
modal_next_step
=
'#templates #modal_qties_validation'
;
}
else
{
var
modal_next_step
=
'#templates #modal_prices_validation'
;
modal_next_step
=
'#templates #modal_qties_validation'
;
}
openModal
(
$
(
modal_next_step
).
html
(),
data_validation
,
'Confirmer'
,
false
);
}
}
...
...
@@ -957,7 +956,7 @@ function send() {
}
else
if
(
list_processed
[
i
].
barcode
==
false
||
list_processed
[
i
].
barcode
==
null
||
list_processed
[
i
].
barcode
==
""
)
{
// Products with no barcode
var
node
=
document
.
createElement
(
'li'
);
var
textNode
=
document
.
createTextNode
(
list_processed
[
i
][
"product_id"
][
1
]);
let
textNode
=
document
.
createTextNode
(
list_processed
[
i
][
"product_id"
][
1
]);
node
.
appendChild
(
textNode
);
document
.
getElementById
(
'barcodesEmpty_list'
).
appendChild
(
node
);
...
...
@@ -983,7 +982,7 @@ function send() {
var
span_node
=
document
.
createElement
(
'span'
);
span_node
.
className
=
'order_ref_reminder'
;
var
textNode
=
document
.
createTextNode
(
orders
[
order_id
].
name
);
let
textNode
=
document
.
createTextNode
(
orders
[
order_id
].
name
);
span_node
.
appendChild
(
textNode
);
...
...
@@ -1043,10 +1042,10 @@ function send() {
// Remove all groups containing these orders
for
(
order_id
in
orders
)
{
search
:
for
(
var
i
=
0
;
i
<
grouped_orders
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
grouped_orders
[
i
].
length
;
j
++
)
{
if
(
grouped_orders
[
i
][
j
]
==
order_id
)
{
grouped_orders
.
splice
(
i
);
for
(
var
h
=
0
;
h
<
grouped_orders
.
length
;
h
++
)
{
for
(
var
j
=
0
;
j
<
grouped_orders
[
h
].
length
;
j
++
)
{
if
(
grouped_orders
[
h
][
j
]
==
order_id
)
{
grouped_orders
.
splice
(
h
);
break
search
;
}
}
...
...
@@ -1179,7 +1178,9 @@ $(document).ready(function() {
err_msg
+=
" - Order id: "
+
row_data
.
id_po
;
err_msg
+=
" - Product: "
+
row_data
.
product_id
[
1
];
}
catch
(
e
)
{}
}
catch
(
e
)
{
console
.
log
(
e
);
}
err
=
{
msg
:
err_msg
,
ctx
:
'datatable: table to_process'
};
console
.
error
(
err
);
...
...
@@ -1205,7 +1206,9 @@ $(document).ready(function() {
err_msg
+=
" - Order id: "
+
row_data
.
id_po
;
err_msg
+=
" - Product: "
+
row_data
.
product_id
[
1
];
}
catch
(
e
)
{}
}
catch
(
e
)
{
console
.
log
(
e
);
}
err
=
{
msg
:
err_msg
,
ctx
:
'datatable: table processed'
};
console
.
error
(
err
);
...
...
shelfs/static/js/shelf_inventory.js
View file @
45a61456
...
...
@@ -17,7 +17,7 @@ var validation_msg = $('#validation_msg'),
var
shelf
,
parent_location
=
'/shelfs'
,
origin
=
"shelf"
,
// or custom_list (create from order view)
origin
View
=
"shelf"
,
// or custom_list (create from order view)
list_to_process
=
[],
table_to_process
,
table_processed
,
...
...
@@ -72,11 +72,11 @@ function select_product_from_bc(barcode) {
if
(
found
!==
null
)
{
setLineEdition
(
found
);
if
(
editing_origin
===
'to_process'
)
{
var
row
=
table_to_process
.
row
(
$
(
'tr#'
+
found
.
id
));
let
row
=
table_to_process
.
row
(
$
(
'tr#'
+
found
.
id
));
remove_from_toProcess
(
row
);
}
else
{
var
row
=
table_processed
.
row
(
$
(
'tr#'
+
found
.
id
));
let
row
=
table_processed
.
row
(
$
(
'tr#'
+
found
.
id
));
remove_from_processed
(
row
);
}
...
...
@@ -107,13 +107,13 @@ function handle_blinking_effect(element) {
function
edit_event
(
clicked
)
{
// Remove from origin table
if
(
editing_origin
==
'to_process'
)
{
var
row
=
table_to_process
.
row
(
clicked
.
parents
(
'tr'
));
var
row_data
=
row
.
data
();
let
row
=
table_to_process
.
row
(
clicked
.
parents
(
'tr'
));
let
row_data
=
row
.
data
();
remove_from_toProcess
(
row
);
}
else
{
var
row
=
table_processed
.
row
(
clicked
.
parents
(
'tr'
));
var
row_data
=
row
.
data
();
let
row
=
table_processed
.
row
(
clicked
.
parents
(
'tr'
));
let
row_data
=
row
.
data
();
remove_from_processed
(
row
);
}
...
...
@@ -185,7 +185,7 @@ function editProductInfo (productToEdit, value = null) {
add_to_processed
(
productToEdit
);
// Update local storage
localStorage
.
setItem
(
origin
+
"_"
+
shelf
.
id
,
JSON
.
stringify
(
shelf
));
localStorage
.
setItem
(
origin
View
+
"_"
+
shelf
.
id
,
JSON
.
stringify
(
shelf
));
return
true
;
}
...
...
@@ -220,7 +220,7 @@ function initLists() {
}
];
if
(
origin
==
'custom_list'
)
{
if
(
origin
View
==
'custom_list'
)
{
columns_to_process
.
splice
(
1
,
0
,
{
data
:
"shelf_sortorder"
,
title
:
"Rayon"
,
className
:
"dt-body-center"
});
}
...
...
@@ -256,7 +256,7 @@ function initLists() {
}
];
if
(
origin
==
'custom_list'
)
{
if
(
origin
View
==
'custom_list'
)
{
columns_processed
.
splice
(
2
,
0
,
{
data
:
"shelf_sortorder"
,
title
:
"Rayon"
,
className
:
"dt-body-center"
});
}
...
...
@@ -420,7 +420,7 @@ function pre_send() {
// Proceed with inventory: send the request to the server
function
send
()
{
if
(
is_time_to
(
'submit_inv_qties'
)
,
5000
)
{
if
(
is_time_to
(
'submit_inv_qties'
))
{
// Loading on
var
wz
=
$
(
'#main-waiting-zone'
).
clone
();
...
...
@@ -430,7 +430,7 @@ function send() {
// Add user comments to data sent to server
shelf
.
user_comments
=
user_comments
;
var
url
=
"../do_"
+
origin
+
"_inventory"
;
var
url
=
"../do_"
+
origin
View
+
"_inventory"
;
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
$
.
ajax
({
...
...
@@ -455,7 +455,7 @@ function send() {
}
}
var
msg
=
(
origin
==
'shelf'
)
?
'Retour à la liste des rayons'
:
'Retour'
;
var
msg
=
(
origin
View
==
'shelf'
)
?
'Retour à la liste des rayons'
:
'Retour'
;
openModal
(
inventory_validated_msg
.
html
(),
back
,
msg
,
true
,
false
);
...
...
@@ -464,7 +464,7 @@ function send() {
$
(
'#modal_closebtn_bottom'
).
on
(
'click'
,
back
);
// Clear local storage before leaving
localStorage
.
removeItem
(
origin
+
'_'
+
shelf
.
id
);
localStorage
.
removeItem
(
origin
View
+
'_'
+
shelf
.
id
);
},
error
:
function
(
data
)
{
// 500 error has been thrown
if
(
typeof
data
.
responseJSON
!=
'undefined'
&&
typeof
data
.
responseJSON
.
error
!=
'undefined'
)
{
...
...
@@ -489,7 +489,7 @@ function exit_adding_product() {
// Add a product that's not in the list
function
open_adding_product
()
{
if
(
origin
==
'shelf'
)
{
if
(
origin
View
==
'shelf'
)
{
adding_product
=
true
;
openModal
(
add_product_form
.
html
(),
do_add_product
,
'Valider'
,
false
,
true
,
exit_adding_product
);
...
...
@@ -560,7 +560,7 @@ function saveIssuesReport() {
function
get_shelf_data
()
{
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
var
url
=
(
origin
==
'shelf'
)
?
'../'
+
shelf
.
id
:
'../get_custom_list_data?id='
+
shelf
.
id
;
var
url
=
(
origin
View
==
'shelf'
)
?
'../'
+
shelf
.
id
:
'../get_custom_list_data?id='
+
shelf
.
id
;
$
.
ajax
({
type
:
'GET'
,
...
...
@@ -591,7 +591,7 @@ function init() {
initLists
();
// Set DOM
if
(
origin
==
"shelf"
)
{
if
(
origin
View
==
"shelf"
)
{
$
(
'#shelf_name'
).
text
(
shelf
.
name
+
' (numéro '
+
shelf
.
sort_order
+
')'
);
}
else
{
$
(
'#page_title'
).
text
(
"Inventaire du"
);
...
...
@@ -761,17 +761,17 @@ $(document).ready(function() {
// Working on a shelf
if
(
pathArray
.
includes
(
'shelf_inventory'
))
{
origin
=
'shelf'
;
origin
View
=
'shelf'
;
parent_location
=
'/shelfs'
;
}
else
{
origin
=
'custom_list'
;
origin
View
=
'custom_list'
;
parent_location
=
'/inventory/custom_lists'
;
}
//console.log(products)
// Get shelf data from local storage
if
(
Modernizr
.
localstorage
)
{
var
stored_shelf
=
JSON
.
parse
(
localStorage
.
getItem
(
origin
+
'_'
+
shelf
.
id
));
var
stored_shelf
=
JSON
.
parse
(
localStorage
.
getItem
(
origin
View
+
'_'
+
shelf
.
id
));
if
(
stored_shelf
!=
null
)
{
shelf
=
stored_shelf
;
...
...
shelfs/static/js/shelfs_admin.js
View file @
45a61456
...
...
@@ -409,8 +409,10 @@ var recordProductsAddedShelf = function() {
'/shelfs/admin/add_products'
,
{
bc
:
JSON
.
stringify
(
barcodes
),
shelf_id
:
id
},
function
(
err
,
rData
)
{
let
msg
=
'Echec'
;
if
(
typeof
rData
.
res
.
added
!=
"undefined"
)
{
var
msg
=
"Ajout des produits réussi."
;
msg
=
"Ajout des produits réussi."
;
if
(
typeof
rData
.
res
.
missing
!=
"undefined"
)
{
msg
+=
"
\
nSauf pour :"
;
...
...
@@ -421,8 +423,6 @@ var recordProductsAddedShelf = function() {
alert
(
msg
);
backToMain
();
}
else
{
var
msg
=
'Echec'
;
if
(
typeof
rData
.
res
.
error
!=
"undefined"
)
msg
=
rData
.
res
.
error
;
else
if
(
typeof
rData
.
res
.
msg
!=
"undefined"
)
...
...
shifts/static/js/shift_exchange.js
View file @
45a61456
...
...
@@ -471,7 +471,6 @@ $(document).ready(function() {
maxTime
:
"22:00:00"
,
hiddenDays
:
daysToHide
,
initialView
:
calInitialView
,
navLinks
:
true
,
weekNumbers
:
true
,
events
:
function
(
start
,
end
,
timezone
,
callback
)
{
// Load possible shifts
...
...
shop/static/js/shop.js
View file @
45a61456
...
...
@@ -36,6 +36,21 @@ var main_content = $('#main-content'),
// Sort products div according to selected sort type
function
sort_product_divs
(
divs_to_sort
,
sort_type
)
{
let
compare_price_uom
=
function
(
a
,
b
)
{
// For products by unit : get uom price
// For products by kg : get unit price (which is price of kg, we need to do this because some of them don't have a uom price)
let
a_price_uom
=
$
(
a
).
find
(
"span.uom_price"
)
.
text
()
==
'Unité(s)'
?
parseFloat
(
$
(
a
).
find
(
"span.uom_price"
)
.
text
())
:
parseFloat
(
$
(
a
).
find
(
"span.price"
)
.
text
());
let
b_price_uom
=
$
(
b
).
find
(
"span.uom_price"
)
.
text
()
==
'Unité(s)'
?
parseFloat
(
$
(
b
).
find
(
"span.uom_price"
)
.
text
())
:
parseFloat
(
$
(
b
).
find
(
"span.price"
)
.
text
());
return
a_price_uom
>
b_price_uom
?
1
:
-
1
;
};
var
sorted_products
=
divs_to_sort
.
sort
(
function
(
a
,
b
)
{
switch
(
sort_type
)
{
case
'name_asc'
:
...
...
@@ -55,29 +70,9 @@ function sort_product_divs(divs_to_sort, sort_type) {
.
text
())
<
parseFloat
(
$
(
b
).
find
(
"span.price"
)
.
text
())
?
1
:
-
1
;
case
'price_uom_asc'
:
// For products by unit : get uom price
// For products by kg : get unit price (which is price of kg, we need to do this because some of them don't have a uom price)
var
a_price_uom
=
$
(
a
).
find
(
"span.uom_price"
)
.
text
()
==
'Unité(s)'
?
parseFloat
(
$
(
a
).
find
(
"span.uom_price"
)
.
text
())
:
parseFloat
(
$
(
a
).
find
(
"span.price"
)
.
text
());
var
b_price_uom
=
$
(
b
).
find
(
"span.uom_price"
)
.
text
()
==
'Unité(s)'
?
parseFloat
(
$
(
b
).
find
(
"span.uom_price"
)
.
text
())
:
parseFloat
(
$
(
b
).
find
(
"span.price"
)
.
text
());
return
a_price_uom
>
b_price_uom
?
1
:
-
1
;
return
compare_price_uom
(
a
,
b
);
case
'price_uom_desc'
:
var
a_price_uom
=
$
(
a
).
find
(
"span.uom_price"
)
.
text
()
==
'Unité(s)'
?
parseFloat
(
$
(
a
).
find
(
"span.uom_price"
)
.
text
())
:
parseFloat
(
$
(
a
).
find
(
"span.price"
)
.
text
());
var
b_price_uom
=
$
(
b
).
find
(
"span.uom_price"
)
.
text
()
==
'Unité(s)'
?
parseFloat
(
$
(
b
).
find
(
"span.uom_price"
)
.
text
())
:
parseFloat
(
$
(
b
).
find
(
"span.price"
)
.
text
());
return
a_price_uom
<
b_price_uom
?
1
:
-
1
;
return
compare_price_uom
(
b
,
a
);
default
:
return
$
(
a
).
find
(
".name"
)
.
text
()
>
$
(
b
).
find
(
".name"
)
...
...
@@ -92,7 +87,7 @@ function djLogError(e) {
try
{
$
.
post
(
'/shop/log_error'
,
{
error
:
JSON
.
stringify
(
e
)});
}
catch
(
e
)
{
console
.
log
(
e
);
}
}
...
...
@@ -1605,4 +1600,4 @@ window.onresize = adjustSizes;
$
(
document
).
on
(
"closemodal"
,
function
()
{
if
(
current_action
==
"init_form"
)
reset_home
();
});
\ No newline at end of file
});
website/static/js/info_perso.js
View file @
45a61456
...
...
@@ -36,7 +36,7 @@ try {
}
for
(
var
k
=
1
;
k
<=
12
;
k
++
)
{
let
mth
=
k
.
pad
(
2
);
var
opt
=
$
(
'<option>'
).
val
(
mth
)
let
opt
=
$
(
'<option>'
).
val
(
mth
)
.
text
(
mth
);
if
(
m
==
mth
)
opt
.
prop
(
'selected'
,
true
);
...
...
@@ -44,7 +44,7 @@ try {
}
for
(
var
l
=
1
;
l
<=
31
;
l
++
)
{
let
day
=
l
.
pad
(
2
);
var
opt
=
$
(
'<option>'
).
val
(
day
)
let
opt
=
$
(
'<option>'
).
val
(
day
)
.
text
(
day
);
if
(
d
==
day
)
opt
.
prop
(
'selected'
,
true
);
...
...
@@ -120,4 +120,4 @@ try {
}
catch
(
error
)
{
err_obj
=
{
msg
:
error
.
name
+
' : '
+
error
.
message
,
ctx
:
'info_perso'
};
report_JS_error
(
error
,
'website'
);
}
\ No newline at end of file
}
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