@things-factory/compliance 10.1.256 → 10.1.258

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 +20 -20
  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
@@ -7,7 +7,7 @@ import '@operato/popup/ox-popup-actions.js';
7
7
  import gql from 'graphql-tag';
8
8
  import { css, html, LitElement, nothing } from 'lit';
9
9
  import { customElement, state } from 'lit/decorators.js';
10
- import { client } from '@operato/graphql';
10
+ import { MutationController, QueryController } from '@operato/graphql';
11
11
  import { i18next, localize } from '@operato/i18n';
12
12
  import { notify, openPopup } from '@operato/layout';
13
13
  import { CommonPopupStyles, FormFieldStyles, PopupBodyStyles, PopupFieldStyles } from '@operato/styles';
@@ -27,8 +27,12 @@ let CompliancePrivacyRequestForm = class CompliancePrivacyRequestForm extends lo
27
27
  super(...arguments);
28
28
  this.kind = 'ACCESS';
29
29
  this.details = '';
30
- this.working = false;
31
- this.message = '';
30
+ /* Its failure is drawn under the words, beside the form. */
31
+ this.raising = new MutationController(this, gql `
32
+ mutation ($request: NewMyPrivacyRequest!) {
33
+ raiseMyPrivacyRequest(request: $request) { id dueOn }
34
+ }
35
+ `, { showsError: true });
32
36
  }
33
37
  static { this.styles = [
34
38
  CommonPopupStyles,
@@ -56,6 +60,12 @@ let CompliancePrivacyRequestForm = class CompliancePrivacyRequestForm extends lo
56
60
  }
57
61
  `
58
62
  ]; }
63
+ get working() {
64
+ return this.raising.pending;
65
+ }
66
+ get message() {
67
+ return this.raising.error ? failureOf(this.raising.error) : '';
68
+ }
59
69
  render() {
60
70
  return html `
61
71
  <div class="body">
@@ -81,28 +91,11 @@ let CompliancePrivacyRequestForm = class CompliancePrivacyRequestForm extends lo
81
91
  `;
82
92
  }
83
93
  async raise() {
84
- this.message = '';
85
- this.working = true;
86
- try {
87
- const response = await client.mutate({
88
- mutation: gql `
89
- mutation ($request: NewMyPrivacyRequest!) {
90
- raiseMyPrivacyRequest(request: $request) { id dueOn }
91
- }
92
- `,
93
- variables: { request: { kind: this.kind, details: this.details } }
94
- });
95
- if (response.errors?.length)
96
- throw response;
97
- notify({ message: i18next.t('text.privacy-request-raised', { dueOn: response.data.raiseMyPrivacyRequest.dueOn }) });
98
- this.dispatchEvent(new CustomEvent('raised', { detail: response.data.raiseMyPrivacyRequest }));
99
- }
100
- catch (error) {
101
- this.message = failureOf(error);
102
- }
103
- finally {
104
- this.working = false;
105
- }
94
+ const done = await this.raising.run({ request: { kind: this.kind, details: this.details } });
95
+ if (!done)
96
+ return;
97
+ notify({ message: i18next.t('text.privacy-request-raised', { dueOn: done.raiseMyPrivacyRequest.dueOn }) });
98
+ this.dispatchEvent(new CustomEvent('raised', { detail: done.raiseMyPrivacyRequest }));
106
99
  }
107
100
  };
108
101
  __decorate([
@@ -113,14 +106,6 @@ __decorate([
113
106
  state(),
114
107
  __metadata("design:type", Object)
115
108
  ], CompliancePrivacyRequestForm.prototype, "details", void 0);
116
- __decorate([
117
- state(),
118
- __metadata("design:type", Object)
119
- ], CompliancePrivacyRequestForm.prototype, "working", void 0);
120
- __decorate([
121
- state(),
122
- __metadata("design:type", Object)
123
- ], CompliancePrivacyRequestForm.prototype, "message", void 0);
124
109
  CompliancePrivacyRequestForm = __decorate([
125
110
  customElement('compliance-privacy-request-form')
126
111
  ], CompliancePrivacyRequestForm);
@@ -132,8 +117,12 @@ export { CompliancePrivacyRequestForm };
132
117
  let ComplianceMyPrivacyRequests = class ComplianceMyPrivacyRequests extends localize(i18next)(LitElement) {
133
118
  constructor() {
134
119
  super(...arguments);
135
- this.requests = [];
136
- this.message = '';
120
+ /* The requests the person raised (ADR-0190). */
121
+ this.mine = new QueryController(this, gql `
122
+ query {
123
+ myPrivacyRequests { id kind details receivedOn dueOn extendedDueOn extensionReason handling repliedOn }
124
+ }
125
+ `);
137
126
  }
138
127
  static { this.styles = css `
139
128
  :host {
@@ -167,9 +156,11 @@ let ComplianceMyPrivacyRequests = class ComplianceMyPrivacyRequests extends loca
167
156
  white-space: pre-wrap;
168
157
  }
169
158
  `; }
170
- connectedCallback() {
171
- super.connectedCallback();
172
- this.read();
159
+ get requests() {
160
+ return this.mine.data?.myPrivacyRequests ?? [];
161
+ }
162
+ get message() {
163
+ return this.mine.error ? failureOf(this.mine.error) : '';
173
164
  }
174
165
  render() {
175
166
  return html `
@@ -193,38 +184,11 @@ let ComplianceMyPrivacyRequests = class ComplianceMyPrivacyRequests extends loca
193
184
  : html `<span class="muted">${i18next.t('text.privacy-request-my-empty')}</span>`}
