@things-factory/worklist 9.1.19 → 10.0.0-beta.2

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 (103) hide show
  1. package/dist-client/components/activity-thread-timeline.d.ts +1 -9
  2. package/dist-client/components/activity-thread-timeline.js +1 -3
  3. package/dist-client/components/activity-thread-timeline.js.map +1 -1
  4. package/dist-client/pages/activity/activity-list-page.d.ts +1 -7
  5. package/dist-client/pages/activity/activity-list-page.js +125 -234
  6. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  7. package/dist-client/pages/activity/activity-page.d.ts +1 -7
  8. package/dist-client/pages/activity/activity-page.js +51 -93
  9. package/dist-client/pages/activity/activity-page.js.map +1 -1
  10. package/dist-client/pages/activity/starter-list-page.d.ts +1 -7
  11. package/dist-client/pages/activity/starter-list-page.js +33 -62
  12. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  13. package/dist-client/pages/activity-approval/activity-approval-list-page.d.ts +1 -7
  14. package/dist-client/pages/activity-approval/activity-approval-list-page.js +50 -95
  15. package/dist-client/pages/activity-approval/activity-approval-list-page.js.map +1 -1
  16. package/dist-client/pages/activity-approval/activity-approval-page.d.ts +1 -7
  17. package/dist-client/pages/activity-approval/activity-approval-page.js +73 -119
  18. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  19. package/dist-client/pages/activity-instance/activity-instance-list-page.d.ts +0 -6
  20. package/dist-client/pages/activity-instance/activity-instance-list-page.js +63 -120
  21. package/dist-client/pages/activity-instance/activity-instance-list-page.js.map +1 -1
  22. package/dist-client/pages/activity-instance/activity-instance-search-page.d.ts +1 -7
  23. package/dist-client/pages/activity-instance/activity-instance-search-page.js +55 -101
  24. package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -1
  25. package/dist-client/pages/activity-instance/activity-instance-start-page.d.ts +1 -7
  26. package/dist-client/pages/activity-instance/activity-instance-start-page.js +65 -109
  27. package/dist-client/pages/activity-instance/activity-instance-start-page.js.map +1 -1
  28. package/dist-client/pages/activity-stats/activity-stats-list-page.d.ts +1 -7
  29. package/dist-client/pages/activity-stats/activity-stats-list-page.js +50 -95
  30. package/dist-client/pages/activity-stats/activity-stats-list-page.js.map +1 -1
  31. package/dist-client/pages/activity-store/activity-store-page.d.ts +1 -7
  32. package/dist-client/pages/activity-store/activity-store-page.js +2 -3
  33. package/dist-client/pages/activity-store/activity-store-page.js.map +1 -1
  34. package/dist-client/pages/activity-supervisor/reporter-list-page.d.ts +1 -7
  35. package/dist-client/pages/activity-supervisor/reporter-list-page.js +36 -66
  36. package/dist-client/pages/activity-supervisor/reporter-list-page.js.map +1 -1
  37. package/dist-client/pages/activity-template/activity-template-list-page.d.ts +1 -7
  38. package/dist-client/pages/activity-template/activity-template-list-page.js +70 -134
  39. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  40. package/dist-client/pages/activity-thread/activity-thread-list-page.d.ts +1 -7
  41. package/dist-client/pages/activity-thread/activity-thread-list-page.js +49 -93
  42. package/dist-client/pages/activity-thread/activity-thread-list-page.js.map +1 -1
  43. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +1 -7
  44. package/dist-client/pages/activity-thread/activity-thread-page.js +80 -135
  45. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  46. package/dist-client/pages/activity-thread/activity-thread-view-page.d.ts +1 -7
  47. package/dist-client/pages/activity-thread/activity-thread-view-page.js +54 -80
  48. package/dist-client/pages/activity-thread/activity-thread-view-page.js.map +1 -1
  49. package/dist-client/pages/activity-thread/activity-thread-view.js +4 -0
  50. package/dist-client/pages/activity-thread/activity-thread-view.js.map +1 -1
  51. package/dist-client/pages/dashboard/dashboard-home.js +3 -5
  52. package/dist-client/pages/dashboard/dashboard-home.js.map +1 -1
  53. package/dist-client/pages/installable-activity/installable-activity-list-page.d.ts +0 -6
  54. package/dist-client/pages/installable-activity/installable-activity-list-page.js +68 -130
  55. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  56. package/dist-client/pages/todo/approval-done-list-page.d.ts +1 -7
  57. package/dist-client/pages/todo/approval-done-list-page.js +53 -100
  58. package/dist-client/pages/todo/approval-done-list-page.js.map +1 -1
  59. package/dist-client/pages/todo/approval-pending-list-page.d.ts +0 -6
  60. package/dist-client/pages/todo/approval-pending-list-page.js +63 -119
  61. package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
  62. package/dist-client/pages/todo/done-list-calendar-page.d.ts +1 -7
  63. package/dist-client/pages/todo/done-list-calendar-page.js +2 -3
  64. package/dist-client/pages/todo/done-list-calendar-page.js.map +1 -1
  65. package/dist-client/pages/todo/done-list-page.d.ts +1 -7
  66. package/dist-client/pages/todo/done-list-page.js +56 -106
  67. package/dist-client/pages/todo/done-list-page.js.map +1 -1
  68. package/dist-client/pages/todo/draft-list-page.d.ts +1 -7
  69. package/dist-client/pages/todo/draft-list-page.js +49 -88
  70. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  71. package/dist-client/pages/todo/pickable-list-page.d.ts +1 -7
  72. package/dist-client/pages/todo/pickable-list-page.js +48 -91
  73. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  74. package/dist-client/pages/todo/todo-list-page.d.ts +0 -6
  75. package/dist-client/pages/todo/todo-list-page.js +56 -106
  76. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  77. package/dist-client/pages/worklist-home.js +2 -3
  78. package/dist-client/pages/worklist-home.js.map +1 -1
  79. package/dist-client/route.d.ts +1 -1
  80. package/dist-client/templates/activity-approval-context-template.js +8 -12
  81. package/dist-client/templates/activity-approval-context-template.js.map +1 -1
  82. package/dist-client/templates/activity-instance-context-template.js +8 -12
  83. package/dist-client/templates/activity-instance-context-template.js.map +1 -1
  84. package/dist-client/templates/activity-thread-context-template.js +8 -12
  85. package/dist-client/templates/activity-thread-context-template.js.map +1 -1
  86. package/dist-client/tsconfig.tsbuildinfo +1 -1
  87. package/dist-server/controllers/activity-approval/approve.js +2 -2
  88. package/dist-server/controllers/activity-approval/approve.js.map +1 -1
  89. package/dist-server/controllers/activity-thread/submit.js +2 -2
  90. package/dist-server/controllers/activity-thread/submit.js.map +1 -1
  91. package/dist-server/service/index.d.ts +2 -2
  92. package/dist-server/tsconfig.tsbuildinfo +1 -1
  93. package/package.json +16 -16
  94. package/spec/integration/approval-mixed-types.spec.ts +491 -0
  95. package/spec/integration/approval-role-based.spec.ts +389 -0
  96. package/spec/integration/instance-lifecycle.spec.ts +406 -0
  97. package/spec/integration/role-approval-edge-cases.spec.ts +581 -0
  98. package/spec/unit/controllers/activity-instance-issue.spec.ts +360 -0
  99. package/spec/unit/controllers/activity-thread-submit.spec.ts +384 -0
  100. package/spec/unit/role-approval-escalate-logic.spec.ts +499 -0
  101. package/spec/unit/role-approval-submit-logic.spec.ts +481 -0
  102. package/spec/unit/thread-state-helpers.spec.ts +253 -0
  103. package/translations/en.json +1 -1
