@things-factory/compliance 10.1.256 → 10.1.257

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 (64) hide show
  1. package/dist-client/components/compliance-case-form.d.ts +11 -6
  2. package/dist-client/components/compliance-case-form.js +67 -88
  3. package/dist-client/components/compliance-case-form.js.map +1 -1
  4. package/dist-client/components/compliance-case-sheet.d.ts +14 -12
  5. package/dist-client/components/compliance-case-sheet.js +92 -133
  6. package/dist-client/components/compliance-case-sheet.js.map +1 -1
  7. package/dist-client/components/compliance-my-inventions.d.ts +3 -4
  8. package/dist-client/components/compliance-my-inventions.js +10 -30
  9. package/dist-client/components/compliance-my-inventions.js.map +1 -1
  10. package/dist-client/components/compliance-my-privacy-requests.d.ts +6 -6
  11. package/dist-client/components/compliance-my-privacy-requests.js +30 -66
  12. package/dist-client/components/compliance-my-privacy-requests.js.map +1 -1
  13. package/dist-client/components/compliance-my-reports.d.ts +3 -4
  14. package/dist-client/components/compliance-my-reports.js +19 -40
  15. package/dist-client/components/compliance-my-reports.js.map +1 -1
  16. package/dist-client/components/invention-report-form.d.ts +5 -4
  17. package/dist-client/components/invention-report-form.js +24 -45
  18. package/dist-client/components/invention-report-form.js.map +1 -1
  19. package/dist-client/components/my-trainings.d.ts +3 -5
  20. package/dist-client/components/my-trainings.js +20 -49
  21. package/dist-client/components/my-trainings.js.map +1 -1
  22. package/dist-client/components/seal-use-form.d.ts +9 -6
  23. package/dist-client/components/seal-use-form.js +60 -81
  24. package/dist-client/components/seal-use-form.js.map +1 -1
  25. package/dist-client/components/training-attendance-form.d.ts +6 -4
  26. package/dist-client/components/training-attendance-form.js +30 -50
  27. package/dist-client/components/training-attendance-form.js.map +1 -1
  28. package/dist-client/pages/regulation-detail.d.ts +15 -6
  29. package/dist-client/pages/regulation-detail.js +169 -142
  30. package/dist-client/pages/regulation-detail.js.map +1 -1
  31. package/dist-client/pages/regulations.d.ts +7 -5
  32. package/dist-client/pages/regulations.js +38 -56
  33. package/dist-client/pages/regulations.js.map +1 -1
  34. package/dist-client/regulation/regulation-guide.js +2 -1
  35. package/dist-client/regulation/regulation-guide.js.map +1 -1
  36. package/dist-client/tsconfig.tsbuildinfo +1 -1
  37. package/dist-client/words.js +2 -2
  38. package/dist-client/words.js.map +1 -1
  39. package/dist-server/service/compliance-case/compliance-case-query.js +1 -1
  40. package/dist-server/service/compliance-case/compliance-case-query.js.map +1 -1
  41. package/dist-server/service/compliance-case/compliance-case-rules.d.ts +1 -3
  42. package/dist-server/service/compliance-case/compliance-case-rules.js +2 -4
  43. package/dist-server/service/compliance-case/compliance-case-rules.js.map +1 -1
  44. package/dist-server/service/compliance-case/compliance-case-service.d.ts +3 -3
  45. package/dist-server/service/compliance-case/compliance-case-service.js +4 -6
  46. package/dist-server/service/compliance-case/compliance-case-service.js.map +1 -1
  47. package/dist-server/service/compliance-case/compliance-case-type.js +1 -1
  48. package/dist-server/service/compliance-case/compliance-case-type.js.map +1 -1
  49. package/dist-server/service/compliance-case/compliance-case.js +1 -1
  50. package/dist-server/service/compliance-case/compliance-case.js.map +1 -1
  51. package/dist-server/service/regulation/regulation-rules.d.ts +3 -3
  52. package/dist-server/service/regulation/regulation-rules.js +17 -17
  53. package/dist-server/service/regulation/regulation-rules.js.map +1 -1
  54. package/dist-server/service/regulation/regulation.d.ts +1 -1
  55. package/dist-server/service/regulation/regulation.js +1 -1
  56. package/dist-server/service/regulation/regulation.js.map +1 -1
  57. package/dist-server/tsconfig.tsbuildinfo +1 -1
  58. package/package.json +17 -17
  59. package/translations/en.json +27 -14
  60. package/translations/es.json +27 -14
  61. package/translations/ja.json +27 -14
  62. package/translations/ko.json +27 -14
  63. package/translations/ms.json +27 -14
  64. package/translations/zh.json +27 -14
@@ -14,7 +14,7 @@ export declare function openComplianceCaseForm(handler?: boolean): Promise<any |
14
14
  declare const ComplianceCaseForm_base: (new (...args: any[]) => LitElement) & typeof LitElement;