194
185
  `;
195
186
  }
196
- async read() {
197
- try {
198
- const response = await client.query({
199
- query: gql `
200
- query {
201
- myPrivacyRequests { id kind details receivedOn dueOn extendedDueOn extensionReason handling repliedOn }
202
- }
203
- `,
204
- fetchPolicy: 'network-only'
205
- });
206
- if (response.errors?.length)
207
- throw response;
208
- this.requests = response.data.myPrivacyRequests ?? [];
209
- this.message = '';
210
- }
211
- catch (error) {
212
- this.message = failureOf(error);
213
- }
214
- }
215
187
  async raise() {
216
188
  if (await openPrivacyRequestForm())
217
- this.read();
189
+ this.mine.refetch();
218
190
  }
219
191
  };
220
- __decorate([
221
- state(),
222
- __metadata("design:type", Array)
223
- ], ComplianceMyPrivacyRequests.prototype, "requests", void 0);
224
- __decorate([
225
- state(),
226
- __metadata("design:type", Object)
227
- ], ComplianceMyPrivacyRequests.prototype, "message", void 0);
228
192
  ComplianceMyPrivacyRequests = __decorate([
229
193
  customElement('compliance-my-privacy-requests')
230
194
  ], ComplianceMyPrivacyRequests);
@@ -1 +1 @@
1
- {"version":3,"file":"compliance-my-privacy-requests.js","sourceRoot":"","sources":["../../client/components/compliance-my-privacy-requests.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,6CAA6C,CAAA;AACpD,OAAO,qCAAqC,CAAA;AAC5C,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,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAi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AC,KAAK,CAAC;gBAClC,KAAK,EAAE,GAAG,CAAA;;;;SAIT;gBACD,WAAW,EAAE,cAAc;aAC5B,CAAC,CAAA;YACF,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM;gBAAE,MAAM,QAAQ,CAAA;YAC3C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,IAAI,EAAE,CAAA;YACrD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,KAAK;QACjB,IAAI,MAAM,sBAAsB,EAAE;YAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACjD,CAAC;;AArDgB;IAAhB,KAAK,EAAE;;6DAA6B;AACpB;IAAhB,KAAK,EAAE;;4DAAqB;AAnClB,2BAA2B;IADvC,aAAa,CAAC,gCAAgC,CAAC;GACnC,2BAA2B,CAwFvC","sourcesContent":["import '@material/web/button/filled-button.js'\nimport '@material/web/button/filled-tonal-button.js'\nimport '@material/web/button/text-button.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, state } from 'lit/decorators.js'\n\nimport { client } 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\nconst REQUEST_KINDS = ['ACCESS', 'CORRECTION', 'DELETION', 'SUSPENSION']\n\n/** Opens the request form; resolves with the request raised, or null when closed. */\nexport function openPrivacyRequestForm(): Promise<any | null> {\n return new Promise(resolve => {\n let done: any = null\n const popup: any = openPopup(\n html`<compliance-privacy-request-form @close=${() => popup.close()} @raised=${(e: CustomEvent) => ((done = e.detail), popup.close())}></compliance-privacy-request-form>`,\n { backdrop: true, size: 'medium', title: i18next.t('title.privacy-request-raise') }\n )\n popup.onclosed = () => resolve(done)\n })\n}\n\n/** 내 개인정보 요구 쓰기 - what is asked of one's own personal information. */\n@customElement('compliance-privacy-request-form')\nexport class CompliancePrivacyRequestForm 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 ox-input-select-buttons {\n align-self: flex-start;\n }\n textarea {\n min-height: 96px;\n }\n `\n ]\n\n @state() private kind = 'ACCESS'\n @state() private details = ''\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.privacy-request-guide')}</p></div>\n <div class=\"field\">\n <ox-input-select-buttons\n .value=${this.kind}\n .options=${REQUEST_KINDS.map(code => ({ display: wordOf('privacy-request-kind', code), value: code }))}\n @change=${(e: CustomEvent) => e.detail && (this.kind = e.detail)}\n ></ox-input-select-buttons>\n </div>\n <label class=\"field\">\n <span>${i18next.t('field.privacy-request-details')}</span>\n <textarea .value=${this.details} @input=${(e: any) => (this.details = e.target.value)}></textarea>\n <span invalid>${this.message}</span>\n </label>\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.raise()}>${i18next.t('button.privacy-request-raise')}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n private async raise() {\n this.message = ''\n this.working = true\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($request: NewMyPrivacyRequest!) {\n raiseMyPrivacyRequest(request: $request) { id dueOn }\n }\n `,\n variables: { request: { kind: this.kind, details: this.details } }\n })\n if (response.errors?.length) throw response\n notify({ message: i18next.t('text.privacy-request-raised', { dueOn: response.data.raiseMyPrivacyRequest.dueOn }) })\n this.dispatchEvent(new CustomEvent('raised', { detail: response.data.raiseMyPrivacyRequest }))\n } catch (error) {\n this.message = failureOf(error)\n } finally {\n this.working = false\n }\n }\n}\n\n/**\n * 내 개인정보 요구 (ADR-0187 decisions 10, 22) - inside 「회사 규정과 안내」: ask to see, correct, delete or stop the\n * processing of one's own personal information, and see each one's due day and answer.\n */\n@customElement('compliance-my-privacy-requests')\nexport class ComplianceMyPrivacyRequests extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-medium, 8px);\n color: var(--ui-ink);\n font-size: var(--ui-t-body, 13px);\n line-height: 1.6;\n }\n .head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--spacing-medium, 8px);\n }\n .muted {\n color: var(--ui-muted);\n }\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n li {\n padding: var(--spacing-medium, 8px) 0;\n border-top: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n }\n p {\n margin: var(--spacing-small, 4px) 0 0;\n white-space: pre-wrap;\n }\n `\n\n @state() private requests: any[] = []\n @state() private message = ''\n\n connectedCallback() {\n super.connectedCallback()\n this.read()\n }\n\n render() {\n return html`\n <div class=\"head\">\n <span class=\"muted\">${i18next.t('text.privacy-request-my-guide')}</span>\n <md-filled-tonal-button @click=${() => this.raise()}>${i18next.t('button.privacy-request-raise')}</md-filled-tonal-button>\n </div>\n ${this.message ? html`<span class=\"muted\">${this.message}</span>` : nothing}\n ${this.requests.length\n ? html`<ul>\n ${this.requests.map(\n one => html`<li>\n <strong>${wordOf('privacy-request-kind', one.kind)}</strong> · ${one.receivedOn} ·\n ${one.repliedOn\n ? i18next.t('text.privacy-request-replied', { day: one.repliedOn })\n : i18next.t('text.privacy-request-due', { day: one.extendedDueOn || one.dueOn })}\n <p>${one.details}</p>\n ${one.extensionReason ? html`<p class=\"muted\">${i18next.t('field.privacy-request-extension-reason')}: ${one.extensionReason}</p>` : nothing}\n ${one.repliedOn && one.handling ? html`<p>${one.handling}</p>` : nothing}\n </li>`\n )}\n </ul>`\n : html`<span class=\"muted\">${i18next.t('text.privacy-request-my-empty')}</span>`}\n `\n }\n\n private async read() {\n try {\n const response = await client.query({\n query: gql`\n query {\n myPrivacyRequests { id kind details receivedOn dueOn extendedDueOn extensionReason handling repliedOn }\n }\n `,\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n this.requests = response.data.myPrivacyRequests ?? []\n this.message = ''\n } catch (error) {\n this.message = failureOf(error)\n }\n }\n\n private async raise() {\n if (await openPrivacyRequestForm()) this.read()\n }\n}\n"]}
1
+ {"version":3,"file":"compliance-my-privacy-requests.js","sourceRoot":"","sources":["../../client/components/compliance-my-privacy-requests.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,6CAA6C,CAAA;AACpD,OAAO,qCAAqC,CAAA;AAC5C,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,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,E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AO,EAAE,CAAA;IACzD,CAAC;;AA/EU,2BAA2B;IADvC,aAAa,CAAC,gCAAgC,CAAC;GACnC,2BAA2B,CAgFvC","sourcesContent":["import '@material/web/button/filled-button.js'\nimport '@material/web/button/filled-tonal-button.js'\nimport '@material/web/button/text-button.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, state } from 'lit/decorators.js'\n\nimport { MutationController, QueryController } 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\nconst REQUEST_KINDS = ['ACCESS', 'CORRECTION', 'DELETION', 'SUSPENSION']\n\n/** Opens the request form; resolves with the request raised, or null when closed. */\nexport function openPrivacyRequestForm(): Promise<any | null> {\n return new Promise(resolve => {\n let done: any = null\n const popup: any = openPopup(\n html`<compliance-privacy-request-form @close=${() => popup.close()} @raised=${(e: CustomEvent) => ((done = e.detail), popup.close())}></compliance-privacy-request-form>`,\n { backdrop: true, size: 'medium', title: i18next.t('title.privacy-request-raise') }\n )\n popup.onclosed = () => resolve(done)\n })\n}\n\n/** 내 개인정보 요구 쓰기 - what is asked of one's own personal information. */\n@customElement('compliance-privacy-request-form')\nexport class CompliancePrivacyRequestForm 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 ox-input-select-buttons {\n align-self: flex-start;\n }\n textarea {\n min-height: 96px;\n }\n `\n ]\n\n @state() private kind = 'ACCESS'\n @state() private details = ''\n\n /* Its failure is drawn under the words, beside the form. */\n private raising = new MutationController(\n this,\n gql`\n mutation ($request: NewMyPrivacyRequest!) {\n raiseMyPrivacyRequest(request: $request) { id dueOn }\n }\n `,\n { showsError: true }\n )\n\n private get working() {\n return this.raising.pending\n }\n\n private get message() {\n return this.raising.error ? failureOf(this.raising.error) : ''\n }\n\n render() {\n return html`\n <div class=\"body\">\n <div guide><p>${i18next.t('text.privacy-request-guide')}</p></div>\n <div class=\"field\">\n <ox-input-select-buttons\n .value=${this.kind}\n .options=${REQUEST_KINDS.map(code => ({ display: wordOf('privacy-request-kind', code), value: code }))}\n @change=${(e: CustomEvent) => e.detail && (this.kind = e.detail)}\n ></ox-input-select-buttons>\n </div>\n <label class=\"field\">\n <span>${i18next.t('field.privacy-request-details')}</span>\n <textarea .value=${this.details} @input=${(e: any) => (this.details = e.target.value)}></textarea>\n <span invalid>${this.message}</span>\n </label>\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.raise()}>${i18next.t('button.privacy-request-raise')}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n private async raise() {\n const done = await this.raising.run({ request: { kind: this.kind, details: this.details } })\n if (!done) return\n notify({ message: i18next.t('text.privacy-request-raised', { dueOn: done.raiseMyPrivacyRequest.dueOn }) })\n this.dispatchEvent(new CustomEvent('raised', { detail: done.raiseMyPrivacyRequest }))\n }\n}\n\n/**\n * 내 개인정보 요구 (ADR-0187 decisions 10, 22) - inside 「회사 규정과 안내」: ask to see, correct, delete or stop the\n * processing of one's own personal information, and see each one's due day and answer.\n */\n@customElement('compliance-my-privacy-requests')\nexport class ComplianceMyPrivacyRequests extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-medium, 8px);\n color: var(--ui-ink);\n font-size: var(--ui-t-body, 13px);\n line-height: 1.6;\n }\n .head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--spacing-medium, 8px);\n }\n .muted {\n color: var(--ui-muted);\n }\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n li {\n padding: var(--spacing-medium, 8px) 0;\n border-top: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n }\n p {\n margin: var(--spacing-small, 4px) 0 0;\n white-space: pre-wrap;\n }\n `\n\n /* The requests the person raised (ADR-0190). */\n private mine = new QueryController(\n this,\n gql`\n query {\n myPrivacyRequests { id kind details receivedOn dueOn extendedDueOn extensionReason handling repliedOn }\n }\n `\n )\n\n private get requests(): any[] {\n return this.mine.data?.myPrivacyRequests ?? []\n }\n\n private get message() {\n return this.mine.error ? failureOf(this.mine.error) : ''\n }\n\n render() {\n return html`\n <div class=\"head\">\n <span class=\"muted\">${i18next.t('text.privacy-request-my-guide')}</span>\n <md-filled-tonal-button @click=${() => this.raise()}>${i18next.t('button.privacy-request-raise')}</md-filled-tonal-button>\n </div>\n ${this.message ? html`<span class=\"muted\">${this.message}</span>` : nothing}\n ${this.requests.length\n ? html`<ul>\n ${this.requests.map(\n one => html`<li>\n <strong>${wordOf('privacy-request-kind', one.kind)}</strong> · ${one.receivedOn} ·\n ${one.repliedOn\n ? i18next.t('text.privacy-request-replied', { day: one.repliedOn })\n : i18next.t('text.privacy-request-due', { day: one.extendedDueOn || one.dueOn })}\n <p>${one.details}</p>\n ${one.extensionReason ? html`<p class=\"muted\">${i18next.t('field.privacy-request-extension-reason')}: ${one.extensionReason}</p>` : nothing}\n ${one.repliedOn && one.handling ? html`<p>${one.handling}</p>` : nothing}\n </li>`\n )}\n </ul>`\n : html`<span class=\"muted\">${i18next.t('text.privacy-request-my-empty')}</span>`}\n `\n }\n\n private async raise() {\n if (await openPrivacyRequestForm()) this.mine.refetch()\n }\n}\n"]}
@@ -8,12 +8,11 @@ declare const ComplianceMyReports_base: (new (...args: any[]) => LitElement) & t
8
8
  */
9
9
  export declare class ComplianceMyReports extends ComplianceMyReports_base {
10
10
  static styles: import("lit").CSSResult;
11
- private reports;
12
- private message;
13
- connectedCallback(): void;
11
+ private mine;
12
+ private get reports();
13
+ private get message();
14
14
  render(): import("lit-html").TemplateResult<1>;
15
15
  private item;
16
- private read;
17
16
  private report;
18
17
  }
19
18
  export {};
@@ -1,9 +1,9 @@
1
- import { __decorate, __metadata } from "tslib";
1
+ import { __decorate } from "tslib";
2
2
  import '@material/web/button/filled-tonal-button.js';
3
3
  import gql from 'graphql-tag';
4
4
  import { css, html, LitElement, nothing } from 'lit';
5
- import { customElement, state } from 'lit/decorators.js';
6
- import { client } from '@operato/graphql';
5
+ import { customElement } from 'lit/decorators.js';
6
+ import { QueryController } from '@operato/graphql';
7
7
  import { i18next, localize } from '@operato/i18n';
8
8
  import { failureOf, wordOf } from '../words.js';
9
9
  import { openComplianceCaseForm } from './compliance-case-form.js';
@@ -15,8 +15,15 @@ import { openComplianceCaseForm } from './compliance-case-form.js';
15
15
  let ComplianceMyReports = class ComplianceMyReports extends localize(i18next)(LitElement) {
16
16
  constructor() {
17
17
  super(...arguments);
18
- this.reports = [];
19
- this.message = '';
18
+ /* What the person reported or what happened to them (ADR-0190). */
19
+ this.mine = new QueryController(this, gql `
20
+ query {
21
+ myComplianceReports {
22
+ id kind status standing receivedOn noInsideHandler occurredOn description accusedNames victimName
23
+ protectionMeasures victimOpinion resultNotice resultToldOn closedOn
24
+ }
25
+ }
26
+ `);
20
27
  }
21
28
  static { this.styles = css `
22
29
  :host {
@@ -63,9 +70,11 @@ let ComplianceMyReports = class ComplianceMyReports extends localize(i18next)(Li
63
70
  color: var(--ui-crit, var(--md-sys-color-error));
64
71
  }
65
72
  `; }
66
- connectedCallback() {
67
- super.connectedCallback();
68
- this.read();
73
+ get reports() {
74
+ return this.mine.data?.myComplianceReports ?? [];
75
+ }
76
+ get message() {
77
+ return this.mine.error ? failureOf(this.mine.error) : '';
69
78
  }
70
79
  render() {
71
80
  return html `
@@ -87,7 +96,7 @@ let ComplianceMyReports = class ComplianceMyReports extends localize(i18next)(Li
87
96
  <strong>${wordOf('compliance-case-kind', one.kind)}</strong> · ${one.receivedOn} · ${wordOf('compliance-case-status', one.status)}
88
97
  ${one.standing === 'VICTIM' ? html ` · <span class="muted">${i18next.t('text.compliance-case-standing-victim')}</span>` : nothing}
89
98
  ${one.noInsideHandler
90
- ? html `<p outside>${i18next.t('text.compliance-case-no-inside-handler')} ${i18next.t('text.compliance-case-ministry-route')}</p>`
99
+ ? html `<p outside>${i18next.t('text.compliance-case-no-inside-handler')}</p>`
91
100
  : nothing}
92
101
  <dl>
93
102
  ${row('accused', one.accusedNames?.join(', '))} ${row('description', one.description)} ${row('protection-measures', one.protectionMeasures)}
@@ -95,41 +104,11 @@ let ComplianceMyReports = class ComplianceMyReports extends localize(i18next)(Li
95
104
  </dl>
96
105
  </li>`;
97
106
  }
98
- async read() {
99
- try {
100
- const response = await client.query({
101
- query: gql `
102
- query {
103
- myComplianceReports {
104
- id kind status standing receivedOn noInsideHandler occurredOn description accusedNames victimName
105
- protectionMeasures victimOpinion resultNotice resultToldOn closedOn
106
- }
107
- }
108
- `,
109
- fetchPolicy: 'network-only'
110
- });
111
- if (response.errors?.length)
112
- throw response;
113
- this.reports = response.data.myComplianceReports ?? [];
114
- this.message = '';
115
- }
116
- catch (error) {
117
- this.message = failureOf(error);
118
- }
119
- }
120
107
  async report() {
121
108
  if (await openComplianceCaseForm())
122
- this.read();
109
+ this.mine.refetch();
123
110
  }
124
111
  };
125
- __decorate([
126
- state(),
127
- __metadata("design:type", Array)
128
- ], ComplianceMyReports.prototype, "reports", void 0);
129
- __decorate([
130
- state(),
131
- __metadata("design:type", Object)
132
- ], ComplianceMyReports.prototype, "message", void 0);
133
112
  ComplianceMyReports = __decorate([
134
113
  customElement('compliance-my-reports')
135
114
  ], ComplianceMyReports);
@@ -1 +1 @@
1
- {"version":3,"file":"compliance-my-reports.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AC,eAAe,EAAE,GAAG,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,gBAAgB,EAAE,GAAG,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC;;UAE/J,CAAA;IACR,CAAC;IAEO,KAAK,CAAC,IAAI;QAChB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;gBAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;SAOT;gBACD,WAAW,EAAE,cAAc;aAC5B,CAAC,CAAA;YACF,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM;gBAAE,MAAM,QAAQ,CAAA;YAC3C,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,mBAAmB,IAAI,EAAE,CAAA;YACtD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,MAAM;QAClB,IAAI,MAAM,sBAAsB,EAAE;YAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACjD,CAAC;;AA7DgB;IAAhB,KAAK,EAAE;;oDAA4B;AACnB;IAAhB,KAAK,EAAE;;oDAAqB;AAhDlB,mBAAmB;IAD/B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,mBAAmB,CA6G/B","sourcesContent":["import '@material/web/button/filled-tonal-button.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\n\nimport { failureOf, wordOf } from '../words.js'\nimport { openComplianceCaseForm } from './compliance-case-form.js'\n\n/**\n * 신고하기 (ADR-0187 decisions 10, 21) - the employee's way in, inside 「회사 규정과 안내」: report a case, and follow\n * what they reported or what happened to them - where it stands, the protection given, the result told. Never the\n * investigation; the server hands out none of it here.\n */\n@customElement('compliance-my-reports')\nexport class ComplianceMyReports extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-medium, 8px);\n color: var(--ui-ink);\n font-size: var(--ui-t-body, 13px);\n line-height: 1.6;\n }\n .head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--spacing-medium, 8px);\n }\n .muted {\n color: var(--ui-muted);\n }\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n li {\n padding: var(--spacing-medium, 8px) 0;\n border-top: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n }\n dl {\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 2px var(--spacing-large, 12px);\n margin: var(--spacing-small, 4px) 0 0;\n }\n dt {\n color: var(--ui-muted);\n }\n dd {\n margin: 0;\n white-space: pre-wrap;\n }\n [outside] {\n margin: var(--spacing-small, 4px) 0 0;\n color: var(--ui-crit, var(--md-sys-color-error));\n }\n `\n\n @state() private reports: any[] = []\n @state() private message = ''\n\n connectedCallback() {\n super.connectedCallback()\n this.read()\n }\n\n render() {\n return html`\n <div class=\"head\">\n <span class=\"muted\">${i18next.t('text.compliance-case-my-guide')}</span>\n <md-filled-tonal-button @click=${() => this.report()}>${i18next.t('button.compliance-case-report')}</md-filled-tonal-button>\n </div>\n ${this.message ? html`<span class=\"muted\">${this.message}</span>` : nothing}\n ${this.reports.length\n ? html`<ul>\n ${this.reports.map(one => this.item(one))}\n </ul>`\n : html`<span class=\"muted\">${i18next.t('text.compliance-case-my-empty')}</span>`}\n `\n }\n\n private item(one: any) {\n const row = (field: string, value: any) => (value ? html`<dt>${i18next.t(`field.compliance-case-${field}`)}</dt><dd>${value}</dd>` : nothing)\n return html`<li>\n <strong>${wordOf('compliance-case-kind', one.kind)}</strong> · ${one.receivedOn} · ${wordOf('compliance-case-status', one.status)}\n ${one.standing === 'VICTIM' ? html` · <span class=\"muted\">${i18next.t('text.compliance-case-standing-victim')}</span>` : nothing}\n ${one.noInsideHandler\n ? html`<p outside>${i18next.t('text.compliance-case-no-inside-handler')} ${i18next.t('text.compliance-case-ministry-route')}</p>`\n : nothing}\n <dl>\n ${row('accused', one.accusedNames?.join(', '))} ${row('description', one.description)} ${row('protection-measures', one.protectionMeasures)}\n ${row('victim-opinion', one.victimOpinion)} ${row('result-notice', one.resultNotice)} ${row('result-told-on', one.resultToldOn)} ${row('closed-on', one.closedOn)}\n </dl>\n </li>`\n }\n\n private async read() {\n try {\n const response = await client.query({\n query: gql`\n query {\n myComplianceReports {\n id kind status standing receivedOn noInsideHandler occurredOn description accusedNames victimName\n protectionMeasures victimOpinion resultNotice resultToldOn closedOn\n }\n }\n `,\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n this.reports = response.data.myComplianceReports ?? []\n this.message = ''\n } catch (error) {\n this.message = failureOf(error)\n }\n }\n\n private async report() {\n if (await openComplianceCaseForm()) this.read()\n }\n}\n"]}
1
+ {"version":3,"file":"compliance-my-reports.js","sourceRoot":"","sources":["../../client/components/compliance-my-reports.ts"],"names":[],"mappings":";AAAA,OAAO,6CAA6C,CAAA;AAEpD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAElE;;;;GAIG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,QAAQ,CAA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\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\n\nimport { failureOf, wordOf } from '../words.js'\nimport { openComplianceCaseForm } from './compliance-case-form.js'\n\n/**\n * 신고하기 (ADR-0187 decisions 10, 21) - the employee's way in, inside 「회사 규정과 안내」: report a case, and follow\n * what they reported or what happened to them - where it stands, the protection given, the result told. Never the\n * investigation; the server hands out none of it here.\n */\n@customElement('compliance-my-reports')\nexport class ComplianceMyReports extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-medium, 8px);\n color: var(--ui-ink);\n font-size: var(--ui-t-body, 13px);\n line-height: 1.6;\n }\n .head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--spacing-medium, 8px);\n }\n .muted {\n color: var(--ui-muted);\n }\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n li {\n padding: var(--spacing-medium, 8px) 0;\n border-top: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n }\n dl {\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 2px var(--spacing-large, 12px);\n margin: var(--spacing-small, 4px) 0 0;\n }\n dt {\n color: var(--ui-muted);\n }\n dd {\n margin: 0;\n white-space: pre-wrap;\n }\n [outside] {\n margin: var(--spacing-small, 4px) 0 0;\n color: var(--ui-crit, var(--md-sys-color-error));\n }\n `\n\n /* What the person reported or what happened to them (ADR-0190). */\n private mine = new QueryController(\n this,\n gql`\n query {\n myComplianceReports {\n id kind status standing receivedOn noInsideHandler occurredOn description accusedNames victimName\n protectionMeasures victimOpinion resultNotice resultToldOn closedOn\n }\n }\n `\n )\n\n private get reports(): any[] {\n return this.mine.data?.myComplianceReports ?? []\n }\n\n private get message() {\n return this.mine.error ? failureOf(this.mine.error) : ''\n }\n\n render() {\n return html`\n <div class=\"head\">\n <span class=\"muted\">${i18next.t('text.compliance-case-my-guide')}</span>\n <md-filled-tonal-button @click=${() => this.report()}>${i18next.t('button.compliance-case-report')}</md-filled-tonal-button>\n </div>\n ${this.message ? html`<span class=\"muted\">${this.message}</span>` : nothing}\n ${this.reports.length\n ? html`<ul>\n ${this.reports.map(one => this.item(one))}\n </ul>`\n : html`<span class=\"muted\">${i18next.t('text.compliance-case-my-empty')}</span>`}\n `\n }\n\n private item(one: any) {\n const row = (field: string, value: any) => (value ? html`<dt>${i18next.t(`field.compliance-case-${field}`)}</dt><dd>${value}</dd>` : nothing)\n return html`<li>\n <strong>${wordOf('compliance-case-kind', one.kind)}</strong> · ${one.receivedOn} · ${wordOf('compliance-case-status', one.status)}\n ${one.standing === 'VICTIM' ? html` · <span class=\"muted\">${i18next.t('text.compliance-case-standing-victim')}</span>` : nothing}\n ${one.noInsideHandler\n ? html`<p outside>${i18next.t('text.compliance-case-no-inside-handler')}</p>`\n : nothing}\n <dl>\n ${row('accused', one.accusedNames?.join(', '))} ${row('description', one.description)} ${row('protection-measures', one.protectionMeasures)}\n ${row('victim-opinion', one.victimOpinion)} ${row('result-notice', one.resultNotice)} ${row('result-told-on', one.resultToldOn)} ${row('closed-on', one.closedOn)}\n </dl>\n </li>`\n }\n\n private async report() {\n if (await openComplianceCaseForm()) this.mine.refetch()\n }\n}\n"]}
@@ -19,11 +19,12 @@ export declare class InventionReportForm extends InventionReportForm_base {
19
19
  private reportedOn;
20
20
  private coInventorIds;
21
21
  private files;
22
- private people;
23
- private working;
24
22
  private progress?;
25
- private message;
26
- connectedCallback(): Promise<void>;
23
+ private colleagues;
24
+ private reporting;
25
+ private get people();
26
+ private get working();
27
+ private get message();
27
28
  render(): import("lit-html").TemplateResult<1>;
28
29
  private report;
29
30
  }
@@ -8,7 +8,7 @@ import '@operato/popup/ox-popup-list.js';
8
8
  import gql from 'graphql-tag';
9
9
  import { css, html, LitElement } from 'lit';
10
10
  import { customElement, 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';
@@ -37,9 +37,14 @@ let InventionReportForm = class InventionReportForm extends localize(i18next)(Li
37
37
  this.reportedOn = today();
38
38
  this.coInventorIds = [];
39
39
  this.files = [];
40
- this.people = [];
41
- this.working = false;
42
- this.message = '';
40
+ /* The colleagues who may be named co-inventors (ADR-0190). */
41
+ this.colleagues = new QueryController(this, gql `query { inventionColleagues { id name departmentName } }`);
42
+ /* Its failure is drawn under the files, beside the form. */
43
+ this.reporting = new MutationController(this, gql `
44
+ mutation ($invention: NewInvention!, $files: [Upload!]) {
45
+ reportInvention(invention: $invention, files: $files) { id decisionDueOn }
46
+ }
47
+ `, { showsError: true });
43
48
  }
44
49
  /* The house shape of a popup (page-standard sections 7, 8): only the body scrolls, fields are labels above native
45
50
  inputs, the one button row is `ox-popup-actions`. */
@@ -70,10 +75,14 @@ let InventionReportForm = class InventionReportForm extends localize(i18next)(Li
70
75
  }
71
76
  `
72
77
  ]; }
73
- async connectedCallback() {
74
- super.connectedCallback();
75
- const response = await client.query({ query: gql `query { inventionColleagues { id name departmentName } }`, fetchPolicy: 'no-cache' });
76
- this.people = (response.data?.inventionColleagues ?? []).map((one) => ({ value: one.id, display: one.departmentName ? `${one.name} · ${one.departmentName}` : one.name }));
78
+ get people() {
79
+ return (this.colleagues.data?.inventionColleagues ?? []).map((one) => ({ value: one.id, display: one.departmentName ? `${one.name} · ${one.departmentName}` : one.name }));
80
+ }
81
+ get working() {
82
+ return this.reporting.pending;
83
+ }
84
+ get message() {
85
+ return this.reporting.error ? failureOf(this.reporting.error) : '';
77
86
  }
78
87
  render() {
79
88
  const named = this.people.filter(one => this.coInventorIds.includes(one.value)).map(one => one.display);
@@ -118,31 +127,13 @@ let InventionReportForm = class InventionReportForm extends localize(i18next)(Li
118
127
  `;
119
128
  }
120
129
  async report() {
121
- this.message = '';
122
- this.working = true;
123
- try {
124
- const response = await client.mutate({
125
- mutation: gql `
126
- mutation ($invention: NewInvention!, $files: [Upload!]) {
127
- reportInvention(invention: $invention, files: $files) { id decisionDueOn }
128
- }
129
- `,
130
- variables: { invention: { title: this.inventionTitle, content: this.content, reportedOn: this.reportedOn || null, coInventorIds: this.coInventorIds }, files: this.files },
131
- ...(this.files.length ? { context: uploadContext((fraction) => (this.progress = fraction)) } : {})
132
- });
133
- if (response.errors?.length)
134
- throw response;
135
- const reported = response.data.reportInvention;
136
- notify({ message: i18next.t('text.invention-reported', { day: reported.decisionDueOn }) });
137
- this.dispatchEvent(new CustomEvent('reported', { detail: reported }));
138
- }
139
- catch (error) {
140
- this.message = failureOf(error);
141
- }
142
- finally {
143
- this.working = false;
144
- this.progress = undefined;
145
- }
130
+ const done = await this.reporting.run({ invention: { title: this.inventionTitle, content: this.content, reportedOn: this.reportedOn || null, coInventorIds: this.coInventorIds }, files: this.files }, { context: this.files.length ? uploadContext((fraction) => (this.progress = fraction)) : undefined });
131
+ this.progress = undefined;
132
+ if (!done)
133
+ return;
134
+ const reported = done.reportInvention;
135
+ notify({ message: i18next.t('text.invention-reported', { day: reported.decisionDueOn }) });
136
+ this.dispatchEvent(new CustomEvent('reported', { detail: reported }));
146
137
  }
147
138
  };
