@conduction/nextcloud-vue 0.1.0-beta.1 → 0.1.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/README.md +226 -0
  2. package/css/index.css +5 -0
  3. package/dist/nextcloud-vue.cjs.js +79416 -7715
  4. package/dist/nextcloud-vue.cjs.js.map +1 -1
  5. package/dist/nextcloud-vue.css +3583 -504
  6. package/dist/nextcloud-vue.esm.js +79343 -7692
  7. package/dist/nextcloud-vue.esm.js.map +1 -1
  8. package/l10n/en.json +164 -0
  9. package/l10n/nl.json +164 -0
  10. package/package.json +104 -63
  11. package/src/components/CnActionsBar/CnActionsBar.vue +254 -0
  12. package/src/components/CnActionsBar/index.js +1 -0
  13. package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +570 -0
  14. package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -0
  15. package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -0
  16. package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +422 -0
  17. package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -0
  18. package/src/components/CnAdvancedFormDialog/index.js +1 -0
  19. package/src/components/CnCard/CnCard.vue +415 -0
  20. package/src/components/CnCard/index.js +1 -0
  21. package/src/components/CnCardGrid/CnCardGrid.vue +156 -152
  22. package/src/components/CnCardGrid/index.js +1 -1
  23. package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
  24. package/src/components/CnCellRenderer/index.js +1 -1
  25. package/src/components/CnChartWidget/CnChartWidget.vue +346 -0
  26. package/src/components/CnChartWidget/index.js +1 -0
  27. package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
  28. package/src/components/CnConfigurationCard/index.js +1 -1
  29. package/src/components/CnContextMenu/CnContextMenu.vue +142 -0
  30. package/src/components/CnContextMenu/index.js +1 -0
  31. package/src/components/CnCopyDialog/CnCopyDialog.vue +266 -0
  32. package/src/components/CnCopyDialog/index.js +1 -0
  33. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +229 -0
  34. package/src/components/CnDashboardGrid/index.js +1 -0
  35. package/src/components/CnDashboardPage/CnDashboardPage.vue +397 -0
  36. package/src/components/CnDashboardPage/index.js +1 -0
  37. package/src/components/CnDataTable/CnDataTable.vue +362 -354
  38. package/src/components/CnDataTable/index.js +1 -1
  39. package/src/components/CnDeleteDialog/CnDeleteDialog.vue +177 -0
  40. package/src/components/CnDeleteDialog/index.js +1 -0
  41. package/src/components/CnDetailCard/CnDetailCard.vue +225 -0
  42. package/src/components/CnDetailCard/index.js +1 -0
  43. package/src/components/CnDetailGrid/CnDetailGrid.vue +256 -0
  44. package/src/components/CnDetailGrid/index.js +1 -0
  45. package/src/components/CnDetailPage/CnDetailPage.vue +432 -0
  46. package/src/components/CnDetailPage/index.js +1 -0
  47. package/src/components/CnFacetSidebar/CnFacetSidebar.vue +234 -223
  48. package/src/components/CnFacetSidebar/index.js +1 -1
  49. package/src/components/CnFilterBar/CnFilterBar.vue +153 -152
  50. package/src/components/CnFilterBar/index.js +1 -1
  51. package/src/components/CnFormDialog/CnFormDialog.vue +1047 -0
  52. package/src/components/CnFormDialog/index.js +1 -0
  53. package/src/components/CnIcon/CnIcon.vue +89 -0
  54. package/src/components/CnIcon/index.js +1 -0
  55. package/src/components/CnIndexPage/CnIndexPage.vue +980 -682
  56. package/src/components/CnIndexPage/index.js +1 -1
  57. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +536 -0
  58. package/src/components/CnIndexSidebar/index.js +1 -0
  59. package/src/components/CnInfoWidget/CnInfoWidget.vue +219 -0
  60. package/src/components/CnInfoWidget/index.js +1 -0
  61. package/src/components/CnItemCard/CnItemCard.vue +134 -0
  62. package/src/components/CnItemCard/index.js +1 -0
  63. package/src/components/CnJsonViewer/CnJsonViewer.vue +312 -0
  64. package/src/components/CnJsonViewer/index.js +1 -0
  65. package/src/components/CnKpiGrid/CnKpiGrid.vue +93 -89
  66. package/src/components/CnKpiGrid/index.js +1 -1
  67. package/src/components/CnMassActionBar/CnMassActionBar.vue +161 -160
  68. package/src/components/CnMassActionBar/index.js +1 -1
  69. package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +327 -320
  70. package/src/components/CnMassCopyDialog/index.js +1 -1
  71. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +245 -238
  72. package/src/components/CnMassDeleteDialog/index.js +1 -1
  73. package/src/components/CnMassExportDialog/CnMassExportDialog.vue +191 -190
  74. package/src/components/CnMassExportDialog/index.js +1 -1
  75. package/src/components/CnMassImportDialog/CnMassImportDialog.vue +494 -491
  76. package/src/components/CnMassImportDialog/index.js +1 -1
  77. package/src/components/CnNoteCard/CnNoteCard.vue +149 -0
  78. package/src/components/CnNoteCard/index.js +1 -0
  79. package/src/components/CnNotesCard/CnNotesCard.vue +416 -0
  80. package/src/components/CnNotesCard/index.js +1 -0
  81. package/src/components/CnObjectCard/CnObjectCard.vue +294 -292
  82. package/src/components/CnObjectCard/index.js +1 -1
  83. package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +854 -0
  84. package/src/components/CnObjectDataWidget/index.js +1 -0
  85. package/src/components/CnObjectMetadataWidget/CnObjectMetadataWidget.vue +289 -0
  86. package/src/components/CnObjectMetadataWidget/index.js +1 -0
  87. package/src/components/CnObjectSidebar/CnAuditTrailTab.vue +369 -0
  88. package/src/components/CnObjectSidebar/CnFilesTab.vue +287 -0
  89. package/src/components/CnObjectSidebar/CnNotesTab.vue +250 -0
  90. package/src/components/CnObjectSidebar/CnObjectSidebar.vue +255 -0
  91. package/src/components/CnObjectSidebar/CnTagsTab.vue +259 -0
  92. package/src/components/CnObjectSidebar/CnTasksTab.vue +483 -0
  93. package/src/components/CnObjectSidebar/index.js +6 -0
  94. package/src/components/CnPageHeader/CnPageHeader.vue +61 -0
  95. package/src/components/CnPageHeader/index.js +1 -0
  96. package/src/components/CnPagination/CnPagination.vue +253 -252
  97. package/src/components/CnPagination/index.js +1 -1
  98. package/src/components/CnProgressBar/CnProgressBar.vue +262 -0
  99. package/src/components/CnProgressBar/index.js +1 -0
  100. package/src/components/CnRegisterMapping/CnRegisterMapping.vue +793 -0
  101. package/src/components/CnRegisterMapping/index.js +1 -0
  102. package/src/components/CnRowActions/CnRowActions.vue +95 -73
  103. package/src/components/CnRowActions/index.js +1 -1
  104. package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -0
  105. package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +788 -0
  106. package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -0
  107. package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -0
  108. package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -0
  109. package/src/components/CnSchemaFormDialog/index.js +1 -0
  110. package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -92
  111. package/src/components/CnSettingsCard/index.js +1 -1
  112. package/src/components/CnSettingsSection/CnSettingsSection.vue +267 -266
  113. package/src/components/CnSettingsSection/index.js +1 -1
  114. package/src/components/CnStatsBlock/CnStatsBlock.vue +437 -366
  115. package/src/components/CnStatsBlock/index.js +1 -1
  116. package/src/components/CnStatsPanel/CnStatsPanel.vue +321 -0
  117. package/src/components/CnStatsPanel/index.js +1 -0
  118. package/src/components/CnStatusBadge/CnStatusBadge.vue +90 -77
  119. package/src/components/CnStatusBadge/index.js +1 -1
  120. package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +545 -0
  121. package/src/components/CnTabbedFormDialog/index.js +1 -0
  122. package/src/components/CnTableWidget/CnTableWidget.vue +333 -0
  123. package/src/components/CnTableWidget/index.js +1 -0
  124. package/src/components/CnTasksCard/CnTasksCard.vue +374 -0
  125. package/src/components/CnTasksCard/index.js +1 -0
  126. package/src/components/CnTileWidget/CnTileWidget.vue +159 -0
  127. package/src/components/CnTileWidget/index.js +1 -0
  128. package/src/components/CnTimelineStages/CnTimelineStages.vue +294 -0
  129. package/src/components/CnTimelineStages/index.js +1 -0
  130. package/src/components/CnUserActionMenu/CnUserActionMenu.vue +436 -0
  131. package/src/components/CnUserActionMenu/index.js +1 -0
  132. package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +313 -312
  133. package/src/components/CnVersionInfoCard/index.js +1 -1
  134. package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -0
  135. package/src/components/CnWidgetRenderer/index.js +1 -0
  136. package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +248 -0
  137. package/src/components/CnWidgetWrapper/index.js +1 -0
  138. package/src/components/index.js +57 -25
  139. package/src/composables/index.js +5 -3
  140. package/src/composables/useContextMenu.js +126 -0
  141. package/src/composables/useDashboardView.js +286 -0
  142. package/src/composables/useDetailView.js +290 -132
  143. package/src/composables/useListView.js +364 -153
  144. package/src/composables/useSubResource.js +142 -142
  145. package/src/constants/metadata.js +30 -0
  146. package/src/css/CnSchemaFormDialog.css +546 -0
  147. package/src/css/__sample_nextcloud_tokens.css +110 -0
  148. package/src/css/actions-bar.css +54 -0
  149. package/src/css/badge.css +83 -51
  150. package/src/css/card.css +129 -128
  151. package/src/css/context-menu.css +20 -0
  152. package/src/css/dashboard.css +70 -0
  153. package/src/css/detail-page.css +235 -0
  154. package/src/css/detail.css +68 -68
  155. package/src/css/index-page.css +44 -0
  156. package/src/css/index-sidebar.css +193 -0
  157. package/src/css/index.css +17 -8
  158. package/src/css/layout.css +90 -90
  159. package/src/css/page-header.css +35 -0
  160. package/src/css/pagination.css +72 -72
  161. package/src/css/table.css +142 -143
  162. package/src/css/timeline-stages.css +220 -0
  163. package/src/css/utilities.css +46 -46
  164. package/src/index.js +95 -50
  165. package/src/l10n/index.js +12 -0
  166. package/src/mixins/gridLayout.js +118 -0
  167. package/src/store/createCrudStore.d.ts +350 -0
  168. package/src/store/createCrudStore.js +413 -0
  169. package/src/store/createSubResourcePlugin.js +125 -135
  170. package/src/store/index.js +4 -3
  171. package/src/store/pluginMerge.js +55 -0
  172. package/src/store/plugins/auditTrails.js +357 -17
  173. package/src/store/plugins/files.js +250 -186
  174. package/src/store/plugins/index.js +8 -4
  175. package/src/store/plugins/lifecycle.js +180 -180
  176. package/src/store/plugins/logs.d.ts +22 -0
  177. package/src/store/plugins/logs.js +172 -0
  178. package/src/store/plugins/registerMapping.js +195 -0
  179. package/src/store/plugins/relations.js +68 -68
  180. package/src/store/plugins/search.js +385 -0
  181. package/src/store/plugins/selection.js +104 -0
  182. package/src/store/useObjectStore.js +793 -625
  183. package/src/types/auditTrail.d.ts +32 -32
  184. package/src/types/file.d.ts +23 -23
  185. package/src/types/index.d.ts +67 -35
  186. package/src/types/notification.d.ts +36 -36
  187. package/src/types/object.d.ts +40 -40
  188. package/src/types/organisation.d.ts +41 -41
  189. package/src/types/register.d.ts +25 -25
  190. package/src/types/schema.d.ts +39 -39
  191. package/src/types/shared.d.ts +79 -79
  192. package/src/types/source.d.ts +14 -14
  193. package/src/types/task.d.ts +31 -31
  194. package/src/utils/errors.js +96 -96
  195. package/src/utils/getTheme.js +9 -0
  196. package/src/utils/headers.js +80 -44
  197. package/src/utils/id.js +13 -0
  198. package/src/utils/index.js +4 -3
  199. package/src/utils/schema.js +423 -287
  200. package/src/utils/widgetVisibility.js +162 -0
  201. package/src/components/CnDetailViewLayout/CnDetailViewLayout.vue +0 -88
  202. package/src/components/CnDetailViewLayout/index.js +0 -1
  203. package/src/components/CnEmptyState/CnEmptyState.vue +0 -78
  204. package/src/components/CnEmptyState/index.js +0 -1
  205. package/src/components/CnListViewLayout/CnListViewLayout.vue +0 -80
  206. package/src/components/CnListViewLayout/index.js +0 -1
  207. package/src/components/CnViewModeToggle/CnViewModeToggle.vue +0 -77
  208. package/src/components/CnViewModeToggle/index.js +0 -1
