Spaces:
Running
Running
Update ui.js
Browse files
ui.js
CHANGED
|
@@ -4,57 +4,6 @@ import { appState } from './state.js';
|
|
| 4 |
import { attachAllListeners } from './events.js';
|
| 5 |
import { getMonthlyProductionSummary, getMonthlyMaterialUsage } from './reportService.js';
|
| 6 |
|
| 7 |
-
// ... (No changes to any other functions in this file) ...
|
| 8 |
-
|
| 9 |
-
// The only change is in renderCustomPOModal
|
| 10 |
-
export function renderCustomPOModal(materials) {
|
| 11 |
-
const modal = document.getElementById('custom-po-modal');
|
| 12 |
-
if (!modal) return;
|
| 13 |
-
|
| 14 |
-
const materialRows = materials.map(material => {
|
| 15 |
-
const suggestedQty = Math.max(1, (material.reorderPoint * 2) - material.currentStock);
|
| 16 |
-
return `
|
| 17 |
-
<div class="po-item-row" data-material-name="${material.name}">
|
| 18 |
-
<!-- MODIFICATION: Removed the 'checked' attribute to make items unselected by default -->
|
| 19 |
-
<input type="checkbox" class="po-item-select form-checkbox h-5 w-5 rounded bg-dark border-border-color text-accent-blue focus:ring-accent-blue">
|
| 20 |
-
<div>
|
| 21 |
-
<span class="font-semibold">${material.name}</span>
|
| 22 |
-
<span class="text-xs text-secondary block">Stock: ${material.currentStock} | Reorder: ${material.reorderPoint}</span>
|
| 23 |
-
</div>
|
| 24 |
-
<input type="number" class="po-item-qty input-field w-24 text-right" value="${suggestedQty}" min="0">
|
| 25 |
-
</div>
|
| 26 |
-
`;
|
| 27 |
-
}).join('');
|
| 28 |
-
|
| 29 |
-
modal.innerHTML = `
|
| 30 |
-
<div class="modal-content dashboard-card p-6 max-w-3xl w-full mx-4 flex flex-col">
|
| 31 |
-
<div class="flex justify-between items-center mb-4">
|
| 32 |
-
<h3 class="text-lg font-semibold">Create Custom Purchase Order</h3>
|
| 33 |
-
<button id="cancel-po-btn" class="text-secondary hover:text-primary text-2xl">×</button>
|
| 34 |
-
</div>
|
| 35 |
-
<div class="mb-4">
|
| 36 |
-
<label for="supplier-name" class="block text-sm font-medium text-secondary mb-1">Supplier Name (Optional)</label>
|
| 37 |
-
<input type="text" id="supplier-name" class="input-field w-full" placeholder="Enter supplier name...">
|
| 38 |
-
</div>
|
| 39 |
-
<div id="po-item-list" class="flex-grow overflow-y-auto pr-2" style="max-height: 40vh;">
|
| 40 |
-
${materialRows}
|
| 41 |
-
</div>
|
| 42 |
-
<div class="flex justify-end space-x-2 mt-6">
|
| 43 |
-
<button id="cancel-po-btn-footer" class="btn btn-secondary">Cancel</button>
|
| 44 |
-
<button id="confirm-po-generation-btn" class="btn btn-primary">Generate PO PDF</button>
|
| 45 |
-
</div>
|
| 46 |
-
</div>
|
| 47 |
-
`;
|
| 48 |
-
|
| 49 |
-
modal.classList.remove('hidden');
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
// --- THE REST OF THE FILE REMAINS UNCHANGED ---
|
| 54 |
-
// (refreshUI, showToast, animateValue, renderKpiCards, renderCharts, renderProductionHistoryChart,
|
| 55 |
-
// renderInventoryStatusChart, renderModals, renderReport, renderProductInputs, renderInventory,
|
| 56 |
-
// renderProductionLog, renderReorderList)
|
| 57 |
-
// --- OMITTED FOR BREVITY ---
|
| 58 |
let productionChart = null;
|
| 59 |
let inventoryChart = null;
|
| 60 |
|
|
@@ -352,7 +301,7 @@ export function renderCustomPOModal(materials) {
|
|
| 352 |
const suggestedQty = Math.max(1, (material.reorderPoint * 2) - material.currentStock);
|
| 353 |
return `
|
| 354 |
<div class="po-item-row" data-material-name="${material.name}">
|
| 355 |
-
<input type="checkbox" class="po-item-select form-checkbox h-5 w-5 rounded bg-dark border-border-color text-accent-blue focus:ring-accent-blue"
|
| 356 |
<div>
|
| 357 |
<span class="font-semibold">${material.name}</span>
|
| 358 |
<span class="text-xs text-secondary block">Stock: ${material.currentStock} | Reorder: ${material.reorderPoint}</span>
|
|
|
|
| 4 |
import { attachAllListeners } from './events.js';
|
| 5 |
import { getMonthlyProductionSummary, getMonthlyMaterialUsage } from './reportService.js';
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
let productionChart = null;
|
| 8 |
let inventoryChart = null;
|
| 9 |
|
|
|
|
| 301 |
const suggestedQty = Math.max(1, (material.reorderPoint * 2) - material.currentStock);
|
| 302 |
return `
|
| 303 |
<div class="po-item-row" data-material-name="${material.name}">
|
| 304 |
+
<input type="checkbox" class="po-item-select form-checkbox h-5 w-5 rounded bg-dark border-border-color text-accent-blue focus:ring-accent-blue">
|
| 305 |
<div>
|
| 306 |
<span class="font-semibold">${material.name}</span>
|
| 307 |
<span class="text-xs text-secondary block">Stock: ${material.currentStock} | Reorder: ${material.reorderPoint}</span>
|