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
0c9150b6
Commit
0c9150b6
authored
Jun 27, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REC: dont display add produt input when no products to add
parent
1bc514ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
20 deletions
+43
-20
reception_style.css
reception/static/css/reception_style.css
+5
-0
reception_produits.js
reception/static/js/reception_produits.js
+31
-20
reception_produits.html
templates/reception/reception_produits.html
+7
-0
No files found.
reception/static/css/reception_style.css
View file @
0c9150b6
...
...
@@ -215,6 +215,11 @@ tr.odd td.row_product_no_qty {
display
:
none
;
}
.no_products_to_add_area
{
margin
:
2rem
0
;
/* display: none; */
}
.search_products_to_add_area
{
margin
:
2rem
0
;
display
:
flex
;
...
...
reception/static/js/reception_produits.js
View file @
0c9150b6
...
...
@@ -411,6 +411,11 @@ function fetch_suppliers_products() {
contentType
:
"application/json; charset=utf-8"
,
success
:
function
(
data
)
{
suppliers_products
=
data
.
res
.
products
;
// Filter supplier products on products already in orders
suppliers_products
=
suppliers_products
.
filter
(
p
=>
list_to_process
.
findIndex
(
ptp
=>
ptp
.
product_id
[
1
]
===
p
.
name
)
===
-
1
);
suppliers_products
=
suppliers_products
.
filter
(
p
=>
list_processed
.
findIndex
(
pp
=>
pp
.
product_id
[
1
]
===
p
.
name
)
===
-
1
);
closeModal
();
set_add_products_modal
();
},
...
...
@@ -1814,7 +1819,7 @@ function add_products_action() {
}
}
if
(
qty_inputs
.
length
>
0
&&
has_empty_qty_input
===
false
)
{
if
(
products_to_add
.
length
>
0
&&
qty_inputs
.
length
>
0
&&
has_empty_qty_input
===
false
)
{
create_orders
();
}
}
...
...
@@ -2039,16 +2044,10 @@ function openErrorReport() {
* If extists, destroys instance and recreate it.
* Filter autocomplete data by removing products already selected.
*/
function
set_products_autocomplete
()
{
// Filter autocomplete products on products already in orders
let
autocomplete_products
=
suppliers_products
.
filter
(
p
=>
list_to_process
.
findIndex
(
ptp
=>
ptp
.
product_id
[
1
]
===
p
.
name
)
===
-
1
);
autocomplete_products
=
autocomplete_products
.
filter
(
p
=>
list_processed
.
findIndex
(
pp
=>
pp
.
product_id
[
1
]
===
p
.
name
)
===
-
1
);
console
.
log
(
products_to_add
);
function
set_products_autocomplete
()
{
// Filter autocomplete products on products already selected
autocomplete_products
=
autocomplete_products
.
filter
(
p
=>
products_to_add
.
findIndex
(
pta
=>
pta
.
name
===
p
.
name
)
===
-
1
);
let
autocomplete_products
=
autocomplete_products
.
filter
(
p
=>
products_to_add
.
findIndex
(
pta
=>
pta
.
name
===
p
.
name
)
===
-
1
);
try
{
$
(
"#modal .search_product_input"
).
autocomplete
(
"destroy"
);
}
catch
(
error
)
{
...
...
@@ -2108,20 +2107,32 @@ function remove_product_line(e) {
}
/**
* Set & display the modal to search products
* Set & display the modal to search products.
* If no products to add, display the according modal.
*/
function
set_add_products_modal
()
{
let
add_products_modal
=
$
(
"#modal_add_products"
);
openModal
(
add_products_modal
.
html
(),
add_products_action
,
'Ajouter les produits'
,
false
);
if
(
suppliers_products
.
length
===
0
)
{
let
modal_no_product_to_add
=
$
(
"#modal_no_product_to_add"
);
set_products_autocomplete
();
openModal
(
modal_no_product_to_add
.
html
(),
()
=>
{},
'OK'
);
}
else
{
let
add_products_modal
=
$
(
"#modal_add_products"
);
openModal
(
add_products_modal
.
html
(),
add_products_action
,
'Ajouter les produits'
,
false
);
set_products_autocomplete
();
}
}
/**
* Init the page according to order(s) data (texts, colors, events...)
...
...
templates/reception/reception_produits.html
View file @
0c9150b6
...
...
@@ -208,6 +208,13 @@
</div>
<hr
/>
</div>
<div
id=
"modal_no_product_to_add"
>
<h3>
Ajouter des produits à la commande
</h3>
<div
class=
"no_products_to_add_area"
>
Aucun produit à ajouter : tous les produits de ce(s) fournisseur(s) sont déjà dans la commande.
</div>
<hr
/>
</div>
<div
id=
"add_product_line_template"
>
<div
class=
"add_product_line"
>
<div
class=
"product_name add_product_line_item"
></div>
...
...
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