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
261
Issues
261
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
Paul
third-party
Commits
2d9012a9
Commit
2d9012a9
authored
Jun 11, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] linting
parent
9f56118c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
11 deletions
+34
-11
reception_index.js
reception/static/js/reception_index.js
+13
-6
reception_produits.js
reception/static/js/reception_produits.js
+21
-5
No files found.
reception/static/js/reception_index.js
View file @
2d9012a9
...
@@ -42,7 +42,7 @@ function group_goto(group_index) {
...
@@ -42,7 +42,7 @@ function group_goto(group_index) {
// Find order data
// Find order data
for
(
let
order
of
orders
)
{
for
(
let
order
of
orders
)
{
if
(
order
.
id
==
order_groups
.
groups
[
group_index
][
i
])
{
if
(
order
.
id
==
order_groups
.
groups
[
group_index
][
i
])
{
order_data
=
order
order_data
=
order
;
}
}
}
}
...
@@ -63,19 +63,20 @@ function create_order_doc(order_data, go_to_order = false) {
...
@@ -63,19 +63,20 @@ function create_order_doc(order_data, go_to_order = false) {
dbc
.
get
(
order_doc_id
).
then
(()
=>
{
dbc
.
get
(
order_doc_id
).
then
(()
=>
{
if
(
go_to_order
===
true
)
{
if
(
go_to_order
===
true
)
{
goto
(
order_data
.
id
)
goto
(
order_data
.
id
)
;
}
}
})
})
.
catch
(
function
(
err
)
{
.
catch
(
function
(
err
)
{
// Create if doesn't exist
// Create if doesn't exist
if
(
err
.
status
===
404
)
{
if
(
err
.
status
===
404
)
{
let
order_doc
=
{
...
order_data
};
let
order_doc
=
{
...
order_data
};
order_doc
.
_id
=
order_doc_id
;
order_doc
.
_id
=
order_doc_id
;
dbc
.
put
(
order_doc
,
(
err
)
=>
{
dbc
.
put
(
order_doc
,
(
err
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
if
(
go_to_order
===
true
)
{
if
(
go_to_order
===
true
)
{
goto
(
order_data
.
id
)
goto
(
order_data
.
id
);
}
}
}
else
{
}
else
{
error
=
{
error
=
{
...
@@ -96,7 +97,7 @@ function create_order_doc(order_data, go_to_order = false) {
...
@@ -96,7 +97,7 @@ function create_order_doc(order_data, go_to_order = false) {
/**
/**
* Validate all prices of an order
* Validate all prices of an order
*/
*/
function
validatePrices
()
{
function
validatePrices
()
{
// Loading on
// Loading on
openModal
();
openModal
();
...
@@ -194,7 +195,7 @@ function group_action() {
...
@@ -194,7 +195,7 @@ function group_action() {
if
(
!
err
)
{
if
(
!
err
)
{
goto
(
group_ids
[
0
]);
goto
(
group_ids
[
0
]);
}
else
{
}
else
{
alert
(
"Une erreur est survenue lors de la création du groupe. Veuillez ré-essayer plus tard svp."
)
alert
(
"Une erreur est survenue lors de la création du groupe. Veuillez ré-essayer plus tard svp."
)
;
console
.
log
(
err
);
console
.
log
(
err
);
}
}
});
});
...
@@ -445,6 +446,12 @@ $(document).ready(function() {
...
@@ -445,6 +446,12 @@ $(document).ready(function() {
});
});
// TODO sync on change : get data, update data & dom
// TODO sync on change : get data, update data & dom
sync
.
on
(
'change'
,
function
(
info
)
{
console
.
log
(
info
);
}).
on
(
'error'
,
function
(
err
)
{
console
.
log
(
err
);
});
// TODO on button click to access order: verif fingerprint & timestamp
// TODO on button click to access order: verif fingerprint & timestamp
// Get or create order groups doc
// Get or create order groups doc
...
...
reception/static/js/reception_produits.js
View file @
2d9012a9
...
@@ -348,7 +348,12 @@ function initLists() {
...
@@ -348,7 +348,12 @@ function initLists() {
className
:
"dt-head-center dt-body-center"
,
className
:
"dt-head-center dt-body-center"
,
visible
:
(
reception_status
==
"False"
),
visible
:
(
reception_status
==
"False"
),
render
:
function
(
data
,
type
,
full
)
{
render
:
function
(
data
,
type
,
full
)
{
let
disp
=
[
full
.
product_qty
,
(
full
.
old_qty
!==
undefined
)?
full
.
old_qty
:
full
.
product_qty
].
join
(
"/"
);
let
disp
=
[
full
.
product_qty
,
(
full
.
old_qty
!==
undefined
)?
full
.
old_qty
:
full
.
product_qty
].
join
(
"/"
);
return
disp
;
return
disp
;
},
},
orderable
:
false
orderable
:
false
...
@@ -414,7 +419,7 @@ function initLists() {
...
@@ -414,7 +419,7 @@ function initLists() {
orders
[
data
.
id_po
][
'valid_products'
]
=
[];
orders
[
data
.
id_po
][
'valid_products'
]
=
[];
}
}
orders
[
data
.
id_po
][
'valid_products'
].
push
(
data
[
'id'
]);
orders
[
data
.
id_po
][
'valid_products'
].
push
(
data
[
'id'
]);
update_distant_order
(
data
.
id_po
)
update_distant_order
(
data
.
id_po
)
;
// Reset search
// Reset search
document
.
getElementById
(
'search_input'
).
value
=
''
;
document
.
getElementById
(
'search_input'
).
value
=
''
;
...
@@ -1306,7 +1311,7 @@ function send() {
...
@@ -1306,7 +1311,7 @@ function send() {
traditional
:
true
,
traditional
:
true
,
contentType
:
"application/json; charset=utf-8"
,
contentType
:
"application/json; charset=utf-8"
,
data
:
JSON
.
stringify
(
updates
),
data
:
JSON
.
stringify
(
updates
),
success
:
function
(
data
)
{},
success
:
function
()
{},
error
:
function
()
{
error
:
function
()
{
closeModal
();
closeModal
();
alert
(
'Erreur dans l
\'
envoi du rapport.'
);
alert
(
'Erreur dans l
\'
envoi du rapport.'
);
...
@@ -1360,6 +1365,7 @@ function openErrorReport() {
...
@@ -1360,6 +1365,7 @@ function openErrorReport() {
// this is necessary because default behavior is overwritten by the listener defined in jquery.pos.js;
// this is necessary because default behavior is overwritten by the listener defined in jquery.pos.js;
$
(
"#error_report"
).
keypress
(
function
(
e
)
{
$
(
"#error_report"
).
keypress
(
function
(
e
)
{
var
key
=
e
.
keyCode
;
var
key
=
e
.
keyCode
;
if
(
key
===
13
)
{
if
(
key
===
13
)
{
this
.
value
+=
"
\
n"
;
this
.
value
+=
"
\
n"
;
}
}
...
@@ -1378,7 +1384,7 @@ function saveErrorReport() {
...
@@ -1378,7 +1384,7 @@ function saveErrorReport() {
// Save comments in all orders
// Save comments in all orders
for
(
order_id
of
Object
.
keys
(
orders
))
{
for
(
order_id
of
Object
.
keys
(
orders
))
{
orders
[
order_id
].
user_comments
=
user_comments
;
orders
[
order_id
].
user_comments
=
user_comments
;
update_distant_order
(
order_id
)
update_distant_order
(
order_id
)
;
}
}
document
.
getElementById
(
"search_input"
).
focus
();
document
.
getElementById
(
"search_input"
).
focus
();
...
@@ -1589,6 +1595,12 @@ $(document).ready(function() {
...
@@ -1589,6 +1595,12 @@ $(document).ready(function() {
});
});
// TODO on sync change : redirect (cf order_helper)
// TODO on sync change : redirect (cf order_helper)
sync
.
on
(
'change'
,
function
(
info
)
{
console
.
log
(
info
);
}).
on
(
'error'
,
function
(
err
)
{
console
.
log
(
err
);
});
// TODO insert fingerprint & timestamp on access to order
// TODO insert fingerprint & timestamp on access to order
// Disable alert errors from datatables
// Disable alert errors from datatables
...
@@ -1653,7 +1665,8 @@ $(document).ready(function() {
...
@@ -1653,7 +1665,8 @@ $(document).ready(function() {
/* Get order info from couchdb */
/* Get order info from couchdb */
// Get order groups
// Get order groups
let
order_groups
=
[]
let
order_groups
=
[];
dbc
.
get
(
"grouped_orders"
).
then
((
doc
)
=>
{
dbc
.
get
(
"grouped_orders"
).
then
((
doc
)
=>
{
order_groups
=
doc
.
groups
;
order_groups
=
doc
.
groups
;
...
@@ -1680,6 +1693,7 @@ $(document).ready(function() {
...
@@ -1680,6 +1693,7 @@ $(document).ready(function() {
for
(
let
order_id
of
group_ids
)
{
for
(
let
order_id
of
group_ids
)
{
// find order
// find order
let
order
=
result
.
rows
.
find
(
el
=>
el
.
id
==
'order_'
+
order_id
);
let
order
=
result
.
rows
.
find
(
el
=>
el
.
id
==
'order_'
+
order_id
);
order
=
order
.
doc
;
order
=
order
.
doc
;
orders
[
order_id
]
=
order
;
orders
[
order_id
]
=
order
;
...
@@ -1710,6 +1724,7 @@ $(document).ready(function() {
...
@@ -1710,6 +1724,7 @@ $(document).ready(function() {
})
})
.
catch
(
function
(
e
)
{
.
catch
(
function
(
e
)
{
let
msg
=
(
'message'
in
e
&&
'name'
in
e
)
?
e
.
name
+
' : '
+
e
.
message
:
''
;
let
msg
=
(
'message'
in
e
&&
'name'
in
e
)
?
e
.
name
+
' : '
+
e
.
message
:
''
;
err
=
{
msg
,
ctx
:
'page init - get orders from couchdb'
,
details
:
e
};
err
=
{
msg
,
ctx
:
'page init - get orders from couchdb'
,
details
:
e
};
console
.
error
(
err
);
console
.
error
(
err
);
report_JS_error
(
err
,
'reception'
);
report_JS_error
(
err
,
'reception'
);
...
@@ -1721,6 +1736,7 @@ $(document).ready(function() {
...
@@ -1721,6 +1736,7 @@ $(document).ready(function() {
})
})
.
catch
(
function
(
e
)
{
.
catch
(
function
(
e
)
{
let
msg
=
(
'message'
in
e
&&
'name'
in
e
)
?
e
.
name
+
' : '
+
e
.
message
:
''
;
let
msg
=
(
'message'
in
e
&&
'name'
in
e
)
?
e
.
name
+
' : '
+
e
.
message
:
''
;
err
=
{
msg
,
ctx
:
'page init - get grouped orders'
,
details
:
e
};
err
=
{
msg
,
ctx
:
'page init - get grouped orders'
,
details
:
e
};
console
.
error
(
err
);
console
.
error
(
err
);
report_JS_error
(
err
,
'reception'
);
report_JS_error
(
err
,
'reception'
);
...
...
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