@@ -13,13 +13,7 @@ export declare const ActivityThreadStatus: {
13
13
  Ended: string;
14
14
  Aborted: string;
15
15
  };
16
- declare const ActivityApprovalPage_base: (new (...args: any[]) => {
17
- _storeUnsubscribe: import("redux").Unsubscribe;
18
- connectedCallback(): void;
19
- disconnectedCallback(): void;
20
- stateChanged(_state: unknown): void;
21
- readonly isConnected: boolean;
22
- }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
16
+ declare const ActivityApprovalPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
23
17
  export declare class ActivityApprovalPage extends ActivityApprovalPage_base {
24
18
  static styles: import("lit").CSSResult[];
25
19
  activityApproval: any;
@@ -8,67 +8,55 @@ import { css, html, nothing } from 'lit';
8
8
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
9
9
  import { customElement, query, state } from 'lit/decorators.js';
10
10
  import { keyed } from 'lit/directives/keyed.js';
11
- import { connect } from 'pwa-helpers/connect-mixin.js';
12
11
  import { client } from '@operato/graphql';
13
12
  import { i18next, localize } from '@operato/i18n';
14
- import { PageView, store } from '@operato/shell';
13
+ import { PageView } from '@operato/shell';
15
14
  import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles';
16
15
  import { provider } from '@things-factory/board-ui/dist-client/board-provider.js';
17
16
  const ActivityApprovalFetchResult = `\
18
- {
19
- id
17
+ { id
20
18
  judgment
21
19
  comment
22
- approver {
23
- id
20
+ approver { id
24
21
  name
25
- }
22
+ }
26
23
  round
27
24
  order
28
25
  createdAt
29
26
  terminatedAt
30
- activityThread {
31
- state
27
+ activityThread { state
32
28
  dueAt
33
29
  assignedAt
34
- assignee {
35
- id
30
+ assignee { id
36
31
  name
37
- }
32
+ }
38
33
  updatedAt
39
34
  terminatedAt
40
35
  output
41
- activityApprovals {
42
- round
36
+ activityApprovals { round
43
37
  order
44
- approver {
45
- name
46
- }
38
+ approver { name
39
+ }
47
40
  judgment
48
41
  comment
49
42
  createdAt
50
43
  updatedAt
51
44
  terminatedAt
52
- }
53
- activityThreadHistories {
54
- transaction
45
+ }
46
+ activityThreadHistories { transaction
55
47
  reason
56
- updater {
57
- name
58
- }
48
+ updater { name
49
+ }
59
50
  updatedAt
60
51
  state
61
52
  output
62
- }
63
- activityInstance {
64
- id
53
+ }
54
+ activityInstance { id
65
55
  name
66
56
  description
67
57
  state
68
- activity {
69
- id
70
- model {
71
- name
58
+ activity { id
59
+ model { name
72
60
  description
73
61
  active
74
62
  tag
@@ -78,18 +66,16 @@ const ActivityApprovalFetchResult = `\
78
66
  options
79
67
  quantifier
80
68
  spec
81
- }
82
- }
83
- approvalLine {
84
- type
69
+ }
70
+ }
71
+ approvalLine { type
85
72
  value
86
- approver {
87
- id
73
+ approver { id
88
74
  name
89
75
  description
90
76
  controlNo
91
- }
92
- }
77
+ }
78
+ }
93
79
  thumbnail
