add customer note

This commit is contained in:
2026-07-11 20:59:34 -04:00
parent 73783ff272
commit d04153360f
4 changed files with 14 additions and 1 deletions
+6
View File
@@ -22,6 +22,12 @@ if (isNewDb) {
db.exec(schema); db.exec(schema);
} }
// Lightweight migration for DBs created before internal_note existed on customers.
const customerColumns = db.prepare(`PRAGMA table_info(customers)`).all() as { name: string }[];
if (!customerColumns.some((c) => c.name === 'internal_note')) {
db.exec(`ALTER TABLE customers ADD COLUMN internal_note TEXT`);
}
const FIRST_ORDER_NUMBER = 8246; const FIRST_ORDER_NUMBER = 8246;
/** Allocates the next order number inside the caller's transaction. */ /** Allocates the next order number inside the caller's transaction. */
+2 -1
View File
@@ -36,7 +36,7 @@ router.post('/:id/edit', (req, res) => {
.prepare( .prepare(
`UPDATE customers SET `UPDATE customers SET
name = ?, phone = ?, alt_phone = ?, email = ?, name = ?, phone = ?, alt_phone = ?, email = ?,
address_line1 = ?, address_line2 = ?, city = ?, state = ?, zip = ? address_line1 = ?, address_line2 = ?, city = ?, state = ?, zip = ?, internal_note = ?
WHERE id = ?` WHERE id = ?`
) )
.run( .run(
@@ -49,6 +49,7 @@ router.post('/:id/edit', (req, res) => {
b.city || null, b.city || null,
b.state || null, b.state || null,
b.zip || null, b.zip || null,
b.internal_note || null,
req.params.id req.params.id
); );
+1
View File
@@ -9,6 +9,7 @@ CREATE TABLE customers (
phone TEXT, phone TEXT,
alt_phone TEXT, alt_phone TEXT,
email TEXT, email TEXT,
internal_note TEXT, -- staff-only; never printed on the invoice
created_at TEXT DEFAULT (datetime('now')) created_at TEXT DEFAULT (datetime('now'))
); );
+5
View File
@@ -19,6 +19,11 @@
<label>State <input type="text" name="state" value="{{ customer.state or '' }}"></label> <label>State <input type="text" name="state" value="{{ customer.state or '' }}"></label>
<label>Zip <input type="text" name="zip" value="{{ customer.zip or '' }}"></label> <label>Zip <input type="text" name="zip" value="{{ customer.zip or '' }}"></label>
</div> </div>
<label>
Note <span class="hint">(internal only — never printed on the invoice)</span>
<textarea name="internal_note" rows="3">{{ customer.internal_note or '' }}</textarea>
</label>
</fieldset> </fieldset>
<button type="submit">Save</button> <button type="submit">Save</button>