@@ -0,0 +1,483 @@
1
+ <template>
2
+ <div class="cn-sidebar-tab">
3
+ <!-- Add / Edit task -->
4
+ <div class="cn-sidebar-tab__section">
5
+ <div class="cn-sidebar-tab__action--row">
6
+ <NcTextField
7
+ v-model="newTaskSummary"
8
+ :label="editingTaskId ? editLabel : addTaskPlaceholder"
9
+ @keyup.enter="editingTaskId ? saveEdit() : addTask()" />
10
+ <NcButton
11
+ v-if="editingTaskId"
12
+ type="tertiary"
13
+ @click="cancelEdit">
14
+ <template #icon>
15
+ <Close :size="20" />
16
+ </template>
17
+ </NcButton>
18
+ <NcButton
19
+ type="primary"
20
+ :disabled="!newTaskSummary.trim() || saving"
21
+ @click="editingTaskId ? saveEdit() : addTask()">
22
+ <template #icon>
23
+ <Plus v-if="!editingTaskId" :size="20" />
24
+ <ContentSave v-else :size="20" />
25
+ </template>
26
+ </NcButton>
27
+ </div>
28
+ <div class="cn-sidebar-tab__grid">
29
+ <NcDateTimePickerNative
30
+ id="task-deadline"
31
+ v-model="newTaskDue"
32
+ :label="deadlineLabel"
33
+ type="date" />
34
+ <NcSelect
35
+ v-model="newTaskAssignee"
36
+ :options="userList"
37
+ :placeholder="assigneeLabel"
38
+ :input-label="assigneeLabel"
39
+ label="displayName"
40
+ track-by="userId"
41
+ :clearable="true" />
42
+ </div>
43
+ </div>
44
+
45
+ <!-- Filters -->
46
+ <div v-if="tasks.length > 0 || filterStatus || filterAssignee" class="cn-sidebar-tab__section cn-sidebar-tab__section--filters">
47
+ <div class="cn-sidebar-tab__grid">
48
+ <NcSelect
49
+ v-model="filterStatus"
50
+ :options="statusOptions"
51
+ :placeholder="statusFilterLabel"
52
+ :input-label="statusFilterLabel"
53
+ :clearable="true" />
54
+ <NcSelect
55
+ v-model="filterAssignee"
56
+ :options="assigneeOptions"
57
+ :placeholder="assigneeFilterLabel"
58
+ :input-label="assigneeFilterLabel"
59
+ :clearable="true" />
60
+ </div>
61
+ </div>
62
+
63
+ <!-- Tasks list -->
64
+ <NcLoadingIcon v-if="loading" />
65
+ <div v-else-if="filteredTasks.length === 0" class="cn-sidebar-tab__empty">
66
+ {{ noTasksLabel }}
67
+ </div>
68
+ <div v-else class="cn-sidebar-tab__list">
69
+ <NcListItem
70
+ v-for="task in filteredTasks"
71
+ :key="task.id"
72
+ :name="task.summary || task.title || task.name"
73
+ :bold="false"
74
+ :force-display-actions="true"
75
+ :class="{ 'cn-sidebar-tab__task--overdue': isOverdue(task) }">
76
+ <template #icon>
77
+ <button class="cn-sidebar-tab__task-checkbox" @click.stop="toggleTask(task)">
78
+ <CheckboxMarkedOutline v-if="task.status === 'completed'" :size="32" class="cn-sidebar-tab__task-done" />
79
+ <CheckboxBlankOutline v-else :size="32" :class="{ 'cn-sidebar-tab__task-overdue-icon': isOverdue(task) }" />
80
+ </button>
81
+ </template>
82
+ <template #subname>
83
+ {{ extractAssignee(task) }}
84
+ </template>
85
+ <template v-if="task.due" #details>
86
+ <span :class="{ 'cn-sidebar-tab__task-overdue-date': isOverdue(task) }">
87
+ {{ formatShortDate(task.due) }}
88
+ </span>
89
+ </template>
90
+ <template #actions>
91
+ <NcActionButton @click="startEdit(task)">
92
+ <template #icon>
93
+ <Pencil :size="20" />
94
+ </template>
95
+ {{ editLabel }}
96
+ </NcActionButton>
97
+ <NcActionButton v-if="task.status !== 'completed'" @click="completeTask(task)">
98
+ <template #icon>
99
+ <CheckboxMarkedOutline :size="20" />
100
+ </template>
101
+ {{ completeLabel }}
102
+ </NcActionButton>
103
+ <NcActionButton @click="deleteTask(task)">
104
+ <template #icon>
105
+ <Delete :size="20" />
106
+ </template>
107
+ {{ deleteLabel }}
108
+ </NcActionButton>
109
+ </template>
110
+ </NcListItem>
111
+ </div>
112
+ <NcButton
113
+ v-if="tasks.length < total"
114
+ type="tertiary"
115
+ :wide="true"
116
+ :disabled="loadingMore"
117
+ class="cn-sidebar-tab__load-more"
118
+ @click="loadMore">
119
+ <template v-if="loadingMore" #icon>
120
+ <NcLoadingIcon :size="20" />
121
+ </template>
122
+ {{ loadingMore ? '' : loadMoreLabel }}
123
+ </NcButton>
124
+ </div>
125
+ </template>
126
+
127
+ <script>
128
+ import { translate as t } from '@nextcloud/l10n'
129
+ import { NcButton, NcTextField, NcListItem, NcActionButton, NcLoadingIcon, NcDateTimePickerNative, NcSelect } from '@nextcloud/vue'
130
+ import Plus from 'vue-material-design-icons/Plus.vue'
131
+ import Delete from 'vue-material-design-icons/Delete.vue'
132
+ import Pencil from 'vue-material-design-icons/Pencil.vue'
133
+ import Close from 'vue-material-design-icons/Close.vue'
134
+ import ContentSave from 'vue-material-design-icons/ContentSave.vue'
135
+ import CheckboxMarkedOutline from 'vue-material-design-icons/CheckboxMarkedOutline.vue'
136
+ import CheckboxBlankOutline from 'vue-material-design-icons/CheckboxBlankOutline.vue'
137
+ import { buildHeaders } from '../../utils/index.js'
138
+
139
+ export default {
140
+ name: 'CnTasksTab',
141
+
142
+ components: {
143
+ NcButton,
144
+ NcTextField,
145
+ NcListItem,
146
+ NcActionButton,
147
+ NcLoadingIcon,
148
+ NcDateTimePickerNative,
149
+ NcSelect,
150
+ Plus,
151
+ Delete,
152
+ Pencil,
153
+ Close,
154
+ ContentSave,
155
+ CheckboxMarkedOutline,
156
+ CheckboxBlankOutline,
157
+ },
158
+
159
+ props: {
160
+ objectId: { type: String, required: true },
161
+ register: { type: String, default: '' },
162
+ schema: { type: String, default: '' },
163
+ apiBase: { type: String, default: '/apps/openregister/api' },
164
+ addTaskPlaceholder: { type: String, default: () => t('nextcloud-vue', 'Add task...') },
165
+ deadlineLabel: { type: String, default: () => t('nextcloud-vue', 'Deadline') },
166
+ assigneeLabel: { type: String, default: () => t('nextcloud-vue', 'Assignee') },
167
+ completeLabel: { type: String, default: () => t('nextcloud-vue', 'Complete') },
168
+ editLabel: { type: String, default: () => t('nextcloud-vue', 'Edit') },
169
+ deleteLabel: { type: String, default: () => t('nextcloud-vue', 'Delete') },
170
+ noTasksLabel: { type: String, default: () => t('nextcloud-vue', 'No linked tasks') },
171
+ loadMoreLabel: { type: String, default: () => t('nextcloud-vue', 'Load more') },
172
+ statusFilterLabel: { type: String, default: () => t('nextcloud-vue', 'Status') },
173
+ assigneeFilterLabel: { type: String, default: () => t('nextcloud-vue', 'Assignee') },
174
+ },
175
+
176
+ data() {
177
+ return {
178
+ tasks: [],
179
+ loading: false,
180
+ loadingMore: false,
181
+ newTaskSummary: '',
182
+ newTaskDue: null,
183
+ newTaskAssignee: null,
184
+ saving: false,
185
+ editingTaskId: null,
186
+ userList: [],
187
+ page: 1,
188
+ total: 0,
189
+ limit: 20,
190
+ filterStatus: null,
191
+ filterAssignee: null,
192
+ }
193
+ },
194
+
195
+ computed: {
196
+ statusOptions() {
197
+ return [...new Set(this.tasks.map(t => t.status).filter(Boolean))]
198
+ },
199
+ assigneeOptions() {
200
+ return [...new Set(this.tasks.map(t => this.extractAssignee(t)).filter(Boolean))]
201
+ },
202
+ filteredTasks() {
203
+ let result = this.tasks
204
+ if (this.filterStatus) {
205
+ result = result.filter(t => t.status === this.filterStatus)
206
+ }
207
+ if (this.filterAssignee) {
208
+ result = result.filter(t => this.extractAssignee(t) === this.filterAssignee)
209
+ }
210
+ return result
211
+ },
212
+ },
213
+
214
+ watch: {
215
+ objectId: {
216
+ immediate: true,
217
+ handler(id) {
218
+ if (id) {
219
+ this.fetchTasks()
220
+ this.fetchUsers()
221
+ }
222
+ },
223
+ },
224
+ },
225
+
226
+ methods: {
227
+ async fetchTasks(append = false) {
228
+ if (!this.register || !this.schema) return
229
+ if (append) { this.loadingMore = true } else { this.loading = true }
230
+ try {
231
+ const params = new URLSearchParams({ limit: this.limit, _page: this.page })
232
+ const response = await fetch(
233
+ `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/tasks?${params}`,
234
+ { headers: buildHeaders() },
235
+ )
236
+ if (response.ok) {
237
+ const data = await response.json()
238
+ const results = data.results || data || []
239
+ this.tasks = append ? [...this.tasks, ...results] : results
240
+ this.total = data.total || this.tasks.length
241
+ }
242
+ } catch (err) {
243
+ console.error('CnTasksTab: Failed to fetch tasks', err)
244
+ } finally {
245
+ this.loading = false
246
+ this.loadingMore = false
247
+ }
248
+ },
249
+
250
+ loadMore() {
251
+ this.page++
252
+ this.fetchTasks(true)
253
+ },
254
+
255
+ isOverdue(task) {
256
+ if (!task.due || task.status === 'completed') return false
257
+ return new Date(task.due) < new Date()
258
+ },
259
+
260
+ async fetchUsers() {
261
+ try {
262
+ const response = await fetch('/ocs/v2.php/cloud/users/details?format=json&limit=50', {
263
+ headers: buildHeaders(),
264
+ })
265
+ if (response.ok) {
266
+ const data = await response.json()
267
+ const users = data.ocs?.data?.users || {}
268
+ this.userList = Object.entries(users).map(([id, user]) => ({
269
+ userId: id,
270
+ displayName: user.displayname || id,
271
+ }))
272
+ }
273
+ } catch (err) {
274
+ console.error('CnTasksTab: Failed to fetch users', err)
275
+ }
276
+ },
277
+
278
+ async addTask() {
279
+ if (!this.newTaskSummary.trim() || !this.register || !this.schema) return
280
+ this.saving = true
281
+ try {
282
+ const taskData = { summary: this.newTaskSummary.trim() }
283
+ if (this.newTaskDue) {
284
+ taskData.due = new Date(this.newTaskDue).toISOString()
285
+ }
286
+ if (this.newTaskAssignee) {
287
+ taskData.description = 'Assigned to: ' + this.newTaskAssignee.displayName
288
+ }
289
+ await fetch(
290
+ `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/tasks`,
291
+ {
292
+ method: 'POST',
293
+ headers: buildHeaders(),
294
+ body: JSON.stringify(taskData),
295
+ },
296
+ )
297
+ this.clearForm()
298
+ await this.fetchTasks()
299
+ } catch (err) {
300
+ console.error('CnTasksTab: Failed to add task', err)
301
+ } finally {
302
+ this.saving = false
303
+ }
304
+ },
305
+
306
+ startEdit(task) {
307
+ this.editingTaskId = task.id
308
+ this.newTaskSummary = task.summary || task.title || task.name || ''
309
+ this.newTaskDue = task.due ? new Date(task.due).toISOString().split('T')[0] : null
310
+ const assigneeName = this.extractAssignee(task)
311
+ this.newTaskAssignee = this.userList.find(u => u.displayName === assigneeName) || null
312
+ },
313
+
314
+ cancelEdit() {
315
+ this.editingTaskId = null
316
+ this.clearForm()
317
+ },
318
+
319
+ async saveEdit() {
320
+ if (!this.newTaskSummary.trim() || !this.editingTaskId) return
321
+ this.saving = true
322
+ try {
323
+ const taskData = { summary: this.newTaskSummary.trim() }
324
+ if (this.newTaskDue) {
325
+ taskData.due = new Date(this.newTaskDue).toISOString()
326
+ } else {
327
+ taskData.due = ''
328
+ }
329
+ if (this.newTaskAssignee) {
330
+ taskData.description = 'Assigned to: ' + this.newTaskAssignee.displayName
331
+ } else {
332
+ taskData.description = ''
333
+ }
334
+ await fetch(
335
+ `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/tasks/${encodeURIComponent(this.editingTaskId)}`,
336
+ {
337
+ method: 'PUT',
338
+ headers: buildHeaders(),
339
+ body: JSON.stringify(taskData),
340
+ },
341
+ )
342
+ this.editingTaskId = null
343
+ this.clearForm()
344
+ await this.fetchTasks()
345
+ } catch (err) {
346
+ console.error('CnTasksTab: Failed to update task', err)
347
+ } finally {
348
+ this.saving = false
349
+ }
350
+ },
351
+
352
+ clearForm() {
353
+ this.newTaskSummary = ''
354
+ this.newTaskDue = null
355
+ this.newTaskAssignee = null
356
+ },
357
+
358
+ async toggleTask(task) {
359
+ const newStatus = task.status === 'completed' ? 'NEEDS-ACTION' : 'COMPLETED'
360
+ try {
361
+ await fetch(
362
+ `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/tasks/${encodeURIComponent(task.id)}`,
363
+ {
364
+ method: 'PUT',
365
+ headers: buildHeaders(),
366
+ body: JSON.stringify({ status: newStatus }),
367
+ },
368
+ )
369
+ await this.fetchTasks()
370
+ } catch (err) {
371
+ console.error('CnTasksTab: Failed to toggle task', err)
372
+ }
373
+ },
374
+
375
+ async completeTask(task) {
376
+ try {
377
+ await fetch(
378
+ `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/tasks/${encodeURIComponent(task.id)}`,
379
+ {
380
+ method: 'PUT',
381
+ headers: buildHeaders(),
382
+ body: JSON.stringify({ status: 'COMPLETED' }),
383
+ },
384
+ )
385
+ await this.fetchTasks()
386
+ } catch (err) {
387
+ console.error('CnTasksTab: Failed to complete task', err)
388
+ }
389
+ },
390
+
391
+ async deleteTask(task) {
392
+ try {
393
+ await fetch(
394
+ `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/tasks/${encodeURIComponent(task.id)}`,
395
+ { method: 'DELETE', headers: buildHeaders() },
396
+ )
397
+ this.tasks = this.tasks.filter(t => t.id !== task.id)
398
+ } catch (err) {
399
+ console.error('CnTasksTab: Failed to delete task', err)
400
+ }
401
+ },
402
+
403
+ extractAssignee(task) {
404
+ if (task.description?.startsWith('Assigned to: ')) {
405
+ return task.description.replace('Assigned to: ', '')
406
+ }
407
+ return task.description || ''
408
+ },
409
+
410
+ formatShortDate(dateStr) {
411
+ if (!dateStr) return ''
412
+ try {
413
+ return new Date(dateStr).toLocaleDateString(undefined, {
414
+ day: 'numeric', month: 'short',
415
+ })
416
+ } catch { return dateStr }
417
+ },
418
+ },
419
+ }
420
+ </script>
421
+
422
+ <style scoped>
423
+ .cn-sidebar-tab {
424
+ padding: 12px;
425
+ overflow-x: hidden;
426
+ }
427
+
428
+ .cn-sidebar-tab__section {
429
+ margin-bottom: 12px;
430
+ }
431
+
432
+ .cn-sidebar-tab__section--filters {
433
+ padding-top: 12px;
434
+ border-top: 1px solid var(--color-border);
435
+ }
436
+
437
+ .cn-sidebar-tab__action--row {
438
+ display: flex;
439
+ gap: 8px;
440
+ align-items: flex-end;
441
+ margin-bottom: 8px;
442
+ }
443
+
444
+ .cn-sidebar-tab__grid {
445
+ display: grid;
446
+ grid-template-columns: 1fr 1fr;
447
+ gap: 8px;
448
+ }
449
+
450
+ .cn-sidebar-tab__grid > * {
451
+ min-width: 0;
452
+ }
453
+
454
+ .cn-sidebar-tab__empty {
455
+ text-align: center;
456
+ padding: 24px 12px;
457
+ color: var(--color-text-maxcontrast);
458
+ font-size: 13px;
459
+ }
460
+
461
+ .cn-sidebar-tab__list {
462
+ display: flex;
463
+ flex-direction: column;
464
+ gap: 2px;
465
+ }
466
+
467
+ .cn-sidebar-tab__load-more { margin-top: 8px; }
468
+
469
+ .cn-sidebar-tab__task-checkbox {
470
+ display: flex;
471
+ align-items: center;
472
+ justify-content: center;
473
+ background: none;
474
+ border: none;
475
+ padding: 0;
476
+ cursor: pointer;
477
+ color: inherit;
478
+ }
479
+
480
+ .cn-sidebar-tab__task-done { color: var(--color-success); }
481
+ .cn-sidebar-tab__task-overdue-icon { color: var(--color-error, #e53935); }
482
+ .cn-sidebar-tab__task-overdue-date { color: var(--color-error, #e53935); font-weight: 500; }
483
+ </style>
@@ -0,0 +1,6 @@
1
+ export { default as CnObjectSidebar } from './CnObjectSidebar.vue'
2
+ export { default as CnFilesTab } from './CnFilesTab.vue'
3
+ export { default as CnNotesTab } from './CnNotesTab.vue'
4
+ export { default as CnTagsTab } from './CnTagsTab.vue'
5
+ export { default as CnTasksTab } from './CnTasksTab.vue'
6
+ export { default as CnAuditTrailTab } from './CnAuditTrailTab.vue'
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div class="cn-page-header">
3
+ <div v-if="icon || $slots.icon" class="cn-page-header__icon">
4
+ <slot name="icon">
5
+ <CnIcon :name="icon" :size="iconSize" />
6
+ </slot>
7
+ </div>
8
+ <div class="cn-page-header__text">
9
+ <h1 class="cn-page-header__title">
10
+ {{ title }}
11
+ </h1>
12
+ <p v-if="description" class="cn-page-header__description">
13
+ {{ description }}
14
+ </p>
15
+ </div>
16
+ <slot name="extra" />
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import { CnIcon } from '../CnIcon/index.js'
22
+
23
+ /**
24
+ * CnPageHeader — Reusable page header with optional icon, title, and description.
25
+ *
26
+ * @example
27
+ * <CnPageHeader title="Clients" description="Manage your clients" icon="AccountGroup" />
28
+ */
29
+ export default {
30
+ name: 'CnPageHeader',
31
+
32
+ components: {
33
+ CnIcon,
34
+ },
35
+
36
+ props: {
37
+ /** Page title text */
38
+ title: {
39
+ type: String,
40
+ required: true,
41
+ },
42
+ /** Optional description shown below the title */
43
+ description: {
44
+ type: String,
45
+ default: '',
46
+ },
47
+ /** Optional MDI icon name (rendered via CnIcon) */
48
+ icon: {
49
+ type: String,
50
+ default: '',
51
+ },
52
+ /** Icon size in pixels */
53
+ iconSize: {
54
+ type: Number,
55
+ default: 28,
56
+ },
57
+ },
58
+ }
59
+ </script>
60
+
61
+ <!-- Styles in css/page-header.css -->
@@ -0,0 +1 @@
1
+ export { default as CnPageHeader } from './CnPageHeader.vue'