Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(orders): add alert for orders which close far away #220

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/templates/orders.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,24 @@ <h3>Create new order</h3>
<script src="{{ url_for('static', filename='js/bootstrap-datetimepicker.min.js') }}"></script>
<script type="text/javascript">
$.ready(function(){
let allowFarFuture = false;
let onePass = false;
let oldDate = null;
$('.select').select2();
$('.datetimepicker').datetimepicker({
format: 'DD-MM-YYYY HH:mm'
})
$('#stoptime').on("dp.change", (e) => {
if (onePass) {
onePass = false;
return;
}
if (e.date.isAfter(moment().add(1, 'd')) && !allowFarFuture) {
allowFarFuture = confirm("Are you sure you want to create an order with closes later than 1 day")
if (!allowFarFuture) {
$(e.currentTarget).data("DateTimePicker").date(e.oldDate)
}
}
});
}());
</script>
Expand Down