@things-factory/worklist 7.0.0-alpha.3 → 7.0.0-alpha.30

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 (132) hide show
  1. package/client/components/activity-starter-form.ts +16 -23
  2. package/client/components/activity-thread-timeline.ts +210 -0
  3. package/client/index.ts +2 -1
  4. package/client/pages/activity-approval/activity-approval-page.ts +73 -153
  5. package/client/pages/activity-instance/activity-instance-view.ts +10 -36
  6. package/client/pages/activity-thread/activity-thread-page.ts +52 -23
  7. package/client/pages/activity-thread/activity-thread-view-page.ts +50 -11
  8. package/client/pages/activity-thread/activity-thread-view.ts +50 -133
  9. package/client/pages/todo/approval-done-list-page.ts +8 -7
  10. package/client/pages/todo/approval-pending-list-page.ts +18 -11
  11. package/client/pages/todo/done-list-page.ts +8 -8
  12. package/client/pages/todo/draft-list-page.ts +11 -1
  13. package/client/pages/todo/pickable-list-page.ts +25 -10
  14. package/client/pages/todo/todo-list-page.ts +12 -11
  15. package/client/templates/activity-approval-context-template.ts +14 -13
  16. package/client/templates/activity-instance-context-template.ts +16 -18
  17. package/client/templates/activity-thread-context-template.ts +51 -174
  18. package/client/types/activity-thread-history.ts +47 -0
  19. package/client/types/activity-thread.ts +5 -0
  20. package/dist-client/components/activity-starter-form.js +15 -21
  21. package/dist-client/components/activity-starter-form.js.map +1 -1
  22. package/dist-client/components/activity-thread-timeline.d.ts +24 -0
  23. package/dist-client/components/activity-thread-timeline.js +201 -0
  24. package/dist-client/components/activity-thread-timeline.js.map +1 -0
  25. package/dist-client/index.d.ts +2 -1
  26. package/dist-client/index.js +2 -1
  27. package/dist-client/index.js.map +1 -1
  28. package/dist-client/pages/activity-approval/activity-approval-page.d.ts +2 -3
  29. package/dist-client/pages/activity-approval/activity-approval-page.js +65 -146
  30. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  31. package/dist-client/pages/activity-instance/activity-instance-view.js +8 -22
  32. package/dist-client/pages/activity-instance/activity-instance-view.js.map +1 -1
  33. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +2 -1
  34. package/dist-client/pages/activity-thread/activity-thread-page.js +46 -15
  35. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  36. package/dist-client/pages/activity-thread/activity-thread-view-page.d.ts +12 -1
  37. package/dist-client/pages/activity-thread/activity-thread-view-page.js +44 -7
  38. package/dist-client/pages/activity-thread/activity-thread-view-page.js.map +1 -1
  39. package/dist-client/pages/activity-thread/activity-thread-view.d.ts +0 -2
  40. package/dist-client/pages/activity-thread/activity-thread-view.js +50 -120
  41. package/dist-client/pages/activity-thread/activity-thread-view.js.map +1 -1
  42. package/dist-client/pages/todo/approval-done-list-page.js +8 -7
  43. package/dist-client/pages/todo/approval-done-list-page.js.map +1 -1
  44. package/dist-client/pages/todo/approval-pending-list-page.js +15 -8
  45. package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
  46. package/dist-client/pages/todo/done-list-page.js +8 -8
  47. package/dist-client/pages/todo/done-list-page.js.map +1 -1
  48. package/dist-client/pages/todo/draft-list-page.js +10 -1
  49. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  50. package/dist-client/pages/todo/pickable-list-page.js +19 -1
  51. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  52. package/dist-client/pages/todo/todo-list-page.js +9 -8
  53. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  54. package/dist-client/templates/activity-approval-context-template.d.ts +1 -0
  55. package/dist-client/templates/activity-approval-context-template.js +14 -13
  56. package/dist-client/templates/activity-approval-context-template.js.map +1 -1
  57. package/dist-client/templates/activity-instance-context-template.js +15 -16
  58. package/dist-client/templates/activity-instance-context-template.js.map +1 -1
  59. package/dist-client/templates/activity-thread-context-template.d.ts +1 -0
  60. package/dist-client/templates/activity-thread-context-template.js +51 -169
  61. package/dist-client/templates/activity-thread-context-template.js.map +1 -1
  62. package/dist-client/tsconfig.tsbuildinfo +1 -1
  63. package/dist-client/types/activity-thread-history.d.ts +28 -0
  64. package/dist-client/types/activity-thread-history.js +7 -0
  65. package/dist-client/types/activity-thread-history.js.map +1 -0
  66. package/dist-client/types/activity-thread.d.ts +3 -0
  67. package/dist-client/types/activity-thread.js.map +1 -1
  68. package/dist-server/controllers/activity-approval/_abort.js +3 -1
  69. package/dist-server/controllers/activity-approval/_abort.js.map +1 -1
  70. package/dist-server/controllers/activity-approval/abort.js.map +1 -1
  71. package/dist-server/controllers/activity-approval/approve.js +2 -2
  72. package/dist-server/controllers/activity-approval/approve.js.map +1 -1
  73. package/dist-server/controllers/activity-approval/delegate.js +2 -1
  74. package/dist-server/controllers/activity-approval/delegate.js.map +1 -1
  75. package/dist-server/controllers/activity-approval/reject.js +1 -1
  76. package/dist-server/controllers/activity-approval/reject.js.map +1 -1
  77. package/dist-server/controllers/activity-thread/_abort.js.map +1 -1
  78. package/dist-server/controllers/activity-thread/abort.js.map +1 -1
  79. package/dist-server/controllers/activity-thread/delegate.js +1 -2
  80. package/dist-server/controllers/activity-thread/delegate.js.map +1 -1
  81. package/dist-server/controllers/activity-thread/end.js.map +1 -1
  82. package/dist-server/controllers/activity-thread/restart.js.map +1 -1
  83. package/dist-server/controllers/activity-thread/save.js +1 -1
  84. package/dist-server/controllers/activity-thread/save.js.map +1 -1
  85. package/dist-server/controllers/activity-thread/start.js.map +1 -1
  86. package/dist-server/controllers/activity-thread/submit.js +2 -0
  87. package/dist-server/controllers/activity-thread/submit.js.map +1 -1
  88. package/dist-server/service/activity-approval/activity-approval-mutation.js +0 -3
  89. package/dist-server/service/activity-approval/activity-approval-mutation.js.map +1 -1
  90. package/dist-server/service/activity-approval/activity-approval-subscription.js.map +1 -1
  91. package/dist-server/service/activity-approval/activity-approval.js.map +1 -1
  92. package/dist-server/service/activity-thread/activity-thread-history-query.js +65 -0
  93. package/dist-server/service/activity-thread/activity-thread-history-query.js.map +1 -0
  94. package/dist-server/service/activity-thread/activity-thread-history.js +10 -11
  95. package/dist-server/service/activity-thread/activity-thread-history.js.map +1 -1
  96. package/dist-server/service/activity-thread/activity-thread-mutation.js +1 -1
  97. package/dist-server/service/activity-thread/activity-thread-mutation.js.map +1 -1
  98. package/dist-server/service/activity-thread/activity-thread-query.js +20 -3
  99. package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
  100. package/dist-server/service/activity-thread/activity-thread.js +5 -0
  101. package/dist-server/service/activity-thread/activity-thread.js.map +1 -1
  102. package/dist-server/service/activity-thread/index.js +2 -1
  103. package/dist-server/service/activity-thread/index.js.map +1 -1
  104. package/dist-server/tsconfig.tsbuildinfo +1 -1
  105. package/package.json +9 -9
  106. package/server/controllers/activity-approval/_abort.ts +12 -1
  107. package/server/controllers/activity-approval/abort.ts +2 -9
  108. package/server/controllers/activity-approval/approve.ts +3 -4
  109. package/server/controllers/activity-approval/delegate.ts +6 -6
  110. package/server/controllers/activity-approval/reject.ts +3 -9
  111. package/server/controllers/activity-thread/_abort.ts +1 -4
  112. package/server/controllers/activity-thread/abort.ts +1 -4
  113. package/server/controllers/activity-thread/delegate.ts +1 -1
  114. package/server/controllers/activity-thread/end.ts +1 -4
  115. package/server/controllers/activity-thread/restart.ts +1 -6
  116. package/server/controllers/activity-thread/save.ts +1 -1
  117. package/server/controllers/activity-thread/start.ts +1 -6
  118. package/server/controllers/activity-thread/submit.ts +5 -6
  119. package/server/service/activity-approval/activity-approval-mutation.ts +3 -19
  120. package/server/service/activity-approval/activity-approval-subscription.ts +1 -2
  121. package/server/service/activity-approval/activity-approval.ts +1 -11
  122. package/server/service/activity-thread/activity-thread-history-query.ts +34 -0
  123. package/server/service/activity-thread/activity-thread-history.ts +10 -22
  124. package/server/service/activity-thread/activity-thread-mutation.ts +4 -20
  125. package/server/service/activity-thread/activity-thread-query.ts +15 -7
  126. package/server/service/activity-thread/activity-thread.ts +8 -19
  127. package/server/service/activity-thread/index.ts +2 -1
  128. package/translations/en.json +13 -1
  129. package/translations/ja.json +20 -8
  130. package/translations/ko.json +14 -2
  131. package/translations/ms.json +14 -2
  132. package/translations/zh.json +17 -5
