@things-factory/compliance 10.1.267 → 10.1.269

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 (51) hide show
  1. package/dist-client/components/compliance-case-form.d.ts +1 -0
  2. package/dist-client/components/compliance-case-form.js +3 -2
  3. package/dist-client/components/compliance-case-form.js.map +1 -1
  4. package/dist-client/components/compliance-case-sheet.d.ts +1 -0
  5. package/dist-client/components/compliance-case-sheet.js +3 -2
  6. package/dist-client/components/compliance-case-sheet.js.map +1 -1
  7. package/dist-client/components/invention-report-form.d.ts +1 -0
  8. package/dist-client/components/invention-report-form.js +2 -1
  9. package/dist-client/components/invention-report-form.js.map +1 -1
  10. package/dist-client/components/seal-use-form.d.ts +5 -0
  11. package/dist-client/components/seal-use-form.js +37 -7
  12. package/dist-client/components/seal-use-form.js.map +1 -1
  13. package/dist-client/components/training-attendance-form.d.ts +1 -0
  14. package/dist-client/components/training-attendance-form.js +2 -1
  15. package/dist-client/components/training-attendance-form.js.map +1 -1
  16. package/dist-client/components/training-certificate-form.d.ts +1 -0
  17. package/dist-client/components/training-certificate-form.js +2 -1
  18. package/dist-client/components/training-certificate-form.js.map +1 -1
  19. package/dist-client/components/training-session-form.d.ts +1 -0
  20. package/dist-client/components/training-session-form.js +3 -2
  21. package/dist-client/components/training-session-form.js.map +1 -1
  22. package/dist-client/pages/regulation-detail.d.ts +1 -0
  23. package/dist-client/pages/regulation-detail.js +3 -2
  24. package/dist-client/pages/regulation-detail.js.map +1 -1
  25. package/dist-client/tsconfig.tsbuildinfo +1 -1
  26. package/dist-server/activities/regulation-activity.js +4 -2
  27. package/dist-server/activities/regulation-activity.js.map +1 -1
  28. package/dist-server/activities/seal-use-activity.js +4 -1
  29. package/dist-server/activities/seal-use-activity.js.map +1 -1
  30. package/dist-server/index.js +2 -0
  31. package/dist-server/index.js.map +1 -1
  32. package/dist-server/service/index.d.ts +1 -0
  33. package/dist-server/service/index.js +1 -0
  34. package/dist-server/service/index.js.map +1 -1
  35. package/dist-server/service/seal-use/seal-use-mutation.d.ts +2 -1
  36. package/dist-server/service/seal-use/seal-use-mutation.js +6 -4
  37. package/dist-server/service/seal-use/seal-use-mutation.js.map +1 -1
  38. package/dist-server/service/seal-use/seal-use-paper.d.ts +16 -0
  39. package/dist-server/service/seal-use/seal-use-paper.js +45 -0
  40. package/dist-server/service/seal-use/seal-use-paper.js.map +1 -0
  41. package/dist-server/service/seal-use/seal-use-service.d.ts +2 -1
  42. package/dist-server/service/seal-use/seal-use-service.js +21 -3
  43. package/dist-server/service/seal-use/seal-use-service.js.map +1 -1
  44. package/dist-server/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +16 -16
  46. package/translations/en.json +3 -1
  47. package/translations/es.json +3 -1
  48. package/translations/ja.json +3 -1
  49. package/translations/ko.json +3 -1
  50. package/translations/ms.json +3 -1
  51. package/translations/zh.json +3 -1
@@ -1,3 +1,4 @@
1
+ import '@operato/input/ox-input-date.js';
1
2
  import '@material/web/button/filled-button.js';
2
3
  import '@material/web/button/text-button.js';
3
4
  import '@material/web/icon/icon.js';
@@ -1,4 +1,5 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
+ import '@operato/input/ox-input-date.js';
2
3
  import '@material/web/button/filled-button.js';
3
4
  import '@material/web/button/text-button.js';
4
5
  import '@material/web/icon/icon.js';
@@ -167,7 +168,7 @@ let ComplianceCaseForm = class ComplianceCaseForm extends localize(i18next)(LitE
167
168
  ? html `${this.picker('reporter', this.reporter ? [this.reporter] : [], one => (this.reporter = one), () => (this.reporter = null))}
168
169
  <label class="field">
169
170
  <span>${i18next.t('field.compliance-case-received-on')}</span>
170
- <input type="date" .value=${this.receivedOn} @input=${(e) => (this.receivedOn = e.target.value)} />
171
+ <ox-input-date type="date" .value=${this.receivedOn} @change=${(e) => (this.receivedOn = e.target.value)}></ox-input-date>
171
172
  </label>`
172
173
  : nothing}
173
174
  ${this.picker('accused', this.accused, one => this.setAccused([...this.accused.filter(other => other.id !== one.id), one]), one => this.setAccused(this.accused.filter(other => other.id !== one.id)))}
