mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 09:26:17 -05:00
Add CSV/PDF export and a search filter to Inventory
New Export tab with two client-side formats (no new dependencies):
- CSV: the raw items table (RFC-4180 quoting, UTF-8 BOM for Excel), generated
entirely in the browser. The download anchor is attached to the DOM and the
object URL is revoked on the next tick for cross-browser robustness.
- PDF: a printable full-inventory table followed by a group-by summary table,
via the browser's print dialog ("Save as PDF"). The summary's grouping is
chosen in the Export tab.
Search filter: a box on its own line under the inventory selector filters the
active inventory across every column's displayed value (case-insensitive;
whitespace-separated terms are AND-ed). It narrows the whole view — Items
table, Summary aggregation, and Export/PDF — while edits/adds in the table
still operate on the full inventory, so filtering never drops data.
Summary/export grouping:
- The group-by aggregation is extracted into a shared summarize.js (field-role
detection + count-aware totals via units.js + calories), now the single
source of truth for the Summary tab, the PDF summary, and the ration
calculator. findCaloriesKey/findCountKey moved here from RationCalculator
(re-exported for back-compat).
- The Sum selector now offers number and calories fields in addition to
quantity: number/calories are summed as a plain column total, while quantity
stays count-aware and unit-compacted and the dedicated Calories column stays
count-aware.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cc5afe3fbc
commit
947ee01b25
13 changed files with 835 additions and 102 deletions
|
|
@ -479,3 +479,68 @@ tr.drag-deselecting td {
|
|||
color: rgba(0, 0, 0, 0.87) !important;
|
||||
}
|
||||
|
||||
|
||||
/* Inventory "PDF" export: the printable table is hidden on screen and becomes the only
|
||||
visible content when printing, so a user can use the browser dialog to Save as PDF. */
|
||||
.inventory-print {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media print {
|
||||
body * {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.inventory-print,
|
||||
.inventory-print * {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.inventory-print {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.inventory-print h1 {
|
||||
font-size: 18pt;
|
||||
margin: 0 0 0.25em;
|
||||
}
|
||||
|
||||
.inventory-print h2 {
|
||||
font-size: 13pt;
|
||||
margin: 1.25em 0 0.5em;
|
||||
}
|
||||
|
||||
.inventory-print-meta {
|
||||
font-size: 9pt;
|
||||
color: #444;
|
||||
margin: 0 0 0.75em;
|
||||
}
|
||||
|
||||
.inventory-print table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
.inventory-print th,
|
||||
.inventory-print td {
|
||||
border: 1px solid #999;
|
||||
padding: 4px 6px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* Repeat the header row at the top of each printed page. */
|
||||
.inventory-print thead {
|
||||
display: table-header-group;
|
||||
}
|
||||
|
||||
.inventory-print tr {
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue