@things-factory/dataset 8.0.0 → 8.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/client/activities/activity-data-review-edit.ts +150 -5
  2. package/client/activities/activity-data-review-view.ts +81 -0
  3. package/dist-client/activities/activity-data-review-edit.d.ts +5 -1
  4. package/dist-client/activities/activity-data-review-edit.js +152 -5
  5. package/dist-client/activities/activity-data-review-edit.js.map +1 -1
  6. package/dist-client/activities/activity-data-review-view.js +80 -0
  7. package/dist-client/activities/activity-data-review-view.js.map +1 -1
  8. package/dist-client/tsconfig.tsbuildinfo +1 -1
  9. package/dist-server/activities/activity-data-review.js +18 -5
  10. package/dist-server/activities/activity-data-review.js.map +1 -1
  11. package/dist-server/activities/activity-ooc-review.js +13 -52
  12. package/dist-server/activities/activity-ooc-review.js.map +1 -1
  13. package/dist-server/controllers/create-data-ooc.d.ts +4 -0
  14. package/dist-server/controllers/create-data-ooc.js +67 -0
  15. package/dist-server/controllers/create-data-ooc.js.map +1 -0
  16. package/dist-server/controllers/create-data-sample.js +4 -94
  17. package/dist-server/controllers/create-data-sample.js.map +1 -1
  18. package/dist-server/controllers/index.d.ts +3 -0
  19. package/dist-server/controllers/index.js +3 -0
  20. package/dist-server/controllers/index.js.map +1 -1
  21. package/dist-server/controllers/issue-ooc-resolve.d.ts +3 -0
  22. package/dist-server/controllers/issue-ooc-resolve.js +49 -0
  23. package/dist-server/controllers/issue-ooc-resolve.js.map +1 -0
  24. package/dist-server/controllers/issue-ooc-review.d.ts +3 -0
  25. package/dist-server/controllers/issue-ooc-review.js +47 -0
  26. package/dist-server/controllers/issue-ooc-review.js.map +1 -0
  27. package/dist-server/service/data-archive/index.d.ts +1 -1
  28. package/dist-server/service/data-ooc/index.d.ts +1 -1
  29. package/dist-server/service/data-sample/index.d.ts +1 -1
  30. package/dist-server/service/data-set/index.d.ts +1 -1
  31. package/dist-server/service/index.d.ts +2 -2
  32. package/dist-server/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +13 -13
  34. package/server/activities/activity-data-review.ts +32 -5
  35. package/server/activities/activity-ooc-review.ts +20 -69
  36. package/server/controllers/create-data-ooc.ts +80 -0
  37. package/server/controllers/create-data-sample.ts +4 -107
  38. package/server/controllers/index.ts +3 -0
  39. package/server/controllers/issue-ooc-resolve.ts +58 -0
  40. package/server/controllers/issue-ooc-review.ts +52 -0
  41. package/translations/en.json +3 -0
  42. package/translations/ja.json +3 -0
  43. package/translations/ko.json +3 -0
  44. package/translations/ms.json +3 -0
  45. package/translations/zh.json +3 -0
@@ -1,8 +1,10 @@
1
+ import '@material/web/icon/icon.js'
2
+ import '@material/web/radio/radio.js'
1
3
  import '@operato/dataset/ox-data-entry-form.js'
2
4
 
3
5
  import gql from 'graphql-tag'
4
6
  import { css, html, LitElement } from 'lit'
5
- import { customElement, property, state } from 'lit/decorators.js'
7
+ import { customElement, property, query, state } from 'lit/decorators.js'
6
8
 
7
9
  import { i18next, localize } from '@operato/i18n'
8
10
  import { ScrollbarStyles } from '@operato/styles'
@@ -33,25 +35,168 @@ export class DataReviewActivityEdit extends localize(i18next)(LitElement) {
33
35
  padding: var(--spacing-large);
34
36
  overflow: auto;
35
37
  }
38
+
39
+ div[role='radiogroup'] {
40
+ display: flex;
41
+ flex-direction: row;
42
+ gap: var(--spacing-medium);
43
+
44
+ label {
45
+ display: flex;
46
+ flex-direction: row;
47
+
48
+ gap: var(--spacing-small);
49
+ align-items: center;
50
+ }
51
+ }
52
+
53
+ label {
54
+ display: flex;
55
+ flex-direction: column;
56
+
57
+ padding: var(--spacing-large);
58
+
59
+ h2 {
60
+ display: flex;
61
+
62
+ color: var(--title-text-color);
63
+ text-transform: capitalize;
64
+ margin: var(--title-margin);
65
+ align-items: center;
66
+ }
67
+
68
+ div {
69
+ padding: var(--spacing-large);
70
+ font: var(--input-field-font);
71
+ border: var(--md-sys-color-outline) solid 1px;
72
+ border-radius: var(--spacing-small);
73
+ background-color: var(--md-sys-color-surface-variant);
74
+ }
75
+
76
+ div[instruction] {
77
+ min-height: 200px;
78
+ }
79
+
80
+ md-icon {
81
+ color: var(--status-danger-color);
82
+ }
83
+
84
+ textarea {
85
+ margin: var(--spacing-medium);
86
+ padding: var(--spacing-medium);
87
+ margin: 0;
88
+ font: var(--input-field-font);
89
+ color: var(--md-sys-color-on-surface);
90
+ border: var(--md-sys-color-outline) solid 1px;
91
+ border-radius: var(--spacing-small);
92
+ background-color: var(--md-sys-color-surface-variant);
93
+
94
+ resize: none;
95
+ outline: none;
96
+ min-height: 200px;
97
+ }
98
+ }
36
99
  `
37
100
  ]
38
101
 
39
102
  @property({ type: Object }) input?: any
40
103
  @property({ type: Object }) output?: any
104
+ @property({ type: Object }) activityThread?: any
41
105
 
42
106
  @state() dataSample?: any
43
107
 
108
+ @query('form') form!: HTMLFormElement
109
+
44
110
  render() {
111
+ const { instruction, judgment } = this.output || {}
112
+ const { state } = this.activityThread || {}
113
+ const editable = state == 'unassigned' || state == 'assigned' || state == 'started' || state == 'submitted'
114
+
45
115
  return html`
46
116
  <div content>
47
117
  <ox-data-sample-view .dataSample=${this.dataSample}></ox-data-sample-view>
48
118
  </div>
119
+
120
+ <form @change=${this.onChangeInstruction}>
121
+ ${editable
122
+ ? html`
123
+ <label>
124
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.judgment')}</span></h2>
125
+ <div role="radiogroup" aria-label="An example group of radio buttons">
126
+ <label>
127
+ <md-radio
128
+ name="judgment"
129
+ value="normal"
130
+ ?checked=${judgment == 'normal'}
131
+ aria-label=${i18next.t('label.judgment-normal')}
132
+ ></md-radio>
133
+ ${i18next.t('label.judgment-normal')}
134
+ </label>
135
+ <label>
136
+ <md-radio
137
+ name="judgment"
138
+ value="abnormal"
139
+ ?checked=${judgment == 'abnormal'}
140
+ aria-label=${i18next.t('label.judgment-abnormal')}
141
+ ></md-radio
142
+ >${i18next.t('label.judgment-abnormal')}
143
+ </label>
144
+ </div>
145
+ </label>
146
+
147
+ <label>
148
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.corrective instruction')}</span></h2>
149
+ <textarea
150
+ name="instruction"
151
+ placeholder=${String(i18next.t('text.corrective instruction placeholder'))}
152
+ .value=${instruction || ''}
153
+ instruction
154
+ ></textarea>
155
+ </label>
156
+ `
157
+ : html`
158
+ <label>
159
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.judgment')}</span></h2>
160
+ <div role="radiogroup" aria-label="An example group of radio buttons">
161
+ <label>
162
+ <md-radio
163
+ value="normal"
164
+ ?checked=${judgment == 'normal'}
165
+ aria-label=${i18next.t('label.judgment-normal')}
166
+ disabled
167
+ ></md-radio>
168
+ ${i18next.t('label.judgment-normal')}
169
+ </label>
170
+ <label>
171
+ <md-radio
172
+ value="abnormal"
173
+ ?checked=${judgment == 'abnormal'}
174
+ aria-label=${i18next.t('label.judgment-abnormal')}
175
+ disabled
176
+ ></md-radio
177
+ >${i18next.t('label.judgment-abnormal')}
178
+ </label>
179
+ </div>
180
+ </label>
181
+
182
+ <label>
183
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.corrective instruction')}</span></h2>
184
+ <div instruction>${instruction}</div>
185
+ </label>
186
+ `}
187
+ </form>
49
188
  `
50
189
  }
51
190
 
52
191
  onChangeInstruction(e: Event) {
53
- this.output ||= {}
54
- this.output.instruction = (e.target as HTMLTextAreaElement).value
192
+ var output = {}
193
+
194
+ const formData = new FormData(this.form)
195
+ formData.forEach((value, key) => {
196
+ output[key] = value
197
+ })
198
+
199
+ this.output = output
55
200
 
56
201
  this.dispatchEvent(
57
202
  new CustomEvent('change', {
@@ -62,11 +207,11 @@ export class DataReviewActivityEdit extends localize(i18next)(LitElement) {
62
207
 
63
208
  updated(changes) {
64
209
  if (changes.has('input')) {
65
- this.fetchDataAssign()
210
+ this.fetchDataSample()
66
211
  }
67
212
  }
68
213
 
69
- async fetchDataAssign() {
214
+ async fetchDataSample() {
70
215
  const { dataSampleId, dataSample } = this.input || {}
71
216
 
72
217
  if (dataSample) {
@@ -34,6 +34,52 @@ export class DataReviewActivityView extends localize(i18next)(LitElement) {
34
34
  overflow: auto;
35
35
  }
36
36
 
37
+ div[role='radiogroup'] {
38
+ display: flex;
39
+ flex-direction: row;
40
+ gap: var(--spacing-medium);
41
+
42
+ label {
43
+ display: flex;
44
+ flex-direction: row;
45
+
46
+ gap: var(--spacing-small);
47
+ align-items: center;
48
+ }
49
+ }
50
+
51
+ label {
52
+ display: flex;
53
+ flex-direction: column;
54
+
55
+ padding: var(--spacing-large);
56
+
57
+ h2 {
58
+ display: flex;
59
+
60
+ color: var(--title-text-color);
61
+ text-transform: capitalize;
62
+ margin: var(--title-margin);
63
+ align-items: center;
64
+ }
65
+
66
+ div {
67
+ padding: var(--spacing-large);
68
+ font: var(--input-field-font);
69
+ border: var(--md-sys-color-outline) solid 1px;
70
+ border-radius: var(--spacing-small);
71
+ background-color: var(--md-sys-color-surface-variant);
72
+ }
73
+
74
+ div[instruction] {
75
+ min-height: 200px;
76
+ }
77
+
78
+ md-icon {
79
+ color: var(--status-danger-color);
80
+ }
81
+ }
82
+
37
83
  @media print {
38
84
  :host {
39
85
  display: block;
@@ -54,10 +100,45 @@ export class DataReviewActivityView extends localize(i18next)(LitElement) {
54
100
  @state() dataSample?: any
55
101
 
56
102
  render() {
103
+ const { judgment, instruction } = this.output || {}
104
+
57
105
  return html`
58
106
  <div content>
59
107
  <ox-data-sample-view .dataSample=${this.dataSample}></ox-data-sample-view>
60
108
  </div>
109
+
110
+ <form>
111
+ <label>
112
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.judgment')}</span></h2>
113
+ <div role="radiogroup" aria-label="An example group of radio buttons">
114
+ <label>
115
+ <md-radio
116
+ name="judgment"
117
+ value="normal"
118
+ ?checked=${judgment == 'normal'}
119
+ aria-label=${i18next.t('label.judgment-normal')}
120
+ disabled
121
+ ></md-radio>
122
+ ${i18next.t('label.judgment-normal')}
123
+ </label>
124
+ <label>
125
+ <md-radio
126
+ name="judgment"
127
+ value="abnormal"
128
+ ?checked=${judgment == 'abnormal'}
129
+ aria-label=${i18next.t('label.judgment-abnormal')}
130
+ disabled
131
+ ></md-radio
132
+ >${i18next.t('label.judgment-abnormal')}
133
+ </label>
134
+ </div>
135
+ </label>
136
+
137
+ <label>
138
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.corrective instruction')}</span></h2>
139
+ <div instruction>${instruction}</div>
140
+ </label>
141
+ </form>
61
142
  `
62
143
  }
63
144
 
@@ -1,3 +1,5 @@
1
+ import '@material/web/icon/icon.js';
2
+ import '@material/web/radio/radio.js';
1
3
  import '@operato/dataset/ox-data-entry-form.js';
2
4
  import { LitElement } from 'lit';
3
5
  declare const DataReviewActivityEdit_base: (new (...args: any[]) => LitElement) & typeof LitElement;
@@ -5,10 +7,12 @@ export declare class DataReviewActivityEdit extends DataReviewActivityEdit_base
5
7
  static styles: import("lit").CSSResult[];
6
8
  input?: any;
7
9
  output?: any;
10
+ activityThread?: any;
8
11
  dataSample?: any;
12
+ form: HTMLFormElement;
9
13
  render(): import("lit-html").TemplateResult<1>;
10
14
  onChangeInstruction(e: Event): void;
11
15
  updated(changes: any): void;
12
- fetchDataAssign(): Promise<void>;
16
+ fetchDataSample(): Promise<void>;
13
17
  }
14
18
  export {};
@@ -1,32 +1,110 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/icon/icon.js';
3
+ import '@material/web/radio/radio.js';
2
4
  import '@operato/dataset/ox-data-entry-form.js';
3
5
  import gql from 'graphql-tag';
4
6
  import { css, html, LitElement } from 'lit';
5
- import { customElement, property, state } from 'lit/decorators.js';
7
+ import { customElement, property, query, state } from 'lit/decorators.js';
6
8
  import { i18next, localize } from '@operato/i18n';
7
9
  import { ScrollbarStyles } from '@operato/styles';
8
10
  import { client } from '@operato/graphql';
9
11
  let DataReviewActivityEdit = class DataReviewActivityEdit extends localize(i18next)(LitElement) {
10
12
  render() {
13
+ const { instruction, judgment } = this.output || {};
14
+ const { state } = this.activityThread || {};
15
+ const editable = state == 'unassigned' || state == 'assigned' || state == 'started' || state == 'submitted';
11
16
  return html `
12
17
  <div content>
13
18
  <ox-data-sample-view .dataSample=${this.dataSample}></ox-data-sample-view>
14
19
  </div>
20
+
21
+ <form @change=${this.onChangeInstruction}>
22
+ ${editable
23
+ ? html `
24
+ <label>
25
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.judgment')}</span></h2>
26
+ <div role="radiogroup" aria-label="An example group of radio buttons">
27
+ <label>
28
+ <md-radio
29
+ name="judgment"
30
+ value="normal"
31
+ ?checked=${judgment == 'normal'}
32
+ aria-label=${i18next.t('label.judgment-normal')}
33
+ ></md-radio>
34
+ ${i18next.t('label.judgment-normal')}
35
+ </label>
36
+ <label>
37
+ <md-radio
38
+ name="judgment"
39
+ value="abnormal"
40
+ ?checked=${judgment == 'abnormal'}
41
+ aria-label=${i18next.t('label.judgment-abnormal')}
42
+ ></md-radio
43
+ >${i18next.t('label.judgment-abnormal')}
44
+ </label>
45
+ </div>
46
+ </label>
47
+
48
+ <label>
49
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.corrective instruction')}</span></h2>
50
+ <textarea
51
+ name="instruction"
52
+ placeholder=${String(i18next.t('text.corrective instruction placeholder'))}
53
+ .value=${instruction || ''}
54
+ instruction
55
+ ></textarea>
56
+ </label>
57
+ `
58
+ : html `
59
+ <label>
60
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.judgment')}</span></h2>
61
+ <div role="radiogroup" aria-label="An example group of radio buttons">
62
+ <label>
63
+ <md-radio
64
+ value="normal"
65
+ ?checked=${judgment == 'normal'}
66
+ aria-label=${i18next.t('label.judgment-normal')}
67
+ disabled
68
+ ></md-radio>
69
+ ${i18next.t('label.judgment-normal')}
70
+ </label>
71
+ <label>
72
+ <md-radio
73
+ value="abnormal"
74
+ ?checked=${judgment == 'abnormal'}
75
+ aria-label=${i18next.t('label.judgment-abnormal')}
76
+ disabled
77
+ ></md-radio
78
+ >${i18next.t('label.judgment-abnormal')}
79
+ </label>
80
+ </div>
81
+ </label>
82
+
83
+ <label>
84
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.corrective instruction')}</span></h2>
85
+ <div instruction>${instruction}</div>
86
+ </label>
87
+ `}
88
+ </form>
15
89
  `;
16
90
  }
17
91
  onChangeInstruction(e) {
18
- this.output || (this.output = {});
19
- this.output.instruction = e.target.value;
92
+ var output = {};
93
+ const formData = new FormData(this.form);
94
+ formData.forEach((value, key) => {
95
+ output[key] = value;
96
+ });
97
+ this.output = output;
20
98
  this.dispatchEvent(new CustomEvent('change', {
21
99
  detail: this.output
22
100
  }));
23
101
  }
24
102
  updated(changes) {
25
103
  if (changes.has('input')) {
26
- this.fetchDataAssign();
104
+ this.fetchDataSample();
27
105
  }
28
106
  }
29
- async fetchDataAssign() {
107
+ async fetchDataSample() {
30
108
  const { dataSampleId, dataSample } = this.input || {};
31
109
  if (dataSample) {
32
110
  /* only for backwards compatibility - should be deleted later */
@@ -111,6 +189,67 @@ DataReviewActivityEdit.styles = [
111
189
  padding: var(--spacing-large);
112
190
  overflow: auto;
113
191
  }
192
+
193
+ div[role='radiogroup'] {
194
+ display: flex;
195
+ flex-direction: row;
196
+ gap: var(--spacing-medium);
197
+
198
+ label {
199
+ display: flex;
200
+ flex-direction: row;
201
+
202
+ gap: var(--spacing-small);
203
+ align-items: center;
204
+ }
205
+ }
206
+
207
+ label {
208
+ display: flex;
209
+ flex-direction: column;
210
+
211
+ padding: var(--spacing-large);
212
+
213
+ h2 {
214
+ display: flex;
215
+
216
+ color: var(--title-text-color);
217
+ text-transform: capitalize;
218
+ margin: var(--title-margin);
219
+ align-items: center;
220
+ }
221
+
222
+ div {
223
+ padding: var(--spacing-large);
224
+ font: var(--input-field-font);
225
+ border: var(--md-sys-color-outline) solid 1px;
226
+ border-radius: var(--spacing-small);
227
+ background-color: var(--md-sys-color-surface-variant);
228
+ }
229
+
230
+ div[instruction] {
231
+ min-height: 200px;
232
+ }
233
+
234
+ md-icon {
235
+ color: var(--status-danger-color);
236
+ }
237
+
238
+ textarea {
239
+ margin: var(--spacing-medium);
240
+ padding: var(--spacing-medium);
241
+ margin: 0;
242
+ font: var(--input-field-font);
243
+ color: var(--md-sys-color-on-surface);
244
+ border: var(--md-sys-color-outline) solid 1px;
245
+ border-radius: var(--spacing-small);
246
+ background-color: var(--md-sys-color-surface-variant);
247
+
248
+ resize: none;
249
+ outline: none;
250
+ min-height: 200px;
251
+ }
252
+ }
114
253
  `
115
254
  ];
116
255
  __decorate([
@@ -121,10 +260,18 @@ __decorate([
121
260
  property({ type: Object }),
122
261
  __metadata("design:type", Object)
123
262
  ], DataReviewActivityEdit.prototype, "output", void 0);
263
+ __decorate([
264
+ property({ type: Object }),
265
+ __metadata("design:type", Object)
266
+ ], DataReviewActivityEdit.prototype, "activityThread", void 0);
124
267
  __decorate([
125
268
  state(),
126
269
  __metadata("design:type", Object)
127
270
  ], DataReviewActivityEdit.prototype, "dataSample", void 0);
271
+ __decorate([
272
+ query('form'),
273
+ __metadata("design:type", HTMLFormElement)
274
+ ], DataReviewActivityEdit.prototype, "form", void 0);
128
275
  DataReviewActivityEdit = __decorate([
129
276
  customElement('activity-data-review-edit')
130
277
  ], DataReviewActivityEdit);
@@ -1 +1 @@
1
- {"version":3,"file":"activity-data-review-edit.js","sourceRoot":"","sources":["../../client/activities/activity-data-review-edit.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAA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IACH,CAAC;;AAvHM,6BAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;KAqBF;CACF,AAxBY,CAwBZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAa;AAE/B;IAAR,KAAK,EAAE;;0DAAiB;AA9Bd,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CAyHlC","sourcesContent":["import '@operato/dataset/ox-data-entry-form.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { client } from '@operato/graphql'\n\n@customElement('activity-data-review-edit')\nexport class DataReviewActivityEdit extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n }\n\n div[content] {\n flex: 1;\n flex-direction: column;\n\n display: flex;\n overflow: auto;\n }\n\n ox-data-sample-view {\n flex: 1;\n padding: var(--spacing-large);\n overflow: auto;\n }\n `\n ]\n\n @property({ type: Object }) input?: any\n @property({ type: Object }) output?: any\n\n @state() dataSample?: any\n\n render() {\n return html`\n <div content>\n <ox-data-sample-view .dataSample=${this.dataSample}></ox-data-sample-view>\n </div>\n `\n }\n\n onChangeInstruction(e: Event) {\n this.output ||= {}\n this.output.instruction = (e.target as HTMLTextAreaElement).value\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.output\n })\n )\n }\n\n updated(changes) {\n if (changes.has('input')) {\n this.fetchDataAssign()\n }\n }\n\n async fetchDataAssign() {\n const { dataSampleId, dataSample } = this.input || {}\n\n if (dataSample) {\n /* only for backwards compatibility - should be deleted later */\n this.dataSample = dataSample\n } else if (dataSampleId) {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n dataSample(id: $id) {\n id\n name\n description\n useCase\n key01\n key02\n key03\n key04\n key05\n data\n ooc\n oos\n dataSet {\n id\n name\n description\n }\n dataItems {\n name\n description\n active\n hidden\n tag\n group\n type\n unit\n options\n quota\n spec\n stat\n }\n judgment\n workDate\n workShift\n updater {\n id\n name\n }\n updatedAt\n collectedAt\n }\n }\n `,\n variables: {\n id: dataSampleId\n }\n })\n\n this.dataSample = {\n ...response.data.dataSample\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"activity-data-review-edit.js","sourceRoot":"","sources":["../../client/activities/activity-data-review-edit.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,8BAA8B,CAAA;AACrC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGlC,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAgGvE,MAAM;QACJ,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA;QACnD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,cAAc,IAAI,EAAE,CAAA;QAC3C,MAAM,QAAQ,GAAG,KAAK,IAAI,YAAY,IAAI,KAAK,IAAI,UAAU,IAAI,KAAK,IAAI,SA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,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAa;AACZ;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DAAqB;AAEvC;IAAR,KAAK,EAAE;;0DAAiB;AAEV;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;oDAAA;AA9F1B,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CAwQlC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/radio/radio.js'\nimport '@operato/dataset/ox-data-entry-form.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { client } from '@operato/graphql'\n\n@customElement('activity-data-review-edit')\nexport class DataReviewActivityEdit extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n }\n\n div[content] {\n flex: 1;\n flex-direction: column;\n\n display: flex;\n overflow: auto;\n }\n\n ox-data-sample-view {\n flex: 1;\n padding: var(--spacing-large);\n overflow: auto;\n }\n\n div[role='radiogroup'] {\n display: flex;\n flex-direction: row;\n gap: var(--spacing-medium);\n\n label {\n display: flex;\n flex-direction: row;\n\n gap: var(--spacing-small);\n align-items: center;\n }\n }\n\n label {\n display: flex;\n flex-direction: column;\n\n padding: var(--spacing-large);\n\n h2 {\n display: flex;\n\n color: var(--title-text-color);\n text-transform: capitalize;\n margin: var(--title-margin);\n align-items: center;\n }\n\n div {\n padding: var(--spacing-large);\n font: var(--input-field-font);\n border: var(--md-sys-color-outline) solid 1px;\n border-radius: var(--spacing-small);\n background-color: var(--md-sys-color-surface-variant);\n }\n\n div[instruction] {\n min-height: 200px;\n }\n\n md-icon {\n color: var(--status-danger-color);\n }\n\n textarea {\n margin: var(--spacing-medium);\n padding: var(--spacing-medium);\n margin: 0;\n font: var(--input-field-font);\n color: var(--md-sys-color-on-surface);\n border: var(--md-sys-color-outline) solid 1px;\n border-radius: var(--spacing-small);\n background-color: var(--md-sys-color-surface-variant);\n\n resize: none;\n outline: none;\n min-height: 200px;\n }\n }\n `\n ]\n\n @property({ type: Object }) input?: any\n @property({ type: Object }) output?: any\n @property({ type: Object }) activityThread?: any\n\n @state() dataSample?: any\n\n @query('form') form!: HTMLFormElement\n\n render() {\n const { instruction, judgment } = this.output || {}\n const { state } = this.activityThread || {}\n const editable = state == 'unassigned' || state == 'assigned' || state == 'started' || state == 'submitted'\n\n return html`\n <div content>\n <ox-data-sample-view .dataSample=${this.dataSample}></ox-data-sample-view>\n </div>\n\n <form @change=${this.onChangeInstruction}>\n ${editable\n ? html`\n <label>\n <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.judgment')}</span></h2>\n <div role=\"radiogroup\" aria-label=\"An example group of radio buttons\">\n <label>\n <md-radio\n name=\"judgment\"\n value=\"normal\"\n ?checked=${judgment == 'normal'}\n aria-label=${i18next.t('label.judgment-normal')}\n ></md-radio>\n ${i18next.t('label.judgment-normal')}\n </label>\n <label>\n <md-radio\n name=\"judgment\"\n value=\"abnormal\"\n ?checked=${judgment == 'abnormal'}\n aria-label=${i18next.t('label.judgment-abnormal')}\n ></md-radio\n >${i18next.t('label.judgment-abnormal')}\n </label>\n </div>\n </label>\n\n <label>\n <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.corrective instruction')}</span></h2>\n <textarea\n name=\"instruction\"\n placeholder=${String(i18next.t('text.corrective instruction placeholder'))}\n .value=${instruction || ''}\n instruction\n ></textarea>\n </label>\n `\n : html`\n <label>\n <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.judgment')}</span></h2>\n <div role=\"radiogroup\" aria-label=\"An example group of radio buttons\">\n <label>\n <md-radio\n value=\"normal\"\n ?checked=${judgment == 'normal'}\n aria-label=${i18next.t('label.judgment-normal')}\n disabled\n ></md-radio>\n ${i18next.t('label.judgment-normal')}\n </label>\n <label>\n <md-radio\n value=\"abnormal\"\n ?checked=${judgment == 'abnormal'}\n aria-label=${i18next.t('label.judgment-abnormal')}\n disabled\n ></md-radio\n >${i18next.t('label.judgment-abnormal')}\n </label>\n </div>\n </label>\n\n <label>\n <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.corrective instruction')}</span></h2>\n <div instruction>${instruction}</div>\n </label>\n `}\n </form>\n `\n }\n\n onChangeInstruction(e: Event) {\n var output = {}\n\n const formData = new FormData(this.form)\n formData.forEach((value, key) => {\n output[key] = value\n })\n\n this.output = output\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.output\n })\n )\n }\n\n updated(changes) {\n if (changes.has('input')) {\n this.fetchDataSample()\n }\n }\n\n async fetchDataSample() {\n const { dataSampleId, dataSample } = this.input || {}\n\n if (dataSample) {\n /* only for backwards compatibility - should be deleted later */\n this.dataSample = dataSample\n } else if (dataSampleId) {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n dataSample(id: $id) {\n id\n name\n description\n useCase\n key01\n key02\n key03\n key04\n key05\n data\n ooc\n oos\n dataSet {\n id\n name\n description\n }\n dataItems {\n name\n description\n active\n hidden\n tag\n group\n type\n unit\n options\n quota\n spec\n stat\n }\n judgment\n workDate\n workShift\n updater {\n id\n name\n }\n updatedAt\n collectedAt\n }\n }\n `,\n variables: {\n id: dataSampleId\n }\n })\n\n this.dataSample = {\n ...response.data.dataSample\n }\n }\n }\n}\n"]}
@@ -8,10 +8,44 @@ import { ScrollbarStyles } from '@operato/styles';
8
8
  import { client } from '@operato/graphql';