@@ -180,7 +181,7 @@ let ComplianceCaseForm = class ComplianceCaseForm extends localize(i18next)(LitE
180
181
 
181
182
  <label class="field">
182
183
  <span>${i18next.t('field.compliance-case-occurred-on')}</span>
183
- <input type="date" .value=${this.occurredOn} @input=${(e) => (this.occurredOn = e.target.value)} />
184
+ <ox-input-date type="date" .value=${this.occurredOn} @change=${(e) => (this.occurredOn = e.target.value)}></ox-input-date>
184
185
  </label>
185
186
 
186
187
  <label class="field">
@@ -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,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrF,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,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAA;AAI7D;;;GAGG;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AAK,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;QAC5E,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC5B,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,uCAAuC,CAAC,CAAC,CAAC,+BAA+B,CAAC,EAAE,CAAC,CAAA;QACnI,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;IACtE,CAAC;;AAlL4B;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;AAElB;IAAhB,KAAK,EAAE;;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"]}
1
+ {"version":3,"file":"compliance-case-form.js","sourceRoot":"","sources":["../../client/components/compliance-case-form.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,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,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrF,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,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAA;AAI7D;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAO,GAAG,KAAK;IACpD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,IAAI,IAAI,GAAQ,IAAI,CAAA;QACpB,MAAM,KAAK,GAAQ,SAAS,CAC1B,IAAI,CAAA,kCAAkC,OAAO,WAAW,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC,CAAc,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,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aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;IACtE,CAAC;;AAlL4B;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;AAElB;IAAhB,KAAK,EAAE;;oDAAwE;AA1ErE,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAkP9B","sourcesContent":["import '@operato/input/ox-input-date.js'\nimport '@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 <ox-input-date type=\"date\" .value=${this.receivedOn} @change=${(e: any) => (this.receivedOn = e.target.value)}></ox-input-date>\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 <ox-input-date type=\"date\" .value=${this.occurredOn} @change=${(e: any) => (this.occurredOn = e.target.value)}></ox-input-date>\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"]}
@@ -1,3 +1,4 @@
1
+ import '@operato/input/ox-input-date.js';
1
2
  import '@material/web/button/filled-button.js';
2
3
  import '@material/web/button/text-button.js';
3
4
  import '@material/web/icon/icon.js';
@@ -1,4 +1,5 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
+ import '@operato/input/ox-input-date.js';
2
3
  import '@material/web/button/filled-button.js';
3
4
  import '@material/web/button/text-button.js';
4
5
  import '@material/web/icon/icon.js';
@@ -209,7 +210,7 @@ let ComplianceCaseSheet = class ComplianceCaseSheet extends localize(i18next)(Li
209
210
  ${HANDLING.map(field => DAYS.includes(field)
210
211
  ? html `<label class="field">
211
212
  <span>${i18next.t(`field.compliance-case-${kebab(field)}`)}</span>
212
- <input type="date" ?disabled=${closed} .value=${this.handling.value(field) ?? ''} @input=${(e) => this.handling.set(field, e.target.value)} />
213
+ <ox-input-date type="date" ?disabled=${closed} .value=${this.handling.value(field) ?? ''} @change=${(e) => this.handling.set(field, e.target.value)}></ox-input-date>
213
214
  </label>`
214
215
  : html `<label class="field">
215
216
  <span>${i18next.t(`field.compliance-case-${kebab(field)}`)}</span>
@@ -229,7 +230,7 @@ let ComplianceCaseSheet = class ComplianceCaseSheet extends localize(i18next)(Li
229
230
  ? nothing
230
231
  : html `<label class="field">
231
232
  <span>${i18next.t('field.compliance-case-entry-written-on')}</span>
232
- <input type="date" .value=${this.entry.value('writtenOn') ?? ''} @input=${(e) => this.entry.set('writtenOn', e.target.value)} />
233
+ <ox-input-date type="date" .value=${this.entry.value('writtenOn') ?? ''} @change=${(e) => this.entry.set('writtenOn', e.target.value)}></ox-input-date>
233
234
  </label>
234
235
  <label class="field">
235
236
  <span>${i18next.t('field.compliance-case-entry-body')}</span>
@@ -1 +1 @@
1
- {"version":3,"file":"compliance-case-sheet.js","sourceRoot":"","sources":["../../client/components/compliance-case-sheet.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,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,MAA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AAG,EAAE,CACzC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAC/I,CAAA;QACD,IAAI,KAAK;YAAE,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAA;IACzE,CAAC;;AAtM2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAY;AAGtB;IAAhB,KAAK,EAAE;;qDAAsB;AA1EnB,mBAAmB;IAD/B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,mBAAmB,CA8Q/B","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/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 { DraftController } from '@operato/shell'\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\n/** Opens one case's sheet; resolves when it closes. */\nexport function openComplianceCaseSheet(id: string): Promise<void> {\n return new Promise(resolve => {\n const popup: any = openPopup(html`<compliance-case-sheet .caseId=${id} @close=${() => popup.close()}></compliance-case-sheet>`, {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.compliance-case-sheet')\n })\n popup.onclosed = () => resolve()\n })\n}\n\nconst HANDLING = ['investigationStartedOn', 'protectionMeasures', 'victimOpinion', 'finding', 'actionOnAccused', 'resultNotice', 'resultToldOn', 'closedOn']\nconst DAYS = ['investigationStartedOn', 'resultToldOn', 'closedOn']\nconst kebab = (name: string) => name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()\nconst today = () => {\n const now = new Date()\n return new Date(now.getTime() - now.getTimezoneOffset() * 60000).toISOString().slice(0, 10)\n}\n\ntype Person = { id: string; name: string; note?: string }\ntype Handling = Record<string, any> & { investigators: Person[] }\ntype Entry = { writtenOn: string; body: string; files: File[] }\n\n/**\n * 사건 처리 (ADR-0187 decision 21) - one case whole, for its handlers and investigators: the report, who investigates\n * it, the investigation record, the protection of the victim with their view, the finding, what was done to those\n * reported against, the result told and the closing. A value changed keeps a correction; nothing is deleted.\n */\n@customElement('compliance-case-sheet')\nexport class ComplianceCaseSheet 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 dl {\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 2px var(--spacing-large, 12px);\n margin: 0;\n }\n dt {\n color: var(--ui-muted);\n }\n dd {\n margin: 0;\n white-space: pre-wrap;\n }\n h4 {\n margin: var(--spacing-medium, 8px) 0 0;\n }\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n li {\n padding: var(--spacing-small, 4px) 0;\n border-top: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n white-space: pre-wrap;\n }\n .muted {\n color: var(--ui-muted);\n }\n .chips,\n .found {\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 textarea {\n min-height: 64px;\n }\n `\n ]\n\n @property({ type: String }) caseId = ''\n\n /* The words typed to find an investigator. */\n @state() private searched = ''\n\n /* The case, read for the case the sheet opens (ADR-0190). */\n private record = new QueryController(\n this,\n gql`\n query ($id: String!) {\n complianceCase(id: $id) {\n id kind status receivedOn investigationDueOn occurredOn description\n investigationStartedOn protectionMeasures victimOpinion finding actionOnAccused resultNotice resultToldOn closedOn\n reporter { id name } victim { id name } accused { id name } investigators { id name email }\n attachments { id name fullpath }\n entries { id writtenOn body creator { id name } attachments { id name fullpath } }\n corrections { id field before after createdAt creator { id name } }\n }\n }\n `,\n { variables: () => (this.caseId ? { id: this.caseId } : undefined) }\n )\n\n /* What is typed over the handling read, and the investigation entry being written. */\n private handling = new DraftController<Handling>(this, {\n read: () => {\n const one = this.one\n if (!one) return undefined\n return {\n ...Object.fromEntries(HANDLING.map(field => [field, one[field] ?? ''])),\n investigators: (one.investigators ?? []).map((person: any) => ({ id: person.id, name: person.name, note: person.email }))\n } as Handling\n },\n key: () => this.caseId\n })\n private entry = new DraftController<Entry>(this, { read: () => ({ writtenOn: today(), body: '', files: [] }), key: () => this.caseId })\n\n /* Each save reads the case again; its refusal is said in the sheet. */\n private saves = {\n handle: this.saving(gql`mutation ($patch: ComplianceCaseHandling!) { handleComplianceCase(patch: $patch) { id } }`),\n entry: this.saving(gql`\n mutation ($caseId: String!, $writtenOn: String!, $body: String!, $attach: [Upload!]) {\n addComplianceCaseEntry(caseId: $caseId, writtenOn: $writtenOn, body: $body, attach: $attach) { id }\n }\n `)\n }\n\n private saving(mutation: any) {\n return new MutationController(this, mutation, { refetch: () => [this.record], showsError: true })\n }\n\n private get one(): any {\n return this.record.data?.complianceCase ?? null\n }\n\n private get investigators(): Person[] {\n return this.handling.value('investigators') ?? []\n }\n\n private get working() {\n return Object.values(this.saves).some(save => save.pending)\n }\n\n /** What went wrong last: the read, or a save. */\n private get message() {\n const failed = this.record.error ?? this.saves.handle.error ?? this.saves.entry.error\n return failed ? failureOf(failed) : ''\n }\n\n /* The users the words find (ADR-0190). */\n private choices = new QueryController(\n this,\n gql`\n query ($text: String!) {\n complianceCaseInvestigatorChoices(text: $text) { id name note }\n }\n `,\n { variables: () => (this.searched.trim() ? { text: this.searched } : undefined), keepPrevious: true }\n )\n\n private get found(): Person[] {\n return this.searched.trim() ? (this.choices.data?.complianceCaseInvestigatorChoices ?? []) : []\n }\n\n render() {\n const one = this.one\n if (!one) return html`<div class=\"body\"><span invalid>${this.message}</span></div>`\n const closed = !!one.closedOn\n const fact = (field: string, value: any) => (value ? html`<dt>${i18next.t(`field.compliance-case-${field}`)}</dt><dd>${value}</dd>` : nothing)\n return html`\n <div class=\"body\">\n <dl>\n ${fact('kind', wordOf('compliance-case-kind', one.kind))} ${fact('status', wordOf('compliance-case-status', one.status))} ${fact('received-on', one.receivedOn)}\n ${fact('investigation-due-on', one.investigationDueOn)} ${fact('reporter', one.reporter?.name)} ${fact('victim', one.victim?.name)}\n ${fact('accused', (one.accused ?? []).map((person: any) => person.name).join(', '))} ${fact('occurred-on', one.occurredOn)} ${fact('description', one.description)}\n ${fact('attachments', (one.attachments ?? []).length ? html`${one.attachments.map((file: any) => html`<a href=${file.fullpath} target=\"_blank\">${file.name}</a> `)}` : '')}\n </dl>\n\n <div class=\"field\">\n <span>${i18next.t('field.compliance-case-investigators')}</span>\n <div class=\"chips\">\n ${this.investigators.map(\n person =>\n html`<button type=\"button\" ?disabled=${closed} aria-label=${i18next.t('button.compliance-case-remove')} @click=${() => this.handling.set('investigators', this.investigators.filter(other => other.id !== person.id))}>\n ${person.name}<md-icon>close</md-icon>\n </button>`\n )}\n </div>\n ${closed\n ? nothing\n : html`<input placeholder=${i18next.t('text.compliance-case-find-person')} @input=${(e: any) => this.find(e.target.value)} />\n <div class=\"found\">\n ${this.found\n .filter(person => !this.investigators.some(other => other.id === person.id))\n .map(person => html`<button type=\"button\" @click=${() => (this.handling.set('investigators', [...this.investigators, person]), (this.searched = ''))}>${person.note ? `${person.name} · ${person.note}` : person.name}</button>`)}\n </div>`}\n </div>\n\n ${HANDLING.map(field =>\n DAYS.includes(field)\n ? html`<label class=\"field\">\n <span>${i18next.t(`field.compliance-case-${kebab(field)}`)}</span>\n <input type=\"date\" ?disabled=${closed} .value=${this.handling.value(field) ?? ''} @input=${(e: any) => this.handling.set(field, e.target.value)} />\n </label>`\n : html`<label class=\"field\">\n <span>${i18next.t(`field.compliance-case-${kebab(field)}`)}</span>\n <textarea ?disabled=${closed} .value=${this.handling.value(field) ?? ''} @input=${(e: any) => this.handling.set(field, e.target.value)}></textarea>\n </label>`\n )}\n\n <h4>${i18next.t('field.compliance-case-entries')}</h4>\n ${(one.entries ?? []).length\n ? html`<ul>\n ${one.entries.map(\n (entry: any) => html`<li>\n <span class=\"muted\">${entry.writtenOn} · ${entry.creator?.name ?? ''}</span><br />${entry.body}\n ${(entry.attachments ?? []).map((file: any) => html` <a href=${file.fullpath} target=\"_blank\">${file.name}</a>`)}\n </li>`\n )}\n </ul>`\n : html`<span class=\"muted\">${i18next.t('text.compliance-case-entries-empty')}</span>`}\n ${closed\n ? nothing\n : html`<label class=\"field\">\n <span>${i18next.t('field.compliance-case-entry-written-on')}</span>\n <input type=\"date\" .value=${this.entry.value('writtenOn') ?? ''} @input=${(e: any) => this.entry.set('writtenOn', e.target.value)} />\n </label>\n <label class=\"field\">\n <span>${i18next.t('field.compliance-case-entry-body')}</span>\n <textarea .value=${this.entry.value('body') ?? ''} @input=${(e: any) => this.entry.set('body', e.target.value)}></textarea>\n </label>\n <div class=\"field\">\n <ox-input-file multiple icon=\"attach_file\" @change=${(e: CustomEvent) => this.entry.set('files', [...((e.detail as File[]) ?? [])])}></ox-input-file>\n <md-text-button ?disabled=${this.working || !(this.entry.value('body') ?? '').trim()} @click=${() => this.addEntry()}>${i18next.t('button.compliance-case-add-entry')}</md-text-button>\n </div>`}\n ${(one.corrections ?? []).length\n ? html`<h4>${i18next.t('field.compliance-case-corrections')}</h4>\n <ul>\n ${one.corrections.map(\n (row: any) =>\n html`<li class=\"muted\">${new Date(row.createdAt).toLocaleString()} · ${row.creator?.name ?? ''} · ${i18next.t(`field.compliance-case-${kebab(row.field === 'investigatorIds' ? 'investigators' : row.field)}`)}: ${row.before ?? ''} → ${row.after ?? ''}</li>`\n )}\n </ul>`\n : nothing}\n <span invalid>${this.message}</span>\n </div>\n\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.dispatchEvent(new CustomEvent('close'))}>${i18next.t('button.close')}</md-text-button>\n ${closed ? nothing : html`<md-filled-button slot=\"confirm\" ?disabled=${this.working} @click=${() => this.save()}>${i18next.t('button.save')}</md-filled-button>`}\n </ox-popup-actions>\n `\n }\n\n private find(text: string) {\n this.searched = text\n }\n\n /** Only what was changed goes, as a correction of what was read. */\n private async save() {\n const one = this.one\n const changed = HANDLING.filter(field => (this.handling.value(field) ?? '') !== (one[field] ?? ''))\n const before = (one.investigators ?? []).map((person: any) => person.id).sort().join()\n const after = this.investigators.map(person => person.id).sort().join()\n const patch: any = { id: one.id, ...Object.fromEntries(changed.map(field => [field, this.handling.value(field) || null])) }\n if (before !== after) patch.investigatorIds = this.investigators.map(person => person.id)\n const saved = await this.handling.submit(() => this.saves.handle.run({ patch }))\n if (saved) notify({ message: i18next.t('text.compliance-case-saved') })\n }\n\n private async addEntry() {\n const writtenOn = this.entry.value('writtenOn')\n const body = this.entry.value('body')\n const files = this.entry.value('files') ?? []\n const added = await this.entry.submit(() =>\n this.saves.entry.run({ caseId: this.one.id, writtenOn, body, attach: files }, { context: files.length ? uploadContext(() => {}) : undefined })\n )\n if (added) notify({ message: i18next.t('text.compliance-case-saved') })\n }\n}\n"]}
1
+ {"version":3,"file":"compliance-case-sheet.js","sourceRoot":"","sources":["../../client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AC,EAAE,CAAC,CAAA;IACzE,CAAC;IAEO,KAAK,CAAC,QAAQ;QACpB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;QAC7C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CACzC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAC/I,CAAA;QACD,IAAI,KAAK;YAAE,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAA;IACzE,CAAC;;AAtM2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAY;AAGtB;IAAhB,KAAK,EAAE;;qDAAsB;AA1EnB,mBAAmB;IAD/B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,mBAAmB,CA8Q/B","sourcesContent":["import '@operato/input/ox-input-date.js'\nimport '@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/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 { DraftController } from '@operato/shell'\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\n/** Opens one case's sheet; resolves when it closes. */\nexport function openComplianceCaseSheet(id: string): Promise<void> {\n return new Promise(resolve => {\n const popup: any = openPopup(html`<compliance-case-sheet .caseId=${id} @close=${() => popup.close()}></compliance-case-sheet>`, {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.compliance-case-sheet')\n })\n popup.onclosed = () => resolve()\n })\n}\n\nconst HANDLING = ['investigationStartedOn', 'protectionMeasures', 'victimOpinion', 'finding', 'actionOnAccused', 'resultNotice', 'resultToldOn', 'closedOn']\nconst DAYS = ['investigationStartedOn', 'resultToldOn', 'closedOn']\nconst kebab = (name: string) => name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()\nconst today = () => {\n const now = new Date()\n return new Date(now.getTime() - now.getTimezoneOffset() * 60000).toISOString().slice(0, 10)\n}\n\ntype Person = { id: string; name: string; note?: string }\ntype Handling = Record<string, any> & { investigators: Person[] }\ntype Entry = { writtenOn: string; body: string; files: File[] }\n\n/**\n * 사건 처리 (ADR-0187 decision 21) - one case whole, for its handlers and investigators: the report, who investigates\n * it, the investigation record, the protection of the victim with their view, the finding, what was done to those\n * reported against, the result told and the closing. A value changed keeps a correction; nothing is deleted.\n */\n@customElement('compliance-case-sheet')\nexport class ComplianceCaseSheet 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 dl {\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 2px var(--spacing-large, 12px);\n margin: 0;\n }\n dt {\n color: var(--ui-muted);\n }\n dd {\n margin: 0;\n white-space: pre-wrap;\n }\n h4 {\n margin: var(--spacing-medium, 8px) 0 0;\n }\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n li {\n padding: var(--spacing-small, 4px) 0;\n border-top: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n white-space: pre-wrap;\n }\n .muted {\n color: var(--ui-muted);\n }\n .chips,\n .found {\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 textarea {\n min-height: 64px;\n }\n `\n ]\n\n @property({ type: String }) caseId = ''\n\n /* The words typed to find an investigator. */\n @state() private searched = ''\n\n /* The case, read for the case the sheet opens (ADR-0190). */\n private record = new QueryController(\n this,\n gql`\n query ($id: String!) {\n complianceCase(id: $id) {\n id kind status receivedOn investigationDueOn occurredOn description\n investigationStartedOn protectionMeasures victimOpinion finding actionOnAccused resultNotice resultToldOn closedOn\n reporter { id name } victim { id name } accused { id name } investigators { id name email }\n attachments { id name fullpath }\n entries { id writtenOn body creator { id name } attachments { id name fullpath } }\n corrections { id field before after createdAt creator { id name } }\n }\n }\n `,\n { variables: () => (this.caseId ? { id: this.caseId } : undefined) }\n )\n\n /* What is typed over the handling read, and the investigation entry being written. */\n private handling = new DraftController<Handling>(this, {\n read: () => {\n const one = this.one\n if (!one) return undefined\n return {\n ...Object.fromEntries(HANDLING.map(field => [field, one[field] ?? ''])),\n investigators: (one.investigators ?? []).map((person: any) => ({ id: person.id, name: person.name, note: person.email }))\n } as Handling\n },\n key: () => this.caseId\n })\n private entry = new DraftController<Entry>(this, { read: () => ({ writtenOn: today(), body: '', files: [] }), key: () => this.caseId })\n\n /* Each save reads the case again; its refusal is said in the sheet. */\n private saves = {\n handle: this.saving(gql`mutation ($patch: ComplianceCaseHandling!) { handleComplianceCase(patch: $patch) { id } }`),\n entry: this.saving(gql`\n mutation ($caseId: String!, $writtenOn: String!, $body: String!, $attach: [Upload!]) {\n addComplianceCaseEntry(caseId: $caseId, writtenOn: $writtenOn, body: $body, attach: $attach) { id }\n }\n `)\n }\n\n private saving(mutation: any) {\n return new MutationController(this, mutation, { refetch: () => [this.record], showsError: true })\n }\n\n private get one(): any {\n return this.record.data?.complianceCase ?? null\n }\n\n private get investigators(): Person[] {\n return this.handling.value('investigators') ?? []\n }\n\n private get working() {\n return Object.values(this.saves).some(save => save.pending)\n }\n\n /** What went wrong last: the read, or a save. */\n private get message() {\n const failed = this.record.error ?? this.saves.handle.error ?? this.saves.entry.error\n return failed ? failureOf(failed) : ''\n }\n\n /* The users the words find (ADR-0190). */\n private choices = new QueryController(\n this,\n gql`\n query ($text: String!) {\n complianceCaseInvestigatorChoices(text: $text) { id name note }\n }\n `,\n { variables: () => (this.searched.trim() ? { text: this.searched } : undefined), keepPrevious: true }\n )\n\n private get found(): Person[] {\n return this.searched.trim() ? (this.choices.data?.complianceCaseInvestigatorChoices ?? []) : []\n }\n\n render() {\n const one = this.one\n if (!one) return html`<div class=\"body\"><span invalid>${this.message}</span></div>`\n const closed = !!one.closedOn\n const fact = (field: string, value: any) => (value ? html`<dt>${i18next.t(`field.compliance-case-${field}`)}</dt><dd>${value}</dd>` : nothing)\n return html`\n <div class=\"body\">\n <dl>\n ${fact('kind', wordOf('compliance-case-kind', one.kind))} ${fact('status', wordOf('compliance-case-status', one.status))} ${fact('received-on', one.receivedOn)}\n ${fact('investigation-due-on', one.investigationDueOn)} ${fact('reporter', one.reporter?.name)} ${fact('victim', one.victim?.name)}\n ${fact('accused', (one.accused ?? []).map((person: any) => person.name).join(', '))} ${fact('occurred-on', one.occurredOn)} ${fact('description', one.description)}\n ${fact('attachments', (one.attachments ?? []).length ? html`${one.attachments.map((file: any) => html`<a href=${file.fullpath} target=\"_blank\">${file.name}</a> `)}` : '')}\n </dl>\n\n <div class=\"field\">\n <span>${i18next.t('field.compliance-case-investigators')}</span>\n <div class=\"chips\">\n ${this.investigators.map(\n person =>\n html`<button type=\"button\" ?disabled=${closed} aria-label=${i18next.t('button.compliance-case-remove')} @click=${() => this.handling.set('investigators', this.investigators.filter(other => other.id !== person.id))}>\n ${person.name}<md-icon>close</md-icon>\n </button>`\n )}\n </div>\n ${closed\n ? nothing\n : html`<input placeholder=${i18next.t('text.compliance-case-find-person')} @input=${(e: any) => this.find(e.target.value)} />\n <div class=\"found\">\n ${this.found\n .filter(person => !this.investigators.some(other => other.id === person.id))\n .map(person => html`<button type=\"button\" @click=${() => (this.handling.set('investigators', [...this.investigators, person]), (this.searched = ''))}>${person.note ? `${person.name} · ${person.note}` : person.name}</button>`)}\n </div>`}\n </div>\n\n ${HANDLING.map(field =>\n DAYS.includes(field)\n ? html`<label class=\"field\">\n <span>${i18next.t(`field.compliance-case-${kebab(field)}`)}</span>\n <ox-input-date type=\"date\" ?disabled=${closed} .value=${this.handling.value(field) ?? ''} @change=${(e: any) => this.handling.set(field, e.target.value)}></ox-input-date>\n </label>`\n : html`<label class=\"field\">\n <span>${i18next.t(`field.compliance-case-${kebab(field)}`)}</span>\n <textarea ?disabled=${closed} .value=${this.handling.value(field) ?? ''} @input=${(e: any) => this.handling.set(field, e.target.value)}></textarea>\n </label>`\n )}\n\n <h4>${i18next.t('field.compliance-case-entries')}</h4>\n ${(one.entries ?? []).length\n ? html`<ul>\n ${one.entries.map(\n (entry: any) => html`<li>\n <span class=\"muted\">${entry.writtenOn} · ${entry.creator?.name ?? ''}</span><br />${entry.body}\n ${(entry.attachments ?? []).map((file: any) => html` <a href=${file.fullpath} target=\"_blank\">${file.name}</a>`)}\n </li>`\n )}\n </ul>`\n : html`<span class=\"muted\">${i18next.t('text.compliance-case-entries-empty')}</span>`}\n ${closed\n ? nothing\n : html`<label class=\"field\">\n <span>${i18next.t('field.compliance-case-entry-written-on')}</span>\n <ox-input-date type=\"date\" .value=${this.entry.value('writtenOn') ?? ''} @change=${(e: any) => this.entry.set('writtenOn', e.target.value)}></ox-input-date>\n </label>\n <label class=\"field\">\n <span>${i18next.t('field.compliance-case-entry-body')}</span>\n <textarea .value=${this.entry.value('body') ?? ''} @input=${(e: any) => this.entry.set('body', e.target.value)}></textarea>\n </label>\n <div class=\"field\">\n <ox-input-file multiple icon=\"attach_file\" @change=${(e: CustomEvent) => this.entry.set('files', [...((e.detail as File[]) ?? [])])}></ox-input-file>\n <md-text-button ?disabled=${this.working || !(this.entry.value('body') ?? '').trim()} @click=${() => this.addEntry()}>${i18next.t('button.compliance-case-add-entry')}</md-text-button>\n </div>`}\n ${(one.corrections ?? []).length\n ? html`<h4>${i18next.t('field.compliance-case-corrections')}</h4>\n <ul>\n ${one.corrections.map(\n (row: any) =>\n html`<li class=\"muted\">${new Date(row.createdAt).toLocaleString()} · ${row.creator?.name ?? ''} · ${i18next.t(`field.compliance-case-${kebab(row.field === 'investigatorIds' ? 'investigators' : row.field)}`)}: ${row.before ?? ''} → ${row.after ?? ''}</li>`\n )}\n </ul>`\n : nothing}\n <span invalid>${this.message}</span>\n </div>\n\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.dispatchEvent(new CustomEvent('close'))}>${i18next.t('button.close')}</md-text-button>\n ${closed ? nothing : html`<md-filled-button slot=\"confirm\" ?disabled=${this.working} @click=${() => this.save()}>${i18next.t('button.save')}</md-filled-button>`}\n </ox-popup-actions>\n `\n }\n\n private find(text: string) {\n this.searched = text\n }\n\n /** Only what was changed goes, as a correction of what was read. */\n private async save() {\n const one = this.one\n const changed = HANDLING.filter(field => (this.handling.value(field) ?? '') !== (one[field] ?? ''))\n const before = (one.investigators ?? []).map((person: any) => person.id).sort().join()\n const after = this.investigators.map(person => person.id).sort().join()\n const patch: any = { id: one.id, ...Object.fromEntries(changed.map(field => [field, this.handling.value(field) || null])) }\n if (before !== after) patch.investigatorIds = this.investigators.map(person => person.id)\n const saved = await this.handling.submit(() => this.saves.handle.run({ patch }))\n if (saved) notify({ message: i18next.t('text.compliance-case-saved') })\n }\n\n private async addEntry() {\n const writtenOn = this.entry.value('writtenOn')\n const body = this.entry.value('body')\n const files = this.entry.value('files') ?? []\n const added = await this.entry.submit(() =>\n this.saves.entry.run({ caseId: this.one.id, writtenOn, body, attach: files }, { context: files.length ? uploadContext(() => {}) : undefined })\n )\n if (added) notify({ message: i18next.t('text.compliance-case-saved') })\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import '@operato/input/ox-input-date.js';
1
2
  import '@material/web/button/filled-button.js';
2
3
  import '@material/web/button/text-button.js';
3
4
  import '@operato/input/ox-input-file.js';
@@ -1,4 +1,5 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
+ import '@operato/input/ox-input-date.js';
2
3
  import '@material/web/button/filled-button.js';
3
4
  import '@material/web/button/text-button.js';
4
5
  import '@operato/input/ox-input-file.js';
@@ -102,7 +103,7 @@ let InventionReportForm = class InventionReportForm extends localize(i18next)(Li
102
103
 
103
104
  <label class="field">
104
105
  <span>${i18next.t('field.invention-reported-on')}</span>
105
- <input type="date" .value=${this.reportedOn} @input=${(e) => (this.reportedOn = e.target.value)} />
106
+ <ox-input-date type="date" .value=${this.reportedOn} @change=${(e) => (this.reportedOn = e.target.value)}></ox-input-date>
106
107
  </label>
107
108
 
108
109
  <label class="field">
@@ -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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AAQ,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAC7G,CAAA;QACD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAA;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"]}
1
+ {"version":3,"file":"invention-report-form.js","sourceRoot":"","sources":["../../client/components/invention-report-form.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,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,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrF,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,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AmB,CAsH/B","sourcesContent":["import '@operato/input/ox-input-date.js'\nimport '@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 <ox-input-date type=\"date\" .value=${this.reportedOn} @change=${(e: any) => (this.reportedOn = e.target.value)}></ox-input-date>\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"]}
@@ -1,5 +1,7 @@
1
+ import '@operato/input/ox-input-date.js';
1
2
  import '@material/web/button/filled-button.js';
2
3
  import '@material/web/button/text-button.js';
4
+ import '@operato/input/ox-input-file.js';
3
5
  import '@operato/input/ox-input-select-buttons.js';
4
6
  import '@operato/input/ox-select.js';
5
7
  import '@operato/popup/ox-popup-actions.js';
@@ -34,6 +36,8 @@ export declare class SealUseForm extends SealUseForm_base {
34
36
  private copies;
35
37
  private usableUntil;
36
38
  private notes;
39
+ private files;
40
+ private progress?;
37
41
  private choices;
38
42
  private recording;
39
43
  connectedCallback(): void;
@@ -45,6 +49,7 @@ export declare class SealUseForm extends SealUseForm_base {
45
49
  render(): import("lit-html").TemplateResult<1>;
46
50
  /** One value among many - the framework popup list with its search box on top. */
47
51
  private chooser;
52
+ private pick;
48
53
  private record;
49
54
  }
50
55
  export {};
@@ -1,6 +1,8 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
+ import '@operato/input/ox-input-date.js';
2
3
  import '@material/web/button/filled-button.js';
3
4
  import '@material/web/button/text-button.js';
5
+ import '@operato/input/ox-input-file.js';
4
6
  import '@operato/input/ox-input-select-buttons.js';
5
7
  import '@operato/input/ox-select.js';
6
8
  import '@operato/popup/ox-popup-actions.js';
@@ -8,7 +10,7 @@ import '@operato/popup/ox-popup-list.js';
8
10
  import gql from 'graphql-tag';
9
11
  import { css, html, LitElement, nothing } from 'lit';
10
12
  import { customElement, property, state } from 'lit/decorators.js';
11
- import { MutationController, QueryController } from '@operato/graphql';
13
+ import { MutationController, QueryController, uploadContext } from '@operato/graphql';
12
14
  import { i18next, localize } from '@operato/i18n';
13
15
  import { notify, openPopup } from '@operato/layout';
14
16
  import { CommonPopupStyles, FormFieldStyles, PopupBodyStyles, PopupFieldStyles } from '@operato/styles';
@@ -43,6 +45,8 @@ let SealUseForm = class SealUseForm extends localize(i18next)(LitElement) {
43
45
  this.copies = '1';
44
46
  this.usableUntil = '';
45
47
  this.notes = '';
48
+ /* The paper to be stamped - a copy the approver opens from the approval (2026-11-10). */
49
+ this.files = [];
46
50
  /* The seals in use and the employees who may ask for one (ADR-0190). */
47
51
  this.choices = new QueryController(this, gql `
48
52
  query {
@@ -56,8 +60,8 @@ let SealUseForm = class SealUseForm extends localize(i18next)(LitElement) {
56
60
  `);
57
61
  /* Its failure is drawn under the notes, beside the form. */
58
62
  this.recording = new MutationController(this, gql `
59
- mutation ($use: NewSealUse!) {
60
- recordSealUse(use: $use) { id status }
63
+ mutation ($use: NewSealUse!, $files: [Upload!]) {
64
+ recordSealUse(use: $use, files: $files) { id status }
61
65
  }
62
66
  `, { showsError: true });
63
67
  }
@@ -141,7 +145,7 @@ let SealUseForm = class SealUseForm extends localize(i18next)(LitElement) {
141
145
 
142
146
  <label class="field">
143
147
  <span>${i18next.t(`field.seal-use-used-on-${this.kind.toLowerCase().replace('_', '-')}`)}</span>
144
- <input type="date" .value=${this.usedOn} @input=${(e) => (this.usedOn = e.target.value)} />
148
+ <ox-input-date type="date" .value=${this.usedOn} @change=${(e) => (this.usedOn = e.target.value)}></ox-input-date>
145
149
  </label>
146
150
 
147
151
  ${certificate
@@ -164,7 +168,7 @@ let SealUseForm = class SealUseForm extends localize(i18next)(LitElement) {
164
168
  ${this.kind === 'TAKE_OUT'
165
169
  ? html `<label class="field">
166
170
  <span>${i18next.t('field.seal-use-return-due-on')}</span>
167
- <input type="date" .value=${this.returnDueOn} @input=${(e) => (this.returnDueOn = e.target.value)} />
171
+ <ox-input-date type="date" .value=${this.returnDueOn} @change=${(e) => (this.returnDueOn = e.target.value)}></ox-input-date>
168
172
  </label>`
169
173
  : nothing}
170
174
  ${certificate
@@ -174,11 +178,18 @@ let SealUseForm = class SealUseForm extends localize(i18next)(LitElement) {
174
178
  </label>
175
179
  <label class="field">
176
180
  <span>${i18next.t('field.seal-use-usable-until')}</span>
177
- <input type="date" .value=${this.usableUntil} @input=${(e) => (this.usableUntil = e.target.value)} />
181
+ <ox-input-date type="date" .value=${this.usableUntil} @change=${(e) => (this.usableUntil = e.target.value)}></ox-input-date>
178
182
  <span>${i18next.t('text.seal-use-usable-until-hint')}</span>
179
183
  </label>`
180
184
  : nothing}
181
185
 
186
+ <div class="field">
187
+ <span>${i18next.t('field.seal-use-papers')}</span>
188
+ ${this.files.length ? html `<ul>${this.files.map(one => html `<li>${one.name}</li>`)}</ul>` : nothing}
189
+ <ox-input-file quiet hide-filelist multiple icon="attach_file" .dropTarget=${this} .progress=${this.progress} @change=${(e) => this.pick(e)}></ox-input-file>
190
+ <span>${i18next.t('text.seal-use-papers-hint')}</span>
191
+ </div>
192
+
182
193
  <label class="field">
183
194
  <span>${i18next.t('field.seal-use-notes')}</span>
184
195
  <input .value=${this.notes} @input=${(e) => (this.notes = e.target.value)} />
@@ -200,9 +211,20 @@ let SealUseForm = class SealUseForm extends localize(i18next)(LitElement) {
200
211
  <ox-popup-list align-left nowrap with-search>${options.map(one => html `<div option value=${one.value}>${one.display}</div>`)}</ox-popup-list>
201
212
  </ox-select>`;
202
213
  }
214
+ pick(e) {
215
+ const picked = [...(e.detail ?? [])];
216
+ /* The picker's own reset says `change` again, with nothing - that one is let go. */
217
+ if (!picked.length)
218
+ return;
219
+ e.target.reset?.();
220
+ this.files = [...this.files, ...picked];
221
+ }
203
222
  async record() {
204
223
  const certificate = this.kind === 'CERTIFICATE';
224
+ /* The paper goes with the use, its upload's progress drawn on the picker. */
225
+ const upload = this.files.length ? { context: uploadContext((fraction) => (this.progress = fraction)) } : undefined;
205
226
  const done = await this.recording.run({
227
+ files: this.files,
206
228
  use: {
207
229
  kind: this.kind,
208
230
  sealId: this.sealId,
@@ -216,7 +238,7 @@ let SealUseForm = class SealUseForm extends localize(i18next)(LitElement) {
216
238
  usableUntil: certificate ? this.usableUntil || null : null,
217
239
  notes: this.notes
218
240
  }
219
- });
241
+ }, upload);
220
242
  if (!done)
221
243
  return;
222
244
  const written = done.recordSealUse;
@@ -272,6 +294,14 @@ __decorate([
272
294
  state(),
273
295
  __metadata("design:type", Object)
274
296
  ], SealUseForm.prototype, "notes", void 0);
297
+ __decorate([
298
+ state(),
299
+ __metadata("design:type", Array)
300
+ ], SealUseForm.prototype, "files", void 0);
301
+ __decorate([
302
+ state(),
303
+ __metadata("design:type", Number)
304
+ ], SealUseForm.prototype, "progress", void 0);
275
305
  SealUseForm = __decorate([
276
306
  customElement('seal-use-form')
277
307
  ], SealUseForm);