Allow changing active scan batch location
This commit is contained in:
@@ -1,21 +1,44 @@
|
||||
{% extends 'planner/base.html' %}{% load static %}
|
||||
{% block title %}Bulk scan inventory · Tasknest{% endblock %}
|
||||
{% block content %}
|
||||
<link rel="stylesheet" href="{% static 'food/food.css' %}?v=20261026-bulk-3">
|
||||
<link rel="stylesheet" href="{% static 'food/food.css' %}?v=20261026-location-3">
|
||||
<main class="food-page inventory-scan-page">
|
||||
<header class="food-heading">
|
||||
<div><a href="{% url 'food:inventory' %}">← Kitchen inventory</a><h1>Bulk scan inventory</h1><p>Scan packages into a location, then review your session queue.</p></div>
|
||||
{% if run %}<span class="inventory-scan-location" data-scan-current-location>{{ draft_batch.location.name }}</span>{% endif %}
|
||||
</header>
|
||||
{% if run %}
|
||||
<section class="inventory-scan-location-panel" aria-labelledby="scan-current-location-title">
|
||||
<div class="inventory-scan-location-summary">
|
||||
<p class="inventory-kicker" id="scan-current-location-title">Current batch location</p>
|
||||
<strong class="inventory-scan-location" data-scan-current-location aria-live="polite">{{ draft_batch.location.name }}</strong>
|
||||
</div>
|
||||
<form class="inventory-scan-location-form" data-scan-location-change
|
||||
action="{% url 'food:inventory-scan-location' draft_batch.pk %}">
|
||||
{% csrf_token %}
|
||||
<label for="scan-current-location">Change location for this batch</label>
|
||||
<div class="inventory-scan-location-actions">
|
||||
<select id="scan-current-location" name="location_id" required>
|
||||
{% for location in locations %}<option value="{{ location.pk }}" {% if location.pk == draft_batch.location_id %}selected{% endif %}>{{ location.name }}</option>{% endfor %}
|
||||
</select>
|
||||
<button class="button button--secondary" type="submit">Update current batch</button>
|
||||
</div>
|
||||
<p>Moves every scan in this unsaved batch. Previously saved batches stay in their locations. Use Save & next location to keep batches in different places.</p>
|
||||
<p class="inventory-scan-error" data-scan-location-error role="alert" hidden></p>
|
||||
</form>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% if not run %}
|
||||
<section class="food-card inventory-scan-start">
|
||||
<h2>Choose a starting location</h2>
|
||||
<p>Your session is saved as you scan, so you can return to it after navigating away.</p>
|
||||
<p>Choose where these packages will be stored before starting. Your session is saved as you scan, so you can return to it after navigating away.</p>
|
||||
{% if start_error %}<p class="inventory-scan-error" role="alert">{{ start_error }}</p>{% endif %}
|
||||
{% if locations %}
|
||||
<form method="post" action="{% url 'food:inventory-scan-start' %}" class="inventory-scan-start-form">
|
||||
{% csrf_token %}<label for="scan-start-location">Scan into</label>
|
||||
<select id="scan-start-location" name="location_id" required>{% for location in locations %}<option value="{{ location.pk }}">{{ location.name }}</option>{% endfor %}</select>
|
||||
{% csrf_token %}<label for="scan-start-location">Starting location</label>
|
||||
<select id="scan-start-location" name="location_id" required>
|
||||
<option value="" selected disabled>Choose a location</option>
|
||||
{% for location in locations %}<option value="{{ location.pk }}">{{ location.name }}</option>{% endfor %}
|
||||
</select>
|
||||
<button class="button" type="submit">Start scanning</button>
|
||||
</form>
|
||||
{% else %}
|
||||
@@ -26,6 +49,8 @@
|
||||
<div class="inventory-scan-layout" data-inventory-scanner
|
||||
data-run-id="{{ run.api_id }}"
|
||||
data-batch-id="{{ draft_batch.pk }}"
|
||||
data-current-location-id="{{ draft_batch.location_id }}"
|
||||
data-location-url="{% url 'food:inventory-scan-location' draft_batch.pk %}"
|
||||
data-create-url="{% url 'food:inventory-scan-create' run.api_id %}"
|
||||
data-queue-url="{% url 'food:inventory-scan-queue' run.api_id %}"
|
||||
data-submit-url="{% url 'food:inventory-scan-submit' draft_batch.pk %}"
|
||||
@@ -65,5 +90,5 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</main>
|
||||
<script src="{% static 'food/scanner.js' %}?v=20261026-bulk-3" defer></script>
|
||||
<script src="{% static 'food/scanner.js' %}?v=20261026-location-3" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user