From 0ea8d12c9fdf4572558008b29cd3c496faced1f3 Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Mon, 3 Apr 2023 18:55:30 -0600 Subject: [PATCH] Add quick-fill button to Fulfillment form --- dashboard/templates/dashboard/order/fulfill.html | 9 ++++++++- static/scripts/fulfillment.js | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 static/scripts/fulfillment.js diff --git a/dashboard/templates/dashboard/order/fulfill.html b/dashboard/templates/dashboard/order/fulfill.html index b118cf9..345d977 100644 --- a/dashboard/templates/dashboard/order/fulfill.html +++ b/dashboard/templates/dashboard/order/fulfill.html @@ -3,6 +3,10 @@ {% block head_title %}Fulfill Order No. {{ order.pk }} | {% endblock %} +{% block head %} + +{% endblock %} + {% block content %}

@@ -77,7 +81,10 @@ {% endfor %} - + + + + diff --git a/static/scripts/fulfillment.js b/static/scripts/fulfillment.js new file mode 100644 index 0000000..ae8450f --- /dev/null +++ b/static/scripts/fulfillment.js @@ -0,0 +1,10 @@ +const quickFill = event => { + document.querySelectorAll("input[name*=quantity_fulfilled").forEach(input => { + input.value = input.max + }) +} + +document.querySelector("#quick-fill").addEventListener("click", event => { + event.preventDefault() + quickFill() +})