94
80
  input
95
81
  output
@@ -97,42 +83,37 @@ const ActivityApprovalFetchResult = `\
97
83
  viewSource
98
84
  dueAt
99
85
  createdAt
100
- }
101
- }
86
+ }
87
+ }
102
88
  }`;
103
- export const ActivityThreadStatus = {
104
- Unassigned: 'unassigned',
89
+ export const ActivityThreadStatus = { Unassigned: 'unassigned',
105
90
  Assigned: 'assigned',
106
91
  Started: 'started',
107
92
  Delegated: 'delegated',
108
93
  Ended: 'ended',
109
94
  Aborted: 'aborted'
110
95
  };
111
- let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(localize(i18next)(PageView)) {
96
+ let ActivityApprovalPage = class ActivityApprovalPage extends localize(i18next)(PageView) {
112
97
  static { this.styles = [
113
98
  ScrollbarStyles,
114
99
  css `
115
- :host {
116
- display: flex;
100
+ :host { display: flex;
117
101
  flex-direction: column;
118
102
  position: relative;
119
103
 
120
104
  width: 100%;
121
105
  overflow: auto;
122
106
  background-color: var(--md-sys-color-background);
123
- }
107
+ }
124
108
 
125
- ox-board-viewer {
126
- width: 100%;
109
+ ox-board-viewer { width: 100%;
127
110
  height: 100%;
128
- }
111
+ }
129
112
 
130
- activity-thread-timeline {
131
- margin: var(--spacing-medium);
132
- }
113
+ activity-thread-timeline { margin: var(--spacing-medium);
114
+ }
133
115
 
134
- div[comment] {
135
- display: flex;
116
+ div[comment] { display: flex;
136
117
  position: sticky;
137
118
  bottom: 0;
138
119
  margin: 0;
@@ -140,8 +121,7 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
140
121
  width: 100%;
141
122
  background-color: var(--md-sys-color-background);
142
123
 
143
- textarea {
144
- flex: 1;
124
+ textarea { flex: 1;
145
125
  margin: var(--spacing-medium);
146
126
  padding: var(--spacing-medium);
147
127
  font: var(--input-font);
@@ -152,26 +132,27 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
152
132
  resize: none;
153
133
  color: var(--md-sys-color-on-surface);
154
134
  background: var(--md-sys-color-surface-variant);
155
- }
156
- }
135
+ }
136
+ }
157
137
 
158
- [empty] {
159
- flex: 1;
138
+ [empty] { flex: 1;
160
139
  display: flex;
161
140
  align-items: center;
141
+ justify-content: center;
162
142
  align-self: center;
163
- }
143
+ color: var(--md-sys-color-on-surface-variant);
144
+ font: var(--md-sys-typescale-title-medium);
145
+ opacity: 0.7;
146
+ }
164
147
  `
165
148
  ]; }
166
149
  get context() {
167
150
  const judgment = this.activityApproval?.judgment;
168
- return {
169
- title: this.lifecycle?.params?.['title'] || i18next.t('title.activity approval'),
151
+ return { title: this.lifecycle?.params?.['title'] || i18next.t('title.activity approval'),
170
152
  help: 'worklist/activity-approval',
171
153
  actions: judgment
172
154
  ? [
173
- {
174
- title: i18next.t('button.close'),
155
+ { title: i18next.t('button.close'),
175
156
  action: () => {
176
157
  history.back();
177
158
  },
@@ -179,25 +160,21 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
179
160
  }
180
161
  ]
181
162
  : [
182
- {
183
- title: i18next.t('button.reject'),
163
+ { title: i18next.t('button.reject'),
184
164
  action: this.rejectActivityApproval.bind(this),
185
165
  ...CommonButtonStyles.play,
186
166
  icon: 'assignment_return'
187
167
  },
188
- {
189
- title: i18next.t('button.approve'),
168
+ { title: i18next.t('button.approve'),
190
169
  action: this.approveActivityApproval.bind(this),
191
170
  ...CommonButtonStyles.save,
192
171
  icon: 'approval'
193
172
  },
194
- {
195
- title: i18next.t('button.save'),
173
+ { title: i18next.t('button.save'),
196
174
  action: this.saveActivityApproval.bind(this),
197
175
  ...CommonButtonStyles.save
198
176
  },
199
- {
200
- title: i18next.t('button.close'),
177
+ { title: i18next.t('button.close'),
201
178
  action: () => {
202
179
  history.back();
203
180
  },
@@ -262,8 +239,7 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
262
239
  return (model || [])
263
240
  .filter(item => item.inout === 'in' || item.inout === 'inout')
264
241
  .map(item => {
265
- return {
266
- ...item,
242
+ return { ...item,
267
243
  name: item.tag,
268
244
  label: item.tKey || item.name,
269
245
  property: item.options
@@ -275,8 +251,7 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
275
251
  return (model || [])
276
252
  .filter(item => item.inout === 'inout' || item.inout === 'out')
277
253
  .map(item => {
278
- return {
279
- ...item,
254
+ return { ...item,
280
255
  name: item.tag,
281
256
  label: item.tKey || item.name,
282
257
  property: item.options
@@ -327,8 +302,7 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
327
302
  const { output, activityInstance } = this.activityThread;
328
303
  const { viewSource: boardId, input } = activityInstance || {};
329
304
  if (!this.board || this.board.id !== boardId) {
330
- this.board = {
331
- id: boardId
305
+ this.board = { id: boardId
332
306
  };
333
307
  }
334
308
  return keyed(this.activityApproval.id, html `
@@ -375,14 +349,11 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
375
349
  }
376
350
  }
377
351
  async fetchActivityApproval(id) {
378
- const response = await client.query({
379
- query: gql `
380
- query activityApproval($id: String!) {
381
- activityApproval(id: $id) ${ActivityApprovalFetchResult}
382
- }
352
+ const response = await client.query({ query: gql `
353
+ query activityApproval($id: String!) { activityApproval(id: $id) ${ActivityApprovalFetchResult}
354
+ }
383
355
  `,
384
- variables: {
385
- id
356
+ variables: { id
386
357
  }
387
358
  });
388
359
  this.activityApproval = response.data.activityApproval;
@@ -392,22 +363,17 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
392
363
  async rejectActivityApproval() {
393
364
  var { id, comment } = this.activityApproval;
394
365
  if (!comment) {
395
- document.dispatchEvent(new CustomEvent('notify', {
396
- detail: {
397
- message: i18next.t('text.enter a comment')
366
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.enter a comment')
398
367
  }
399
368
  }));
400
369
  this.commentInput.focus();
401
370
  return;
402
371
  }
403
- const response = await client.mutate({
404
- mutation: gql `
405
- mutation ($id: String!, $comment: String!) {
406
- rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}
407
- }
372
+ const response = await client.mutate({ mutation: gql `
373
+ mutation ($id: String!, $comment: String!) { rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}
374
+ }
408
375
  `,
409
- variables: {
410
- id,
376
+ variables: { id,
411
377
  comment
412
378
  }
413
379
  });
@@ -415,23 +381,18 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
415
381
  this.activityApproval = response.data.rejectActivityApproval;
416
382
  this.activityThread = this.activityApproval.activityThread;
417
383
  this.updateContext();
418
- document.dispatchEvent(new CustomEvent('notify', {
419
- detail: {
420
- message: i18next.t('text.task_is_rejected_successfully')
384
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_rejected_successfully')
421
385
  }
422
386
  }));
423
387
  }
424
388
  }
425
389
  async approveActivityApproval() {
426
390
  var { id, comment } = this.activityApproval;
427
- const response = await client.mutate({
428
- mutation: gql `
429
- mutation ($id: String!, $comment: String) {
430
- approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}
431
- }
391
+ const response = await client.mutate({ mutation: gql `
392
+ mutation ($id: String!, $comment: String) { approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}
393
+ }
432
394
  `,
433
- variables: {
434
- id,
395
+ variables: { id,
435
396
  comment
436
397
  }
437
398
  });
@@ -439,23 +400,18 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
439
400
  this.activityApproval = response.data.approveActivityApproval;
440
401
  this.activityThread = this.activityApproval.activityThread;
441
402
  this.updateContext();
442
- document.dispatchEvent(new CustomEvent('notify', {
443
- detail: {
444
- message: i18next.t('text.task_is_approved_successfully')
403
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_approved_successfully')
445
404
  }
446
405
  }));
447
406
  }
448
407
  }
449
408
  async saveActivityApproval() {
450
409
  var { id, comment } = this.activityApproval;
451
- const response = await client.mutate({
452
- mutation: gql `
453
- mutation ($id: String!, $comment: String) {
454
- saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}
455
- }
410
+ const response = await client.mutate({ mutation: gql `
411
+ mutation ($id: String!, $comment: String) { saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}
412
+ }
456
413
  `,
457
- variables: {
458
- id,
414
+ variables: { id,
459
415
  comment
460
416
  }
461
417
  });
@@ -463,9 +419,7 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
463
419
  this.activityApproval = response.data.saveActivityApproval;
464
420
  this.activityThread = this.activityApproval.activityThread;
465
421
  this.updateContext();
466
- document.dispatchEvent(new CustomEvent('notify', {
467
- detail: {
468
- message: i18next.t('text.task_is_saved_successfully')
422
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully')
469
423
  }
470
424
  }));
471
425
  }
@@ -1 +1 @@
1
- {"version":3,"file":"activity-approval-page.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,6CAA6C,CAAA;AACpD,OAAO,8CAA8C,CAAA;AAErD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAA;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,wDAAwD,CAAA;AAEjF,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C,cAAc,CAAA;YAE1D,IAAI,CAAC,aAAa,EAAE,CAAA;YAEpB,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAAC;iBACtD;aACF,CAAC,CACH,CAAA;QACH,CAAC;IACH,CAAC;;AAzXQ;IAAR,KAAK,EAAE;;8DAAsB;AACrB;IAAR,KAAK,EAAE;;4DAAoB;AACnB;IAAR,KAAK,EAAE;;mDAAW;AAEA;IAAlB,KAAK,CAAC,UAAU,CAAC;8BAAgB,mBAAmB;0DAAA;AAoO3B;IAAzB,KAAK,CAAC,iBAAiB,CAAC;;2DAAmB;AAhSjC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAkbhC","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\nimport '../../components/activity-approval-ribon.js'\nimport '../../components/activity-thread-timeline.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing, TemplateResult } from 'lit'\nimport { DirectiveResult } from 'lit-html/directive.js'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, query, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui/dist-client/board-provider.js'\n\nconst ActivityApprovalFetchResult = `\\\n{\n id\n judgment\n comment\n approver {\n id\n name\n }\n round\n order\n createdAt\n terminatedAt\n activityThread {\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n updatedAt\n terminatedAt\n output\n activityApprovals {\n round\n order\n approver {\n name\n }\n judgment\n comment\n createdAt\n updatedAt\n terminatedAt\n }\n activityThreadHistories {\n transaction\n reason\n updater {\n name\n }\n updatedAt\n state\n output\n }\n activityInstance {\n id\n name\n description\n state\n activity {\n id\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n approvalLine {\n type\n value\n approver {\n id\n name\n description\n controlNo\n }\n }\n thumbnail\n input\n output\n viewType\n viewSource\n dueAt\n createdAt\n } \n }\n}`\n\nexport const ActivityThreadStatus = {\n Unassigned: 'unassigned',\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-approval-page')\nexport class ActivityApprovalPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n position: relative;\n\n width: 100%;\n overflow: auto;\n background-color: var(--md-sys-color-background);\n }\n\n ox-board-viewer {\n width: 100%;\n height: 100%;\n }\n\n activity-thread-timeline {\n margin: var(--spacing-medium);\n }\n\n div[comment] {\n display: flex;\n position: sticky;\n bottom: 0;\n margin: 0;\n padding: 0;\n width: 100%;\n background-color: var(--md-sys-color-background);\n\n textarea {\n flex: 1;\n margin: var(--spacing-medium);\n padding: var(--spacing-medium);\n font: var(--input-font);\n outline: none;\n height: 80px;\n border-radius: var(--spacing-small);\n border: var(--input-field-border);\n resize: none;\n color: var(--md-sys-color-on-surface);\n background: var(--md-sys-color-surface-variant);\n }\n }\n\n [empty] {\n flex: 1;\n display: flex;\n align-items: center;\n align-self: center;\n }\n `\n ]\n\n @state() activityApproval: any\n @state() activityThread: any\n @state() board: any\n\n @query('textarea') commentInput!: HTMLTextAreaElement\n\n get context() {\n const judgment = this.activityApproval?.judgment\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity approval'),\n help: 'worklist/activity-approval',\n actions: judgment\n ? [\n {\n title: i18next.t('button.close'),\n action: () => {\n history.back()\n },\n ...CommonButtonStyles.back\n }\n ]\n : [\n {\n title: i18next.t('button.reject'),\n action: this.rejectActivityApproval.bind(this),\n ...CommonButtonStyles.play,\n icon: 'assignment_return'\n },\n\n {\n title: i18next.t('button.approve'),\n action: this.approveActivityApproval.bind(this),\n ...CommonButtonStyles.save,\n icon: 'approval'\n },\n\n {\n title: i18next.t('button.save'),\n action: this.saveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.close'),\n action: () => {\n history.back()\n },\n ...CommonButtonStyles.back,\n icon: 'close'\n }\n ]\n // activityApproval: this.activityApproval\n }\n }\n\n render() {\n if (!this.activityThread) {\n return html`<div empty>${i18next.t('text.no activity thread info')}</div>`\n }\n\n const { terminatedAt } = this.activityApproval\n const editable = !terminatedAt\n\n return html`\n <activity-approval-ribon .activityApproval=${this.activityApproval}></activity-approval-ribon>\n ${this.activityContent()}\n <activity-thread-timeline .activityThread=${this.activityThread} short-form></activity-thread-timeline>\n ${editable\n ? html`\n <div comment>\n <textarea\n placeholder=${String(i18next.t('text.explain the reason for approval/rejection'))}\n .value=${this.activityApproval?.comment}\n @change=${(e: Event) => {\n this.activityApproval.comment = (e.target as HTMLTextAreaElement).value\n }}\n ></textarea>\n </div>\n `\n : nothing}\n `\n }\n\n activityContent() {\n switch (this.activityThread?.activityInstance?.viewType) {\n case 'template':\n return this.templateContent()\n case 'generated':\n return this.generatedContent()\n case 'board':\n return this.boardContent()\n case 'custom-element':\n return this.customElementContent()\n case 'page':\n case 'external':\n return html``\n default:\n return this.generatedContent()\n }\n }\n\n templateContent() {\n if (!this.activityApproval) {\n return html``\n }\n\n const { viewSource: template } = this.activityThread?.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n name: item.tag,\n label: item.tKey || item.name,\n property: item.options\n }\n })\n }\n\n getOutputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return {\n ...item,\n name: item.tag,\n label: item.tKey || item.name,\n property: item.options\n }\n })\n }\n\n generatedContent(): DirectiveResult {\n if (!this.activityApproval) {\n return html``\n }\n\n var { output, activityInstance } = this.activityThread || {}\n var { input } = activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) {\n output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => {\n inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return keyed(\n this.activityApproval.id,\n html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view\n data-name=\"input\"\n .props=${inputSpec}\n .value=${input}\n ></ox-properties-dynamic-view>\n </fieldset>\n\n <fieldset>\n <legend>Output</legend>\n <ox-properties-dynamic-view\n data-name=\"output\"\n .props=${outputSpec}\n .value=${output}\n @property-change=${e => (this.activityApproval.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent(): DirectiveResult {\n if (!this.activityApproval) {\n return html``\n }\n\n const { output, activityInstance } = this.activityThread\n const { viewSource: boardId, input } = activityInstance || {}\n\n if (!this.board || this.board.id !== boardId) {\n this.board = {\n id: boardId\n }\n }\n\n return keyed(\n this.activityApproval.id,\n html`\n <ox-board-viewer\n style=\"background-color: white;\"\n .board=${this.board}\n .provider=${provider}\n .values=${{ ...input, ...output }}\n hide-fullscreen\n hide-navigation\n ></ox-board-viewer>\n `\n )\n }\n\n customElementContent() {\n if (!this.activityApproval) {\n return html``\n }\n\n const { output, activityInstance } = this.activityThread\n const { viewSource: tagName, input } = activityInstance || {}\n\n const element = document.createElement(tagName)\n element.id = 'custom-content'\n element.activityId = activityInstance.activity.id\n element.input = input\n element.output = output\n element.activityApproval = this.activityApproval\n\n return element\n }\n\n @query('ox-board-viewer') oxBoardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.oxBoardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => {\n output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) {\n if (changes.has('activityApproval')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active && lifecycle.resourceId) {\n this.fetchActivityApproval(lifecycle.resourceId)\n }\n }\n\n async fetchActivityApproval(id) {\n const response = await client.query({\n query: gql`\n query activityApproval($id: String!) {\n activityApproval(id: $id) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityApproval = response.data.activityApproval\n this.activityThread = this.activityApproval.activityThread\n\n this.updateContext()\n }\n\n async rejectActivityApproval() {\n var { id, comment } = this.activityApproval\n\n if (!comment) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.enter a comment')\n }\n })\n )\n this.commentInput.focus()\n return\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.rejectActivityApproval\n this.activityThread = this.activityApproval.activityThread\n\n this.updateContext()\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_rejected_successfully')\n }\n })\n )\n }\n }\n\n async approveActivityApproval() {\n var { id, comment } = this.activityApproval\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String) {\n approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.approveActivityApproval\n this.activityThread = this.activityApproval.activityThread\n\n this.updateContext()\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_approved_successfully')\n }\n })\n )\n }\n }\n\n async saveActivityApproval() {\n var { id, comment } = this.activityApproval\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String) {\n saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.saveActivityApproval\n this.activityThread = this.activityApproval.activityThread\n\n this.updateContext()\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n}\n"]}
1
+ {"version":3,"file":"activity-approval-page.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,6CAA6C,CAAA;AACpD,OAAO,8CAA8C,CAAA;AAErD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAA;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,wDAAwD,CAAA;AAEjF,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwElC,CAAA;AAEF,MAAM,CAAC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,EAAE,EAAY,MAAM,EAAE,EAAc,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAAC;iBACvH;aACA,CAAC,CACI,CAAA;QACN,CAAC;IACD,CAAC;;AAvTS;IAAR,KAAK,EAAE;;8DAAsB;AACrB;IAAR,KAAK,EAAE;;4DAAoB;AACnB;IAAR,KAAK,EAAE;;mDAAW;AAEA;IAAlB,KAAK,CAAC,UAAU,CAAC;8BAAgB,mBAAmB;0DAAA;AAoM3B;IAAzB,KAAK,CAAC,iBAAiB,CAAC;;2DAAmB;AA7PjC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CA6WhC","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\nimport '../../components/activity-approval-ribon.js'\nimport '../../components/activity-thread-timeline.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing, TemplateResult } from 'lit'\nimport { DirectiveResult } from 'lit-html/directive.js'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, query, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView } from '@operato/shell'\nimport { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui/dist-client/board-provider.js'\n\nconst ActivityApprovalFetchResult = `\\\n{ id\n judgment\n comment\n approver { id\n name\n }\n round\n order\n createdAt\n terminatedAt\n activityThread { state\n dueAt\n assignedAt\n assignee { id\n name\n }\n updatedAt\n terminatedAt\n output\n activityApprovals { round\n order\n approver { name\n }\n judgment\n comment\n createdAt\n updatedAt\n terminatedAt\n }\n activityThreadHistories { transaction\n reason\n updater { name\n }\n updatedAt\n state\n output\n }\n activityInstance { id\n name\n description\n state\n activity { id\n model { name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n approvalLine { type\n value\n approver { id\n name\n description\n controlNo\n }\n }\n thumbnail\n input\n output\n viewType\n viewSource\n dueAt\n createdAt\n } \n }\n}`\n\nexport const ActivityThreadStatus = { Unassigned: 'unassigned',\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-approval-page')\nexport class ActivityApprovalPage extends localize(i18next)(PageView) { static styles = [\n ScrollbarStyles,\n css`\n :host { display: flex;\n flex-direction: column;\n position: relative;\n\n width: 100%;\n overflow: auto;\n background-color: var(--md-sys-color-background);\n }\n\n ox-board-viewer { width: 100%;\n height: 100%;\n }\n\n activity-thread-timeline { margin: var(--spacing-medium);\n }\n\n div[comment] { display: flex;\n position: sticky;\n bottom: 0;\n margin: 0;\n padding: 0;\n width: 100%;\n background-color: var(--md-sys-color-background);\n\n textarea { flex: 1;\n margin: var(--spacing-medium);\n padding: var(--spacing-medium);\n font: var(--input-font);\n outline: none;\n height: 80px;\n border-radius: var(--spacing-small);\n border: var(--input-field-border);\n resize: none;\n color: var(--md-sys-color-on-surface);\n background: var(--md-sys-color-surface-variant);\n }\n }\n\n [empty] { flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n align-self: center;\n color: var(--md-sys-color-on-surface-variant);\n font: var(--md-sys-typescale-title-medium);\n opacity: 0.7;\n }\n `\n ]\n\n @state() activityApproval: any\n @state() activityThread: any\n @state() board: any\n\n @query('textarea') commentInput!: HTMLTextAreaElement\n\n get context() { const judgment = this.activityApproval?.judgment\n\n return { title: this.lifecycle?.params?.['title'] || i18next.t('title.activity approval'),\n help: 'worklist/activity-approval',\n actions: judgment\n ? [\n { title: i18next.t('button.close'),\n action: () => { history.back()\n },\n ...CommonButtonStyles.back\n }\n ]\n : [\n { title: i18next.t('button.reject'),\n action: this.rejectActivityApproval.bind(this),\n ...CommonButtonStyles.play,\n icon: 'assignment_return'\n },\n\n { title: i18next.t('button.approve'),\n action: this.approveActivityApproval.bind(this),\n ...CommonButtonStyles.save,\n icon: 'approval'\n },\n\n { title: i18next.t('button.save'),\n action: this.saveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.close'),\n action: () => { history.back()\n },\n ...CommonButtonStyles.back,\n icon: 'close'\n }\n ]\n // activityApproval: this.activityApproval\n }\n }\n\n render() { if (!this.activityThread) { return html`<div empty>${i18next.t('text.no activity thread info')}</div>`\n }\n\n const { terminatedAt } = this.activityApproval\n const editable = !terminatedAt\n\n return html`\n <activity-approval-ribon .activityApproval=${this.activityApproval}></activity-approval-ribon>\n ${this.activityContent()}\n <activity-thread-timeline .activityThread=${this.activityThread} short-form></activity-thread-timeline>\n ${editable\n ? html`\n <div comment>\n <textarea\n placeholder=${String(i18next.t('text.explain the reason for approval/rejection'))}\n .value=${this.activityApproval?.comment}\n @change=${(e: Event) => { this.activityApproval.comment = (e.target as HTMLTextAreaElement).value\n }}\n ></textarea>\n </div>\n `\n : nothing}\n `\n }\n\n activityContent() { switch (this.activityThread?.activityInstance?.viewType) { case 'template':\n return this.templateContent()\n case 'generated':\n return this.generatedContent()\n case 'board':\n return this.boardContent()\n case 'custom-element':\n return this.customElementContent()\n case 'page':\n case 'external':\n return html``\n default:\n return this.generatedContent()\n }\n }\n\n templateContent() { if (!this.activityApproval) { return html``\n }\n\n const { viewSource: template } = this.activityThread?.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() { const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => { return { ...item,\n name: item.tag,\n label: item.tKey || item.name,\n property: item.options\n }\n })\n }\n\n getOutputSpec() { const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => { return { ...item,\n name: item.tag,\n label: item.tKey || item.name,\n property: item.options\n }\n })\n }\n\n generatedContent(): DirectiveResult { if (!this.activityApproval) { return html``\n }\n\n var { output, activityInstance } = this.activityThread || {}\n var { input } = activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) { output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => { inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return keyed(\n this.activityApproval.id,\n html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view\n data-name=\"input\"\n .props=${inputSpec}\n .value=${input}\n ></ox-properties-dynamic-view>\n </fieldset>\n\n <fieldset>\n <legend>Output</legend>\n <ox-properties-dynamic-view\n data-name=\"output\"\n .props=${outputSpec}\n .value=${output}\n @property-change=${e => (this.activityApproval.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent(): DirectiveResult { if (!this.activityApproval) { return html``\n }\n\n const { output, activityInstance } = this.activityThread\n const { viewSource: boardId, input } = activityInstance || {}\n\n if (!this.board || this.board.id !== boardId) { this.board = { id: boardId\n }\n }\n\n return keyed(\n this.activityApproval.id,\n html`\n <ox-board-viewer\n style=\"background-color: white;\"\n .board=${this.board}\n .provider=${provider}\n .values=${{ ...input, ...output }}\n hide-fullscreen\n hide-navigation\n ></ox-board-viewer>\n `\n )\n }\n\n customElementContent() { if (!this.activityApproval) { return html``\n }\n\n const { output, activityInstance } = this.activityThread\n const { viewSource: tagName, input } = activityInstance || {}\n\n const element = document.createElement(tagName)\n element.id = 'custom-content'\n element.activityId = activityInstance.activity.id\n element.input = input\n element.output = output\n element.activityApproval = this.activityApproval\n\n return element\n }\n\n @query('ox-board-viewer') oxBoardViewer: any\n\n getOutputFromBoard() { const outputSpec = this.getOutputSpec()\n const data = this.oxBoardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => { output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) { if (changes.has('activityApproval')) { this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) { if (this.active && lifecycle.resourceId) { this.fetchActivityApproval(lifecycle.resourceId)\n }\n }\n\n async fetchActivityApproval(id) { const response = await client.query({ query: gql`\n query activityApproval($id: String!) { activityApproval(id: $id) ${ActivityApprovalFetchResult}\n }\n `,\n variables: { id\n }\n })\n\n this.activityApproval = response.data.activityApproval\n this.activityThread = this.activityApproval.activityThread\n\n this.updateContext()\n }\n\n async rejectActivityApproval() { var { id, comment } = this.activityApproval\n\n if (!comment) { document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.enter a comment')\n }\n })\n )\n this.commentInput.focus()\n return\n }\n\n const response = await client.mutate({ mutation: gql`\n mutation ($id: String!, $comment: String!) { rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: { id,\n comment\n }\n })\n\n if (!response.errors) { this.activityApproval = response.data.rejectActivityApproval\n this.activityThread = this.activityApproval.activityThread\n\n this.updateContext()\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_rejected_successfully')\n }\n })\n )\n }\n }\n\n async approveActivityApproval() { var { id, comment } = this.activityApproval\n\n const response = await client.mutate({ mutation: gql`\n mutation ($id: String!, $comment: String) { approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: { id,\n comment\n }\n })\n\n if (!response.errors) { this.activityApproval = response.data.approveActivityApproval\n this.activityThread = this.activityApproval.activityThread\n\n this.updateContext()\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_approved_successfully')\n }\n })\n )\n }\n }\n\n async saveActivityApproval() { var { id, comment } = this.activityApproval\n\n const response = await client.mutate({ mutation: gql`\n mutation ($id: String!, $comment: String) { saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: { id,\n comment\n }\n })\n\n if (!response.errors) { this.activityApproval = response.data.saveActivityApproval\n this.activityThread = this.activityApproval.activityThread\n\n this.updateContext()\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n}\n"]}
@@ -3,12 +3,6 @@ import '@operato/input/ox-input-select-buttons.js';
3
3
  import { FetchOption, DataGrist } from '@operato/data-grist';
4
4
  import { PageView } from '@operato/shell';
5
5
  declare const ActivityInstanceListPage_base: (new (...args: any[]) => {
6
- _storeUnsubscribe: import("redux").Unsubscribe;
7
- connectedCallback(): void;
8
- disconnectedCallback(): void;
9
- stateChanged(_state: unknown): void;
10
- readonly isConnected: boolean;
11
- }) & (new (...args: any[]) => {
12
6
  __preferenceProviders: {
13
7
  [element: string]: import("@operato/p13n").PagePreferenceProvider;
14
8
  };