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
672c5269
Commit
672c5269
authored
Jul 08, 2022
by
François C.
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '3438-rec-unmerge-orders' into 'dev_cooperatic'
REC: unmerge orders See merge request
!193
parents
53f28cc4
3a8879bb
Pipeline
#2308
passed with stage
in 1 minute 23 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
24 deletions
+154
-24
reception_style.css
reception/static/css/reception_style.css
+23
-0
reception_index.js
reception/static/js/reception_index.js
+109
-14
reception_produits.js
reception/static/js/reception_produits.js
+7
-9
index.html
templates/reception/index.html
+15
-1
No files found.
reception/static/css/reception_style.css
View file @
672c5269
...
...
@@ -15,6 +15,11 @@ input[type="number"] {
margin-bottom
:
5px
;
}
.group_line_content
{
display
:
flex
;
align-items
:
center
;
}
#orders
tbody
tr
{
cursor
:
pointer
;
}
...
...
@@ -44,6 +49,24 @@ input[type="number"] {
color
:
#e62720
;
}
.group_partner_name
{
margin
:
0
3px
;
}
.goto_group_button
{
margin-left
:
10px
;
}
.ungroup_orders_icon
{
margin-left
:
15px
;
color
:
#d9534f
;
cursor
:
pointer
;
}
.ungroup_precisions
{
font-style
:
italic
;
}
/* PRODUITS */
.page_body
{
height
:
100%
;
...
...
reception/static/js/reception_index.js
View file @
672c5269
...
...
@@ -289,6 +289,71 @@ function group_action() {
}
}
/**
* Remove an orders group.
* Correctly set orders data so ungrouping goes smoothly.
*
* @param {int} group_index index in the groups array
*/
function
ungroup
(
group_index
)
{
let
group
=
order_groups
.
groups
[
group_index
];
for
(
let
order_id
of
group
)
{
let
order_doc_id
=
'order_'
+
order_id
;
// Delete group data in each order
dbc
.
get
(
order_doc_id
).
then
((
doc
)
=>
{
if
(
"updated_products"
in
doc
)
{
for
(
let
i
=
0
;
i
<
doc
.
updated_products
.
length
;
i
++
)
{
delete
(
doc
.
updated_products
[
i
].
other_orders_data
);
}
doc
.
last_update
=
{
timestamp
:
Date
.
now
(),
fingerprint
:
fingerprint
};
dbc
.
put
(
doc
).
then
(()
=>
{})
.
catch
((
err
)
=>
{
error
=
{
msg
:
'Erreur dans la creation de la commande dans couchdb'
,
ctx
:
'create_order_doc'
,
details
:
err
};
report_JS_error
(
error
,
'reception'
);
console
.
log
(
error
);
});
}
})
.
catch
(
function
(
err
)
{
error
=
{
msg
:
'Erreur dans la récupération du doc d
\'
une commande pour suppression d
\'
un groupe'
,
ctx
:
'ungroup'
,
details
:
err
};
report_JS_error
(
error
,
'reception'
);
console
.
log
(
error
);
});
}
order_groups
.
groups
.
splice
(
group_index
,
1
);
dbc
.
put
(
order_groups
,
(
err
,
result
)
=>
{
if
(
!
err
)
{
order_groups
.
_rev
=
result
.
rev
;
display_orders_table
();
display_grouped_orders
();
}
else
{
error
=
{
msg
:
'Erreur dans la mise à jour du doc des groupes pour la suppression'
,
ctx
:
'ungroup'
,
details
:
err
};
report_JS_error
(
error
,
'reception'
);
console
.
log
(
error
);
}
});
}
/* DISPLAY */
/**
...
...
@@ -296,7 +361,6 @@ function group_action() {
* Remove the grouped orders from the order table to prevent grouping in multiple groups.
*/
function
display_grouped_orders
()
{
if
(
table_orders
!==
null
)
{
var
display_something
=
false
;
...
...
@@ -326,33 +390,57 @@ function display_grouped_orders() {
// Display group
display_something
=
true
;
document
.
getElementById
(
"container_groups"
).
hidden
=
false
;
let
group_row
=
`<li class="group_line"> Commandes de `
;
let
group_row
=
`<li class="group_line"
group_index="
${
group_index
}
"><span class="group_line_content"
> Commandes de `
;
for
(
let
i
in
group_orders
)
{
if
(
i
==
group_orders
.
length
-
1
)
{
// last element of list
group_row
+=
"<b>"
+
group_orders
[
i
].
partner
+
"</b> du "
+
group_orders
[
i
].
date_order
+
" : "
;
}
else
{
group_row
+=
"<b>"
+
group_orders
[
i
].
partner
+
"</b> du "
+
group_orders
[
i
].
date_order
+
", "
;
group_row
+=
`<b class="group_partner_name">
${
group_orders
[
i
].
partner
}
</b> du
${
group_orders
[
i
].
date_order
}
`
;
if
(
i
!=
group_orders
.
length
-
1
)
{
// for other elements than last of list
group_row
+=
", "
;
}
}
if
(
group_orders
[
0
].
reception_status
==
'False'
)
{
group_row
+=
"<button class='btn--primary' onClick='group_goto("
+
group_index
+
")'>Compter les produits</button>"
;
group_row
+=
`
<button class='btn--primary goto_group_button' onClick='group_goto(
${
group_index
}
)'>
Compter les produits
</button>`
;
}
else
{
group_row
+=
"<button class='btn--success' onClick='group_goto("
+
group_index
+
")'>Mettre à jour les prix</button>"
;
group_row
+=
`
<button class='btn--success goto_group_button' onClick='group_goto(
${
group_index
}
)'>
Mettre à jour les prix
</button>`
;
}
group_row
+=
"</li>"
;
group_row
+=
`<i class="fas fa-times fa-lg ungroup_orders_icon"></i>`
;
group_row
+=
"</span></li>"
;
groups_display_content
+=
group_row
;
}
}
if
(
display_something
===
true
)
{
$
(
'#container_groups'
).
show
();
$
(
'#groups_items'
).
append
(
groups_display_content
);
setTimeout
(()
=>
{
$
(
".ungroup_orders_icon"
).
off
(
"click"
);
$
(
".ungroup_orders_icon"
).
on
(
"click"
,
function
()
{
let
modal_template
=
$
(
"#modal_delete_group"
);
let
group_to_delete_index
=
$
(
this
).
closest
(
".group_line"
)
.
attr
(
"group_index"
);
openModal
(
modal_template
.
html
(),
()
=>
{
ungroup
(
group_to_delete_index
);
},
"Confirmer"
);
});
},
100
);
}
else
{
$
(
'#container_groups'
).
hide
();
}
}
}
...
...
@@ -593,7 +681,6 @@ $(document).ready(function() {
order_groups
=
doc
;
})
.
catch
(
function
(
err
)
{
console
.
log
(
err
);
if
(
err
.
status
===
404
)
{
// Create if doesn't exist
dbc
.
put
(
order_groups
,
(
err
,
result
)
=>
{
...
...
@@ -604,6 +691,14 @@ $(document).ready(function() {
console
.
log
(
err
);
}
});
}
else
{
error
=
{
msg
:
'Erreur dans la récupération des groupes dans couchdb'
,
ctx
:
'document_init'
,
details
:
err
};
report_JS_error
(
error
,
'reception'
);
console
.
log
(
error
);
}
});
...
...
reception/static/js/reception_produits.js
View file @
672c5269
...
...
@@ -631,14 +631,14 @@ function initLists() {
title
:
"Prix unit"
,
className
:
"dt-body-center"
,
visible
:
(
reception_status
==
"qty_valid"
),
width
:
"5%"
,
width
:
"5%"
},
{
title
:
"Editer"
,
defaultContent
:
"<a class='btn' id='processed_line_edit' href='#'><i class='far fa-edit'></i></a>"
,
className
:
"dt-body-center"
,
orderable
:
false
,
width
:
"5%"
,
width
:
"5%"
},
{
title
:
"Autres"
,
...
...
@@ -666,12 +666,10 @@ function initLists() {
// For grouped orders, order first by number of order, then by product id
if
(
is_grouped_order
())
{
table_to_process_ordering
.
push
(
[
table_to_process_ordering
.
push
([
1
,
"asc"
]
)
]);
}
// Init table for to_process content
...
...
@@ -944,7 +942,7 @@ function initLists() {
alert
(
'Mauvais mot de passe !'
);
}
}
else
{
alert
(
"Il y a déjà un produit dans la zone d'édition. Terminez d'abord d'éditer ce produit."
)
alert
(
"Il y a déjà un produit dans la zone d'édition. Terminez d'abord d'éditer ce produit."
)
;
}
});
...
...
@@ -975,7 +973,7 @@ function initLists() {
alert
(
'Mauvais mot de passe !'
);
}
}
else
{
alert
(
"Il y a déjà un produit dans la zone d'édition. Terminez d'abord d'éditer ce produit."
)
alert
(
"Il y a déjà un produit dans la zone d'édition. Terminez d'abord d'éditer ce produit."
)
;
}
});
}
...
...
@@ -1274,7 +1272,7 @@ function editProductInfo (productToEdit, value = null, batch = false) {
productToEdit
.
product_qty_package
=
1
;
productToEdit
.
package_qty
=
productToEdit
.
product_qty
;
orders
[
productToEdit
.
id_po
][
"previous_steps_data"
][
"False"
][
"updated_products"
].
push
(
productToEdit
)
orders
[
productToEdit
.
id_po
][
"previous_steps_data"
][
"False"
][
"updated_products"
].
push
(
productToEdit
)
;
}
else
{
productToEdit
.
product_qty
=
newValue
;
productToEdit
.
package_qty
=
productToEdit
.
product_qty
;
...
...
templates/reception/index.html
View file @
672c5269
...
...
@@ -59,7 +59,21 @@
</p><br/>
<p>
Voulez-vous quand même y accéder ?
</p>
<hr/>
</div>
</div>
<div
id=
"modal_delete_group"
>
<h3>
Attention !
</h3>
<p>
Vous vous apprêtez à défusionner un groupe de commandes.
</p>
<p>
Les données de réception des différentes commandes seront conservées.
<br/>
<span
class=
"ungroup_precisions"
>
Attention aux produits se trouvant dans plusieurs commandes !
Bien vérifier les données dans chaque commande.
</span>
</p>
<p>
Êtez-vous sûr.e ?
<br/>
</p>
</div>
</div>
<br/>
...
...
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