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
0f180214
Commit
0f180214
authored
Jul 26, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add button to metabase
parent
80eee51d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
121 additions
and
38 deletions
+121
-38
config_lacagette.py
coops_configurations/config_lacagette.py
+3
-0
oders_helper_style.css
orders/static/css/oders_helper_style.css
+64
-19
orders_helper.js
orders/static/js/orders_helper.js
+28
-8
views.py
orders/views.py
+2
-1
helper.html
templates/orders/helper.html
+24
-10
No files found.
coops_configurations/config_lacagette.py
View file @
0f180214
...
@@ -109,3 +109,6 @@ RECEPTION_PB = "Ici, vous pouvez signaler toute anomalie lors d'une réception,
...
@@ -109,3 +109,6 @@ RECEPTION_PB = "Ici, vous pouvez signaler toute anomalie lors d'une réception,
# display or not column "Autres" in reception process
# display or not column "Autres" in reception process
DISPLAY_COL_AUTRES
=
False
DISPLAY_COL_AUTRES
=
False
# URL to the metabase dashboard for orders helper
ORDERS_HELPER_METABASE_URL
=
"https://metabase.lacagette-coop.fr/dashboard/16"
orders/static/css/oders_helper_style.css
View file @
0f180214
...
@@ -31,6 +31,26 @@
...
@@ -31,6 +31,26 @@
background-color
:
#a1a2a3
;
background-color
:
#a1a2a3
;
}
}
.link_as_button
:hover
{
text-decoration
:
none
;
color
:
white
;
}
.link_as_button
:active
{
text-decoration
:
none
;
color
:
white
;
}
.link_as_button
:focus
{
text-decoration
:
none
;
color
:
white
;
}
.remove_order_modal_text
{
font-size
:
2rem
;
}
.remove_order_name
{
font-weight
:
bold
;
}
/* - Order selection screen */
/* - Order selection screen */
#new_order_area
{
#new_order_area
{
margin-bottom
:
40px
;
margin-bottom
:
40px
;
...
@@ -59,17 +79,14 @@
...
@@ -59,17 +79,14 @@
}
}
.remove_order_icon
{
.remove_order_icon
{
flex
:
0
1
auto
;
flex
:
0
1
auto
;
color
:
#
B22222
;
color
:
#
912930
;
margin-left
:
5px
;
margin-left
:
5px
;
cursor
:
pointer
;
cursor
:
pointer
;
z-index
:
2
;
z-index
:
2
;
transform
:
scale
(
1.2
);
}
}
.remove_order_icon
:hover
{
.remove_order_icon
:hover
{
color
:
#CD5C5C
;
color
:
#e62720
;
}
.remove_order_name
{
font-weight
:
bold
;
}
}
.order_last_update
{
.order_last_update
{
...
@@ -104,6 +121,47 @@
...
@@ -104,6 +121,47 @@
justify-content
:
flex-start
;
justify-content
:
flex-start
;
}
}
.right_action_buttons
{
display
:
flex
;
}
#actions_buttons_wrapper
{
position
:
relative
;
margin-left
:
5px
;
}
#toggle_action_buttons
{
width
:
250px
;
border
:
1px
solid
black
;
position
:
relative
;
}
#toggle_action_buttons
:hover
{
background-color
:
#c7cace
;
}
.toggle_action_buttons_icon
{
position
:
absolute
;
top
:
50%
;
transform
:
translateY
(
-50%
);
right
:
15px
;
}
#actions_buttons_container
{
position
:
absolute
;
display
:
flex
;
flex-direction
:
column
;
width
:
250px
;
display
:
none
;
}
.action_button
{
width
:
100%
;
min-height
:
45px
;
border-color
:
black
;
border-style
:
solid
;
border-width
:
0
1px
1px
1px
;
}
/* -- Order data */
/* -- Order data */
#order_data_container
{
#order_data_container
{
font-size
:
1.8rem
;
font-size
:
1.8rem
;
...
@@ -285,19 +343,6 @@
...
@@ -285,19 +343,6 @@
margin-top
:
10px
;
margin-top
:
10px
;
}
}
.download_order_file_button
:hover
{
text-decoration
:
none
;
color
:
white
;
}
.download_order_file_button
:active
{
text-decoration
:
none
;
color
:
white
;
}
.download_order_file_button
:focus
{
text-decoration
:
none
;
color
:
white
;
}
#recap_delivery_date
{
#recap_delivery_date
{
font-weight
:
bold
;
font-weight
:
bold
;
}
}
...
...
orders/static/js/orders_helper.js
View file @
0f180214
...
@@ -625,10 +625,10 @@ function set_product_npa(p_id, npa) {
...
@@ -625,10 +625,10 @@ function set_product_npa(p_id, npa) {
// Give time for modal to fade
// Give time for modal to fade
setTimeout
(
function
()
{
setTimeout
(
function
()
{
$
(
".actions_buttons_area .right
s
_buttons"
).
notify
(
$
(
".actions_buttons_area .right
_action
_buttons"
).
notify
(
"Produit passé en NPA !"
,
"Produit passé en NPA !"
,
{
{
p
osition
:
"bottom right"
,
elementP
osition
:
"bottom right"
,
className
:
"success"
,
className
:
"success"
,
arrowShow
:
false
arrowShow
:
false
}
}
...
@@ -696,7 +696,7 @@ function generate_inventory() {
...
@@ -696,7 +696,7 @@ function generate_inventory() {
modal_create_inventory
.
html
(),
modal_create_inventory
.
html
(),
()
=>
{
()
=>
{
if
(
is_time_to
(
'validate_generate_inventory'
))
{
if
(
is_time_to
(
'validate_generate_inventory'
))
{
$
(
'#
do_inventory
'
).
empty
()
$
(
'#
toggle_action_buttons .button_content
'
).
empty
()
.
append
(
`<i class="fas fa-spinner fa-spin"></i>`
);
.
append
(
`<i class="fas fa-spinner fa-spin"></i>`
);
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
...
@@ -710,13 +710,13 @@ function generate_inventory() {
...
@@ -710,13 +710,13 @@ function generate_inventory() {
// Give time for modal to fade
// Give time for modal to fade
setTimeout
(
function
()
{
setTimeout
(
function
()
{
$
(
'#
do_inventory
'
).
empty
()
$
(
'#
toggle_action_buttons .button_content
'
).
empty
()
.
append
(
`
Faire un inventaire
`
);
.
append
(
`
Actions
`
);
$
(
'#
do_inventory
'
).
notify
(
$
(
'#
toggle_action_buttons
'
).
notify
(
"Inventaire créé !"
,
"Inventaire créé !"
,
{
{
globalPosition
:
"bottom center
"
,
elementPosition
:
"bottom right
"
,
className
:
"success"
className
:
"success"
,
}
}
);
);
},
200
);
},
200
);
...
@@ -1641,6 +1641,8 @@ function display_products(params) {
...
@@ -1641,6 +1641,8 @@ function display_products(params) {
* Unselect all rows from datatable.
* Unselect all rows from datatable.
*/
*/
function
unselect_all_rows
()
{
function
unselect_all_rows
()
{
$
(
"#select_all_products_cb"
).
prop
(
"checked"
,
false
);
products_table
.
rows
().
every
(
function
()
{
products_table
.
rows
().
every
(
function
()
{
const
node
=
$
(
this
.
node
());
const
node
=
$
(
this
.
node
());
...
@@ -1895,6 +1897,10 @@ $(document).ready(function() {
...
@@ -1895,6 +1897,10 @@ $(document).ready(function() {
init_pouchdb_sync
();
init_pouchdb_sync
();
// Main screen
// Main screen
if
(
metabase_url
!==
''
)
{
$
(
'#access_metabase'
).
show
();
}
$
(
"#coverage_form"
).
on
(
"submit"
,
function
(
e
)
{
$
(
"#coverage_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
if
(
is_time_to
(
'submit_coverage_form'
,
1000
))
{
if
(
is_time_to
(
'submit_coverage_form'
,
1000
))
{
...
@@ -1914,6 +1920,20 @@ $(document).ready(function() {
...
@@ -1914,6 +1920,20 @@ $(document).ready(function() {
}
}
});
});
$
(
"#toggle_action_buttons"
).
on
(
"click"
,
function
(
e
)
{
$
(
'#actions_buttons_container'
).
toggle
();
});
// Close dropdown menu on click outside
$
(
document
).
click
(
function
(
event
)
{
let
target
=
$
(
event
.
target
);
if
(
!
target
.
closest
(
'#actions_buttons_wrapper'
).
length
&&
$
(
'#actions_buttons_container'
).
is
(
":visible"
)
)
{
$
(
'#actions_buttons_container'
).
hide
();
}
});
$
(
"#supplier_form"
).
on
(
"submit"
,
function
(
e
)
{
$
(
"#supplier_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
...
...
orders/views.py
View file @
0f180214
...
@@ -19,7 +19,8 @@ def helper(request):
...
@@ -19,7 +19,8 @@ def helper(request):
'title'
:
'Aide à la commande'
,
'title'
:
'Aide à la commande'
,
'couchdb_server'
:
settings
.
COUCHDB
[
'url'
],
'couchdb_server'
:
settings
.
COUCHDB
[
'url'
],
'db'
:
settings
.
COUCHDB
[
'dbs'
][
'orders'
],
'db'
:
settings
.
COUCHDB
[
'dbs'
][
'orders'
],
'odoo_server'
:
settings
.
ODOO
[
'url'
]
'odoo_server'
:
settings
.
ODOO
[
'url'
],
'metabase_url'
:
getattr
(
settings
,
'ORDERS_HELPER_METABASE_URL'
,
''
)
}
}
template
=
loader
.
get_template
(
'orders/helper.html'
)
template
=
loader
.
get_template
(
'orders/helper.html'
)
...
...
templates/orders/helper.html
View file @
0f180214
...
@@ -40,13 +40,26 @@
...
@@ -40,13 +40,26 @@
<button
type=
"button"
class=
"btn--danger"
id=
"back_to_order_selection_from_main"
>
<button
type=
"button"
class=
"btn--danger"
id=
"back_to_order_selection_from_main"
>
<i
class=
"fas fa-arrow-left"
></i>
Retour
<i
class=
"fas fa-arrow-left"
></i>
Retour
</button>
</button>
<div
class=
"rights_buttons"
>
<div
class=
"right_action_buttons"
>
<button
type=
"button"
class=
'btn--danger'
id=
"delete_order_button"
>
<a
class=
'btn--success link_as_button'
id=
"access_metabase"
style=
"display:none;"
href=
"{{metabase_url}}"
target=
"_blank"
>
Supprimer la commande
Stats Métabase
</button>
</a>
<button
type=
"button"
class=
'btn--primary'
id=
"do_inventory"
style=
"display:none;"
>
<div
id=
"actions_buttons_wrapper"
>
Faire un inventaire
<button
type=
"button"
class=
'btn'
id=
"toggle_action_buttons"
>
</button>
<span
class=
"button_content"
>
Actions
</span>
<i
class=
"fas fa-chevron-down toggle_action_buttons_icon"
></i>
</button>
<div
id=
"actions_buttons_container"
>
<button
type=
"button"
class=
'btn--primary action_button'
id=
"do_inventory"
style=
"display:none;"
>
Faire un inventaire
</button>
<button
type=
"button"
class=
'btn--danger action_button'
id=
"delete_order_button"
>
Supprimer la commande
</button>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -157,7 +170,7 @@
...
@@ -157,7 +170,7 @@
<h4
class=
"new_order_date_planned"
></h4>
<h4
class=
"new_order_date_planned"
></h4>
<div
class=
'download_order_file'
>
<div
class=
'download_order_file'
>
<i
class=
"fas fa-spinner fa-spin download_order_file_loading"
></i>
<i
class=
"fas fa-spinner fa-spin download_order_file_loading"
></i>
<a
class=
'btn--success download_order_file_button'
style=
"display:none;"
href=
"#"
>
<a
class=
'btn--success download_order_file_button
link_as_button
'
style=
"display:none;"
href=
"#"
>
Télécharger le fichier de commande
Télécharger le fichier de commande
</a>
</a>
</div>
</div>
...
@@ -180,8 +193,8 @@
...
@@ -180,8 +193,8 @@
<div
id=
"modal_remove_order"
>
<div
id=
"modal_remove_order"
>
<h3>
Attention !
</h3>
<h3>
Attention !
</h3>
<p>
<p
class=
"remove_order_modal_text"
>
Vous vous apprêtez à
supprimer
cette commande en cours :
<span
class=
"remove_order_name"
></span>
.
<br/>
Vous vous apprêtez à
<b
style=
"color: #d9534f;"
>
supprimer
</b>
cette commande en cours :
<span
class=
"remove_order_name"
></span>
.
<br/>
</p>
</p>
<p>
Êtez-vous sûr ?
</p>
<p>
Êtez-vous sûr ?
</p>
<hr/>
<hr/>
...
@@ -287,6 +300,7 @@
...
@@ -287,6 +300,7 @@
var
couchdb_dbname
=
'{{db}}'
;
var
couchdb_dbname
=
'{{db}}'
;
var
couchdb_server
=
'{{couchdb_server}}'
+
couchdb_dbname
;
var
couchdb_server
=
'{{couchdb_server}}'
+
couchdb_dbname
;
var
odoo_server
=
'{{odoo_server}}'
;
var
odoo_server
=
'{{odoo_server}}'
;
var
metabase_url
=
'{{metabase_url}}'
;
</script>
</script>
<script
src=
"{% static "
js
/
all_common
.
js
"
%}?
v=
"></script>
<script
src=
"{% static "
js
/
all_common
.
js
"
%}?
v=
"></script>
<script type="
text
/
javascript
"
src=
"{% static 'js/orders_helper.js' %}?v="
></script>
<script type="
text
/
javascript
"
src=
"{% static 'js/orders_helper.js' %}?v="
></script>
...
...
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