Add text input type to checklist items for measurements

Checklist items can now be either 'checkbox' (tick/untick) or 'input'
(text value with optional unit). Useful for recording measurements
like RPM, wow & flutter, torque, voltage, dB levels, etc.

- itemType and unit fields on template_items and checklist_items
- Template page shows type selector and unit field when adding items
- Device checklist renders input items as labeled text fields with unit
- Save button persists measured values
- Import copies item types and units from templates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 10:57:19 +07:00
parent cceba73785
commit 97f97f5571
5 changed files with 117 additions and 35 deletions
+5
View File
@@ -213,6 +213,8 @@ export const templateItems = pgTable(
.notNull()
.references(() => checklistTemplates.id, { onDelete: 'cascade' }),
text: text('text').notNull(),
itemType: text('item_type').notNull().default('checkbox'), // 'checkbox' or 'input'
unit: text('unit'), // e.g. 'RPM', 'dB', '%'
sortOrder: integer('sort_order').default(0).notNull()
},
(table) => [index('template_items_template_idx').on(table.templateId)]
@@ -241,7 +243,10 @@ export const checklistItems = pgTable(
.notNull()
.references(() => deviceChecklists.id, { onDelete: 'cascade' }),
text: text('text').notNull(),
itemType: text('item_type').notNull().default('checkbox'), // 'checkbox' or 'input'
unit: text('unit'), // e.g. 'RPM', 'dB', '%'
checked: boolean('checked').default(false).notNull(),
value: text('value'), // for input type items
sortOrder: integer('sort_order').default(0).notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull()
},