@things-factory/worklist 6.0.43 → 6.0.46

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 (190) hide show
  1. package/client/bootstrap.ts +5 -0
  2. package/client/components/activity-starter-form.ts +52 -303
  3. package/client/pages/activity/activity-list-page.ts +44 -28
  4. package/client/pages/activity/activity-page.ts +3 -3
  5. package/client/pages/activity/activity-partial-view.ts +2 -1
  6. package/client/pages/activity/starter-list-page.ts +16 -11
  7. package/client/pages/activity-instance/activity-instance-search-page.ts +2 -19
  8. package/client/pages/activity-instance/activity-instance-start-page.ts +514 -0
  9. package/client/pages/activity-stats/activity-stats-importer.ts +97 -0
  10. package/client/pages/activity-stats/activity-stats-list-page.ts +348 -0
  11. package/client/pages/activity-thread/activity-thread-page.ts +1 -1
  12. package/client/pages/installable-activity/installable-activity-list-page.ts +7 -5
  13. package/client/pages/todo/approval-done-list-page.ts +340 -0
  14. package/client/pages/todo/approval-pending-list-page.ts +2 -2
  15. package/client/pages/todo/done-list-calendar-page.ts +115 -0
  16. package/client/pages/todo/done-list-page.ts +2 -3
  17. package/client/pages/todo/draft-list-page.ts +26 -102
  18. package/client/pages/todo/pickable-list-page.ts +2 -1
  19. package/client/pages/todo/todo-list-page.ts +1 -1
  20. package/client/route.ts +14 -2
  21. package/client/templates/activity-approval-context-template.ts +4 -0
  22. package/client/templates/activity-instance-context-template.ts +171 -0
  23. package/client/templates/activity-thread-context-template.ts +4 -0
  24. package/client/themes/calendar-theme.css +54 -0
  25. package/client/types/activity-instance-type.ts +4 -2
  26. package/client/types/activity-instance.ts +2 -2
  27. package/client/types/activity.ts +7 -0
  28. package/client/types/types.ts +8 -0
  29. package/dist-client/bootstrap.d.ts +1 -0
  30. package/dist-client/bootstrap.js +5 -0
  31. package/dist-client/bootstrap.js.map +1 -1
  32. package/dist-client/components/activity-starter-form.d.ts +2 -5
  33. package/dist-client/components/activity-starter-form.js +54 -247
  34. package/dist-client/components/activity-starter-form.js.map +1 -1
  35. package/dist-client/pages/activity/activity-list-page.d.ts +1 -1
  36. package/dist-client/pages/activity/activity-list-page.js +45 -30
  37. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  38. package/dist-client/pages/activity/activity-page.d.ts +1 -1
  39. package/dist-client/pages/activity/activity-page.js +3 -3
  40. package/dist-client/pages/activity/activity-page.js.map +1 -1
  41. package/dist-client/pages/activity/activity-partial-view.js +2 -2
  42. package/dist-client/pages/activity/activity-partial-view.js.map +1 -1
  43. package/dist-client/pages/activity/starter-list-page.d.ts +1 -0
  44. package/dist-client/pages/activity/starter-list-page.js +14 -11
  45. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  46. package/dist-client/pages/activity-instance/activity-instance-page.d.ts +2 -2
  47. package/dist-client/pages/activity-instance/activity-instance-page.js +19 -10
  48. package/dist-client/pages/activity-instance/activity-instance-page.js.map +1 -1
  49. package/dist-client/pages/activity-instance/activity-instance-search-page.js +1 -8
  50. package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -1
  51. package/dist-client/pages/activity-instance/activity-instance-start-page.d.ts +49 -0
  52. package/dist-client/pages/activity-instance/activity-instance-start-page.js +450 -0
  53. package/dist-client/pages/activity-instance/activity-instance-start-page.js.map +1 -0
  54. package/dist-client/pages/activity-stats/activity-stats-importer.d.ts +22 -0
  55. package/dist-client/pages/activity-stats/activity-stats-importer.js +100 -0
  56. package/dist-client/pages/activity-stats/activity-stats-importer.js.map +1 -0
  57. package/dist-client/pages/activity-stats/activity-stats-list-page.d.ts +62 -0
  58. package/dist-client/pages/activity-stats/activity-stats-list-page.js +326 -0
  59. package/dist-client/pages/activity-stats/activity-stats-list-page.js.map +1 -0
  60. package/dist-client/pages/activity-thread/activity-thread-page.js +1 -1
  61. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  62. package/dist-client/pages/installable-activity/installable-activity-list-page.js +7 -5
  63. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  64. package/dist-client/pages/todo/approval-done-list-page.d.ts +39 -0
  65. package/dist-client/pages/todo/approval-done-list-page.js +338 -0
  66. package/dist-client/pages/todo/approval-done-list-page.js.map +1 -0
  67. package/dist-client/pages/todo/approval-pending-list-page.js +2 -2
  68. package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
  69. package/dist-client/pages/todo/done-list-calendar-page.d.ts +24 -0
  70. package/dist-client/pages/todo/done-list-calendar-page.js +107 -0
  71. package/dist-client/pages/todo/done-list-calendar-page.js.map +1 -0
  72. package/dist-client/pages/todo/done-list-page.js +2 -3
  73. package/dist-client/pages/todo/done-list-page.js.map +1 -1
  74. package/dist-client/pages/todo/draft-list-page.d.ts +1 -0
  75. package/dist-client/pages/todo/draft-list-page.js +25 -99
  76. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  77. package/dist-client/pages/todo/pickable-list-page.d.ts +1 -0
  78. package/dist-client/pages/todo/pickable-list-page.js +2 -1
  79. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  80. package/dist-client/pages/todo/todo-list-page.js +1 -1
  81. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  82. package/dist-client/route.d.ts +1 -1
  83. package/dist-client/route.js +11 -2
  84. package/dist-client/route.js.map +1 -1
  85. package/dist-client/templates/activity-approval-context-template.js +4 -0
  86. package/dist-client/templates/activity-approval-context-template.js.map +1 -1
  87. package/dist-client/templates/activity-instance-context-template.d.ts +2 -0
  88. package/dist-client/templates/activity-instance-context-template.js +145 -0
  89. package/dist-client/templates/activity-instance-context-template.js.map +1 -0
  90. package/dist-client/templates/activity-thread-context-template.js +4 -0
  91. package/dist-client/templates/activity-thread-context-template.js.map +1 -1
  92. package/dist-client/tsconfig.tsbuildinfo +1 -1
  93. package/dist-client/types/activity-instance-type.d.ts +3 -2
  94. package/dist-client/types/activity-instance-type.js +2 -2
  95. package/dist-client/types/activity-instance-type.js.map +1 -1
  96. package/dist-client/types/activity-instance.d.ts +1 -1
  97. package/dist-client/types/activity-instance.js +2 -2
  98. package/dist-client/types/activity-instance.js.map +1 -1
  99. package/dist-client/types/activity.d.ts +5 -0
  100. package/dist-client/types/activity.js +5 -0
  101. package/dist-client/types/activity.js.map +1 -1
  102. package/dist-client/types/types.d.ts +4 -0
  103. package/dist-client/types/types.js +6 -0
  104. package/dist-client/types/types.js.map +1 -1
  105. package/dist-server/controllers/activity-instance/assign.js +1 -1
  106. package/dist-server/controllers/activity-instance/assign.js.map +1 -1
  107. package/dist-server/controllers/activity-instance/draft.js +24 -6
  108. package/dist-server/controllers/activity-instance/draft.js.map +1 -1
  109. package/dist-server/controllers/activity-instance/index.js +1 -1
  110. package/dist-server/controllers/activity-instance/index.js.map +1 -1
  111. package/dist-server/controllers/activity-instance/issue.js +105 -0
  112. package/dist-server/controllers/activity-instance/issue.js.map +1 -0
  113. package/dist-server/controllers/activity-instance/pick.js +1 -1
  114. package/dist-server/controllers/activity-instance/pick.js.map +1 -1
  115. package/dist-server/controllers/activity-instance/post.js +7 -7
  116. package/dist-server/controllers/activity-instance/post.js.map +1 -1
  117. package/dist-server/controllers/common.js +33 -9
  118. package/dist-server/controllers/common.js.map +1 -1
  119. package/dist-server/routes.js +2 -2
  120. package/dist-server/routes.js.map +1 -1
  121. package/dist-server/service/activity/activity-history.js +6 -2
  122. package/dist-server/service/activity/activity-history.js.map +1 -1
  123. package/dist-server/service/activity/activity-query.js +84 -1
  124. package/dist-server/service/activity/activity-query.js.map +1 -1
  125. package/dist-server/service/activity/activity-type.js +8 -0
  126. package/dist-server/service/activity/activity-type.js.map +1 -1
  127. package/dist-server/service/activity/activity.js +36 -3
  128. package/dist-server/service/activity/activity.js.map +1 -1
  129. package/dist-server/service/activity-approval/activity-approval-query.js +48 -0
  130. package/dist-server/service/activity-approval/activity-approval-query.js.map +1 -1
  131. package/dist-server/service/activity-instance/activity-instance-history.js +1 -1
  132. package/dist-server/service/activity-instance/activity-instance-history.js.map +1 -1
  133. package/dist-server/service/activity-instance/activity-instance-mutation.js +6 -6
  134. package/dist-server/service/activity-instance/activity-instance-mutation.js.map +1 -1
  135. package/dist-server/service/activity-instance/activity-instance-query.js +2 -2
  136. package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
  137. package/dist-server/service/activity-instance/activity-instance-type.js +62 -50
  138. package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
  139. package/dist-server/service/activity-instance/activity-instance.js +4 -23
  140. package/dist-server/service/activity-instance/activity-instance.js.map +1 -1
  141. package/dist-server/service/activity-stats/activity-stats-query.js +93 -0
  142. package/dist-server/service/activity-stats/activity-stats-query.js.map +1 -0
  143. package/dist-server/service/activity-stats/activity-stats-type.js +47 -0
  144. package/dist-server/service/activity-stats/activity-stats-type.js.map +1 -0
  145. package/dist-server/service/activity-stats/index.js +6 -0
  146. package/dist-server/service/activity-stats/index.js.map +1 -0
  147. package/dist-server/service/activity-summary/activity-summary-query.js +5 -23
  148. package/dist-server/service/activity-summary/activity-summary-query.js.map +1 -1
  149. package/dist-server/service/index.js +2 -0
  150. package/dist-server/service/index.js.map +1 -1
  151. package/dist-server/service/installable-activity/installable-activity.js +4 -0
  152. package/dist-server/service/installable-activity/installable-activity.js.map +1 -1
  153. package/dist-server/tsconfig.tsbuildinfo +1 -1
  154. package/helps/worklist/activity-bank.md +22 -0
  155. package/helps/worklist/{activity-approval.md → activity-stats.md} +1 -1
  156. package/helps/worklist/activity.md +91 -0
  157. package/helps/worklist/draft-list.md +19 -0
  158. package/helps/worklist/starter-list.md +34 -0
  159. package/helps/worklist/worklist-concept.md +11 -8
  160. package/package.json +3 -2
  161. package/server/controllers/activity-instance/assign.ts +1 -1
  162. package/server/controllers/activity-instance/draft.ts +33 -6
  163. package/server/controllers/activity-instance/index.ts +1 -1
  164. package/server/controllers/activity-instance/issue.ts +175 -0
  165. package/server/controllers/activity-instance/pick.ts +1 -1
  166. package/server/controllers/common.ts +43 -9
  167. package/server/routes.ts +2 -2
  168. package/server/service/activity/activity-history.ts +5 -2
  169. package/server/service/activity/activity-query.ts +85 -2
  170. package/server/service/activity/activity-type.ts +15 -2
  171. package/server/service/activity/activity.ts +28 -2
  172. package/server/service/activity-approval/activity-approval-query.ts +45 -1
  173. package/server/service/activity-instance/activity-instance-history.ts +1 -1
  174. package/server/service/activity-instance/activity-instance-mutation.ts +7 -7
  175. package/server/service/activity-instance/activity-instance-query.ts +3 -3
  176. package/server/service/activity-instance/activity-instance-type.ts +13 -4
  177. package/server/service/activity-instance/activity-instance.ts +4 -16
  178. package/server/service/activity-stats/activity-stats-query.ts +94 -0
  179. package/server/service/activity-stats/activity-stats-type.ts +34 -0
  180. package/server/service/activity-stats/index.ts +3 -0
  181. package/server/service/activity-summary/activity-summary-query.ts +5 -23
  182. package/server/service/index.ts +2 -0
  183. package/server/service/installable-activity/installable-activity.ts +4 -1
  184. package/things-factory.config.js +5 -2
  185. package/translations/en.json +23 -0
  186. package/translations/ko.json +29 -6
  187. package/translations/ms.json +23 -0
  188. package/translations/zh.json +23 -0
  189. package/client/pages/activity-instance/activity-instance-page.ts +0 -445
  190. package/server/controllers/activity-instance/post.ts +0 -140
