import locations to bulk

This commit is contained in:
2025-10-05 09:58:33 +03:00
parent 97b9ae9fe2
commit cb8a48e58f
3 changed files with 139 additions and 2 deletions

View File

@@ -1209,4 +1209,14 @@ body.dark-mode .calendar-day.selected {
min-height: 30px;
font-size: 0.8em;
}
}
/* Selected row styles */
tr.location-row.selected, .location-row.selected td {
background-color: #ffb300 !important; /* Accent color: Amber */
color: #222 !important;
font-weight: bold;
box-shadow: 0 2px 8px rgba(255,179,0,0.12);
border-left: 4px solid #ff9800;
transition: background 0.2s, color 0.2s;
}

View File

@@ -46,8 +46,12 @@
}
.location-row.selected {
background-color: #007bff !important;
color: white !important;
background-color: #ffb300 !important; /* Accent color: Amber */
color: #222 !important;
font-weight: bold;
box-shadow: 0 2px 8px rgba(255,179,0,0.12);
border-left: 4px solid #ff9800;
transition: background 0.2s, color 0.2s;
}
.location-row {

View File

@@ -0,0 +1,123 @@
{% 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 %}