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
4159459d
Commit
4159459d
authored
Jun 24, 2022
by
Félicie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '3292-alert-message-barrecode' into 'dev_cooperatic'
alert changed See merge request
!183
parents
f962b763
453c21a0
Pipeline
#2271
passed with stage
in 1 minute 24 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
29 deletions
+34
-29
shelfs_admin.css
shelfs/static/css/shelfs_admin.css
+1
-1
shelfs_admin.js
shelfs/static/js/shelfs_admin.js
+27
-27
admin.html
templates/shelfs/admin.html
+6
-1
No files found.
shelfs/static/css/shelfs_admin.css
View file @
4159459d
...
...
@@ -5,7 +5,7 @@
padding
:
20px
;
}
span
.shelf
{
font-weight
:
bold
;}
button
.add-products
{
display
:
none
;}
.add-products
{
display
:
none
;}
td
.p_nb
,
td
.products
.fa-plus-circle
,
...
...
shelfs/static/js/shelfs_admin.js
View file @
4159459d
...
...
@@ -16,7 +16,6 @@ var main_content = $('#main-content'),
adding_pdts_tpl
=
$
(
'#adding-products'
).
clone
()
.
removeAttr
(
'id'
),
active_phase
=
'main'
,
add_pdts_btn_text
=
'AJOUTER AU RAYON'
,
add_to_shelf_product_ids
=
[],
barcodes
=
null
;
...
...
@@ -396,32 +395,29 @@ var addProductToList = async function(barcode) {
//It could also be a wrong reading one
odoo_product
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
if
(
odoo_product
)
{
if
(
odoo_product
===
null
)
{
alert
(
barcode
+
" : ce code-barre est inconnu, merci d'apporter le produit à un salarié."
);
}
else
{
if
(
is_product_in_shelf_adding_queue_list
(
odoo_product
.
data
[
barcodes
.
keys
.
id
]))
{
alert
(
"Produit déjà présent dans la liste."
);
}
else
{
add_to_shelf_product_ids
.
push
(
odoo_product
.
data
[
4
]);
if
(
odoo_product
===
null
)
{
alert
(
barcode
+
' : Code-barre inconnu'
);
}
else
{
var
pdt_line
=
$
(
'<tr>'
).
attr
(
'data-id'
,
odoo_product
.
data
[
barcodes
.
keys
.
id
])
.
attr
(
'data-bc'
,
odoo_product
.
barcode
)
.
addClass
(
'obc'
);
$
(
'<td>'
).
text
(
barcode
)
.
appendTo
(
pdt_line
);
$
(
'<td>'
).
text
(
odoo_product
.
barcode
)
.
appendTo
(
pdt_line
);
$
(
'<td>'
).
text
(
odoo_product
.
data
[
barcodes
.
keys
.
name
])
.
appendTo
(
pdt_line
);
$
(
'<td>'
).
html
(
odoo_product
.
data
[
barcodes
.
keys
.
list_price
]
+
" €"
)
.
appendTo
(
pdt_line
);
$
(
'<td>'
).
html
(
delete_icon
+
" "
+
print_icon
)
.
appendTo
(
pdt_line
);
adding_pdts_tpl
.
find
(
'#added_products tbody'
).
append
(
pdt_line
);
main_content
.
find
(
'button.add-products'
).
css
(
'display'
,
'block'
)
.
html
(
add_pdts_btn_text
);
}
var
pdt_line
=
$
(
'<tr>'
).
attr
(
'data-id'
,
odoo_product
.
data
[
barcodes
.
keys
.
id
])
.
attr
(
'data-bc'
,
odoo_product
.
barcode
)
.
addClass
(
'obc'
);
$
(
'<td>'
).
text
(
barcode
)
.
appendTo
(
pdt_line
);
$
(
'<td>'
).
text
(
odoo_product
.
barcode
)
.
appendTo
(
pdt_line
);
$
(
'<td>'
).
text
(
odoo_product
.
data
[
barcodes
.
keys
.
name
])
.
appendTo
(
pdt_line
);
$
(
'<td>'
).
html
(
odoo_product
.
data
[
barcodes
.
keys
.
list_price
]
+
" €"
)
.
appendTo
(
pdt_line
);
$
(
'<td>'
).
html
(
delete_icon
+
" "
+
print_icon
)
.
appendTo
(
pdt_line
);
adding_pdts_tpl
.
find
(
'#added_products tbody'
).
append
(
pdt_line
);
main_content
.
find
(
'.add-products'
).
css
(
'display'
,
'block'
)
}
}
};
...
...
@@ -438,7 +434,7 @@ var addProducts = async function() {
main_content
.
html
(
adding_pdts_tpl
);
active_phase
=
"adding_products"
;
main_content
.
find
(
'
button
.add-products'
).
css
(
'display'
,
'none'
);
main_content
.
find
(
'.add-products'
).
css
(
'display'
,
'none'
);
if
(
admin_ids
.
find
(
id
=>
id
==
getCookie
(
"uid"
)))
$
(
'.add-search'
).
show
();
};
...
...
@@ -455,7 +451,8 @@ var recordProductsAddedShelf = function() {
});
if
(
is_time_to
(
'add_pdts_to_shelf'
,
5000
))
{
// prevent double click or browser hic up bug
main_content
.
find
(
'button.add-products'
).
html
(
loading_img
);
openModal
();
// loading on
post_form
(
'/shelfs/admin/add_products'
,
{
bc
:
JSON
.
stringify
(
barcodes
),
shelf_id
:
id
},
...
...
@@ -471,6 +468,8 @@ var recordProductsAddedShelf = function() {
msg
+=
"
\
n"
+
bc
;
});
}
closeModal
();
alert
(
msg
);
backToMain
();
}
else
{
...
...
@@ -479,7 +478,8 @@ var recordProductsAddedShelf = function() {
else
if
(
typeof
rData
.
res
.
msg
!=
"undefined"
)
msg
=
rData
.
res
.
msg
;
alert
(
msg
);
main_content
.
find
(
'button.add-products'
).
html
(
add_pdts_btn_text
);
main_content
.
find
(
'.add-products'
).
show
();
closeModal
();
}
}
...
...
@@ -573,7 +573,7 @@ $(document).ready(function() {
$
(
document
).
on
(
'click'
,
'.obc .fa-trash'
,
deleteBarcodeFromList
);
$
(
document
).
on
(
'click'
,
'.obc .fa-print'
,
printProduct
);
$
(
document
).
on
(
'click'
,
'td.products .fa-plus-circle'
,
addProducts
);
$
(
document
).
on
(
'click'
,
'#main-content
button
.add-products'
,
recordProductsAddedShelf
);
$
(
document
).
on
(
'click'
,
'#main-content .add-products'
,
recordProductsAddedShelf
);
$
(
document
).
on
(
'click'
,
'td.p_nb'
,
showProductsList
);
try
{
if
(
admin_ids
.
find
(
id
=>
id
==
getCookie
(
"uid"
)))
{
...
...
templates/shelfs/admin.html
View file @
4159459d
...
...
@@ -70,7 +70,12 @@
</tbody>
</table>
<button
type=
"button"
class=
"btn--primary add-products"
></button>
<div
class =
"add-products"
>
<p>
VOUS POUVEZ AJOUTER PLUSIEURS PRODUITS A LA FOIS AVANT DE VALIDER
</p>
<button
type=
"button"
class=
"btn--primary"
>
Ajouter les produits au rayon
</button>
</div>
</div>
<div
id=
"main-table-wrap"
>
<table
class=
"display shelfs"
width=
"99%"
cellspacing=
"0"
></table>
...
...
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