|
| 1 | +// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. |
| 2 | + |
| 3 | +import type { Page } from '@objectstack/spec/ui'; |
| 4 | + |
| 5 | +/** |
| 6 | + * Project detail — a slotted record page that surfaces the project's Tasks as |
| 7 | + * an INLINE-EDITABLE `record:line_items` grid (ObjectUI ADR-0001), instead of |
| 8 | + * a read-only related list. This is the "view + edit the children together" |
| 9 | + * half of the master-detail story: open a project, edit its tasks in place, |
| 10 | + * and Save persists the diff (create/update/delete) with the `master_detail` |
| 11 | + * FK maintained. |
| 12 | + * |
| 13 | + * `kind: 'slotted'` with only the `tabs` slot overridden — the synthesizer |
| 14 | + * fills in the header / highlights / details / discussion; the Tasks tab below |
| 15 | + * replaces the synthesized related-list strip. |
| 16 | + */ |
| 17 | +export const ProjectDetailPage: Page = { |
| 18 | + name: 'showcase_project_detail', |
| 19 | + label: 'Project', |
| 20 | + type: 'record', |
| 21 | + object: 'showcase_project', |
| 22 | + kind: 'slotted', |
| 23 | + isDefault: true, |
| 24 | + regions: [], |
| 25 | + slots: { |
| 26 | + tabs: { |
| 27 | + type: 'page:tabs', |
| 28 | + properties: { |
| 29 | + type: 'line', |
| 30 | + items: [ |
| 31 | + { |
| 32 | + key: 'tasks', |
| 33 | + label: 'Tasks', |
| 34 | + children: [ |
| 35 | + { |
| 36 | + type: 'record:line_items', |
| 37 | + properties: { |
| 38 | + childObject: 'showcase_task', |
| 39 | + relationshipField: 'project', |
| 40 | + amountField: 'estimate_hours', |
| 41 | + title: 'Tasks', |
| 42 | + columns: [ |
| 43 | + { field: 'title', label: 'Title', type: 'text', required: true }, |
| 44 | + { |
| 45 | + field: 'status', |
| 46 | + label: 'Status', |
| 47 | + type: 'select', |
| 48 | + options: [ |
| 49 | + { label: 'Backlog', value: 'backlog' }, |
| 50 | + { label: 'To Do', value: 'todo' }, |
| 51 | + { label: 'In Progress', value: 'in_progress' }, |
| 52 | + { label: 'In Review', value: 'in_review' }, |
| 53 | + { label: 'Done', value: 'done' }, |
| 54 | + ], |
| 55 | + }, |
| 56 | + { |
| 57 | + field: 'priority', |
| 58 | + label: 'Priority', |
| 59 | + type: 'select', |
| 60 | + options: [ |
| 61 | + { label: 'Low', value: 'low' }, |
| 62 | + { label: 'Medium', value: 'medium' }, |
| 63 | + { label: 'High', value: 'high' }, |
| 64 | + { label: 'Urgent', value: 'urgent' }, |
| 65 | + ], |
| 66 | + }, |
| 67 | + { field: 'estimate_hours', label: 'Estimate (h)', type: 'number' }, |
| 68 | + { field: 'due_date', label: 'Due Date', type: 'date' }, |
| 69 | + ], |
| 70 | + }, |
| 71 | + }, |
| 72 | + ], |
| 73 | + }, |
| 74 | + ], |
| 75 | + }, |
| 76 | + }, |
| 77 | + }, |
| 78 | +}; |
0 commit comments