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
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
Alexis AOUN
third-party
Commits
ec24f072
Commit
ec24f072
authored
Jul 02, 2021
by
Damien Moulard
Committed by
Alexis Aoun
Jul 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
login in aide à la commande
parent
cdbd0c05
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
228 additions
and
213 deletions
+228
-213
oders_helper_style.css
orders/static/css/oders_helper_style.css
+1
-1
orders_helper.js
orders/static/js/orders_helper.js
+214
-207
helper.html
templates/orders/helper.html
+13
-5
No files found.
orders/static/css/oders_helper_style.css
View file @
ec24f072
...
...
@@ -2,7 +2,7 @@
position
:
relative
;
}
.page_content
{
.page_content
,
.login_area
{
position
:
absolute
;
top
:
0
;
left
:
0
;
...
...
orders/static/js/orders_helper.js
View file @
ec24f072
...
...
@@ -1637,243 +1637,250 @@ function init_pouchdb_sync() {
$
(
document
).
ready
(
function
()
{
fingerprint
=
new
Fingerprint
({
canvas
:
true
}).
get
();
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
if
(
coop_is_connected
())
{
$
(
'#new_order_form'
).
show
();
$
(
'#existing_orders_area'
).
show
();
openModal
();
fingerprint
=
new
Fingerprint
({
canvas
:
true
}).
get
();
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
init_pouchdb_sync
();
openModal
();
// Main screen
$
(
"#coverage_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
if
(
is_time_to
(
'submit_coverage_form'
,
1000
))
{
let
val
=
$
(
"#coverage_days_input"
).
val
();
val
=
parseInt
(
val
);
if
(
!
isNaN
(
val
))
{
order_doc
.
coverage_days
=
val
;
compute_products_coverage_qties
();
update_cdb_order
();
update_main_screen
();
}
else
{
$
(
"#coverage_days_input"
).
val
(
order_doc
.
coverage_days
);
alert
(
`Valeur non valide pour le nombre de jours de couverture !`
);
init_pouchdb_sync
();
// Main screen
$
(
"#coverage_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
if
(
is_time_to
(
'submit_coverage_form'
,
1000
))
{
let
val
=
$
(
"#coverage_days_input"
).
val
();
val
=
parseInt
(
val
);
if
(
!
isNaN
(
val
))
{
order_doc
.
coverage_days
=
val
;
compute_products_coverage_qties
();
update_cdb_order
();
update_main_screen
();
}
else
{
$
(
"#coverage_days_input"
).
val
(
order_doc
.
coverage_days
);
alert
(
`Valeur non valide pour le nombre de jours de couverture !`
);
}
}
}
});
});
$
(
"#supplier_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
if
(
is_time_to
(
'add_product'
,
1000
))
{
add_supplier
();
}
});
$
(
"#supplier_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
if
(
is_time_to
(
'add_product'
,
1000
))
{
add_supplier
();
}
});
$
(
"#product_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
if
(
is_time_to
(
'add_product'
,
1000
))
{
add_product
();
}
});
$
(
"#product_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
if
(
is_time_to
(
'add_product'
,
1000
))
{
add_product
();
}
});
$
(
"#do_inventory"
).
on
(
"click"
,
function
()
{
if
(
is_time_to
(
'generate_inventory'
,
1000
))
{
generate_inventory
();
}
});
$
(
"#do_inventory"
).
on
(
"click"
,
function
()
{
if
(
is_time_to
(
'generate_inventory'
,
1000
))
{
generate_inventory
();
}
});
$
(
'#back_to_order_selection_from_main'
).
on
(
'click'
,
function
()
{
if
(
is_time_to
(
'back_to_order_selection_from_main'
,
1000
))
{
back
();
}
});
$
(
'#back_to_order_selection_from_main'
).
on
(
'click'
,
function
()
{
if
(
is_time_to
(
'back_to_order_selection_from_main'
,
1000
))
{
back
();
}
});
$
(
'#create_orders'
).
on
(
'click'
,
function
()
{
if
(
is_time_to
(
'create_orders'
,
1000
))
{
let
modal_create_order
=
$
(
'#templates #modal_create_order'
);
modal_create_order
.
find
(
'.suppliers_date_planned_area'
).
empty
();
for
(
let
supplier
of
selected_suppliers
)
{
let
supplier_date_planned_template
=
$
(
'#templates #modal_create_order__supplier_date_planned'
);
$
(
'#create_orders'
).
on
(
'click'
,
function
()
{
if
(
is_time_to
(
'create_orders'
,
1000
))
{
let
modal_create_order
=
$
(
'#templates #modal_create_order'
);
modal_create_order
.
find
(
'.suppliers_date_planned_area'
).
empty
();
supplier_date_planned_template
.
find
(
".supplier_name"
).
text
(
supplier
.
display_name
);
supplier_date_planned_template
.
find
(
".modal_input_container"
).
attr
(
'id'
,
`container_date_planned_supplier_
${
supplier
.
id
}
`
);
modal_create_order
.
find
(
'.suppliers_date_planned_area'
).
append
(
supplier_date_planned_template
.
html
());
}
openModal
(
modal_create_order
.
html
(),
()
=>
{
if
(
is_time_to
(
'validate_create_orders'
))
{
create_orders
();
}
},
'Valider'
,
false
);
// Add id to input once modal is displayed
for
(
let
supplier
of
selected_suppliers
)
{
$
(
`#modal #container_date_planned_supplier_
${
supplier
.
id
}
`
).
find
(
".supplier_date_planned"
).
attr
(
'id'
,
`date_planned_supplier_
${
supplier
.
id
}
`
);
}
$
(
"#modal .supplier_date_planned"
)
.
datepicker
({
defaultDate
:
"+1d"
,
minDate
:
new
Date
()
})
.
on
(
'change'
,
function
()
{
try
{
// When date input changes, try to read date
$
.
datepicker
.
parseDate
(
date_format
,
$
(
this
).
val
());
}
catch
{
alert
(
'Date invalide'
);
$
(
this
).
val
(
''
);
}
});
}
for
(
let
supplier
of
selected_suppliers
)
{
let
supplier_date_planned_template
=
$
(
'#templates #modal_create_order__supplier_date_planned'
);
return
0
;
});
supplier_date_planned_template
.
find
(
".supplier_name"
).
text
(
supplier
.
display_name
);
supplier_date_planned_template
.
find
(
".modal_input_container"
).
attr
(
'id'
,
`container_date_planned_supplier_
${
supplier
.
id
}
`
);
modal_create_order
.
find
(
'.suppliers_date_planned_area'
).
append
(
supplier_date_planned_template
.
html
());
}
openModal
(
modal_create_order
.
html
(),
()
=>
{
if
(
is_time_to
(
'validate_create_orders'
))
{
create_orders
();
}
},
'Valider'
,
false
);
// Add id to input once modal is displayed
for
(
let
supplier
of
selected_suppliers
)
{
$
(
`#modal #container_date_planned_supplier_
${
supplier
.
id
}
`
).
find
(
".supplier_date_planned"
).
attr
(
'id'
,
`date_planned_supplier_
${
supplier
.
id
}
`
);
}
$
(
"#modal .supplier_date_planned"
)
.
datepicker
({
defaultDate
:
"+1d"
,
minDate
:
new
Date
()
})
.
on
(
'change'
,
function
()
{
try
{
// When date input changes, try to read date
$
.
datepicker
.
parseDate
(
date_format
,
$
(
this
).
val
());
}
catch
{
alert
(
'Date invalide'
);
$
(
this
).
val
(
''
);
}
});
}
return
0
;
});
$
.
datepicker
.
regional
[
'fr'
]
=
{
monthNames
:
[
'Janvier'
,
'Fevrier'
,
'Mars'
,
'Avril'
,
'Mai'
,
'Juin'
,
'Juillet'
,
'Aout'
,
'Septembre'
,
'Octobre'
,
'Novembre'
,
'Decembre'
],
dayNamesMin
:
[
'Di'
,
'Lu'
,
'Ma'
,
'Me'
,
'Je'
,
'Ve'
,
'Sa'
],
dateFormat
:
date_format
};
$
.
datepicker
.
setDefaults
(
$
.
datepicker
.
regional
[
'fr'
]);
$
.
datepicker
.
regional
[
'fr'
]
=
{
monthNames
:
[
'Janvier'
,
'Fevrier'
,
'Mars'
,
'Avril'
,
'Mai'
,
'Juin'
,
'Juillet'
,
'Aout'
,
'Septembre'
,
'Octobre'
,
'Novembre'
,
'Decembre'
],
dayNamesMin
:
[
'Di'
,
'Lu'
,
'Ma'
,
'Me'
,
'Je'
,
'Ve'
,
'Sa'
],
dateFormat
:
date_format
};
$
.
datepicker
.
setDefaults
(
$
.
datepicker
.
regional
[
'fr'
]);
// Order selection screen
update_order_selection_screen
();
// Order selection screen
update_order_selection_screen
();
$
(
"#new_order_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
if
(
is_time_to
(
'submit_new_order_form'
,
1000
))
{
create_cdb_order
();
}
});
$
(
"#new_order_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
if
(
is_time_to
(
'submit_new_order_form'
,
1000
))
{
create_cdb_order
();
}
});
// Orders created screen
$
(
'#back_to_order_selection_from_orders_created'
).
on
(
'click'
,
function
()
{
if
(
is_time_to
(
'back_to_order_selection_from_orders_created'
,
1000
))
{
switch_screen
(
'order_selection'
,
'orders_created'
);
}
});
// Orders created screen
$
(
'#back_to_order_selection_from_orders_created'
).
on
(
'click'
,
function
()
{
if
(
is_time_to
(
'back_to_order_selection_from_orders_created'
,
1000
))
{
switch_screen
(
'order_selection'
,
'orders_created'
);
}
});
// Get suppliers
$
.
ajax
({
type
:
'GET'
,
url
:
"/orders/get_suppliers"
,
dataType
:
"json"
,
traditional
:
true
,
contentType
:
"application/json; charset=utf-8"
,
success
:
function
(
data
)
{
suppliers_list
=
data
.
res
;
// Get suppliers
$
.
ajax
({
type
:
'GET'
,
url
:
"/orders/get_suppliers"
,
dataType
:
"json"
,
traditional
:
true
,
contentType
:
"application/json; charset=utf-8"
,
success
:
function
(
data
)
{
suppliers_list
=
data
.
res
;
// Set up autocomplete on supplier input
$
(
"#supplier_input"
).
autocomplete
({
source
:
suppliers_list
.
map
(
a
=>
a
.
display_name
)
});
// Set up autocomplete on supplier input
$
(
"#supplier_input"
).
autocomplete
({
source
:
suppliers_list
.
map
(
a
=>
a
.
display_name
)
});
},
error
:
function
(
data
)
{
err
=
{
msg
:
"erreur serveur lors de la récupération des fournisseurs"
,
ctx
:
'get_suppliers'
};
if
(
typeof
data
.
responseJSON
!=
'undefined'
&&
typeof
data
.
responseJSON
.
error
!=
'undefined'
)
{
err
.
msg
+=
' : '
+
data
.
responseJSON
.
error
;
},
error
:
function
(
data
)
{
err
=
{
msg
:
"erreur serveur lors de la récupération des fournisseurs"
,
ctx
:
'get_suppliers'
};
if
(
typeof
data
.
responseJSON
!=
'undefined'
&&
typeof
data
.
responseJSON
.
error
!=
'undefined'
)
{
err
.
msg
+=
' : '
+
data
.
responseJSON
.
error
;
}
report_JS_error
(
err
,
'orders'
);
closeModal
();
alert
(
'Erreur lors de la récupération des fournisseurs, rechargez la page plus tard'
);
}
report_JS_error
(
err
,
'orders'
);
}
);
closeModal
();
alert
(
'Erreur lors de la récupération des fournisseurs, rechargez la page plus tard'
);
}
});
//Get products
var
accentMap
=
{
"á"
:
"a"
,
"à"
:
"a"
,
"â"
:
"a"
,
"é"
:
"e"
,
"è"
:
"e"
,
"ê"
:
"e"
,
"ë"
:
"e"
,
"ç"
:
"c"
,
"ù"
:
"u"
,
"ü"
:
"u"
,
"ö"
:
"o"
};
//Get products
var
accentMap
=
{
"á"
:
"a"
,
"à"
:
"a"
,
"â"
:
"a"
,
"é"
:
"e"
,
"è"
:
"e"
,
"ê"
:
"e"
,
"ë"
:
"e"
,
"ç"
:
"c"
,
"ù"
:
"u"
,
"ü"
:
"u"
,
"ö"
:
"o"
};
var
normalize
=
function
(
term
)
{
var
ret
=
""
;
var
normalize
=
function
(
term
)
{
var
ret
=
""
;
for
(
var
i
=
0
;
i
<
term
.
length
;
i
++
)
{
ret
+=
accentMap
[
term
.
charAt
(
i
)
]
||
term
.
charAt
(
i
);
}
for
(
var
i
=
0
;
i
<
term
.
length
;
i
++
)
{
ret
+=
accentMap
[
term
.
charAt
(
i
)
]
||
term
.
charAt
(
i
);
}
return
ret
;
};
return
ret
;
};
$
.
ajax
({
type
:
'GET'
,
url
:
"/products/simple_list"
,
dataType
:
"json"
,
traditional
:
true
,
contentType
:
"application/json; charset=utf-8"
,
success
:
function
(
data
)
{
products_list
=
data
.
list
;
$
.
ajax
({
type
:
'GET'
,
url
:
"/products/simple_list"
,
dataType
:
"json"
,
traditional
:
true
,
contentType
:
"application/json; charset=utf-8"
,
success
:
function
(
data
)
{
products_list
=
data
.
list
;
// Set up autocomplete on product input
$
(
"#product_input"
).
autocomplete
({
source
:
function
(
request
,
response
)
{
var
matcher
=
new
RegExp
(
$
.
ui
.
autocomplete
.
escapeRegex
(
request
.
term
),
"i"
);
// Set up autocomplete on product input
$
(
"#product_input"
).
autocomplete
({
source
:
function
(
request
,
response
)
{
var
matcher
=
new
RegExp
(
$
.
ui
.
autocomplete
.
escapeRegex
(
request
.
term
),
"i"
);
response
(
$
.
grep
(
products_list
.
map
(
a
=>
a
.
display_name
),
function
(
value
)
{
value
=
value
.
label
||
value
.
value
||
value
;
response
(
$
.
grep
(
products_list
.
map
(
a
=>
a
.
display_name
),
function
(
value
)
{
value
=
value
.
label
||
value
.
value
||
value
;
return
matcher
.
test
(
value
)
||
matcher
.
test
(
normalize
(
value
));
}));
},
position
:
{
collision
:
"flip"
}
});
return
matcher
.
test
(
value
)
||
matcher
.
test
(
normalize
(
value
));
}));
},
position
:
{
collision
:
"flip"
}
});
closeModal
();
},
error
:
function
(
data
)
{
err
=
{
msg
:
"erreur serveur lors de la récupération des articles"
,
ctx
:
'get_products'
};
if
(
typeof
data
.
responseJSON
!=
'undefined'
&&
typeof
data
.
responseJSON
.
error
!=
'undefined'
)
{
err
.
msg
+=
' : '
+
data
.
responseJSON
.
error
;
}
report_JS_error
(
err
,
'orders'
);
closeModal
();
},
error
:
function
(
data
)
{
err
=
{
msg
:
"erreur serveur lors de la récupération des articles"
,
ctx
:
'get_products'
};
if
(
typeof
data
.
responseJSON
!=
'undefined'
&&
typeof
data
.
responseJSON
.
error
!=
'undefined'
)
{
err
.
msg
+=
' : '
+
data
.
responseJSON
.
error
;
closeModal
();
alert
(
'Erreur lors de la récupération des articles, rechargez la page plus tard'
);
}
report_JS_error
(
err
,
'orders'
);
closeModal
();
alert
(
'Erreur lors de la récupération des articles, rechargez la page plus tard'
);
}
});
});
}
else
{
$
(
'#not_connected_content'
).
show
();
}
});
templates/orders/helper.html
View file @
ec24f072
...
...
@@ -16,14 +16,20 @@
{% block content %}
<div
class=
"page_body"
>
<div
id=
"select_order_content"
class=
"page_content txtcenter"
>
<div
class=
"login_area"
>
{% include "common/conn_admin.html" %}
</div>
<div
id=
"new_order_area"
>
<h2>
Créer une nouvelle commande
</h2>
<form
id=
"new_order_form"
>
<div
class=
"txtcenter"
id=
"not_connected_content"
style=
"display:none;"
>
<p>
Vous devez vous connecter avec un compte Odoo pour accéder au module d'aide à la commande.
</p>
</div>
<form
id=
"new_order_form"
style=
"display:none;"
>
<input
type=
"text"
id=
"new_order_name"
placeholder=
"Nom de la commande..."
>
<button
type=
"submit"
class=
"btn btn--primary"
>
C'est parti !
</button>
</form>
</div>
<div
id=
"existing_orders_area"
>
<div
id=
"existing_orders_area"
style=
"display:none;"
>
<h2>
Ou, continuer une commande en cours de création
</h2>
<div
id=
"existing_orders"
></div>
</div>
...
...
@@ -34,9 +40,11 @@
<button
type=
"button"
class=
"btn--danger"
id=
"back_to_order_selection_from_main"
>
<i
class=
"fas fa-arrow-left"
></i>
Retour
</button>
<button
type=
"button"
class=
'btn--primary'
id=
"do_inventory"
style=
"display:none;"
>
Faire un inventaire
</button>
<div
class=
"rights_buttons"
>
<button
type=
"button"
class=
'btn--primary'
id=
"do_inventory"
style=
"display:none;"
>
Faire un inventaire
</button>
</div>
</div>
<div
class=
"header txtcenter"
>
...
...
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