15
15
  /**
16
16
  * 신고하기 (ADR-0187 decision 21) - what happened, to whom, by whom and when, with files. When every case handler is
17
- * among those named, the form says nobody inside the company will investigate it and shows the labour ministry's way.
17
+ * among those named, the form says the investigation starts once the company names a case handler (amendment 5).
18
18
  */
19
19
  export declare class ComplianceCaseForm extends ComplianceCaseForm_base {
20
20
  static styles: import("lit").CSSResult[];
@@ -27,15 +27,20 @@ export declare class ComplianceCaseForm extends ComplianceCaseForm_base {
27
27
  private receivedOn;
28
28
  private description;
29
29
  private files;
30
- private found;
31
- private noneInside;
32
- private working;
33
- private message;
30
+ private searched;
31
+ private people;
32
+ private handlerLeft;
33
+ private saves;
34
+ private get found();
35
+ private get noneInside();
36
+ private get save();
37
+ private get working();
38
+ private get message();
34
39
  render(): import("lit-html").TemplateResult<1>;
35
40
  /** People named so far, and a name box that finds employees still working here. */
36
41
  private picker;
37
42
  private find;
38
- /** The people named against, and whether a case handler is left to take it. */
43
+ /** The people named against - whether a case handler is left is read for them. */
39
44
  private setAccused;
40
45
  private submit;
41
46
  }
@@ -8,7 +8,7 @@ import '@operato/popup/ox-popup-actions.js';
8
8
  import gql from 'graphql-tag';
9
9
  import { css, html, LitElement, nothing } from 'lit';
10
10
  import { customElement, property, state } from 'lit/decorators.js';
11
- import { client, uploadContext } from '@operato/graphql';
11
+ import { MutationController, QueryController, uploadContext } from '@operato/graphql';
12
12
  import { i18next, localize } from '@operato/i18n';
13
13
  import { notify, openPopup } from '@operato/layout';
14
14
  import { CommonPopupStyles, FormFieldStyles, PopupBodyStyles, PopupFieldStyles } from '@operato/styles';
@@ -31,7 +31,7 @@ const today = () => {
31
31
  };
32
32
  /**
33
33
  * 신고하기 (ADR-0187 decision 21) - what happened, to whom, by whom and when, with files. When every case handler is
34
- * among those named, the form says nobody inside the company will investigate it and shows the labour ministry's way.
34
+ * among those named, the form says the investigation starts once the company names a case handler (amendment 5).
35
35
  */
36
36
  let ComplianceCaseForm = class ComplianceCaseForm extends localize(i18next)(LitElement) {
37
37
  constructor() {
@@ -45,10 +45,32 @@ let ComplianceCaseForm = class ComplianceCaseForm extends localize(i18next)(LitE
45
45
  this.receivedOn = today();
46
46
  this.description = '';
47
47
  this.files = [];
48
- this.found = { for: '', people: [] };
49
- this.noneInside = false;
50
- this.working = false;
51
- this.message = '';
48
+ /* The words typed to find a person, and the field they are typed in. */
49
+ this.searched = { for: '', text: '' };
50
+ /* The people the words find, and whether a case handler is left to take it once the accused are named (ADR-0190). */
51
+ this.people = new QueryController(this, gql `
52
+ query ($text: String!) {
53
+ complianceCasePeople(text: $text) { id name note }
54
+ }
55
+ `, { variables: () => (this.searched.text.trim() ? { text: this.searched.text } : undefined), keepPrevious: true });
56
+ this.handlerLeft = new QueryController(this, gql `
57
+ query ($ids: [String!]!) {
58
+ complianceCaseHandlerLeft(accusedIds: $ids)
59
+ }
60
+ `, { variables: () => (this.accused.length ? { ids: this.accused.map(one => one.id) } : undefined) });
61
+ /* Its failure is drawn at the foot of the form. */
62
+ this.saves = {
63
+ record: new MutationController(this, gql `
64
+ mutation ($case: NewComplianceCase!, $attach: [Upload!]) {
65
+ written: recordComplianceCase(case: $case, attach: $attach) { id noInsideHandler }
66
+ }
67
+ `, { showsError: true }),
68
+ report: new MutationController(this, gql `
69
+ mutation ($report: NewComplianceCaseReport!, $attach: [Upload!]) {
70
+ written: reportComplianceCase(report: $report, attach: $attach) { id noInsideHandler }
71
+ }
72
+ `, { showsError: true })
73
+ };
52
74
  }
53
75
  static { this.styles = [
54
76
  CommonPopupStyles,
@@ -111,6 +133,23 @@ let ComplianceCaseForm = class ComplianceCaseForm extends localize(i18next)(LitE
111
133
  }
112
134
  `
113
135
  ]; }
136
+ get found() {
137
+ if (!this.searched.text.trim())
138
+ return { for: '', people: [] };
139
+ return { for: this.searched.for, people: this.people.data?.complianceCasePeople ?? [] };
140
+ }
141
+ get noneInside() {
142
+ return this.accused.length > 0 && this.handlerLeft.data?.complianceCaseHandlerLeft === false;
143
+ }
144
+ get save() {
145
+ return this.handler ? this.saves.record : this.saves.report;
146
+ }
147
+ get working() {
148
+ return this.save.pending;
149
+ }
150
+ get message() {
151
+ return this.save.error ? failureOf(this.save.error) : '';
152
+ }
114
153
  render() {
115
154
  return html `
116
155
  <div class="body">
@@ -135,7 +174,6 @@ let ComplianceCaseForm = class ComplianceCaseForm extends localize(i18next)(LitE
135
174
  ${this.noneInside
136
175
  ? html `<div outside>
137
176
  <p>${i18next.t('text.compliance-case-no-inside-handler')}</p>
138
- <p>${i18next.t('text.compliance-case-ministry-route')}</p>
139
177
  </div>`
140
178
  : nothing}
141
179
  ${this.picker('victim', this.victim ? [this.victim] : [], one => (this.victim = one), () => (this.victim = null))}
@@ -176,82 +214,35 @@ let ComplianceCaseForm = class ComplianceCaseForm extends localize(i18next)(LitE
176
214
  <input placeholder=${i18next.t('text.compliance-case-find-person')} @input=${(e) => this.find(field, e.target.value)} />
177
215
  ${found.length
178
216
  ? html `<div class="found">
179
- ${found.map(one => html `<button type="button" @click=${() => ((this.found = { for: '', people: [] }), add(one))}>${one.note ? `${one.name} · ${one.note}` : one.name}</button>`)}
217
+ ${found.map(one => html `<button type="button" @click=${() => ((this.searched = { for: '', text: '' }), add(one))}>${one.note ? `${one.name} · ${one.note}` : one.name}</button>`)}
180
218
  </div>`
181
219
  : nothing}
182
220
  </label>`;
183
221
  }
184
- async find(field, text) {
185
- const response = await client.query({
186
- query: gql `
187
- query ($text: String!) {
188
- complianceCasePeople(text: $text) { id name note }
189
- }
190
- `,
191
- variables: { text },
192
- fetchPolicy: 'no-cache'
193
- });
194
- this.found = { for: field, people: response.data?.complianceCasePeople ?? [] };
222
+ find(field, text) {
223
+ this.searched = { for: field, text };
195
224
  }
196
- /** The people named against, and whether a case handler is left to take it. */
197
- async setAccused(people) {
225
+ /** The people named against - whether a case handler is left is read for them. */
226
+ setAccused(people) {
198
227
  this.accused = people;
199
- if (!people.length)
200
- return (this.noneInside = false);
201
- const response = await client.query({
202
- query: gql `
203
- query ($ids: [String!]!) {
204
- complianceCaseHandlerLeft(accusedIds: $ids)
205
- }
206
- `,
207
- variables: { ids: people.map(one => one.id) },
208
- fetchPolicy: 'no-cache'
209
- });
210
- this.noneInside = response.data?.complianceCaseHandlerLeft === false;
211
228
  }
212
229
  async submit() {
213
- this.message = '';
214
- this.working = true;
215
- try {
216
- const report = {
217
- kind: this.kind,
218
- accusedIds: this.accused.map(one => one.id),
219
- victimId: this.victim?.id ?? null,
220
- occurredOn: this.occurredOn || null,
221
- description: this.description
222
- };
223
- const upload = this.files.length ? { context: uploadContext(() => { }) } : {};
224
- const response = this.handler
225
- ? await client.mutate({
226
- mutation: gql `
227
- mutation ($case: NewComplianceCase!, $attach: [Upload!]) {
228
- written: recordComplianceCase(case: $case, attach: $attach) { id noInsideHandler }
229
- }
230
- `,
231
- variables: { case: { ...report, reporterId: this.reporter?.id ?? null, receivedOn: this.receivedOn }, attach: this.files },
232
- ...upload
233
- })
234
- : await client.mutate({
235
- mutation: gql `
236
- mutation ($report: NewComplianceCaseReport!, $attach: [Upload!]) {
237
- written: reportComplianceCase(report: $report, attach: $attach) { id noInsideHandler }
238
- }
239
- `,
240
- variables: { report, attach: this.files },
241
- ...upload
242
- });
243
- if (response.errors?.length)
244
- throw response;
245
- const written = response.data.written;
246
- notify({ message: i18next.t(written.noInsideHandler ? 'text.compliance-case-reported-outside' : 'text.compliance-case-reported') });
247
- this.dispatchEvent(new CustomEvent('reported', { detail: written }));
248
- }
249
- catch (error) {
250
- this.message = failureOf(error);
251
- }
252
- finally {
253
- this.working = false;
254
- }
230
+ const report = {
231
+ kind: this.kind,
232
+ accusedIds: this.accused.map(one => one.id),
233
+ victimId: this.victim?.id ?? null,
234
+ occurredOn: this.occurredOn || null,
235
+ description: this.description
236
+ };
237
+ const context = this.files.length ? uploadContext(() => { }) : undefined;
238
+ const done = this.handler
239
+ ? await this.saves.record.run({ case: { ...report, reporterId: this.reporter?.id ?? null, receivedOn: this.receivedOn }, attach: this.files }, { context })
240
+ : await this.saves.report.run({ report, attach: this.files }, { context });
241
+ if (!done)
242
+ return;
243
+ const written = done.written;
244
+ notify({ message: i18next.t(written.noInsideHandler ? 'text.compliance-case-reported-outside' : 'text.compliance-case-reported') });
245
+ this.dispatchEvent(new CustomEvent('reported', { detail: written }));
255
246
  }
256
247
  };
257
248
  __decorate([
@@ -293,19 +284,7 @@ __decorate([
293
284
  __decorate([
294
285
  state(),
295
286
  __metadata("design:type", Object)
296
- ], ComplianceCaseForm.prototype, "found", void 0);
297
- __decorate([
298
- state(),
299
- __metadata("design:type", Object)
300
- ], ComplianceCaseForm.prototype, "noneInside", void 0);
301
- __decorate([
302
- state(),
303
- __metadata("design:type", Object)
304
- ], ComplianceCaseForm.prototype, "working", void 0);
305
- __decorate([
306
- state(),
307
- __metadata("design:type", Object)
308
- ], ComplianceCaseForm.prototype, "message", void 0);
287
+ ], ComplianceCaseForm.prototype, "searched", void 0);
309
288
  ComplianceCaseForm = __decorate([
310
289
  customElement('compliance-case-form')
311
290
  ], ComplianceCaseForm);
@@ -1 +1 @@
1
- {"version":3,"file":"compliance-case-form.js","sourceRoot":"","sources":["../../client/components/compliance-case-form.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,2CAA2C,CAAA;AAClD,OAAO,oCAAoC,CAAA;AAE3C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA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ACjC,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACtB,CAAC;IACH,CAAC;;AAjK4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;mDAAgB;AAE3B;IAAhB,KAAK,EAAE;;gDAA4B;AACnB;IAAhB,KAAK,EAAE;;mDAA+B;AACtB;IAAhB,KAAK,EAAE;;kDAAqC;AAC5B;IAAhB,KAAK,EAAE;;oDAAuC;AAC9B;IAAhB,KAAK,EAAE;;sDAAwB;AACf;IAAhB,KAAK,EAAE;;sDAA6B;AACpB;IAAhB,KAAK,EAAE;;uDAAyB;AAChB;IAAhB,KAAK,EAAE;;iDAA2B;AAClB;IAAhB,KAAK,EAAE;;iDAA2E;AAClE;IAAhB,KAAK,EAAE;;sDAA2B;AAClB;IAAhB,KAAK,EAAE;;mDAAwB;AACf;IAAhB,KAAK,EAAE;;mDAAqB;AA5ElB,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAiO9B","sourcesContent":["import '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/icon/icon.js'\nimport '@operato/input/ox-input-file.js'\nimport '@operato/input/ox-input-select-buttons.js'\nimport '@operato/popup/ox-popup-actions.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client, uploadContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { CommonPopupStyles, FormFieldStyles, PopupBodyStyles, PopupFieldStyles } from '@operato/styles'\n\nimport { failureOf, wordOf } from '../words.js'\n\nexport const CASE_KINDS = ['HARASSMENT', 'SEXUAL_HARASSMENT']\n\ntype Person = { id: string; name: string; note?: string }\n\n/**\n * Opens the report form; resolves with the written case, or null when closed. `handler` is the case handler writing a\n * report received another way - who reported it and the day it came.\n */\nexport function openComplianceCaseForm(handler = false): Promise<any | null> {\n return new Promise(resolve => {\n let done: any = null\n const popup: any = openPopup(\n html`<compliance-case-form .handler=${handler} @close=${() => popup.close()} @reported=${(e: CustomEvent) => ((done = e.detail), popup.close())}></compliance-case-form>`,\n { backdrop: true, size: 'medium', title: i18next.t(handler ? 'title.compliance-case-record' : 'title.compliance-case-report') }\n )\n popup.onclosed = () => resolve(done)\n })\n}\n\nconst today = () => {\n const now = new Date()\n return new Date(now.getTime() - now.getTimezoneOffset() * 60000).toISOString().slice(0, 10)\n}\n\n/**\n * 신고하기 (ADR-0187 decision 21) - what happened, to whom, by whom and when, with files. When every case handler is\n * among those named, the form says nobody inside the company will investigate it and shows the labour ministry's way.\n */\n@customElement('compliance-case-form')\nexport class ComplianceCaseForm extends localize(i18next)(LitElement) {\n static styles = [\n CommonPopupStyles,\n PopupBodyStyles,\n FormFieldStyles,\n PopupFieldStyles,\n css`\n [invalid] {\n color: var(--ui-crit, var(--md-sys-color-error));\n font-size: var(--ui-t-small, 11.5px);\n }\n [invalid]:empty {\n display: none;\n }\n [guide] p {\n margin: 0;\n color: var(--ui-muted);\n line-height: var(--popup-line-height);\n }\n [outside] {\n padding: var(--spacing-medium, 8px);\n border: 1px solid var(--ui-crit, var(--md-sys-color-error));\n border-radius: var(--md-sys-shape-corner-small, 4px);\n line-height: var(--popup-line-height);\n }\n [outside] p {\n margin: 0;\n }\n ox-input-select-buttons {\n align-self: flex-start;\n }\n .chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-small, 4px);\n }\n .chips button,\n .found button {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 2px var(--spacing-medium, 8px);\n border: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n border-radius: 999px;\n background: none;\n color: inherit;\n font: inherit;\n cursor: pointer;\n }\n .chips md-icon {\n --md-icon-size: 14px;\n }\n .found {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-small, 4px);\n }\n textarea {\n min-height: 120px;\n }\n `\n ]\n\n @property({ type: Boolean }) handler = false\n\n @state() private kind = 'HARASSMENT'\n @state() private accused: Person[] = []\n @state() private victim: Person | null = null\n @state() private reporter: Person | null = null\n @state() private occurredOn = ''\n @state() private receivedOn = today()\n @state() private description = ''\n @state() private files: File[] = []\n @state() private found: { for: string; people: Person[] } = { for: '', people: [] }\n @state() private noneInside = false\n @state() private working = false\n @state() private message = ''\n\n render() {\n return html`\n <div class=\"body\">\n <div guide><p>${i18next.t('text.compliance-case-report-guide')}</p></div>\n\n <div class=\"field\">\n <ox-input-select-buttons\n .value=${this.kind}\n .options=${CASE_KINDS.map(code => ({ display: wordOf('compliance-case-kind', code), value: code }))}\n @change=${(e: CustomEvent) => e.detail && (this.kind = e.detail)}\n ></ox-input-select-buttons>\n </div>\n\n ${this.handler\n ? html`${this.picker('reporter', this.reporter ? [this.reporter] : [], one => (this.reporter = one), () => (this.reporter = null))}\n <label class=\"field\">\n <span>${i18next.t('field.compliance-case-received-on')}</span>\n <input type=\"date\" .value=${this.receivedOn} @input=${(e: any) => (this.receivedOn = e.target.value)} />\n </label>`\n : nothing}\n ${this.picker(\n 'accused',\n this.accused,\n one => this.setAccused([...this.accused.filter(other => other.id !== one.id), one]),\n one => this.setAccused(this.accused.filter(other => other.id !== one.id))\n )}\n ${this.noneInside\n ? html`<div outside>\n <p>${i18next.t('text.compliance-case-no-inside-handler')}</p>\n <p>${i18next.t('text.compliance-case-ministry-route')}</p>\n </div>`\n : nothing}\n ${this.picker('victim', this.victim ? [this.victim] : [], one => (this.victim = one), () => (this.victim = null))}\n\n <label class=\"field\">\n <span>${i18next.t('field.compliance-case-occurred-on')}</span>\n <input type=\"date\" .value=${this.occurredOn} @input=${(e: any) => (this.occurredOn = e.target.value)} />\n </label>\n\n <label class=\"field\">\n <span>${i18next.t('field.compliance-case-description')}</span>\n <textarea .value=${this.description} @input=${(e: any) => (this.description = e.target.value)}></textarea>\n </label>\n\n <div class=\"field\">\n <span>${i18next.t('field.compliance-case-attachments')}</span>\n <ox-input-file multiple icon=\"attach_file\" @change=${(e: CustomEvent) => (this.files = [...((e.detail as File[]) ?? [])])}></ox-input-file>\n <span invalid>${this.message}</span>\n </div>\n </div>\n\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.dispatchEvent(new CustomEvent('close'))}>${i18next.t('button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${this.working} @click=${() => this.submit()}>${i18next.t(this.handler ? 'button.compliance-case-record' : 'button.compliance-case-report')}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n /** People named so far, and a name box that finds employees still working here. */\n private picker(field: string, chosen: Person[], add: (one: Person) => void, remove: (one: Person) => void) {\n const found = this.found.for === field ? this.found.people.filter(one => !chosen.some(other => other.id === one.id)) : []\n return html`<label class=\"field\">\n <span>${i18next.t(`field.compliance-case-${field}`)}</span>\n ${chosen.length\n ? html`<div class=\"chips\">\n ${chosen.map(one => html`<button type=\"button\" aria-label=${i18next.t('button.compliance-case-remove')} @click=${() => remove(one)}>${one.name}<md-icon>close</md-icon></button>`)}\n </div>`\n : nothing}\n <input placeholder=${i18next.t('text.compliance-case-find-person')} @input=${(e: any) => this.find(field, e.target.value)} />\n ${found.length\n ? html`<div class=\"found\">\n ${found.map(one => html`<button type=\"button\" @click=${() => ((this.found = { for: '', people: [] }), add(one))}>${one.note ? `${one.name} · ${one.note}` : one.name}</button>`)}\n </div>`\n : nothing}\n </label>`\n }\n\n private async find(field: string, text: string) {\n const response = await client.query({\n query: gql`\n query ($text: String!) {\n complianceCasePeople(text: $text) { id name note }\n }\n `,\n variables: { text },\n fetchPolicy: 'no-cache'\n })\n this.found = { for: field, people: response.data?.complianceCasePeople ?? [] }\n }\n\n /** The people named against, and whether a case handler is left to take it. */\n private async setAccused(people: Person[]) {\n this.accused = people\n if (!people.length) return (this.noneInside = false)\n const response = await client.query({\n query: gql`\n query ($ids: [String!]!) {\n complianceCaseHandlerLeft(accusedIds: $ids)\n }\n `,\n variables: { ids: people.map(one => one.id) },\n fetchPolicy: 'no-cache'\n })\n this.noneInside = response.data?.complianceCaseHandlerLeft === false\n }\n\n private async submit() {\n this.message = ''\n this.working = true\n try {\n const report = {\n kind: this.kind,\n accusedIds: this.accused.map(one => one.id),\n victimId: this.victim?.id ?? null,\n occurredOn: this.occurredOn || null,\n description: this.description\n }\n const upload = this.files.length ? { context: uploadContext(() => {}) } : {}\n const response: any = this.handler\n ? await client.mutate({\n mutation: gql`\n mutation ($case: NewComplianceCase!, $attach: [Upload!]) {\n written: recordComplianceCase(case: $case, attach: $attach) { id noInsideHandler }\n }\n `,\n variables: { case: { ...report, reporterId: this.reporter?.id ?? null, receivedOn: this.receivedOn }, attach: this.files },\n ...upload\n })\n : await client.mutate({\n mutation: gql`\n mutation ($report: NewComplianceCaseReport!, $attach: [Upload!]) {\n written: reportComplianceCase(report: $report, attach: $attach) { id noInsideHandler }\n }\n `,\n variables: { report, attach: this.files },\n ...upload\n })\n if (response.errors?.length) throw response\n const written = response.data.written\n notify({ message: i18next.t(written.noInsideHandler ? 'text.compliance-case-reported-outside' : 'text.compliance-case-reported') })\n this.dispatchEvent(new CustomEvent('reported', { detail: written }))\n } catch (error) {\n this.message = failureOf(error)\n } finally {\n this.working = false\n }\n }\n}\n"]}
1
+ {"version":3,"file":"compliance-case-form.js","sourceRoot":"","sources":["../../client/components/compliance-case-form.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,2CAA2C,CAAA;AAClD,OAAO,oCAAoC,CAAA;AAE3C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;A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AE;;oDAAwE;AA1ErE,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAkP9B","sourcesContent":["import '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/icon/icon.js'\nimport '@operato/input/ox-input-file.js'\nimport '@operato/input/ox-input-select-buttons.js'\nimport '@operato/popup/ox-popup-actions.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { MutationController, QueryController, uploadContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { CommonPopupStyles, FormFieldStyles, PopupBodyStyles, PopupFieldStyles } from '@operato/styles'\n\nimport { failureOf, wordOf } from '../words.js'\n\nexport const CASE_KINDS = ['HARASSMENT', 'SEXUAL_HARASSMENT']\n\ntype Person = { id: string; name: string; note?: string }\n\n/**\n * Opens the report form; resolves with the written case, or null when closed. `handler` is the case handler writing a\n * report received another way - who reported it and the day it came.\n */\nexport function openComplianceCaseForm(handler = false): Promise<any | null> {\n return new Promise(resolve => {\n let done: any = null\n const popup: any = openPopup(\n html`<compliance-case-form .handler=${handler} @close=${() => popup.close()} @reported=${(e: CustomEvent) => ((done = e.detail), popup.close())}></compliance-case-form>`,\n { backdrop: true, size: 'medium', title: i18next.t(handler ? 'title.compliance-case-record' : 'title.compliance-case-report') }\n )\n popup.onclosed = () => resolve(done)\n })\n}\n\nconst today = () => {\n const now = new Date()\n return new Date(now.getTime() - now.getTimezoneOffset() * 60000).toISOString().slice(0, 10)\n}\n\n/**\n * 신고하기 (ADR-0187 decision 21) - what happened, to whom, by whom and when, with files. When every case handler is\n * among those named, the form says the investigation starts once the company names a case handler (amendment 5).\n */\n@customElement('compliance-case-form')\nexport class ComplianceCaseForm extends localize(i18next)(LitElement) {\n static styles = [\n CommonPopupStyles,\n PopupBodyStyles,\n FormFieldStyles,\n PopupFieldStyles,\n css`\n [invalid] {\n color: var(--ui-crit, var(--md-sys-color-error));\n font-size: var(--ui-t-small, 11.5px);\n }\n [invalid]:empty {\n display: none;\n }\n [guide] p {\n margin: 0;\n color: var(--ui-muted);\n line-height: var(--popup-line-height);\n }\n [outside] {\n padding: var(--spacing-medium, 8px);\n border: 1px solid var(--ui-crit, var(--md-sys-color-error));\n border-radius: var(--md-sys-shape-corner-small, 4px);\n line-height: var(--popup-line-height);\n }\n [outside] p {\n margin: 0;\n }\n ox-input-select-buttons {\n align-self: flex-start;\n }\n .chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-small, 4px);\n }\n .chips button,\n .found button {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 2px var(--spacing-medium, 8px);\n border: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n border-radius: 999px;\n background: none;\n color: inherit;\n font: inherit;\n cursor: pointer;\n }\n .chips md-icon {\n --md-icon-size: 14px;\n }\n .found {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-small, 4px);\n }\n textarea {\n min-height: 120px;\n }\n `\n ]\n\n @property({ type: Boolean }) handler = false\n\n @state() private kind = 'HARASSMENT'\n @state() private accused: Person[] = []\n @state() private victim: Person | null = null\n @state() private reporter: Person | null = null\n @state() private occurredOn = ''\n @state() private receivedOn = today()\n @state() private description = ''\n @state() private files: File[] = []\n /* The words typed to find a person, and the field they are typed in. */\n @state() private searched: { for: string; text: string } = { for: '', text: '' }\n\n /* The people the words find, and whether a case handler is left to take it once the accused are named (ADR-0190). */\n private people = new QueryController(\n this,\n gql`\n query ($text: String!) {\n complianceCasePeople(text: $text) { id name note }\n }\n `,\n { variables: () => (this.searched.text.trim() ? { text: this.searched.text } : undefined), keepPrevious: true }\n )\n\n private handlerLeft = new QueryController(\n this,\n gql`\n query ($ids: [String!]!) {\n complianceCaseHandlerLeft(accusedIds: $ids)\n }\n `,\n { variables: () => (this.accused.length ? { ids: this.accused.map(one => one.id) } : undefined) }\n )\n\n /* Its failure is drawn at the foot of the form. */\n private saves = {\n record: new MutationController(\n this,\n gql`\n mutation ($case: NewComplianceCase!, $attach: [Upload!]) {\n written: recordComplianceCase(case: $case, attach: $attach) { id noInsideHandler }\n }\n `,\n { showsError: true }\n ),\n report: new MutationController(\n this,\n gql`\n mutation ($report: NewComplianceCaseReport!, $attach: [Upload!]) {\n written: reportComplianceCase(report: $report, attach: $attach) { id noInsideHandler }\n }\n `,\n { showsError: true }\n )\n }\n\n private get found(): { for: string; people: Person[] } {\n if (!this.searched.text.trim()) return { for: '', people: [] }\n return { for: this.searched.for, people: this.people.data?.complianceCasePeople ?? [] }\n }\n\n private get noneInside() {\n return this.accused.length > 0 && this.handlerLeft.data?.complianceCaseHandlerLeft === false\n }\n\n private get save() {\n return this.handler ? this.saves.record : this.saves.report\n }\n\n private get working() {\n return this.save.pending\n }\n\n private get message() {\n return this.save.error ? failureOf(this.save.error) : ''\n }\n\n render() {\n return html`\n <div class=\"body\">\n <div guide><p>${i18next.t('text.compliance-case-report-guide')}</p></div>\n\n <div class=\"field\">\n <ox-input-select-buttons\n .value=${this.kind}\n .options=${CASE_KINDS.map(code => ({ display: wordOf('compliance-case-kind', code), value: code }))}\n @change=${(e: CustomEvent) => e.detail && (this.kind = e.detail)}\n ></ox-input-select-buttons>\n </div>\n\n ${this.handler\n ? html`${this.picker('reporter', this.reporter ? [this.reporter] : [], one => (this.reporter = one), () => (this.reporter = null))}\n <label class=\"field\">\n <span>${i18next.t('field.compliance-case-received-on')}</span>\n <input type=\"date\" .value=${this.receivedOn} @input=${(e: any) => (this.receivedOn = e.target.value)} />\n </label>`\n : nothing}\n ${this.picker(\n 'accused',\n this.accused,\n one => this.setAccused([...this.accused.filter(other => other.id !== one.id), one]),\n one => this.setAccused(this.accused.filter(other => other.id !== one.id))\n )}\n ${this.noneInside\n ? html`<div outside>\n <p>${i18next.t('text.compliance-case-no-inside-handler')}</p>\n </div>`\n : nothing}\n ${this.picker('victim', this.victim ? [this.victim] : [], one => (this.victim = one), () => (this.victim = null))}\n\n <label class=\"field\">\n <span>${i18next.t('field.compliance-case-occurred-on')}</span>\n <input type=\"date\" .value=${this.occurredOn} @input=${(e: any) => (this.occurredOn = e.target.value)} />\n </label>\n\n <label class=\"field\">\n <span>${i18next.t('field.compliance-case-description')}</span>\n <textarea .value=${this.description} @input=${(e: any) => (this.description = e.target.value)}></textarea>\n </label>\n\n <div class=\"field\">\n <span>${i18next.t('field.compliance-case-attachments')}</span>\n <ox-input-file multiple icon=\"attach_file\" @change=${(e: CustomEvent) => (this.files = [...((e.detail as File[]) ?? [])])}></ox-input-file>\n <span invalid>${this.message}</span>\n </div>\n </div>\n\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.dispatchEvent(new CustomEvent('close'))}>${i18next.t('button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${this.working} @click=${() => this.submit()}>${i18next.t(this.handler ? 'button.compliance-case-record' : 'button.compliance-case-report')}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n /** People named so far, and a name box that finds employees still working here. */\n private picker(field: string, chosen: Person[], add: (one: Person) => void, remove: (one: Person) => void) {\n const found = this.found.for === field ? this.found.people.filter(one => !chosen.some(other => other.id === one.id)) : []\n return html`<label class=\"field\">\n <span>${i18next.t(`field.compliance-case-${field}`)}</span>\n ${chosen.length\n ? html`<div class=\"chips\">\n ${chosen.map(one => html`<button type=\"button\" aria-label=${i18next.t('button.compliance-case-remove')} @click=${() => remove(one)}>${one.name}<md-icon>close</md-icon></button>`)}\n </div>`\n : nothing}\n <input placeholder=${i18next.t('text.compliance-case-find-person')} @input=${(e: any) => this.find(field, e.target.value)} />\n ${found.length\n ? html`<div class=\"found\">\n ${found.map(one => html`<button type=\"button\" @click=${() => ((this.searched = { for: '', text: '' }), add(one))}>${one.note ? `${one.name} · ${one.note}` : one.name}</button>`)}\n </div>`\n : nothing}\n </label>`\n }\n\n private find(field: string, text: string) {\n this.searched = { for: field, text }\n }\n\n /** The people named against - whether a case handler is left is read for them. */\n private setAccused(people: Person[]) {\n this.accused = people\n }\n\n private async submit() {\n const report = {\n kind: this.kind,\n accusedIds: this.accused.map(one => one.id),\n victimId: this.victim?.id ?? null,\n occurredOn: this.occurredOn || null,\n description: this.description\n }\n const context = this.files.length ? uploadContext(() => {}) : undefined\n const done = this.handler\n ? await this.saves.record.run({ case: { ...report, reporterId: this.reporter?.id ?? null, receivedOn: this.receivedOn }, attach: this.files }, { context })\n : await this.saves.report.run({ report, attach: this.files }, { context })\n if (!done) return\n const written = done.written\n notify({ message: i18next.t(written.noInsideHandler ? 'text.compliance-case-reported-outside' : 'text.compliance-case-reported') })\n this.dispatchEvent(new CustomEvent('reported', { detail: written }))\n }\n}\n"]}
@@ -15,21 +15,23 @@ declare const ComplianceCaseSheet_base: (new (...args: any[]) => LitElement) & t
15
15
  export declare class ComplianceCaseSheet extends ComplianceCaseSheet_base {
16
16
  static styles: import("lit").CSSResult[];
17
17
  caseId: string;
18
- private one;
19
- private form;
20
- private investigators;
21
- private found;
22
- private entryOn;
23
- private entryBody;
24
- private entryFiles;
25
- private working;
26
- private message;
27
- connectedCallback(): void;
18
+ private searched;
19
+ private record;
20
+ private handling;
21
+ private entry;
22
+ private saves;
23
+ private saving;
24
+ private get one();
25
+ private get investigators();
26
+ private get working();
27
+ /** What went wrong last: the read, or a save. */
28
+ private get message();
29
+ private choices;
30
+ private get found();
28
31
  render(): import("lit-html").TemplateResult<1>;
29
- private read;
30
32
  private find;
33
+ /** Only what was changed goes, as a correction of what was read. */
31
34
  private save;
32
35
  private addEntry;
33
- private call;
34
36
  }
35
37
  export {};