124 lines
4.7 KiB
HTML
124 lines
4.7 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Import Warehouse Locations CSV{% endblock %}
|
|
|
|
{% block head %}
|
|
<style>
|
|
/* Table styling modeled after upload_orders.html */
|
|
table.locations-preview-table.scan-table {
|
|
margin: 0 !important;
|
|
border-spacing: 0 !important;
|
|
border-collapse: collapse !important;
|
|
width: 100% !important;
|
|
table-layout: fixed !important;
|
|
font-size: 11px !important;
|
|
}
|
|
table.locations-preview-table.scan-table thead th {
|
|
height: 48px !important;
|
|
min-height: 48px !important;
|
|
max-height: 48px !important;
|
|
vertical-align: middle !important;
|
|
text-align: center !important;
|
|
white-space: normal !important;
|
|
word-wrap: break-word !important;
|
|
line-height: 1.3 !important;
|
|
padding: 6px 3px !important;
|
|
font-size: 11px !important;
|
|
background-color: #e9ecef !important;
|
|
font-weight: bold !important;
|
|
text-transform: none !important;
|
|
letter-spacing: 0 !important;
|
|
overflow: visible !important;
|
|
box-sizing: border-box !important;
|
|
border: 1px solid #ddd !important;
|
|
text-overflow: clip !important;
|
|
position: relative !important;
|
|
}
|
|
table.locations-preview-table.scan-table tbody td {
|
|
padding: 4px 2px !important;
|
|
font-size: 10px !important;
|
|
text-align: center !important;
|
|
border: 1px solid #ddd !important;
|
|
white-space: nowrap !important;
|
|
overflow: hidden !important;
|
|
text-overflow: ellipsis !important;
|
|
vertical-align: middle !important;
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="scan-container">
|
|
<!-- Upload Locations Card -->
|
|
<div class="card scan-form-card" style="margin-bottom: 24px;">
|
|
<h3>Import Warehouse Locations from CSV</h3>
|
|
<form method="POST" enctype="multipart/form-data" class="form-centered" id="csv-upload-form">
|
|
<label for="csv_file">Choose CSV file:</label>
|
|
{% if not locations %}
|
|
<input type="file" name="csv_file" accept=".csv" required><br>
|
|
<button type="submit" class="btn">Upload & Review</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()">Upload to Locations Database</button>
|
|
{% endif %}
|
|
</form>
|
|
<!-- Popup Modal -->
|
|
<div id="popup-modal" class="popup" style="display:none; position:fixed; top:0; left:0; width:100vw; height:100vh; background:var(--app-overlay-bg, rgba(30,41,59,0.85)); z-index:9999; align-items:center; justify-content:center;">
|
|
<div class="popup-content" style="margin:auto; padding:32px; border-radius:8px; box-shadow:0 2px 8px #333; min-width:320px; max-width:400px; text-align:center;">
|
|
<h3 style="color:var(--app-label-text);">Saving locations to database...</h3>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
function showPopupAndSubmit() {
|
|
document.getElementById('popup-modal').style.display = 'flex';
|
|
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 === '#saved') {
|
|
document.getElementById('popup-modal').style.display = 'none';
|
|
}
|
|
}
|
|
</script>
|
|
</div>
|
|
<!-- Preview Table Card -->
|
|
<div class="card scan-table-card" style="margin-bottom: 24px; max-height: 480px; overflow-y: auto;">
|
|
<h3>Preview Table</h3>
|
|
<table class="scan-table locations-preview-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Location Code</th>
|
|
<th>Size</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% if locations %}
|
|
{% for loc in locations %}
|
|
<tr>
|
|
<td>{{ loc[0] }}</td>
|
|
<td>{{ loc[1] }}</td>
|
|
<td>{{ loc[2] }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
{% else %}
|
|
<tr><td colspan="3" style="text-align:center;">No CSV file uploaded yet.</td></tr>
|
|
{% endif %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% if report %}
|
|
<div class="card" style="margin-bottom: 24px;">
|
|
<h4>Import Report</h4>
|
|
<p>{{ report }}</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|