@@ -0,0 +1,340 @@
1
+ import '@operato/data-grist'
2
+ import '@operato/input/ox-input-select-buttons.js'
3
+
4
+ import gql from 'graphql-tag'
5
+ import { css, html } from 'lit'
6
+ import { customElement, property, query, state } from 'lit/decorators.js'
7
+ import { connect } from 'pwa-helpers/connect-mixin.js'
8
+
9
+ import { DataGrist, FetchOption, getRenderer } from '@operato/data-grist'
10
+ import { client } from '@operato/graphql'
11
+ import { i18next, localize } from '@operato/i18n'
12
+ import { navigate, PageView, store } from '@operato/shell'
13
+ import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
14
+ import { adjustFilters, isMobileDevice, sleep } from '@operato/utils'
15
+
16
+ const MIN = 60
17
+ const HOUR = 60 * MIN
18
+ const DAY = 24 * HOUR
19
+
20
+ @customElement('approval-done-list-page')
21
+ export class ApprovalDoneListPage extends connect(store)(localize(i18next)(PageView)) {
22
+ static styles = [
23
+ ScrollbarStyles,
24
+ CommonGristStyles,
25
+ css`
26
+ :host {
27
+ display: flex;
28
+
29
+ width: 100%;
30
+
31
+ --grid-record-emphasized-background-color: red;
32
+ --grid-record-emphasized-color: yellow;
33
+ }
34
+
35
+ #modes {
36
+ margin-left: auto;
37
+ }
38
+ `
39
+ ]
40
+
41
+ @property({ type: Object }) gristConfig?: any
42
+ @property({ type: String }) mode: 'GRID' | 'LIST' | 'CARD' = isMobileDevice() ? 'CARD' : 'GRID'
43
+
44
+ @query('ox-grist') grist!: DataGrist
45
+
46
+ @state() filters?: string[]
47
+
48
+ get context() {
49
+ return {
50
+ search: {
51
+ handler: (search: string) => {
52
+ this.grist.searchText = search
53
+ },
54
+ placeholder: i18next.t('title.approval done list'),
55
+ value: this.grist.searchText
56
+ },
57
+ filter: {
58
+ handler: () => {
59
+ this.grist.toggleHeadroom()
60
+ }
61
+ },
62
+ help: 'worklist/worklist-concept',
63
+ actions: []
64
+ }
65
+ }
66
+
67
+ render() {
68
+ const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
69
+
70
+ return html`
71
+ <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
72
+ <div slot="headroom">
73
+ <div id="filters">
74
+ <ox-input-select-buttons
75
+ .value=${this.filters}
76
+ .options=${[
77
+ {
78
+ display: i18next.t('label.filter-important'),
79
+ value: 'important'
80
+ },
81
+ {
82
+ display: i18next.t('label.filter-due'),
83
+ value: 'due'
84
+ },
85
+ {
86
+ display: i18next.t('label.filter-rejected'),
87
+ value: 'rejected'
88
+ }
89
+ ]}
90
+ @change=${(e: CustomEvent) => {
91
+ this.filters = (e.currentTarget as any)?.value
92
+ this.grist.fetch()
93
+ }}
94
+ ></ox-input-select-buttons>
95
+ </div>
96
+
97
+ <div id="modes">
98
+ <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
99
+ <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
100
+ <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
101
+ </div>
102
+ </div>
103
+ </ox-grist>
104
+ `
105
+ }
106
+
107
+ async pageInitialized(lifecycle) {
108
+ this.gristConfig = {
109
+ list: {
110
+ thumbnail: 'thumbnail',
111
+ fields: ['name', 'description'],
112
+ details: ['createdAt', 'due']
113
+ },
114
+ columns: [
115
+ { type: 'gutter', gutterName: 'sequence' },
116
+ {
117
+ type: 'gutter',
118
+ gutterName: 'button',
119
+ name: 'start',
120
+ icon: 'play_arrow',
121
+ handlers: {
122
+ click: (columns, data, column, record, rowIndex) => {
123
+ const { id } = record
124
+ this.openActivityApproval(record)
125
+ }
126
+ }
127
+ },
128
+ {
129
+ type: 'string',
130
+ name: 'name',
131
+ header: i18next.t('field.name'),
132
+ record: {
133
+ editable: false
134
+ },
135
+ filter: 'search',
136
+ sortable: true,
137
+ width: 150
138
+ },
139
+ {
140
+ type: 'string',
141
+ name: 'description',
142
+ header: i18next.t('field.description'),
143
+ record: {
144
+ editable: false
145
+ },
146
+ filter: 'search',
147
+ width: 200
148
+ },
149
+ {
150
+ type: 'number',
151
+ name: 'round',
152
+ header: i18next.t('field.round'),
153
+ record: {
154
+ editable: false
155
+ },
156
+ width: 30
157
+ },
158
+ {
159
+ type: 'string',
160
+ name: 'viewSource',
161
+ header: i18next.t('field.view-source'),
162
+ record: {
163
+ editable: false,
164
+ renderer: function (value, column, record, rowIndex, field) {
165
+ const { viewType, viewSource } = record.activity || {}
166
+ var type = viewType !== 'board' ? 'string' : 'board'
167
+ return getRenderer(type)(viewSource, column, record, rowIndex, field)
168
+ }
169
+ },
170
+ width: 140,
171
+ hidden: true
172
+ },
173
+ {
174
+ type: 'number',
175
+ name: 'priority',
176
+ header: i18next.t('field.priority'),
177
+ record: {
178
+ editable: false,
179
+ renderer: function (value, column, record, rowIndex, field) {
180
+ const count = new Array(value > 4 ? 4 : value || 0).fill('')
181
+ return html`${count.map(() => html`<mwc-icon style="color:gray;">star</mwc-icon>`)}`
182
+ }
183
+ },
184
+ width: 60
185
+ },
186
+ {
187
+ type: 'select',
188
+ name: 'judgment',
189
+ header: i18next.t('field.judgment'),
190
+ record: {
191
+ editable: false,
192
+ options: [
193
+ { display: i18next.t('label.activity-state-rejected'), value: 'rejected' },
194
+ { display: i18next.t('label.activity-state-escalated'), value: 'escalated' },
195
+ { display: i18next.t('label.activity-state-delegated'), value: 'delegated' },
196
+ { display: i18next.t('label.activity-state-approved'), value: 'approved' },
197
+ { display: i18next.t('label.activity-state-aborted'), value: 'aborted' }
198
+ ]
199
+ },
200
+ width: 80
201
+ },
202
+ {
203
+ type: 'string',
204
+ name: 'comment',
205
+ header: i18next.t('field.comment'),
206
+ record: {
207
+ editable: false
208
+ },
209
+ width: 160
210
+ },
211
+ {
212
+ type: 'datetime',
213
+ name: 'createdAt',
214
+ header: i18next.t('field.created-at'),
215
+ record: {
216
+ editable: false
217
+ },
218
+ sortable: true,
219
+ filter: false,
220
+ width: 180
221
+ },
222
+ {
223
+ type: 'datetime',
224
+ name: 'terminatedAt',
225
+ header: i18next.t('field.terminated-at'),
226
+ record: {
227
+ editable: false
228
+ },
229
+ sortable: true,
230
+ filter: false,
231
+ width: 180
232
+ },
233
+ {
234
+ type: 'image',
235
+ name: 'thumbnail',
236
+ header: i18next.t('field.thumbnail'),
237
+ record: { editable: false },
238
+ hidden: true
239
+ }
240
+ ],
241
+ rows: {
242
+ appendable: false
243
+ }
244
+ // sorters: [
245
+ // {
246
+ // name: 'dueAt',
247
+ // desc: false
248
+ // }
249
+ // ]
250
+ }
251
+ }
252
+
253
+ async pageUpdated(changes, lifecycle, changedBefore) {
254
+ if (this.active) {
255
+ this.grist?.fetch()
256
+ }
257
+ }
258
+
259
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
260
+ if (this.filters?.includes('important')) {
261
+ filters = adjustFilters(filters, [{ name: 'priority', operator: 'gte', value: 2 }])
262
+ }
263
+
264
+ if (this.filters?.includes('due')) {
265
+ let tomorrow = new Date(Date.now() + 24 * 3600 * 1000).toISOString().replace('T', ' ')
266
+ filters = adjustFilters(filters, [{ name: 'dueAt', operator: 'lte', value: tomorrow }])
267
+ }
268
+
269
+ if (this.filters?.includes('rejected')) {
270
+ filters = adjustFilters(filters, [{ name: 'judgment', operator: 'eq', value: 'rejected' }])
271
+ }
272
+
273
+ const response = await client.query({
274
+ query: gql`
275
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
276
+ responses: approvalDoneList(filters: $filters, pagination: $pagination, sortings: $sortings) {
277
+ items {
278
+ id
279
+ round
280
+ judgment
281
+ comment
282
+ createdAt
283
+ terminatedAt
284
+ activityThread {
285
+ activityInstance {
286
+ activityId: id
287
+ name
288
+ description
289
+ priority
290
+ input
291
+ refBy
292
+ activityType
293
+ viewType
294
+ viewSource
295
+ thumbnail
296
+ updatedAt
297
+ createdAt
298
+ creator {
299
+ id
300
+ name
301
+ }
302
+ }
303
+ state
304
+ output
305
+ dueAt
306
+ assignedAt
307
+ }
308
+ }
309
+ total
310
+ }
311
+ }
312
+ `,
313
+ variables: {
314
+ filters,
315
+ pagination: { page, limit },
316
+ sortings
317
+ }
318
+ })
319
+
320
+ return {
321
+ total: response.data.responses.total || 0,
322
+ records: (response.data.responses.items || []).map(item => {
323
+ let thread = item.activityThread
324
+ return {
325
+ id: item.id,
326
+ ...thread.activityInstance,
327
+ judgment: item.judgment,
328
+ comment: item.comment,
329
+ round: item.round,
330
+ createdAt: item.createdAt,
331
+ terminatedAt: item.terminatedAt
332
+ }
333
+ })
334
+ }
335
+ }
336
+
337
+ openActivityApproval(activityApproval) {
338
+ navigate(`activity-approval/${activityApproval.id}?title=${activityApproval.name}`)
339
+ }
340
+ }
@@ -60,7 +60,7 @@ export class ApprovalPendingListPage extends connect(store)(localize(i18next)(Pa
60
60
  this.grist.toggleHeadroom()
61
61
  }
62
62
  },
