saved the creation of warehows locations

This commit is contained in:
2025-09-10 22:37:42 +03:00
parent bb3352ea4a
commit b37c8bb58f
5 changed files with 103 additions and 56 deletions

View File

@@ -17,6 +17,14 @@
<input type="text" name="description" maxlength="250"><br>
<button type="submit" class="btn">Add Location</button>
</form>
<!-- Import from CSV content moved here -->
<div style="margin-top: 24px;">
<h3 style="font-size: 1.1em;">Import Locations from CSV</h3>
<div style="display: flex; flex-direction: row; gap: 16px; align-items: center;">
<span style="font-size: 0.95em;">Bulk import warehouse locations using a CSV file.</span>
<a href="{{ url_for('warehouse.import_locations_csv') }}" class="btn" style="padding: 4px 12px; font-size: 0.95em;">Go to Import Page</a>
</div>
</div>
</div>
<!-- Locations Table Card -->
<div class="card scan-table-card">
@@ -42,13 +50,5 @@
</tbody>
</table>
</div>
<!-- Import Locations from CSV Card (original size, last position) -->
<div class="card scan-form-card" style="margin-top: 24px;">
<h3>Import Locations from CSV</h3>
<div style="display: flex; flex-direction: row; gap: 16px; align-items: center;">
<span>Bulk import warehouse locations using a CSV file.</span>
<a href="{{ url_for('warehouse.import_locations_csv') }}" class="btn">Go to Import Page</a>
</div>
</div>
</div>
{% endblock %}

View File

@@ -2,20 +2,69 @@
{% block title %}Import Warehouse Locations from CSV{% endblock %}
{% block content %}
<div class="scan-container">
<!-- Import Locations from CSV Card (first) -->
<!-- Import Locations from CSV Card (first, fixed position) -->
<div class="card scan-form-card" style="margin-bottom: 24px;">
<h3>Import Locations from CSV</h3>
<form method="POST" enctype="multipart/form-data" class="form-centered">
<form method="POST" enctype="multipart/form-data" class="form-centered" id="csv-upload-form">
<label for="csv_file">Choose CSV file:</label>
<input type="file" name="csv_file" accept=".csv" required><br>
<button type="submit" class="btn">Upload & Preview</button>
{% if locations %}
<button type="submit" name="create_locations" value="1" class="btn" style="margin-left: 12px;">Create Locations</button>
{% if not locations %}
<input type="file" name="csv_file" accept=".csv" required><br>
<button type="submit" class="btn">Upload & Preview</button>
{% else %}
<label style="font-weight: bold;">Selected file: {{ session['csv_filename'] if session['csv_filename'] else 'Unknown' }}</label><br>
<button type="button" class="btn" onclick="showPopupAndSubmit()">Create Locations</button>
{% endif %}
<!-- CSV File Format Guidance (moved here) -->
<div style="margin-top: 8px;">
<h4 style="margin-bottom: 4px;">CSV File Format</h4>
<label style="margin-bottom: 8px; display: block;">Fisierul CSV trebuie sa aiba urmatorul format:</label>
<table class="scan-table" style="width: 100%;">
<thead>
<tr>
<th>Location Code</th>
<th>Size</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>EX123</td>
<td>100</td>
<td>Zona depozitare A</td>
</tr>
</tbody>
</table>
</div>
</form>
<!-- Popup Modal -->
<div id="popup-modal" style="display:none; position:fixed; top:0; left:0; width:100vw; height:100vh; background:rgba(0,0,0,0.3); z-index:9999; align-items:center; justify-content:center;">
<div style="background:#fff; padding:32px; border-radius:8px; box-shadow:0 2px 8px #333; text-align:center;">
<h3>Performing the creation of the warehouse locations</h3>
</div>
</div>
<script>
function showPopupAndSubmit() {
document.getElementById('popup-modal').style.display = 'flex';
// Submit the form after showing popup
setTimeout(function() {
var form = document.getElementById('csv-upload-form');
var input = document.createElement('input');
input.type = 'hidden';
input.name = 'create_locations';
input.value = '1';
form.appendChild(input);
form.submit();
}, 500);
}
window.onload = function() {
if (window.location.hash === '#created') {
document.getElementById('popup-modal').style.display = 'none';
}
}
</script>
</div>
<!-- Preview Table Card (always visible) -->
<div class="card scan-table-card" style="margin-bottom: 24px;">
<!-- Preview Table Card (expandable height, scrollable) -->
<div class="card scan-table-card" style="margin-bottom: 24px; max-height: 480px; overflow-y: auto;">
<h3>Preview Table</h3>
<table class="scan-table">
<thead>
@@ -46,26 +95,5 @@
<p>{{ report }}</p>
</div>
{% endif %}
<!-- CSV File Format Card (last) -->
<div class="card scan-form-card" style="margin-bottom: 24px;">
<h3>CSV File Format</h3>
<label style="margin-bottom: 8px; display: block;">Fisierul CSV trebuie sa aiba urmatorul format:</label>
<table class="scan-table" style="width: 100%;">
<thead>
<tr>
<th>Location Code</th>
<th>Size</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>EX123</td>
<td>100</td>
<td>Zona depozitare A</td>
</tr>
</tbody>
</table>
</div>
</div>
{% endblock %}

View File

@@ -20,7 +20,7 @@
<div class="dashboard-card">
<h3>Create Warehouse Locations</h3>
<p>Define and manage storage locations in the warehouse.</p>
<a href="{{ url_for('main.create_locations') }}" class="btn">Go to Locations</a>
<a href="{{ url_for('warehouse.create_locations') }}" class="btn">Go to Locations</a>
</div>
<!-- Card 3: Warehouse Reports -->