9
9
  let DataReviewActivityView = class DataReviewActivityView extends localize(i18next)(LitElement) {
10
10
  render() {
11
+ const { judgment, instruction } = this.output || {};
11
12
  return html `
12
13
  <div content>
13
14
  <ox-data-sample-view .dataSample=${this.dataSample}></ox-data-sample-view>
14
15
  </div>
16
+
17
+ <form>
18
+ <label>
19
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.judgment')}</span></h2>
20
+ <div role="radiogroup" aria-label="An example group of radio buttons">
21
+ <label>
22
+ <md-radio
23
+ name="judgment"
24
+ value="normal"
25
+ ?checked=${judgment == 'normal'}
26
+ aria-label=${i18next.t('label.judgment-normal')}
27
+ disabled
28
+ ></md-radio>
29
+ ${i18next.t('label.judgment-normal')}
30
+ </label>
31
+ <label>
32
+ <md-radio
33
+ name="judgment"
34
+ value="abnormal"
35
+ ?checked=${judgment == 'abnormal'}
36
+ aria-label=${i18next.t('label.judgment-abnormal')}
37
+ disabled
38
+ ></md-radio
39
+ >${i18next.t('label.judgment-abnormal')}
40
+ </label>
41
+ </div>
42
+ </label>
43
+
44
+ <label>
45
+ <h2><md-icon>build_circle</md-icon>&nbsp;<span>${i18next.t('label.corrective instruction')}</span></h2>
46
+ <div instruction>${instruction}</div>
47
+ </label>
48
+ </form>
15
49
  `;
16
50
  }
17
51
  onChangeInstruction(e) {
@@ -112,6 +146,52 @@ DataReviewActivityView.styles = [
112
146
  overflow: auto;
113
147
  }
114
148
 
149
+ div[role='radiogroup'] {
150
+ display: flex;
151
+ flex-direction: row;
152
+ gap: var(--spacing-medium);
153
+
154
+ label {
155
+ display: flex;
156
+ flex-direction: row;
157
+
158
+ gap: var(--spacing-small);
159
+ align-items: center;
160
+ }
161
+ }
162
+
163
+ label {
164
+ display: flex;
165
+ flex-direction: column;
166
+
167
+ padding: var(--spacing-large);
168
+
169
+ h2 {
170
+ display: flex;
171
+
172
+ color: var(--title-text-color);
173
+ text-transform: capitalize;
174
+ margin: var(--title-margin);
175
+ align-items: center;
176
+ }
177
+
178
+ div {
179
+ padding: var(--spacing-large);
180
+ font: var(--input-field-font);
181
+ border: var(--md-sys-color-outline) solid 1px;
182
+ border-radius: var(--spacing-small);
183
+ background-color: var(--md-sys-color-surface-variant);
184
+ }
185
+
186
+ div[instruction] {
187
+ min-height: 200px;
188
+ }
189
+
190
+ md-icon {
191
+ color: var(--status-danger-color);
192
+ }
193
+ }
194
+
115
195
  @media print {
116
196
  :host {
117
197
  display: block;