63
- help: 'worklist/approval-pending-list',
63
+ help: 'worklist/worklist-concept',
64
64
  actions: []
65
65
  }
66
66
  }
@@ -229,7 +229,7 @@ export class ApprovalPendingListPage extends connect(store)(localize(i18next)(Pa
229
229
  {
230
230
  type: 'datetime',
231
231
  name: 'createdAt',
232
- header: i18next.t('field.posted-at'),
232
+ header: i18next.t('field.issued-at'),
233
233
  record: {
234
234
  editable: false
235
235
  },
@@ -0,0 +1,115 @@
1
+ import '@material/mwc-icon'
2
+ import '@operato/event-view/ox-event-view.js'
3
+
4
+ import { PropertyValues, html, css } from 'lit'
5
+ import gql from 'graphql-tag'
6
+ import { customElement, property, query, state } from 'lit/decorators.js'
7
+ import { connect } from 'pwa-helpers/connect-mixin.js'
8
+ import { store, PageView } from '@operato/shell'
9
+ import { client } from '@operato/graphql'
10
+ import { i18next, localize } from '@operato/i18n'
11
+ import { OxEventView } from '@operato/event-view'
12
+ import { ScrollbarStyles } from '@operato/styles'
13
+ import { BizEvent, CALENDAR } from '@operato/event-view/types.js'
14
+
15
+ @customElement('done-list-calendar-page')
16
+ export class DoneListCalendarPage extends connect(store)(PageView) {
17
+ static styles = [
18
+ ScrollbarStyles,
19
+ css`
20
+ :host {
21
+ display: flex;
22
+ }
23
+
24
+ ox-event-view {
25
+ flex: 1;
26
+ padding: 10px;
27
+ overflow: auto;
28
+ }
29
+ `
30
+ ]
31
+
32
+ @query('ox-event-view') eventView!: OxEventView
33
+
34
+ get context() {
35
+ return {
36
+ title: i18next.t('title.done list calendar'),
37
+ help: 'worklist/worklist-concept'
38
+ }
39
+ }
40
+
41
+ render() {
42
+ return html` <ox-event-view mode="monthly" .eventProvider=${this}></ox-event-view> `
43
+ }
44
+
45
+ async fetchEventsForCalendar(calendar: CALENDAR): Promise<Map<Date, BizEvent[]>> {
46
+ const from = calendar[0].date.toISOString().split('T').join(' ')
47
+ const to = calendar[calendar.length - 1].date.toISOString().split('T').join(' ')
48
+
49
+ const response = await client.query({
50
+ query: gql`
51
+ query ($from: String!, $to: String!) {
52
+ responses: activityEvents(from: $from, to: $to) {
53
+ id
54
+ name
55
+ type
56
+ state
57
+ priority
58
+ date
59
+ }
60
+ }
61
+ `,
62
+ variables: {
63
+ from,
64
+ to
65
+ }
66
+ })
67
+
68
+ const eventMap = new Map<Date, BizEvent[]>()
69
+
70
+ if (response.data) {
71
+ const activityEvents = response.data.responses
72
+
73
+ calendar.forEach(({ date }) => {
74
+ const localDateString = date.toLocaleDateString()
75
+
76
+ var events = activityEvents
77
+ .filter(({ date: activityDate }) => new Date(activityDate).toLocaleDateString() == localDateString)
78
+ .sort((a, b) => (a.date > b.date ? 1 : -1))
79
+ .map(({ id, name, priority, date, type, state }) => {
80
+ const color = ['black', 'darkgray', 'orange', 'red'][priority || 0]
81
+ const href =
82
+ type == 'activity-thread'
83
+ ? `activity-thread-view/${id}?title=${name}`
84
+ : `activity-approval/${id}?title=${name}`
85
+ const at = new Date(date).toLocaleTimeString([], {
86
+ hourCycle: 'h23',
87
+ hour: '2-digit',
88
+ minute: '2-digit'
89
+ })
90
+ const icon = type == 'activity-thread' ? 'done' : state == 'approved' ? 'done_all' : 'assignment_return'
91
+
92
+ return {
93
+ template: html`<a href=${href} style="color:${color};display:block;text-decoration:none;"
94
+ ><mwc-icon style="font-size:1em;">${icon}</mwc-icon>&nbsp;${at}&nbsp;${name}</a
95
+ >`
96
+ }
97
+ })
98
+
99
+ eventMap.set(date, events)
100
+ })
101
+ }
102
+
103
+ return eventMap
104
+ }
105
+
106
+ pageUpdated(changes: any, lifecycle: any, before: any) {
107
+ if (this.active) {
108
+ /*
109
+ * this page is activated
110
+ */
111
+ } else {
112
+ /* this page is deactivated */
113
+ }
114
+ }
115
+ }
@@ -167,9 +167,8 @@ export class DoneListPage extends connect(store)(localize(i18next)(PageView)) {
167
167
  record: {
168
168
  editable: false,
169
169
  renderer: function (value, column, record, rowIndex, field) {
170
- const color = ['', 'gray', 'yellow', 'orange', 'red'][value || 0]
171
170
  const count = new Array(value > 4 ? 4 : value || 0).fill('')
172
- return html`${count.map(() => html`<mwc-icon style="color:${color};">star</mwc-icon>`)}`
171
+ return html`${count.map(() => html`<mwc-icon style="color:gray;">star</mwc-icon>`)}`
173
172
  }
174
173
  },
175
174
  width: 60
@@ -242,7 +241,7 @@ export class DoneListPage extends connect(store)(localize(i18next)(PageView)) {
242
241
  {
243
242
  type: 'datetime',
244
243
  name: 'createdAt',
245
- header: i18next.t('field.posted-at'),
244
+ header: i18next.t('field.issued-at'),
246
245
  record: {
247
246
  editable: false
248
247
  },
@@ -6,17 +6,15 @@ import { css, html } from 'lit'
6
6
  import { customElement, property, query } from 'lit/decorators.js'
7
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
8
8
 
9
- import { DataGrist, FetchOption, getRenderer } from '@operato/data-grist'
9
+ import { DataGrist, FetchOption } from '@operato/data-grist'
10
10
  import { client } from '@operato/graphql'
11
11
  import { i18next, localize } from '@operato/i18n'
12
- import { openPopup } from '@operato/layout'
13
- import { PageView, store } from '@operato/shell'
12
+ import { navigate, PageView, store } from '@operato/shell'
14
13
  import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
15
14
  import { isMobileDevice } from '@operato/utils'
16
15
  import { OxPopup } from '@operato/popup'
17
16
 
18
- import { ActivityInstanceStatus } from '../../types/activity-instance'
19
- import { Priorities } from '../../types/types.js'
17
+ import { ActivityStartingTypes } from '../../types/types.js'
20
18
 
21
19
  const MIN = 60
22
20
  const HOUR = 60 * MIN
@@ -121,23 +119,7 @@ export class DraftListPage extends connect(store)(localize(i18next)(PageView)) {
121
119
  return
122
120
  }
123
121
 
124
- const popup = openPopup(
125
- html`
126
- <activity-starter-form
127
- .activityId=${record.activity?.id}
128
- .activityInstance=${record}
129
- ></activity-starter-form>
130
- `,
131
- {
132
- backdrop: true,
133
- help: 'worklist/activity-starter-form',
134
- size: 'large',
135
- title: i18next.t('title.activity starter')
136
- }
137
- )
138
- popup.onclosed = () => {
139
- this.grist?.fetch()
140
- }
122
+ this.openActivityInstanceStart(record)
141
123
  }
142
124
  }
143
125
  },
@@ -160,36 +142,19 @@ export class DraftListPage extends connect(store)(localize(i18next)(PageView)) {
160
142
  editable: false
161
143
  },
162
144
  filter: 'search',
163
- width: 200
145
+ width: 240
164
146
  },
165
147
  {
166
- type: 'string',
167
- name: 'uiSource',
168
- header: i18next.t('field.ui-source'),
169
- record: {
170
- editable: false,
171
- renderer: function (value, column, record, rowIndex, field) {
172
- const { uiType, uiSource } = record.activity || {}
173
- var type = uiType !== 'board' ? 'string' : 'board'
174
- return getRenderer(type)(uiSource, column, record, rowIndex, field)
175
- }
176
- },
177
- width: 140,
178
- hidden: true
179
- },
180
- {
181
- type: 'number',
182
- name: 'priority',
183
- header: i18next.t('field.priority'),
148
+ type: 'select',
149
+ name: 'startingType',
150
+ label: true,
151
+ header: i18next.t('field.starting-type'),
184
152
  record: {
185
153
  editable: false,
186
- renderer: function (value, column, record, rowIndex, field) {
187
- const color = ['', 'gray', 'yellow', 'orange', 'red'][value || 0]
188
- const count = new Array(value > 4 ? 4 : value || 0).fill('')
189
- return html`${count.map(() => html`<mwc-icon style="color:${color};">star</mwc-icon>`)}`
190
- }
154
+ options: ActivityStartingTypes
191
155
  },
192
- width: 60
156
+ sortable: true,
157
+ width: 80
193
158
  },
194
159
  {
195
160
  type: 'select',
@@ -213,58 +178,8 @@ export class DraftListPage extends connect(store)(localize(i18next)(PageView)) {
213
178
  },
214
179
  {
215
180
  type: 'datetime',
216
- name: 'dueAt',
217
- header: i18next.t('field.due-at'),
218
- record: {
219
- editable: false,
220
- options: {
221
- year: 'numeric',
222
- month: 'numeric',
223
- day: 'numeric'
224
- }
225
- },
226
- sortable: true,
227
- // filter: {
228
- // type: 'date',
229
- // operator: 'between'
230
- // },
231
- // filter: {
232
- // type: 'select',
233
- // operator: 'between',
234
- // options: (column, owner) => {
235
- // const now = Date.now()
236
- // return [
237
- // {
238
- // display: '1일 이내 처리',
239
- // value: [now, Date.now() + 60 * 60 * 3600 * 1000]
240
- // },
241
- // {
242
- // display: '2일 이내 처리',
243
- // value: [now, Date.now() + 2 * 60 * 60 * 3600 * 1000]
244
- // },
245
- // {
246
- // display: '3일 이내 처리',
247
- // value: [now, Date.now() + 3 * 60 * 60 * 3600 * 1000]
248
- // }
249
- // ]
250
- // }
251
- // },
252
- width: 100
253
- },
254
- {
255
- type: 'resource-object',
256
- name: 'creator',
257
- header: i18next.t('field.issuer'),
258
- record: {
259
- editable: false
260
- },
261
- sortable: true,
262
- width: 120
263
- },
264
- {
265
- type: 'datetime',
266
- name: 'createdAt',
267
- header: i18next.t('field.posted-at'),
181
+ name: 'updatedAt',
182
+ header: i18next.t('field.updated-at'),
268
183
  record: {
269
184
  editable: false
270
185
  },
@@ -284,8 +199,8 @@ export class DraftListPage extends connect(store)(localize(i18next)(PageView)) {
284
199
  },
285
200
  sorters: [
286
201
  {
287
- name: 'dueAt',
288
- desc: false
202
+ name: 'updatedAt',
203
+ desc: true
289
204
  }
290
205
  ]
291
206
  }
@@ -313,6 +228,7 @@ export class DraftListPage extends connect(store)(localize(i18next)(PageView)) {
313
228
  refBy
314
229
  activity {
315
230
  id
231
+ startingType
316
232
  }
317
233
  activityType
318
234
  assignees {
@@ -361,7 +277,15 @@ export class DraftListPage extends connect(store)(localize(i18next)(PageView)) {
361
277
 
362
278
  return {
363
279
  total: response.data.responses.total || 0,
364
- records: response.data.responses.items || []
280
+ records:
281
+ response.data.responses.items.map(item => {
282
+ item['startingType'] = item.activity?.startingType
283
+ return item
284
+ }) || []
365
285
  }
366
286
  }
287
+
288
+ openActivityInstanceStart(activityInstance) {
289
+ navigate(`activity-instance-start/${activityInstance.id}?title=${activityInstance.name}`)
290
+ }
367
291
  }
@@ -45,7 +45,7 @@ export class PickableListPage extends connect(store)(localize(i18next)(PageView)
45
45
  handler: (search: string) => {
46
46
  this.grist.searchText = search
47
47
  },
48
- placeholder: i18next.t('title.activity bank'),
48
+ placeholder: i18next.t('title.activity shopping'),
49
49
  value: this.grist.searchText
50
50
  },
51
51
  filter: {
@@ -53,6 +53,7 @@ export class PickableListPage extends connect(store)(localize(i18next)(PageView)
53
53
  this.grist.toggleHeadroom()
54
54
  }
55
55
  },
56
+ help: 'worklist/activity-bank',
56
57
  actions: []
57
58
  }
58
59
  }