@@ -40,20 +40,21 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
40
40
  color: var(--secondary-color);
41
41
  }
42
42
 
43
- content label{
44
- font:var(--label-font)
43
+ content label {
44
+ font: var(--label-font);
45
45
  }
46
- content input, content textarea{
47
- border-radius:var(--border-radius);
48
- border:var(--border-dark-color);
49
- padding:var(--input-padding);
50
- margin:var(--input-margin);
51
- font:var(--input-font);
46
+ content input,
47
+ content textarea {
48
+ border-radius: var(--border-radius);
49
+ border: var(--border-dark-color);
50
+ padding: var(--input-padding);
51
+ margin: var(--input-margin);
52
+ font: var(--input-font);
52
53
  }
53
54
 
54
- content [desc]{
55
+ content [desc] {
55
56
  color: var(--secondary-text-color);
56
- font-size:0.9em
57
+ font-size: 0.9em;
57
58
  }
58
59
 
59
60
  #description {
@@ -84,23 +85,16 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
84
85
  return html`
85
86
  <content>
86
87
  <div desc>
87
- <span
88
- >업무의 타이틀과 설명을 작성해서 초안저장을 클릭하시면, 업무 초안이 생성되고 편집할 수 있는 페이지로
89
- 이동합니다.</span
90
- >
88
+ <span>업무의 타이틀과 설명을 작성해서 초안저장을 클릭하시면, 업무 초안이 생성되고 편집할 수 있는 페이지로 이동합니다.</span>
91
89
 
92
90
  <span
93
- >이렇게 생성된 업무 초안은 '작성중인 업무' 리스트에서 찾아볼 수 있으며,
94
- '${startingType == 'issue' ? '이슈' : '게시'}' 전까지 언제든지 수정할 수 있습니다.</span
91
+ >이렇게 생성된 업무 초안은 '작성중인 업무' 리스트에서 찾아볼 수 있으며, '${startingType == 'issue' ? '이슈' : '게시'}' 전까지 언제든지 수정할 수
92
+ 있습니다.</span
95
93
  >
96
94
  </div>
97
95
  <div>
98
96
  <label for="name">${i18next.t('label.title')}</label>
99
- <input
100
- id="name"
101
- .value=${name || this.activity?.name}
102
- @change=${e => (this.activityInstance.name = e.currentTarget.value)}
103
- />
97
+ <input id="name" .value=${name || this.activity?.name} @change=${e => (this.activityInstance.name = e.currentTarget.value)} />
104
98
  </div>
105
99
 
106
100
  <div>
@@ -185,8 +179,7 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
185
179
 
186
180
  async draftActivityInstance() {
187
181
  var { id: activityId } = this.activity
188
- var { id, name, description, priority, threadsMin, threadsMax, dueAt, input, assignees, approvalLine } =
189
- this.activityInstance
182
+ var { id, name, description, priority, threadsMin, threadsMax, dueAt, input, assignees, approvalLine } = this.activityInstance
190
183
 
191
184
  name ||= this.activity.name
192
185
  description ||= this.activity.description
@@ -0,0 +1,210 @@
1
+ import '@material/mwc-icon'
2
+ import '@things-factory/organization/dist-client/component/approval-line-view.js'
3
+
4
+ import { html, css, LitElement, nothing } from 'lit'
5
+ import { customElement, property } from 'lit/decorators.js'
6
+
7
+ import { connect } from 'pwa-helpers/connect-mixin'
8
+
9
+ import { store } from '@operato/shell'
10
+ import { i18next } from '@operato/i18n'
11
+
12
+ import { ActivityThread } from '../types/activity-thread'
13
+ import { ActivityThreadHistory } from '../types/activity-thread-history'
14
+ import { ActivityApproval } from '../types/activity-approval'
15
+
16
+ const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
17
+
18
+ @customElement('activity-thread-timeline')
19
+ export class ActivityThreadTimeline extends connect(store)(LitElement) {
20
+ static styles = [
21
+ css`
22
+ :host {
23
+ display: block;
24
+ }
25
+
26
+ [subtitle] {
27
+ padding: var(--padding-narrow) var(--padding-default);
28
+ background-color: var(--theme-white-color);
29
+ border: 2px solid var(--secondary-text-color);
30
+ border-radius: 15px;
31
+ box-shadow: var(--box-shadow);
32
+ color: var(--secondary-text-color);
33
+ font-weight: bold;
34
+ }
35
+
36
+ ol {
37
+ list-style: none;
38
+ margin: var(--margin-default) 0 0 var(--margin-narrow);
39
+ padding: 0;
40
+ }
41
+
42
+ li {
43
+ display: flex;
44
+ border: none;
45
+ }
46
+
47
+ [info] {
48
+ flex: 1;
49
+ color: var(--secondary-color);
50
+
51
+ div {
52
+ float: right;
53
+ opacity: 0.7;
54
+ }
55
+
56
+ mwc-icon {
57
+ position: relative;
58
+ top: 3px;
59
+ font-size: var(--fontsize-large);
60
+ }
61
+
62
+ p {
63
+ background-color: #f4f4f4;
64
+ margin: var(--margin-narrow) 0 var(--margin-default) 0;
65
+ padding: var(--padding-narrow) var(--padding-default);
66
+ font-size: var(--fontsize-small);
67
+ text-align: justify;
68
+ min-height: 20px;
69
+ }
70
+
71
+ p::before {
72
+ content: '';
73
+ float: right;
74
+ margin-top: -10px;
75
+ margin-right: 20px;
76
+ border: 7px solid transparent;
77
+ border-bottom-color: #f4f4f4;
78
+ border-top: 0;
79
+ }
80
+ }
81
+
82
+ [date] {
83
+ opacity: 0.7;
84
+ flex: initial;
85
+ width: 200px;
86
+ max-width: 30%;
87
+ font-size: var(--fontsize-small);
88
+ color: var(--primary-text-color);
89
+ }
90
+
91
+ [status] {
92
+ margin: 0 var(--margin-narrow);
93
+ display: block;
94
+ border-radius: 50%;
95
+ flex: initial;
96
+ width: 12px;
97
+ height: 12px;
98
+ position: relative;
99
+ top: 3px;
100
+ border: 2px solid #fff;
101
+ background-color: var(--worklist-status-color, tomato);
102
+ color: var(--primary-text-color);
103
+ }
104
+
105
+ [status]::before {
106
+ content: '';
107
+ height: 60px;
108
+ width: 2px;
109
+ display: block;
110
+ position: relative;
111
+ margin-left: 5px;
112
+ background-color: var(--worklist-status-color, tomato);
113
+ opacity: 0.2;
114
+ }
115
+
116
+ table,
117
+ th,
118
+ td {
119
+ border: 1px solid lightgray;
120
+ border-collapse: collapse;
121
+ }
122
+
123
+ th,
124
+ td {
125
+ padding: 10px;
126
+ }
127
+ `
128
+ ]
129
+
130
+ @property({ type: Object }) activityThread?: ActivityThread
131
+ @property({ type: String }) subtitle?: string
132
+ @property({ type: Boolean, attribute: 'short-form' }) shortForm?: boolean
133
+
134
+ render() {
135
+ const { activityApprovals = [], activityThreadHistories = [] } = this.activityThread || {}
136
+
137
+ const timeline = [
138
+ ...activityThreadHistories.filter(item => item.transaction && (!this.shortForm || !/^.*(reject|approve|save|restart).*$/.test(item.transaction))),
139
+ ...activityApprovals.filter(item => item.judgment)
140
+ ].sort((a, b) => ((a.updatedAt || 0) > (b.updatedAt || 0) ? 1 : -1))
141
+
142
+ return html` ${timeline.length > 0
143
+ ? html`
144
+ <span subtitle>${this.subtitle || i18next.t('label.timeline')}</span>
145
+
146
+ <ol>
147
+ ${timeline.map(item =>
148
+ 'reason' in item ? this.renderActivityThreadHistory(item as ActivityThreadHistory) : this.renderActivityApproval(item as ActivityApproval)
149
+ )}
150
+ </ol>
151
+ `
152
+ : nothing}`
153
+ }
154
+
155
+ renderActivityThreadHistory(activityThreadHistory: ActivityThreadHistory) {
156
+ const { updater, updatedAt, state, reason, output, transaction } = activityThreadHistory
157
+ const { name } = updater || {}
158
+
159
+ return html`
160
+ <li>
161
+ <span date>${formatter.format(new Date(updatedAt!))}</span>
162
+ <span status></span>
163
+
164
+ <span info>
165
+ ${i18next.t('label.activity-transaction-' + transaction)}
166
+ <div><mwc-icon>account_circle</mwc-icon>${name}</div>
167
+ <p>${reason ? reason : output ? this.renderOutput(output) : nothing}</p>
168
+ </span>
169
+ </li>
170
+ `
171
+ }
172
+
173
+ renderActivityApproval(activityApproval: ActivityApproval) {
174
+ const { judgment, approver, comment, createdAt, terminatedAt } = activityApproval
175
+ const { name } = approver || {}
176
+
177
+ return html`
178
+ <li>
179
+ <span date>${formatter.format(new Date(terminatedAt || createdAt!))}</span>
180
+ <span status></span>
181
+ <span info>
182
+ ${i18next.t('label.activity-state-' + judgment)}
183
+ <div><mwc-icon>account_circle</mwc-icon>${name}</div>
184
+ <p>${comment}</p>
185
+ </span>
186
+ </li>
187
+ `
188
+ }
189
+
190
+ renderOutput(output: any) {
191
+ const rows = [] as [key: string, value: string][]
192
+
193
+ for (let key in output) {
194
+ rows.push([key, output[key]])
195
+ }
196
+
197
+ return html`
198
+ <table>
199
+ ${rows.map(
200
+ ([key, value]) => html`
201
+ <tr>
202
+ <td>${key}</td>
203
+ <td>${value}</td>
204
+ </tr>
205
+ `
206
+ )}
207
+ </table>
208
+ `
209
+ }
210
+ }
package/client/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './pages/activity/activity-page.js'
2
- export * from './activity-summary-generator'
2
+ export * from './activity-summary-generator.js'
3
+ export * from './components/activity-thread-timeline.js'
@@ -1,11 +1,12 @@
1
1
  import '@operato/property-editor/ox-properties-dynamic-view.js'
2
2
  import '@operato/board/ox-board-viewer.js'
3
3
  import '../../components/activity-approval-ribon.js'
4
+ import '../../components/activity-thread-timeline.js'
4
5
 
5
6
  import gql from 'graphql-tag'
6
- import { css, html } from 'lit'
7
+ import { css, html, nothing } from 'lit'
7
8
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js'
8
- import { customElement, property, query, state } from 'lit/decorators.js'
9
+ import { customElement, query, state } from 'lit/decorators.js'
9
10
  import { keyed } from 'lit/directives/keyed.js'
10
11
  import { connect } from 'pwa-helpers/connect-mixin.js'
11
12
 
@@ -14,9 +15,6 @@ import { i18next, localize } from '@operato/i18n'
14
15
  import { PageView, store } from '@operato/shell'
15
16
  import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'
16
17
  import { provider } from '@things-factory/board-ui'
17
- import { ActivityApproval } from '../../types/activity-approval.js'
18
-
19
- const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'short', timeStyle: 'short' })
20
18
 
21
19
  const ActivityApprovalFetchResult = `\
22
20
  {
@@ -30,6 +28,7 @@ const ActivityApprovalFetchResult = `\
30
28
  round
31
29
  order
32
30
  createdAt
31
+ terminatedAt
33
32
  activityThread {
34
33
  state
35
34
  dueAt
@@ -38,19 +37,31 @@ const ActivityApprovalFetchResult = `\
38
37
  id
39
38
  name
40
39
  }
40
+ updatedAt
41
+ terminatedAt
41
42
  output
42
43
  activityApprovals {
43
44
  round
44
45
  order
45
46
  approver {
46
47
  name
47
- email
48
48
  }
49
49
  judgment
50
50
  comment
51
51
  createdAt
52
+ updatedAt
52
53
  terminatedAt
53
54
  }
55
+ activityThreadHistories {
56
+ transaction
57
+ reason
58
+ updater {
59
+ name
60
+ }
61
+ updatedAt
62
+ state
63
+ output
64
+ }
54
65
  activityInstance {
55
66
  id
56
67
  name
@@ -120,106 +131,37 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
120
131
  height: 100%;
121
132
  }
122
133
 
123
- #custom-content {
124
- overflow: auto;
134
+ activity-thread-timeline {
135
+ margin: var(--margin-default);
125
136
  }
126
137
 
127
138
  div[comment] {
128
139
  display: flex;
129
- flex-direction: column;
130
- width: 100%;
131
- right: 0;
140
+ position: sticky;
132
141
  bottom: 0;
133
142
  margin: 0;
134
143
  padding: 0;
135
- opacity: 0.8;
136
- margin-top: auto;
144
+ width: 100%;
145
+ background-color: var(--main-section-background-color);
137
146
 
138
- max-height: 40%;
147
+ textarea {
148
+ flex: 1;
149
+ margin: var(--margin-default);
150
+ padding: var(--input-padding);
151
+ font: var(--input-font);
152
+ outline: none;
153
+ height: 80px;
154
+ border-radius: 10px;
155
+ border: var(--input-field-border);
156
+ resize: none;
157
+ }
139
158
  }
140
159
 
141
- div[timeline] {
142
- margin-bottom: var(--margin-default);
143
- padding: var(--padding-default);
144
- border-bottom: var(--border-dark-color);
145
- overflow: auto;
146
- }
147
- div[timeline] [subtitle] {
148
- padding: var(--padding-narrow) var(--padding-default);
149
- background-color: var(--theme-white-color);
150
- border: 2px solid var(--secondary-text-color);
151
- border-radius: 15px;
152
- box-shadow: var(--box-shadow);
153
- color: var(--secondary-text-color);
154
- font-weight: bold;
155
- }
156
- div[timeline] ol {
157
- list-style: none;
158
- margin: var(--margin-default) 0 0 var(--margin-narrow);
159
- padding: 0;
160
- }
161
- [timeline] li {
162
- display: flex;
163
- }
164
- [timeline] [info] {
160
+ [empty] {
165
161
  flex: 1;
166
- }
167
- [timeline] [date] {
168
- opacity: 0.7;
169
- width: 130px;
170
- font-size: var(--fontsize-small);
171
- }
172
- [timeline] [info] strong {
173
- float: right;
174
- }
175
- [timeline] [status] {
176
- margin: 0 var(--margin-narrow);
177
- display: block;
178
- border-radius: 50%;
179
- width: 12px;
180
- height: 12px;
181
- position: relative;
182
- top: 3px;
183
- border: 2px solid #fff;
184
- background-color: var(--worklist-status-color, tomato);
185
- }
186
- [timeline] [status]::before {
187
- content: '';
188
- height: 60px;
189
- width: 2px;
190
- display: block;
191
- position: relative;
192
- margin-left: 5px;
193
- background-color: var(--worklist-status-color, tomato);
194
- opacity: 0.2;
195
- }
196
- [timeline] [info] mwc-icon {
197
- position: relative;
198
- top: 3px;
199
- font-size: var(--fontsize-large);
200
- }
201
- [timeline] [info] p {
202
- background-color: var(--theme-white-color);
203
- margin: var(--margin-narrow) 0 var(--margin-default) 0;
204
- padding: var(--padding-narrow) var(--padding-default);
205
- font-size: var(--fontsize-small);
206
- text-align: justify;
207
- }
208
- [timeline] [info] p::before {
209
- content: '';
210
- float: right;
211
- margin-top: -10px;
212
- margin-right: 20px;
213
- border: 7px solid transparent;
214
- border-bottom-color: #f4f4f4;
215
- border-top: 0;
216
- }
217
- div[comment] textarea {
218
- margin: 0 var(--margin-default) var(--margin-default) var(--margin-default);
219
- padding: var(--input-padding);
220
- resize: none;
221
- font: var(--input-font);
222
- outline: none;
162
+ display: flex;
163
+ align-items: center;
164
+ align-self: center;
223
165
  }
224
166
  `
225
167
  ]
@@ -237,7 +179,15 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
237
179
  title: this.lifecycle?.params?.['title'] || i18next.t('title.activity approval'),
238
180
  help: 'worklist/activity-approval',
239
181
  actions: judgment
240
- ? []
182
+ ? [
183
+ {
184
+ title: i18next.t('button.close'),
185
+ action: () => {
186
+ history.back()
187
+ },
188
+ ...CommonButtonStyles.back
189
+ }
190
+ ]
241
191
  : [
242
192
  {
243
193
  title: i18next.t('button.reject'),
@@ -255,6 +205,13 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
255
205
  title: i18next.t('button.save'),
256
206
  action: this.saveActivityApproval.bind(this),
257
207
  ...CommonButtonStyles.save
208
+ },
209
+ {
210
+ title: i18next.t('button.close'),
211
+ action: () => {
212
+ history.back()
213
+ },
214
+ ...CommonButtonStyles.back
258
215
  }
259
216
  ]
260
217
  // activityApproval: this.activityApproval
@@ -263,51 +220,29 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
263
220
 
264
221
  render() {
265
222
  if (!this.activityThread) {
266
- return html`<div>no activity thread info.</div>`
223
+ return html`<div empty>${i18next.t('text.no activity thread info')}</div>`
267
224
  }
268
225
 
269
- const { activityApprovals = [] } = this.activityThread
270
- const approvals = activityApprovals
271
- .sort((a, b) => (a.round > b.round ? 1 : a.round < b.round ? -1 : a.order! > b.order! ? 1 : -1))
272
- .slice(0, -1)
226
+ const { terminatedAt } = this.activityApproval
227
+ const editable = !terminatedAt
273
228
 
274
229
  return html`
275
230
  <activity-approval-ribon .activityApproval=${this.activityApproval}></activity-approval-ribon>
276
231
  ${this.activityContent()}
277
- <div comment>
278
- <div timeline>
279
- <span subtitle>${i18next.t('label.review-and-approval')}</span>
280
-
281
- <ol>
282
- ${approvals.map(approval => this.renderActivityApproval(approval))}
283
- </ol>
284
- </div>
285
-
286
- <textarea
287
- placeholder="Jot down your comment here."
288
- .value=${this.activityApproval?.comment}
289
- @change=${(e: Event) => {
290
- this.activityApproval.comment = (e.target as HTMLTextAreaElement).value
291
- }}
292
- ></textarea>
293
- </div>
294
- `
295
- }
296
-
297
- renderActivityApproval(activityApproval: ActivityApproval) {
298
- const { judgment, approver, comment, round, order, createdAt, terminatedAt } = activityApproval
299
- const { name, email } = approver || {}
300
-
301
- return html`
302
- <li>
303
- <span date>${formatter.format(new Date(terminatedAt || createdAt!))}</span>
304
- <span status></span>
305
- <span info>
306
- ${i18next.t('label.activity-state-' + (judgment || 'started'))}
307
- <strong><mwc-icon>account_circle</mwc-icon>${name}</strong>
308
- <p>${comment}</p>
309
- </span>
310
- </li>
232
+ <activity-thread-timeline .activityThread=${this.activityThread} short-form></activity-thread-timeline>
233
+ ${editable
234
+ ? html`
235
+ <div comment>
236
+ <textarea
237
+ placeholder=${String(i18next.t('text.explain the reason for approval/rejection'))}
238
+ .value=${this.activityApproval?.comment}
239
+ @change=${(e: Event) => {
240
+ this.activityApproval.comment = (e.target as HTMLTextAreaElement).value
241
+ }}
242
+ ></textarea>
243
+ </div>
244
+ `
245
+ : nothing}
311
246
  `
312
247
  }
313
248
 
@@ -393,11 +328,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
393
328
  html`
394
329
  <fieldset>
395
330
  <legend>Input</legend>
396
- <ox-properties-dynamic-view
397
- data-name="input"
398
- .props=${inputSpec}
399
- .value=${input}
400
- ></ox-properties-dynamic-view>
331
+ <ox-properties-dynamic-view data-name="input" .props=${inputSpec} .value=${input}></ox-properties-dynamic-view>
401
332
  </fieldset>
402
333
 
403
334
  <fieldset>
@@ -455,6 +386,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
455
386
  element.activityId = activityInstance.activity.id
456
387
  element.input = input
457
388
  element.output = output
389
+ element.activityApproval = this.activityApproval
458
390
 
459
391
  return element
460
392
  }
@@ -547,21 +479,9 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
547
479
  async approveActivityApproval() {
548
480
  var { id, comment } = this.activityApproval
549
481
 
550
- if (!comment) {
551
- document.dispatchEvent(
552
- new CustomEvent('notify', {
553
- detail: {
554
- message: i18next.t('text.enter a comment')
555
- }
556
- })
557
- )
558
- this.commentInput.focus()
559
- return
560
- }
561
-
562
482
  const response = await client.mutate({
563
483
  mutation: gql`
564
- mutation ($id: String!, $comment: String!) {
484
+ mutation ($id: String!, $comment: String) {
565
485
  approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}
566
486
  }
567
487
  `,