Add checklist templates with import into devices
- checklist_templates and template_items tables for reusable checklists - /checklists page: create/edit/delete templates with ordered items - "Import" button on device detail imports a template as a new checklist with all items copied (unchecked) - Sidebar nav item for Checklists between Locations and Gallery Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,11 @@
|
||||
label: 'Locations',
|
||||
icon: 'M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z M15 11a3 3 0 11-6 0 3 3 0 016 0z'
|
||||
},
|
||||
{
|
||||
href: '/checklists',
|
||||
label: 'Checklists',
|
||||
icon: 'M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4'
|
||||
},
|
||||
{
|
||||
href: '/gallery',
|
||||
label: 'Gallery',
|
||||
|
||||
@@ -195,6 +195,29 @@ export const installationLog = pgTable(
|
||||
]
|
||||
);
|
||||
|
||||
// ─── Checklist Templates ────────────────────────────────────────────
|
||||
|
||||
export const checklistTemplates = pgTable('checklist_templates', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
title: text('title').notNull(),
|
||||
description: text('description'),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull()
|
||||
});
|
||||
|
||||
export const templateItems = pgTable(
|
||||
'template_items',
|
||||
{
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
templateId: uuid('template_id')
|
||||
.notNull()
|
||||
.references(() => checklistTemplates.id, { onDelete: 'cascade' }),
|
||||
text: text('text').notNull(),
|
||||
sortOrder: integer('sort_order').default(0).notNull()
|
||||
},
|
||||
(table) => [index('template_items_template_idx').on(table.templateId)]
|
||||
);
|
||||
|
||||
// ─── Device Checklists ──────────────────────────────────────────────
|
||||
|
||||
export const deviceChecklists = pgTable(
|
||||
|
||||
Reference in New Issue
Block a user