Add quick-fill button to Fulfillment form

This commit is contained in:
Nathan Chapman 2023-04-03 18:55:30 -06:00
parent 3cf7688844
commit 0ea8d12c9f
2 changed files with 18 additions and 1 deletions

View File

@ -3,6 +3,10 @@
{% block head_title %}Fulfill Order No. {{ order.pk }} | {% endblock %} {% block head_title %}Fulfill Order No. {{ order.pk }} | {% endblock %}
{% block head %}
<script defer src="{% static 'scripts/fulfillment.js' %}"></script>
{% endblock %}
{% block content %} {% block content %}
<article> <article>
<p> <p>
@ -77,7 +81,10 @@
</tr> </tr>
{% endfor %} {% endfor %}
<tr> <tr>
<td colspan="3"></td> <td colspan="2"></td>
<td class="text-right">
<button id="quick-fill" class="btn">Quick fill</button>
</td>
<td class="text-right"> <td class="text-right">
<input class="btn" type="submit" value="Fulfill order"> <input class="btn" type="submit" value="Fulfill order">
</td> </td>

View File

@ -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()
})