Skip to content

Commit b9b6581

Browse files
authored
Merge pull request #2 from H1D/feat/item-notes-custom-columns
Add per-item notes and custom columns
2 parents 6b64126 + e650ed5 commit b9b6581

File tree

9 files changed

+356
-6
lines changed

9 files changed

+356
-6
lines changed

netlify.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[build]
2+
command = "curl -fsSL https://bun.sh/install | bash && ~/.bun/bin/bun install --frozen-lockfile && ~/.bun/bin/bun run build"
3+
publish = "public"
4+
5+
[build.environment]
6+
NODE_VERSION = "20"
7+
8+
# SPA fallback - route all paths to index.html
9+
[[redirects]]
10+
from = "/*"
11+
to = "/index.html"
12+
status = 200
13+
14+
# Cache static assets
15+
[[headers]]
16+
for = "/js/vendor/*"
17+
[headers.values]
18+
Cache-Control = "public, max-age=31536000, immutable"
19+
20+
[[headers]]
21+
for = "/fonts/*"
22+
[headers.values]
23+
Cache-Control = "public, max-age=31536000, immutable"
24+
25+
[[headers]]
26+
for = "/css/*"
27+
[headers.values]
28+
Cache-Control = "public, max-age=604800"
29+
30+
# Security headers (matching server.ts)
31+
[[headers]]
32+
for = "/*"
33+
[headers.values]
34+
X-Content-Type-Options = "nosniff"
35+
X-Frame-Options = "DENY"
36+
Referrer-Policy = "strict-origin-when-cross-origin"
37+
Permissions-Policy = "camera=(), microphone=(), geolocation=()"

public/css/style.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,40 @@ input[type="file"] {
704704
}
705705

706706
.item-field[data-col="name"] { grid-column: span 2; }
707+
.item-field[data-col="itemNotes"] { grid-column: 1 / -1; }
708+
.item-field[data-col="itemNotes"] textarea {
709+
width: 100%;
710+
padding: 6px 8px;
711+
font-size: 0.82rem;
712+
border: 1px solid var(--border-light);
713+
border-radius: var(--r-sm);
714+
background: var(--card);
715+
box-shadow: var(--shadow-inset);
716+
resize: vertical;
717+
line-height: 1.5;
718+
font-family: var(--font-body);
719+
}
720+
721+
/* === Custom Column Toggles === */
722+
.custom-column-toggles { position: relative; }
723+
.custom-column-toggles:empty { display: none; }
724+
.custom-col-toggle {
725+
display: inline-flex;
726+
align-items: center;
727+
gap: 5px;
728+
}
729+
.btn-remove-custom-col {
730+
background: none;
731+
border: none;
732+
cursor: pointer;
733+
font-size: 1rem;
734+
color: var(--ink-faint);
735+
padding: 0 2px;
736+
line-height: 1;
737+
transition: color 0.15s;
738+
}
739+
.btn-remove-custom-col:hover { color: var(--danger); }
740+
.btn-add-column { margin-bottom: 10px; }
707741

708742
/* === Total Row === */
709743
.total-row {

public/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,13 @@ <h1 class="logo">EasyPDF <span class="logo-lite">Lite</span></h1>
321321
<label class="toggle-label"><input type="checkbox" id="toggle-netAmount" checked data-testid="toggle-net-amount"> Net Amount</label>
322322
<label class="toggle-label"><input type="checkbox" id="toggle-vatAmount" checked data-testid="toggle-vat-amount"> VAT Amount</label>
323323
<label class="toggle-label"><input type="checkbox" id="toggle-preTaxAmount" checked data-testid="toggle-pre-tax-amount"> Pre-tax</label>
324+
<label class="toggle-label"><input type="checkbox" id="toggle-itemNotes" data-testid="toggle-item-notes"> Notes</label>
324325
</div>
325326

327+
<!-- Custom column toggles -->
328+
<div id="custom-column-toggles" class="field-toggles custom-column-toggles hidden" data-testid="custom-column-toggles"></div>
329+
<button type="button" id="btn-add-column" class="btn btn-sm btn-outline btn-add-column" data-testid="add-column-button">+ Add Column</button>
330+
326331
<!-- VAT Summary toggle -->
327332
<div class="field-toggles vat-summary-toggles">
328333
<label class="toggle-label">
@@ -435,6 +440,10 @@ <h1 class="logo">EasyPDF <span class="logo-lite">Lite</span></h1>
435440
<label>Pre-tax Amount</label>
436441
<span class="item-pre-tax-amount" data-testid="item-pre-tax-amount">0.00</span>
437442
</div>
443+
<div class="item-field" data-col="itemNotes">
444+
<label>Notes</label>
445+
<textarea class="item-notes" maxlength="500" rows="2" placeholder="Item notes..." data-testid="item-notes-input"></textarea>
446+
</div>
438447
</div>
439448
</div>
440449
</template>

public/js/app.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
setupSellerProfiles,
1212
setupBuyerProfiles,
1313
updateColumnVisibility,
14+
addCustomColumn,
1415
} from "./form";
1516
import { saveInvoiceData, loadInvoiceData, loadSellers, saveSellers, loadBuyers, saveBuyers, saveAccordionState, loadAccordionState, saveLogo, loadLogo, removeLogo } from "./storage";
1617
import { generateShareUrl, loadFromUrl } from "./url-sharing";
@@ -292,6 +293,16 @@ function setupFormListeners() {
292293
recalculateTotal();
293294
});
294295
}
296+
297+
const addColumnBtn = document.getElementById("btn-add-column");
298+
if (addColumnBtn) {
299+
addColumnBtn.addEventListener("click", () => {
300+
const header = prompt("Column name:");
301+
if (header && header.trim()) {
302+
addCustomColumn(header.trim());
303+
}
304+
});
305+
}
295306
}
296307

297308
// === Seller/Buyer profile management ===

0 commit comments

Comments
 (0)