148
139
  __decorate([
@@ -165,22 +156,10 @@ __decorate([
165
156
  state(),
166
157
  __metadata("design:type", Array)
167
158
  ], InventionReportForm.prototype, "files", void 0);
168
- __decorate([
169
- state(),
170
- __metadata("design:type", Array)
171
- ], InventionReportForm.prototype, "people", void 0);
172
- __decorate([
173
- state(),
174
- __metadata("design:type", Object)
175
- ], InventionReportForm.prototype, "working", void 0);
176
159
  __decorate([
177
160
  state(),
178
161
  __metadata("design:type", Number)
179
162
  ], InventionReportForm.prototype, "progress", void 0);
180
- __decorate([
181
- state(),
182
- __metadata("design:type", Object)
183
- ], InventionReportForm.prototype, "message", void 0);
184
163
  InventionReportForm = __decorate([
185
164
  customElement('invention-report-form')
186
165
  ], InventionReportForm);
@@ -1 +1 @@
1
- {"version":3,"file":"invention-report-form.js","sourceRoot":"","sources":["../../client/components/invention-report-form.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,iCAAiC,CAAA;AACxC,OAAO,6BAA6B,CAAA;AACpC,OAAO,oCAAoC,CAAA;AAC3C,OAAO,iCAAiC,CAAA;AAExC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,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;AACnD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEvG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvC,+FAA+F;AAC/F,MAAM,UAAU,uBAAuB;IACrC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,IAAI,IAAI,GAAQ,IAAI,CAAA;QACpB,MAAM,MAAM,GAAQ,SAAS,CAC3B,IAAI,CAAA,iCAAiC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,CAAc,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,2BAA2B,EACzJ,EAAE,QAAQ,EAAE,IAAI,EAA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AAE;;mDAA8B;AACrB;IAAhB,KAAK,EAAE;;oDAAwB;AACf;IAAhB,KAAK,EAAE;;qDAA0B;AACjB;IAAhB,KAAK,EAAE;;oDAAqB;AAvClB,mBAAmB;IAD/B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,mBAAmB,CAkH/B","sourcesContent":["import '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@operato/input/ox-input-file.js'\nimport '@operato/input/ox-select.js'\nimport '@operato/popup/ox-popup-actions.js'\nimport '@operato/popup/ox-popup-list.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, 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 } from '../words.js'\n\ntype Choice = { value: string; display: string }\n\n/** Opens the form; resolves with the reported invention, or null when the person closed it. */\nexport function openInventionReportForm(): Promise<any | null> {\n return new Promise(resolve => {\n let done: any = null\n const handle: any = openPopup(\n html`<invention-report-form @close=${() => handle.close()} @reported=${(e: CustomEvent) => ((done = e.detail), handle.close())}></invention-report-form>`,\n { backdrop: true, size: 'medium', title: i18next.t('title.invention-report') }\n )\n handle.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 24 · 발명진흥법 §12) - what the invention is, who invented it with the reporter, the\n * papers that show it. The company tells whether it succeeds to the right within four months of the report.\n */\n@customElement('invention-report-form')\nexport class InventionReportForm extends localize(i18next)(LitElement) {\n /* The house shape of a popup (page-standard sections 7, 8): only the body scrolls, fields are labels above native\n inputs, the one button row is `ox-popup-actions`. */\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 textarea {\n min-height: 8em;\n resize: vertical;\n }\n ox-select {\n width: 100%;\n }\n `\n ]\n\n @state() private inventionTitle = ''\n @state() private content = ''\n @state() private reportedOn = today()\n @state() private coInventorIds: string[] = []\n @state() private files: File[] = []\n @state() private people: Choice[] = []\n @state() private working = false\n @state() private progress?: number\n @state() private message = ''\n\n async connectedCallback() {\n super.connectedCallback()\n const response = await client.query({ query: gql`query { inventionColleagues { id name departmentName } }`, fetchPolicy: 'no-cache' })\n this.people = (response.data?.inventionColleagues ?? []).map((one: any) => ({ value: one.id, display: one.departmentName ? `${one.name} · ${one.departmentName}` : one.name }))\n }\n\n render() {\n const named = this.people.filter(one => this.coInventorIds.includes(one.value)).map(one => one.display)\n return html`\n <div class=\"body\">\n <div guide><p>${i18next.t('text.invention-report-guide')}</p></div>\n\n <label class=\"field\">\n <span>${i18next.t('field.invention-title')}</span>\n <input .value=${this.inventionTitle} @input=${(e: any) => (this.inventionTitle = e.target.value)} />\n </label>\n\n <label class=\"field\">\n <span>${i18next.t('field.invention-content')}</span>\n <textarea .value=${this.content} @input=${(e: any) => (this.content = e.target.value)}></textarea>\n </label>\n\n <label class=\"field\">\n <span>${i18next.t('field.invention-reported-on')}</span>\n <input type=\"date\" .value=${this.reportedOn} @input=${(e: any) => (this.reportedOn = e.target.value)} />\n </label>\n\n <label class=\"field\">\n <span>${i18next.t('field.invention-co-inventors')}</span>\n <ox-select multiple .value=${this.coInventorIds} @change=${(e: CustomEvent) => (this.coInventorIds = [].concat(e.detail ?? []).filter(Boolean))}>\n <span slot=\"label\">${named.length ? named.join(', ') : '—'}</span>\n <ox-popup-list align-left nowrap with-search multiple>${this.people.map(one => html`<div option value=${one.value}>${one.display}</div>`)}</ox-popup-list>\n </ox-select>\n </label>\n\n <div class=\"field\">\n <span>${i18next.t('field.invention-files')}</span>\n <ox-input-file multiple .progress=${this.progress} @change=${(e: CustomEvent) => (this.files = [...(e.detail ?? [])])}></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.report()}>${i18next.t('button.invention-report')}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n private async report() {\n this.message = ''\n this.working = true\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($invention: NewInvention!, $files: [Upload!]) {\n reportInvention(invention: $invention, files: $files) { id decisionDueOn }\n }\n `,\n variables: { invention: { title: this.inventionTitle, content: this.content, reportedOn: this.reportedOn || null, coInventorIds: this.coInventorIds }, files: this.files },\n ...(this.files.length ? { context: uploadContext((fraction: number) => (this.progress = fraction)) } : {})\n })\n if ((response as any).errors?.length) throw response\n const reported = response.data.reportInvention\n notify({ message: i18next.t('text.invention-reported', { day: reported.decisionDueOn }) })\n this.dispatchEvent(new CustomEvent('reported', { detail: reported }))\n } catch (error) {\n this.message = failureOf(error)\n } finally {\n this.working = false\n this.progress = undefined\n }\n }\n}\n"]}
1
+ {"version":3,"file":"invention-report-form.js","sourceRoot":"","sources":["../../client/components/invention-report-form.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,iCAAiC,CAAA;AACxC,OAAO,6BAA6B,CAAA;AACpC,OAAO,oCAAoC,CAAA;AAC3C,OAAO,iCAAiC,CAAA;AAExC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,E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AA;QACzB,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAA;QACrC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,yBAAyB,EAAE,EAAE,GAAG,EAAE,QAAQ,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAA;QAC1F,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;IACvE,CAAC;;AAtFgB;IAAhB,KAAK,EAAE;;2DAA4B;AACnB;IAAhB,KAAK,EAAE;;oDAAqB;AACZ;IAAhB,KAAK,EAAE;;uDAA6B;AACpB;IAAhB,KAAK,EAAE;;0DAAqC;AAC5B;IAAhB,KAAK,EAAE;;kDAA2B;AAClB;IAAhB,KAAK,EAAE;;qDAA0B;AApCvB,mBAAmB;IAD/B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,mBAAmB,CAsH/B","sourcesContent":["import '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@operato/input/ox-input-file.js'\nimport '@operato/input/ox-select.js'\nimport '@operato/popup/ox-popup-actions.js'\nimport '@operato/popup/ox-popup-list.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, 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 } from '../words.js'\n\ntype Choice = { value: string; display: string }\n\n/** Opens the form; resolves with the reported invention, or null when the person closed it. */\nexport function openInventionReportForm(): Promise<any | null> {\n return new Promise(resolve => {\n let done: any = null\n const handle: any = openPopup(\n html`<invention-report-form @close=${() => handle.close()} @reported=${(e: CustomEvent) => ((done = e.detail), handle.close())}></invention-report-form>`,\n { backdrop: true, size: 'medium', title: i18next.t('title.invention-report') }\n )\n handle.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 24 · 발명진흥법 §12) - what the invention is, who invented it with the reporter, the\n * papers that show it. The company tells whether it succeeds to the right within four months of the report.\n */\n@customElement('invention-report-form')\nexport class InventionReportForm extends localize(i18next)(LitElement) {\n /* The house shape of a popup (page-standard sections 7, 8): only the body scrolls, fields are labels above native\n inputs, the one button row is `ox-popup-actions`. */\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 textarea {\n min-height: 8em;\n resize: vertical;\n }\n ox-select {\n width: 100%;\n }\n `\n ]\n\n @state() private inventionTitle = ''\n @state() private content = ''\n @state() private reportedOn = today()\n @state() private coInventorIds: string[] = []\n @state() private files: File[] = []\n @state() private progress?: number\n\n /* The colleagues who may be named co-inventors (ADR-0190). */\n private colleagues = new QueryController(this, gql`query { inventionColleagues { id name departmentName } }`)\n\n /* Its failure is drawn under the files, beside the form. */\n private reporting = new MutationController(\n this,\n gql`\n mutation ($invention: NewInvention!, $files: [Upload!]) {\n reportInvention(invention: $invention, files: $files) { id decisionDueOn }\n }\n `,\n { showsError: true }\n )\n\n private get people(): Choice[] {\n return (this.colleagues.data?.inventionColleagues ?? []).map((one: any) => ({ value: one.id, display: one.departmentName ? `${one.name} · ${one.departmentName}` : one.name }))\n }\n\n private get working() {\n return this.reporting.pending\n }\n\n private get message() {\n return this.reporting.error ? failureOf(this.reporting.error) : ''\n }\n\n render() {\n const named = this.people.filter(one => this.coInventorIds.includes(one.value)).map(one => one.display)\n return html`\n <div class=\"body\">\n <div guide><p>${i18next.t('text.invention-report-guide')}</p></div>\n\n <label class=\"field\">\n <span>${i18next.t('field.invention-title')}</span>\n <input .value=${this.inventionTitle} @input=${(e: any) => (this.inventionTitle = e.target.value)} />\n </label>\n\n <label class=\"field\">\n <span>${i18next.t('field.invention-content')}</span>\n <textarea .value=${this.content} @input=${(e: any) => (this.content = e.target.value)}></textarea>\n </label>\n\n <label class=\"field\">\n <span>${i18next.t('field.invention-reported-on')}</span>\n <input type=\"date\" .value=${this.reportedOn} @input=${(e: any) => (this.reportedOn = e.target.value)} />\n </label>\n\n <label class=\"field\">\n <span>${i18next.t('field.invention-co-inventors')}</span>\n <ox-select multiple .value=${this.coInventorIds} @change=${(e: CustomEvent) => (this.coInventorIds = [].concat(e.detail ?? []).filter(Boolean))}>\n <span slot=\"label\">${named.length ? named.join(', ') : '—'}</span>\n <ox-popup-list align-left nowrap with-search multiple>${this.people.map(one => html`<div option value=${one.value}>${one.display}</div>`)}</ox-popup-list>\n </ox-select>\n </label>\n\n <div class=\"field\">\n <span>${i18next.t('field.invention-files')}</span>\n <ox-input-file multiple .progress=${this.progress} @change=${(e: CustomEvent) => (this.files = [...(e.detail ?? [])])}></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.report()}>${i18next.t('button.invention-report')}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n private async report() {\n const done = await this.reporting.run(\n { invention: { title: this.inventionTitle, content: this.content, reportedOn: this.reportedOn || null, coInventorIds: this.coInventorIds }, files: this.files },\n { context: this.files.length ? uploadContext((fraction: number) => (this.progress = fraction)) : undefined }\n )\n this.progress = undefined\n if (!done) return\n const reported = done.reportInvention\n notify({ message: i18next.t('text.invention-reported', { day: reported.decisionDueOn }) })\n this.dispatchEvent(new CustomEvent('reported', { detail: reported }))\n }\n}\n"]}
@@ -7,12 +7,10 @@ declare const ComplianceMyTrainings_base: (new (...args: any[]) => LitElement) &
7
7
  */
8
8
  export declare class ComplianceMyTrainings extends ComplianceMyTrainings_base {
9
9
  static styles: import("lit").CSSResult;
10
- private rows;
11
- private loaded;
12
- private message;
13
- connectedCallback(): void;
10
+ private mine;
11
+ private get rows();
12
+ private get message();
14
13
  render(): import("lit-html").TemplateResult<1> | typeof nothing;
15
- private fetch;
16
14
  private upload;
17
15
  }
18
16
  export {};