@things-factory/compliance 10.1.259 → 10.1.260
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.
- package/dist-client/components/my-trainings.js +6 -2
- package/dist-client/components/my-trainings.js.map +1 -1
- package/dist-client/components/training-session-form.d.ts +3 -0
- package/dist-client/components/training-session-form.js +24 -1
- package/dist-client/components/training-session-form.js.map +1 -1
- package/dist-client/legal-record/legal-child-grid.d.ts +12 -2
- package/dist-client/legal-record/legal-child-grid.js +22 -2
- package/dist-client/legal-record/legal-child-grid.js.map +1 -1
- package/dist-client/legal-record/legal-grid.d.ts +1 -1
- package/dist-client/legal-record/legal-grid.js +4 -2
- package/dist-client/legal-record/legal-grid.js.map +1 -1
- package/dist-client/pages/compliance-case-list.js +1 -1
- package/dist-client/pages/compliance-case-list.js.map +1 -1
- package/dist-client/pages/dispute-list.js +5 -3
- package/dist-client/pages/dispute-list.js.map +1 -1
- package/dist-client/pages/invention-list.js +4 -3
- package/dist-client/pages/invention-list.js.map +1 -1
- package/dist-client/pages/legal-registration-list.js +6 -4
- package/dist-client/pages/legal-registration-list.js.map +1 -1
- package/dist-client/pages/privacy-record-list.d.ts +1 -1
- package/dist-client/pages/privacy-record-list.js +16 -6
- package/dist-client/pages/privacy-record-list.js.map +1 -1
- package/dist-client/pages/regulation-list.js +2 -2
- package/dist-client/pages/regulation-list.js.map +1 -1
- package/dist-client/pages/seal-use-list.d.ts +7 -0
- package/dist-client/pages/seal-use-list.js +4 -4
- package/dist-client/pages/seal-use-list.js.map +1 -1
- package/dist-client/pages/training-list.d.ts +16 -2
- package/dist-client/pages/training-list.js +63 -31
- package/dist-client/pages/training-list.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/training/training-checks.d.ts +5 -0
- package/dist-server/service/training/training-checks.js +24 -0
- package/dist-server/service/training/training-checks.js.map +1 -1
- package/dist-server/service/training/training-query.d.ts +2 -0
- package/dist-server/service/training/training-query.js +11 -0
- package/dist-server/service/training/training-query.js.map +1 -1
- package/dist-server/service/training/training-register.js +6 -0
- package/dist-server/service/training/training-register.js.map +1 -1
- package/dist-server/service/training/training-rules.d.ts +7 -0
- package/dist-server/service/training/training-rules.js +8 -0
- package/dist-server/service/training/training-rules.js.map +1 -1
- package/dist-server/service/training/training-service.d.ts +11 -0
- package/dist-server/service/training/training-service.js +104 -3
- package/dist-server/service/training/training-service.js.map +1 -1
- package/dist-server/service/training/training-type.d.ts +1 -0
- package/dist-server/service/training/training-type.js +4 -0
- package/dist-server/service/training/training-type.js.map +1 -1
- package/dist-server/service/training/training.d.ts +13 -0
- package/dist-server/service/training/training.js +51 -1
- package/dist-server/service/training/training.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -18
- package/translations/en.json +19 -7
- package/translations/es.json +18 -6
- package/translations/ja.json +19 -7
- package/translations/ko.json +19 -7
- package/translations/ms.json +19 -7
- package/translations/zh.json +19 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regulation-list.js","sourceRoot":"","sources":["../../client/pages/regulation-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;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M,QAAQ,CAAA;YACpD,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAA;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACvD,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;;AA7GQ;IAAR,KAAK,EAAE;;mDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;6CAAA;AAJjC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAiH1B","sourcesContent":["import '@operato/data-grist/ox-grist.js'\n\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { openRegulationForm } from '../components/regulation-form.js'\nimport { failureOf, wordOf } from '../words.js'\n\n/**\n * 규정 (ADR-0187 decisions 2-6) - the company's rules for their keepers: each with the version in force, the one adopted\n * to come, the one being written or in approval, and whether the version in force was filed and told. A rule opens on\n * its versions; a new one is written from its form.\n */\n@customElement('regulation-list')\nexport class RegulationList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]\n\n @state() gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.regulation-list'),\n search: { handler: (search: string) => (this.grist.searchText = search), value: this.grist?.searchText || '' },\n actions: [\n { title: i18next.t('button.regulation-new'), icon: 'add', action: () => this.create() },\n { title: i18next.t('button.regulation-employee-view'), icon: 'visibility', action: () => navigate('regulations') },\n { title: i18next.t('button.delete'), action: () => this.delete(), ...CommonButtonStyles.delete }\n ],\n exportable: { name: i18next.t('title.regulation-list'), data: () => this.grist.exportRecords() }\n }\n }\n\n render() {\n return html`<ox-grist class=\"page-fill\" search-mode=\"term\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}></ox-grist>`\n }\n\n async pageInitialized() {\n const header = (name: string) => i18next.t(`field.regulation-${name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()}`)\n const shown = (name: string, width: number, renderer?: (value: any, column: any, record: any) => any, extra: any = {}) => ({\n type: 'string',\n name,\n header: header(name),\n width,\n ...extra,\n record: { renderer, ...extra.record }\n })\n const day = (value: any) => value ?? ''\n this.gristConfig = {\n rows: { appendable: false, selectable: { multiple: true }, handlers: { click: (columns: any, data: any, column: any, record: any) => record?.id && navigate(`regulation-detail?id=${record.id}`) } },\n pagination: { infinite: true },\n emptyNote: { title: i18next.t('text.regulation-empty'), description: i18next.t('text.regulation-empty-description') },\n list: { fields: ['name', 'inForce'], details: ['kind', 'open'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n shown('code', 120),\n shown('name', 180),\n shown('kind', 120, value => wordOf('regulation-kind', value)),\n shown('inForce', 170, value => (value ? i18next.t('text.regulation-in-force', { version: value.version, day: value.effectiveOn }) : i18next.t('text.regulation-none-in-force'))),\n shown('due', 140, value => (value ? i18next.t('text.regulation-due', { version: value.version, day: value.effectiveOn }) : '')),\n shown('open', 130, value => (value ? `${i18next.t('text.regulation-version-of', { version: value.version })} · ${wordOf('regulation-period', value.status)}` : '')),\n shown('filed', 90, value => (value === null ? '' : value ? i18next.t('text.regulation-filed') : i18next.t('text.regulation-not-filed'))),\n shown('told', 110, value => (value === null ? '' : value ? i18next.t('text.regulation-told') : i18next.t('text.regulation-not-told'))),\n shown('topics', 160, value => (value ?? []).join(', ')),\n shown('effectiveOn', 0, day, { hidden: true })\n ]\n }\n }\n\n async fetchHandler() {\n const response = await client.query({\n query: gql`\n query {\n companyRegulations {\n regulation { id code name kind topics }\n inForce { told version { id version effectiveOn } procedures { kind } }\n due { told version { id version effectiveOn } }\n versions { version { id version status } }\n }\n }\n `,\n fetchPolicy: 'network-only'\n })\n if ((response as any).errors?.length) throw response\n const search = (this.grist?.searchText ?? '').trim()\n const records = response.data.companyRegulations\n .map((one: any) => {\n const open = one.versions.find((view: any) => view.version.status !== 'ADOPTED')?.version\n const filing = one.regulation.kind === 'WORK_RULES' || one.regulation.kind === 'WORK_RULES_ANNEX'\n return {\n ...one.regulation,\n inForce: one.inForce?.version ?? null,\n due: one.due?.version ?? null,\n open: open ?? null,\n filed: one.inForce && filing ? one.inForce.procedures?.some((procedure: any) => procedure.kind === 'FILING') : null,\n told: one.inForce ? one.inForce.told : null\n }\n })\n .filter((one: any) => !search || `${one.code} ${one.name}`.includes(search))\n return { total: records.length, records }\n }\n\n private async create() {\n const created = await openRegulationForm()\n if (created) navigate(`regulation-detail?id=${created.id}`)\n }\n\n private async delete() {\n const ids = this.grist.selected.map((one: any) => one.id).filter(Boolean)\n if (!ids.length) return\n const confirmed = await OxPrompt.open({\n title: i18next.t('button.delete'),\n text: i18next.t('text.regulation-delete-confirm', { count: ids.length }),\n confirmButton: { text: i18next.t('button.delete'), destructive: true },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n if (!confirmed) return\n try {\n const response = await client.mutate({ mutation: gql`mutation ($ids: [String!]!) { deleteRegulations(ids: $ids) }`, variables: { ids } })\n if ((response as any).errors?.length) throw response\n notify({ message: i18next.t('text.regulation-saved') })\n } catch (error) {\n notify({ level: 'error', message: failureOf(error) })\n }\n this.grist.fetch()\n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1B","sourcesContent":["import '@operato/data-grist/ox-grist.js'\n\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { openRegulationForm } from '../components/regulation-form.js'\nimport { failureOf, wordOf } from '../words.js'\n\n/**\n * 규정 (ADR-0187 decisions 2-6) - the company's rules for their keepers: each with the version in force, the one adopted\n * to come, the one being written or in approval, and whether the version in force was filed and told. A rule opens on\n * its versions; a new one is written from its form.\n */\n@customElement('regulation-list')\nexport class RegulationList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]\n\n @state() gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.regulation-list'),\n search: { handler: (search: string) => (this.grist.searchText = search), value: this.grist?.searchText || '' },\n actions: [\n { title: i18next.t('button.regulation-new'), icon: 'add', action: () => this.create() },\n { title: i18next.t('button.regulation-employee-view'), icon: 'visibility', action: () => navigate('regulations') },\n { title: i18next.t('button.delete'), action: () => this.delete(), ...CommonButtonStyles.delete }\n ],\n exportable: { name: i18next.t('title.regulation-list'), data: () => this.grist.exportRecords() }\n }\n }\n\n render() {\n return html`<ox-grist class=\"page-fill\" search-mode=\"term\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}></ox-grist>`\n }\n\n async pageInitialized() {\n const header = (name: string) => i18next.t(`field.regulation-${name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()}`)\n const shown = (name: string, width: number, renderer?: (value: any, column: any, record: any) => any, extra: any = {}) => ({\n type: 'string',\n name,\n header: header(name),\n width,\n ...extra,\n record: { renderer, ...extra.record }\n })\n const day = (value: any) => value ?? ''\n this.gristConfig = {\n rows: { appendable: false, selectable: { multiple: true }, handlers: { click: (columns: any, data: any, column: any, record: any) => record?.id && navigate(`regulation-detail?id=${record.id}`) } },\n pagination: { infinite: true },\n emptyNote: { title: i18next.t('text.regulation-empty'), description: i18next.t('text.regulation-empty-description') },\n list: { fields: ['name', 'inForce'], details: ['kind', 'open'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n shown('code', 120),\n shown('name', 180),\n shown('kind', 120, value => wordOf('regulation-kind', value)),\n shown('inForce', 170, value => (value ? i18next.t('text.regulation-in-force', { version: value.version, day: value.effectiveOn }) : i18next.t('text.regulation-none-in-force'))),\n shown('due', 140, value => (value ? i18next.t('text.regulation-due', { version: value.version, day: value.effectiveOn }) : '')),\n shown('open', 130, value => (value ? `${i18next.t('text.regulation-version-of', { version: value.version })} · ${wordOf('regulation-period', value.status)}` : '')),\n shown('filed', 90, value => (value === null ? '' : value ? i18next.t('text.regulation-filed') : i18next.t('text.regulation-not-filed'))),\n shown('told', 110, value => (value === null ? '' : value ? i18next.t('text.regulation-told') : i18next.t('text.regulation-not-told'))),\n shown('topics', 160, value => (value ?? []).join(', ')),\n shown('effectiveOn', 0, day, { hidden: true })\n ]\n }\n }\n\n async fetchHandler() {\n const response = await client.query({\n query: gql`\n query {\n companyRegulations {\n regulation { id code name kind topics }\n inForce { told version { id version effectiveOn } procedures { kind } }\n due { told version { id version effectiveOn } }\n versions { version { id version status } }\n }\n }\n `,\n fetchPolicy: 'network-only'\n })\n if ((response as any).errors?.length) throw response\n const search = (this.grist?.searchText ?? '').trim()\n const records = response.data.companyRegulations\n .map((one: any) => {\n const open = one.versions.find((view: any) => view.version.status !== 'ADOPTED')?.version\n const filing = one.regulation.kind === 'WORK_RULES' || one.regulation.kind === 'WORK_RULES_ANNEX'\n return {\n ...one.regulation,\n inForce: one.inForce?.version ?? null,\n due: one.due?.version ?? null,\n open: open ?? null,\n filed: one.inForce && filing ? one.inForce.procedures?.some((procedure: any) => procedure.kind === 'FILING') : null,\n told: one.inForce ? one.inForce.told : null\n }\n })\n .filter((one: any) => !search || `${one.code} ${one.name}`.includes(search))\n return { total: records.length, records }\n }\n\n private async create() {\n const created = await openRegulationForm()\n if (created) navigate(`regulation-detail?id=${created.id}`)\n }\n\n private async delete() {\n const ids = this.grist.selected.map((one: any) => one.id).filter(Boolean)\n if (!ids.length) return notify({ level: 'warn', message: i18next.t('text.regulation-pick-to-delete') })\n const confirmed = await OxPrompt.open({\n title: i18next.t('button.delete'),\n text: i18next.t('text.regulation-delete-confirm', { count: ids.length }),\n confirmButton: { text: i18next.t('button.delete'), destructive: true },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n if (!confirmed) return\n try {\n const response = await client.mutate({ mutation: gql`mutation ($ids: [String!]!) { deleteRegulations(ids: $ids) }`, variables: { ids } })\n if ((response as any).errors?.length) throw response\n notify({ message: i18next.t('text.regulation-saved') })\n } catch (error) {\n notify({ level: 'error', message: failureOf(error) })\n }\n this.grist.fetch()\n }\n}\n"]}
|
|
@@ -22,9 +22,15 @@ export declare class SealUseList extends SealUseList_base {
|
|
|
22
22
|
handler: () => void;
|
|
23
23
|
};
|
|
24
24
|
actions: ({
|
|
25
|
+
id: string;
|
|
25
26
|
title: string;
|
|
26
27
|
icon: string;
|
|
27
28
|
action: () => Promise<void>;
|
|
29
|
+
} | {
|
|
30
|
+
title: string;
|
|
31
|
+
icon: string;
|
|
32
|
+
action: () => Promise<void>;
|
|
33
|
+
id?: undefined;
|
|
28
34
|
} | {
|
|
29
35
|
icon: string;
|
|
30
36
|
emphasis: {
|
|
@@ -35,6 +41,7 @@ export declare class SealUseList extends SealUseList_base {
|
|
|
35
41
|
};
|
|
36
42
|
title: string;
|
|
37
43
|
action: () => Promise<void>;
|
|
44
|
+
id?: undefined;
|
|
38
45
|
})[];
|
|
39
46
|
exportable: {
|
|
40
47
|
name: string;
|
|
@@ -28,7 +28,7 @@ let SealUseList = class SealUseList extends localize(i18next)(PageView) {
|
|
|
28
28
|
search: { handler: (search) => (this.grist.searchText = search), value: this.grist?.searchText || '' },
|
|
29
29
|
filter: { handler: () => this.grist.toggleHeadroom() },
|
|
30
30
|
actions: [
|
|
31
|
-
{ title: i18next.t('button.seal-use-
|
|
31
|
+
{ id: 'seal-use-new', title: i18next.t('button.seal-use-new'), icon: 'approval', action: () => this.record() },
|
|
32
32
|
{ title: i18next.t('button.seal-use-withdraw'), icon: 'undo', action: () => this.withdraw() },
|
|
33
33
|
{ title: i18next.t('button.delete'), action: () => this.delete(), ...CommonButtonStyles.delete },
|
|
34
34
|
{ title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }
|
|
@@ -37,7 +37,7 @@ let SealUseList = class SealUseList extends localize(i18next)(PageView) {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
render() {
|
|
40
|
-
return html `<ox-grist class="page-fill" search-mode="term" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
40
|
+
return html `<ox-grist class="page-fill" search-mode="term" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>
|
|
41
41
|
<div slot="headroom" class="header">
|
|
42
42
|
<div class="filters"><ox-filters-form without-search autofocus></ox-filters-form></div>
|
|
43
43
|
</div>
|
|
@@ -116,7 +116,7 @@ let SealUseList = class SealUseList extends localize(i18next)(PageView) {
|
|
|
116
116
|
async delete() {
|
|
117
117
|
const ids = this.grist.selected.map((one) => one.id).filter(Boolean);
|
|
118
118
|
if (!ids.length)
|
|
119
|
-
return;
|
|
119
|
+
return notify({ level: 'warn', message: i18next.t('text.seal-use-pick-to-delete') });
|
|
120
120
|
const confirmed = await OxPrompt.open({
|
|
121
121
|
title: i18next.t('button.delete'),
|
|
122
122
|
text: i18next.t('text.seal-use-delete-confirm', { count: ids.length }),
|
|
@@ -135,7 +135,7 @@ let SealUseList = class SealUseList extends localize(i18next)(PageView) {
|
|
|
135
135
|
return { id: one.id, cuFlag: 'M', ...Object.fromEntries(changed.map(field => [field, one[field] === '' ? null : one[field]])) };
|
|
136
136
|
});
|
|
137
137
|
if (!patches.length)
|
|
138
|
-
return;
|
|
138
|
+
return notify({ level: 'info', message: i18next.t('text.compliance-nothing-to-save') });
|
|
139
139
|
await this.call([() => client.mutate({ mutation: gql `mutation ($patches: [SealUsePatch!]!) { updateMultipleSealUse(patches: $patches) { id } }`, variables: { patches } })]);
|
|
140
140
|
}
|
|
141
141
|
async call(calls) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seal-use-list.js","sourceRoot":"","sources":["../../client/pages/seal-use-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,iBA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,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QACjI,CAAC,CAAC,CAAA;QACJ,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,OAAM;QAC3B,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAA,2FAA2F,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IAC9K,CAAC;IAEO,KAAK,CAAC,IAAI,CAAC,KAA6B;QAC9C,IAAI,CAAC;YACH,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;gBACxB,MAAM,QAAQ,GAAG,MAAM,GAAG,EAAE,CAAA;gBAC5B,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM;oBAAE,MAAM,QAAQ,CAAA;YAC7C,CAAC;YACD,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAA;QACvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACvD,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;;AApIQ;IAAR,KAAK,EAAE;;gDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;0CAAA;AAJjC,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CAwIvB","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\n\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { PageView } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { openSealUseForm } from '../components/seal-use-form.js'\nimport { failureOf, optionsOf, USE_KINDS, USE_STATUSES, wordOf } from '../words.js'\n\nconst blankFirst = (options: { value: string; display: string }[]) => [{ value: '', display: '' }, ...options]\n\n/**\n * 날인 기록 (ADR-0188 decision 2) - every use of the company's seals: stamped, taken out, certificates issued, newest\n * first. A use is written from its form; on the list only the day a seal came back and the notes change. Narrowed to the\n * seals let out and not back, or to the certificates still accepted.\n */\n@customElement('seal-use-list')\nexport class SealUseList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]\n\n @state() gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.seal-use-list'),\n search: { handler: (search: string) => (this.grist.searchText = search), value: this.grist?.searchText || '' },\n filter: { handler: () => this.grist.toggleHeadroom() },\n actions: [\n { title: i18next.t('button.seal-use-record'), icon: 'approval', action: () => this.record() },\n { title: i18next.t('button.seal-use-withdraw'), icon: 'undo', action: () => this.withdraw() },\n { title: i18next.t('button.delete'), action: () => this.delete(), ...CommonButtonStyles.delete },\n { title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }\n ],\n exportable: { name: i18next.t('title.seal-use-list'), data: () => this.grist.exportRecords() }\n }\n }\n\n render() {\n return html`<ox-grist class=\"page-fill\" search-mode=\"term\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\"><ox-filters-form without-search autofocus></ox-filters-form></div>\n </div>\n </ox-grist>`\n }\n\n async pageInitialized() {\n const header = (name: string) => i18next.t(`field.seal-use-${name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()}`)\n const shown = (name: string, width: number, renderer?: (value: any, column: any, record: any) => any, extra: any = {}) => ({\n type: 'string',\n name,\n header: header(name),\n width,\n sortable: true,\n ...extra,\n record: { renderer, ...extra.record }\n })\n this.gristConfig = {\n rows: { appendable: false, selectable: { multiple: true } },\n pagination: { limit: 100, pages: [50, 100] },\n emptyNote: { title: i18next.t('text.seal-use-empty'), description: i18next.t('text.seal-use-empty-description') },\n list: { fields: ['usedOn', 'seal', 'document'], details: ['kind', 'status', 'purpose'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n shown('usedOn', 100, undefined, { record: { align: 'center' } }),\n shown('kind', 90, value => wordOf('seal-use-kind', value), { type: 'select', filter: { type: 'select', operator: 'eq', options: blankFirst(optionsOf('seal-use-kind', USE_KINDS)) } }),\n shown('seal', 140, value => value?.name ?? '', { sortable: false }),\n shown('requester', 90, value => value?.name ?? '', { sortable: false }),\n shown('document', 200),\n shown('purpose', 160),\n shown('submittedTo', 140),\n shown('returnDueOn', 100, undefined, { record: { align: 'center' } }),\n { type: 'date', name: 'returnedOn', header: header('returnedOn'), width: 110, sortable: true, record: { editable: true, align: 'center' } },\n shown('copies', 60, undefined, { type: 'integer', record: { align: 'right' } }),\n shown('usableUntil', 100, undefined, { record: { align: 'center' } }),\n shown('status', 90, value => wordOf('seal-use-status', value), { type: 'select', filter: { type: 'select', operator: 'eq', options: blankFirst(optionsOf('seal-use-status', USE_STATUSES)) } }),\n shown('decidedBy', 90, value => value?.name ?? '', { sortable: false }),\n { type: 'string', name: 'notes', header: header('notes'), width: 180, record: { editable: true } },\n /* The list's own narrowings - columns only to carry their filters. */\n { type: 'checkbox', name: 'unreturned', header: header('unreturned'), hidden: true, filter: { operator: 'eq', type: 'checkbox' } },\n { type: 'checkbox', name: 'usable', header: header('usable'), hidden: true, filter: { operator: 'eq', type: 'checkbox' } }\n ],\n sorters: [{ name: 'usedOn', desc: true }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [], search }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {\n responses: sealUses(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {\n items {\n id kind usedOn document purpose submittedTo returnDueOn returnedOn copies usableUntil status notes\n seal { id name kind } requester { id name } decidedBy { id name }\n }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, sortings, search: search?.trim() || undefined },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return { total: response.data.responses.total, records: response.data.responses.items }\n }\n\n private async record() {\n if (await openSealUseForm()) this.grist.fetch()\n }\n\n private async withdraw() {\n const chosen = this.grist.selected.filter((one: any) => one.status === 'SUBMITTED')\n if (!chosen.length) return notify({ level: 'warn', message: i18next.t('text.seal-use-pick-submitted') })\n await this.call(chosen.map((one: any) => () => client.mutate({ mutation: gql`mutation ($id: String!) { withdrawSealUse(id: $id) { id } }`, variables: { id: one.id } })))\n }\n\n private async delete() {\n const ids = this.grist.selected.map((one: any) => one.id).filter(Boolean)\n if (!ids.length) return\n const confirmed = await OxPrompt.open({\n title: i18next.t('button.delete'),\n text: i18next.t('text.seal-use-delete-confirm', { count: ids.length }),\n confirmButton: { text: i18next.t('button.delete'), destructive: true },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n if (confirmed) await this.call([() => client.mutate({ mutation: gql`mutation ($ids: [String!]!) { deleteSealUses(ids: $ids) }`, variables: { ids } })])\n }\n\n /** The day a seal came back and the notes - all the list writes. */\n private async save() {\n const patches = this.grist.dirtyRecords\n .filter((one: any) => one.id)\n .map((one: any) => {\n const changed = Object.keys(one.__dirtyfields__ ?? {}).filter(field => field === 'returnedOn' || field === 'notes')\n return { id: one.id, cuFlag: 'M', ...Object.fromEntries(changed.map(field => [field, one[field] === '' ? null : one[field]])) }\n })\n if (!patches.length) return\n await this.call([() => client.mutate({ mutation: gql`mutation ($patches: [SealUsePatch!]!) { updateMultipleSealUse(patches: $patches) { id } }`, variables: { patches } })])\n }\n\n private async call(calls: (() => Promise<any>)[]) {\n try {\n for (const one of calls) {\n const response = await one()\n if (response.errors?.length) throw response\n }\n notify({ message: i18next.t('text.seal-use-saved') })\n } catch (error) {\n notify({ level: 'error', message: failureOf(error) })\n }\n this.grist.fetch()\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"seal-use-list.js","sourceRoot":"","sources":["../../client/pages/seal-use-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACnI,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA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operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\n\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { PageView } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { openSealUseForm } from '../components/seal-use-form.js'\nimport { failureOf, optionsOf, USE_KINDS, USE_STATUSES, wordOf } from '../words.js'\n\nconst blankFirst = (options: { value: string; display: string }[]) => [{ value: '', display: '' }, ...options]\n\n/**\n * 날인 기록 (ADR-0188 decision 2) - every use of the company's seals: stamped, taken out, certificates issued, newest\n * first. A use is written from its form; on the list only the day a seal came back and the notes change. Narrowed to the\n * seals let out and not back, or to the certificates still accepted.\n */\n@customElement('seal-use-list')\nexport class SealUseList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]\n\n @state() gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.seal-use-list'),\n search: { handler: (search: string) => (this.grist.searchText = search), value: this.grist?.searchText || '' },\n filter: { handler: () => this.grist.toggleHeadroom() },\n actions: [\n { id: 'seal-use-new', title: i18next.t('button.seal-use-new'), icon: 'approval', action: () => this.record() },\n { title: i18next.t('button.seal-use-withdraw'), icon: 'undo', action: () => this.withdraw() },\n { title: i18next.t('button.delete'), action: () => this.delete(), ...CommonButtonStyles.delete },\n { title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }\n ],\n exportable: { name: i18next.t('title.seal-use-list'), data: () => this.grist.exportRecords() }\n }\n }\n\n render() {\n return html`<ox-grist class=\"page-fill\" search-mode=\"term\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\"><ox-filters-form without-search autofocus></ox-filters-form></div>\n </div>\n </ox-grist>`\n }\n\n async pageInitialized() {\n const header = (name: string) => i18next.t(`field.seal-use-${name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()}`)\n const shown = (name: string, width: number, renderer?: (value: any, column: any, record: any) => any, extra: any = {}) => ({\n type: 'string',\n name,\n header: header(name),\n width,\n sortable: true,\n ...extra,\n record: { renderer, ...extra.record }\n })\n this.gristConfig = {\n rows: { appendable: false, selectable: { multiple: true } },\n pagination: { limit: 100, pages: [50, 100] },\n emptyNote: { title: i18next.t('text.seal-use-empty'), description: i18next.t('text.seal-use-empty-description') },\n list: { fields: ['usedOn', 'seal', 'document'], details: ['kind', 'status', 'purpose'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n shown('usedOn', 100, undefined, { record: { align: 'center' } }),\n shown('kind', 90, value => wordOf('seal-use-kind', value), { type: 'select', filter: { type: 'select', operator: 'eq', options: blankFirst(optionsOf('seal-use-kind', USE_KINDS)) } }),\n shown('seal', 140, value => value?.name ?? '', { sortable: false }),\n shown('requester', 90, value => value?.name ?? '', { sortable: false }),\n shown('document', 200),\n shown('purpose', 160),\n shown('submittedTo', 140),\n shown('returnDueOn', 100, undefined, { record: { align: 'center' } }),\n { type: 'date', name: 'returnedOn', header: header('returnedOn'), width: 110, sortable: true, record: { editable: true, align: 'center' } },\n shown('copies', 60, undefined, { type: 'integer', record: { align: 'right' } }),\n shown('usableUntil', 100, undefined, { record: { align: 'center' } }),\n shown('status', 90, value => wordOf('seal-use-status', value), { type: 'select', filter: { type: 'select', operator: 'eq', options: blankFirst(optionsOf('seal-use-status', USE_STATUSES)) } }),\n shown('decidedBy', 90, value => value?.name ?? '', { sortable: false }),\n { type: 'string', name: 'notes', header: header('notes'), width: 180, record: { editable: true } },\n /* The list's own narrowings - columns only to carry their filters. */\n { type: 'checkbox', name: 'unreturned', header: header('unreturned'), hidden: true, filter: { operator: 'eq', type: 'checkbox' } },\n { type: 'checkbox', name: 'usable', header: header('usable'), hidden: true, filter: { operator: 'eq', type: 'checkbox' } }\n ],\n sorters: [{ name: 'usedOn', desc: true }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [], search }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {\n responses: sealUses(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {\n items {\n id kind usedOn document purpose submittedTo returnDueOn returnedOn copies usableUntil status notes\n seal { id name kind } requester { id name } decidedBy { id name }\n }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, sortings, search: search?.trim() || undefined },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return { total: response.data.responses.total, records: response.data.responses.items }\n }\n\n private async record() {\n if (await openSealUseForm()) this.grist.fetch()\n }\n\n private async withdraw() {\n const chosen = this.grist.selected.filter((one: any) => one.status === 'SUBMITTED')\n if (!chosen.length) return notify({ level: 'warn', message: i18next.t('text.seal-use-pick-submitted') })\n await this.call(chosen.map((one: any) => () => client.mutate({ mutation: gql`mutation ($id: String!) { withdrawSealUse(id: $id) { id } }`, variables: { id: one.id } })))\n }\n\n private async delete() {\n const ids = this.grist.selected.map((one: any) => one.id).filter(Boolean)\n if (!ids.length) return notify({ level: 'warn', message: i18next.t('text.seal-use-pick-to-delete') })\n const confirmed = await OxPrompt.open({\n title: i18next.t('button.delete'),\n text: i18next.t('text.seal-use-delete-confirm', { count: ids.length }),\n confirmButton: { text: i18next.t('button.delete'), destructive: true },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n if (confirmed) await this.call([() => client.mutate({ mutation: gql`mutation ($ids: [String!]!) { deleteSealUses(ids: $ids) }`, variables: { ids } })])\n }\n\n /** The day a seal came back and the notes - all the list writes. */\n private async save() {\n const patches = this.grist.dirtyRecords\n .filter((one: any) => one.id)\n .map((one: any) => {\n const changed = Object.keys(one.__dirtyfields__ ?? {}).filter(field => field === 'returnedOn' || field === 'notes')\n return { id: one.id, cuFlag: 'M', ...Object.fromEntries(changed.map(field => [field, one[field] === '' ? null : one[field]])) }\n })\n if (!patches.length) return notify({ level: 'info', message: i18next.t('text.compliance-nothing-to-save') })\n await this.call([() => client.mutate({ mutation: gql`mutation ($patches: [SealUsePatch!]!) { updateMultipleSealUse(patches: $patches) { id } }`, variables: { patches } })])\n }\n\n private async call(calls: (() => Promise<any>)[]) {\n try {\n for (const one of calls) {\n const response = await one()\n if (response.errors?.length) throw response\n }\n notify({ message: i18next.t('text.seal-use-saved') })\n } catch (error) {\n notify({ level: 'error', message: failureOf(error) })\n }\n this.grist.fetch()\n }\n}\n"]}
|
|
@@ -3,6 +3,17 @@ import '@operato/data-grist/ox-filters-form.js';
|
|
|
3
3
|
import '@operato/input/ox-input-select-buttons.js';
|
|
4
4
|
import { FetchOption } from '@operato/data-grist';
|
|
5
5
|
import { PageView } from '@operato/shell';
|
|
6
|
+
/**
|
|
7
|
+
* The training year the grid's `year` filter names, else this year - a year the list reads by, never none. A value
|
|
8
|
+
* outside 2000-2999 is no year (`valid: false`), and the list reads this year. Pure.
|
|
9
|
+
*/
|
|
10
|
+
export declare function trainingYearOf(filters: readonly {
|
|
11
|
+
name: string;
|
|
12
|
+
value?: any;
|
|
13
|
+
}[] | undefined, now?: Date): {
|
|
14
|
+
year: number;
|
|
15
|
+
valid: boolean;
|
|
16
|
+
};
|
|
6
17
|
declare const TrainingList_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
7
18
|
/**
|
|
8
19
|
* 법정 의무 교육 (ADR-0187 decisions 15-19) - one screen read four ways, as the audit screen is: the kinds the domain
|
|
@@ -12,8 +23,10 @@ declare const TrainingList_base: (new (...args: any[]) => import("lit").LitEleme
|
|
|
12
23
|
export declare class TrainingList extends TrainingList_base {
|
|
13
24
|
static styles: import("lit").CSSResult[];
|
|
14
25
|
private view;
|
|
15
|
-
private
|
|
26
|
+
private gristConfig;
|
|
16
27
|
private grist;
|
|
28
|
+
/** The year the list reads by and the year actions open - the grid's `year` filter. */
|
|
29
|
+
private get year();
|
|
17
30
|
get context(): {
|
|
18
31
|
title: string;
|
|
19
32
|
search: {
|
|
@@ -30,8 +43,9 @@ export declare class TrainingList extends TrainingList_base {
|
|
|
30
43
|
};
|
|
31
44
|
};
|
|
32
45
|
render(): import("lit-html").TemplateResult<1>;
|
|
46
|
+
pageUpdated(changes: any, lifecycle: any): Promise<void>;
|
|
47
|
+
/** Another view is another list: its address keeps the year chosen and drops the other list's conditions. */
|
|
33
48
|
private show;
|
|
34
|
-
private pickYear;
|
|
35
49
|
private configOf;
|
|
36
50
|
fetchHandler({ page, limit, sortings, filters, search }: FetchOption): Promise<{
|
|
37
51
|
total: any;
|
|
@@ -6,12 +6,12 @@ import gql from 'graphql-tag';
|
|
|
6
6
|
import { css, html } from 'lit';
|
|
7
7
|
import { customElement, query, state } from 'lit/decorators.js';
|
|
8
8
|
import { keyed } from 'lit/directives/keyed.js';
|
|
9
|
-
import { DataGrist } from '@operato/data-grist';
|
|
9
|
+
import { convertListParamToSearchString, DataGrist } from '@operato/data-grist';
|
|
10
10
|
import { client } from '@operato/graphql';
|
|
11
11
|
import { i18next, localize } from '@operato/i18n';
|
|
12
12
|
import { notify } from '@operato/layout';
|
|
13
13
|
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
14
|
-
import { PageView } from '@operato/shell';
|
|
14
|
+
import { navigate, PageView } from '@operato/shell';
|
|
15
15
|
import { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
|
|
16
16
|
import { isMobileDevice } from '@operato/utils';
|
|
17
17
|
import { openTrainingAttendanceForm } from '../components/training-attendance-form.js';
|
|
@@ -21,6 +21,17 @@ import { COMPLETION_STATUSES, TRAINING_KINDS, TRAINING_METHODS, TRAINING_STATES,
|
|
|
21
21
|
import { failureOf } from '../words.js';
|
|
22
22
|
const VIEWS = ['settings', 'standings', 'sessions', 'completions'];
|
|
23
23
|
const blankFirst = (options) => [{ value: '', display: '' }, ...options];
|
|
24
|
+
/**
|
|
25
|
+
* The training year the grid's `year` filter names, else this year - a year the list reads by, never none. A value
|
|
26
|
+
* outside 2000-2999 is no year (`valid: false`), and the list reads this year. Pure.
|
|
27
|
+
*/
|
|
28
|
+
export function trainingYearOf(filters, now = new Date()) {
|
|
29
|
+
const chosen = filters?.find(one => one.name === 'year')?.value;
|
|
30
|
+
if (chosen === undefined || chosen === null || chosen === '')
|
|
31
|
+
return { year: now.getFullYear(), valid: true };
|
|
32
|
+
const year = Number(chosen);
|
|
33
|
+
return Number.isInteger(year) && year >= 2000 && year <= 2999 ? { year, valid: true } : { year: now.getFullYear(), valid: false };
|
|
34
|
+
}
|
|
24
35
|
/**
|
|
25
36
|
* 법정 의무 교육 (ADR-0187 decisions 15-19) - one screen read four ways, as the audit screen is: the kinds the domain
|
|
26
37
|
* trains, where everyone stands this year, the sessions given, and the completions with their certificates. The kinds
|
|
@@ -29,8 +40,12 @@ const blankFirst = (options) => [{ value: '', display: '' }, ...options];
|
|
|
29
40
|
let TrainingList = class TrainingList extends localize(i18next)(PageView) {
|
|
30
41
|
constructor() {
|
|
31
42
|
super(...arguments);
|
|
43
|
+
/*
|
|
44
|
+
* The view is a different list (kinds, standings, sessions, completions - each its own entity), so it stays the
|
|
45
|
+
* page's and the address's `view`. What narrows a list - the year, the column filters, search, sort, page - is the
|
|
46
|
+
* grid's, kept in the address (FOOTER-BUTTON-REVIEW G09): a shared link, coming back and reloading read the same list.
|
|
47
|
+
*/
|
|
32
48
|
this.view = 'settings';
|
|
33
|
-
this.year = new Date().getFullYear();
|
|
34
49
|
}
|
|
35
50
|
static { this.styles = [
|
|
36
51
|
WorkSurfacePageStyles,
|
|
@@ -41,19 +56,12 @@ let TrainingList = class TrainingList extends localize(i18next)(PageView) {
|
|
|
41
56
|
.filters {
|
|
42
57
|
flex-wrap: wrap;
|
|
43
58
|
}
|
|
44
|
-
input[type='number'] {
|
|
45
|
-
width: 80px;
|
|
46
|
-
height: var(--context-action-height, 28px);
|
|
47
|
-
box-sizing: border-box;
|
|
48
|
-
border: 1px solid var(--md-sys-color-outline-variant);
|
|
49
|
-
border-radius: var(--md-sys-shape-corner-small, 4px);
|
|
50
|
-
background: var(--md-sys-color-surface-container-lowest);
|
|
51
|
-
color: var(--md-sys-color-on-surface);
|
|
52
|
-
font: inherit;
|
|
53
|
-
padding: 0 var(--spacing-small, 4px);
|
|
54
|
-
}
|
|
55
59
|
`
|
|
56
60
|
]; }
|
|
61
|
+
/** The year the list reads by and the year actions open - the grid's `year` filter. */
|
|
62
|
+
get year() {
|
|
63
|
+
return trainingYearOf(this.grist?.filters).year;
|
|
64
|
+
}
|
|
57
65
|
get context() {
|
|
58
66
|
const t = i18next.t.bind(i18next);
|
|
59
67
|
const actions = {
|
|
@@ -81,7 +89,7 @@ let TrainingList = class TrainingList extends localize(i18next)(PageView) {
|
|
|
81
89
|
};
|
|
82
90
|
}
|
|
83
91
|
render() {
|
|
84
|
-
return html `${keyed(this.view, html `<ox-grist class="page-fill" search-mode="term" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.
|
|
92
|
+
return html `${keyed(this.view, html `<ox-grist class="page-fill" search-mode="term" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>
|
|
85
93
|
<div slot="headroom" class="header">
|
|
86
94
|
<div class="filters">
|
|
87
95
|
<ox-input-select-buttons
|
|
@@ -89,24 +97,29 @@ let TrainingList = class TrainingList extends localize(i18next)(PageView) {
|
|
|
89
97
|
.value=${this.view}
|
|
90
98
|
@change=${(e) => (e.detail ? this.show(e.detail) : (e.target.value = this.view))}
|
|
91
99
|
></ox-input-select-buttons>
|
|
92
|
-
${this.view === 'settings'
|
|
93
|
-
? ''
|
|
94
|
-
: html `<input type="number" min="2000" max="2999" aria-label=${i18next.t('field.training-year')} .value=${String(this.year)} @change=${(e) => this.pickYear(e)} />`}
|
|
95
100
|
<ox-filters-form without-search></ox-filters-form>
|
|
96
101
|
</div>
|
|
97
102
|
</div>
|
|
98
103
|
</ox-grist>`)}`;
|
|
99
104
|
}
|
|
100
|
-
|
|
105
|
+
async pageUpdated(changes, lifecycle) {
|
|
106
|
+
if (!this.active)
|
|
107
|
+
return;
|
|
108
|
+
const asked = lifecycle?.params?.view;
|
|
109
|
+
const view = VIEWS.includes(asked) ? asked : 'settings';
|
|
110
|
+
if (view === this.view && this.gristConfig)
|
|
111
|
+
return;
|
|
101
112
|
this.view = view;
|
|
113
|
+
this.gristConfig = this.configOf(view);
|
|
102
114
|
this.updateContext();
|
|
103
115
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
116
|
+
/** Another view is another list: its address keeps the year chosen and drops the other list's conditions. */
|
|
117
|
+
show(view) {
|
|
118
|
+
if (view === this.view)
|
|
119
|
+
return;
|
|
120
|
+
const year = this.grist?.filters?.find((one) => one.name === 'year');
|
|
121
|
+
const search = convertListParamToSearchString({ filters: year ? [year] : undefined, base: view === 'settings' ? '' : `view=${view}` });
|
|
122
|
+
navigate(search ? `training-list?${search}` : 'training-list');
|
|
110
123
|
}
|
|
111
124
|
configOf(view) {
|
|
112
125
|
const t = i18next.t.bind(i18next);
|
|
@@ -125,7 +138,19 @@ let TrainingList = class TrainingList extends localize(i18next)(PageView) {
|
|
|
125
138
|
rows: { appendable: false, selectable: { multiple: view === 'completions' } },
|
|
126
139
|
pagination: view === 'settings' ? { infinite: true } : { limit: 100, pages: [50, 100] }
|
|
127
140
|
};
|
|
128
|
-
|
|
141
|
+
/*
|
|
142
|
+
* The year narrows every list but the kinds; there it is not shown and only names the year 「연도 열기」 opens.
|
|
143
|
+
* It is a filter of its own, on no column shown.
|
|
144
|
+
*/
|
|
145
|
+
const year = {
|
|
146
|
+
type: 'integer',
|
|
147
|
+
name: 'year',
|
|
148
|
+
header: t('field.training-year'),
|
|
149
|
+
hidden: true,
|
|
150
|
+
record: { editable: false },
|
|
151
|
+
filter: { type: 'number', operator: 'eq', value: new Date().getFullYear(), ...(view === 'settings' ? { hidden: true } : {}) }
|
|
152
|
+
};
|
|
153
|
+
const gutters = [{ type: 'gutter', gutterName: 'sequence' }, { type: 'gutter', gutterName: 'row-selector', multiple: view === 'completions' }, year];
|
|
129
154
|
switch (view) {
|
|
130
155
|
case 'settings':
|
|
131
156
|
return {
|
|
@@ -167,6 +192,7 @@ let TrainingList = class TrainingList extends localize(i18next)(PageView) {
|
|
|
167
192
|
shown('kind', 180, value => trainingWord('kind', value), select('kind', TRAINING_KINDS)),
|
|
168
193
|
{ type: 'string', name: 'name', header: t('field.training-session-name'), width: 200, record: { editable: true } },
|
|
169
194
|
shown('method', 100, value => trainingWord('method', value), select('method', TRAINING_METHODS)),
|
|
195
|
+
shown('course', 160, value => value?.name ?? ''),
|
|
170
196
|
{ type: 'string', name: 'instructor', header: t('field.training-instructor'), width: 120, record: { editable: true } },
|
|
171
197
|
{ type: 'string', name: 'organisation', header: t('field.training-organisation'), width: 140, record: { editable: true } },
|
|
172
198
|
{ type: 'string', name: 'notes', header: t('field.training-notes'), width: 200, record: { editable: true } }
|
|
@@ -194,7 +220,11 @@ let TrainingList = class TrainingList extends localize(i18next)(PageView) {
|
|
|
194
220
|
}
|
|
195
221
|
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [], search }) {
|
|
196
222
|
const view = this.view;
|
|
197
|
-
|
|
223
|
+
/* The server reads one year, a number; a year outside the range reads this year and says so. */
|
|
224
|
+
const { year, valid } = trainingYearOf(filters);
|
|
225
|
+
if (!valid)
|
|
226
|
+
notify({ level: 'warn', message: i18next.t('error.training-year-invalid') });
|
|
227
|
+
const list = { filters: [...filters.filter(one => one.name !== 'year'), { name: 'year', operator: 'eq', value: year }], pagination: { page, limit }, sortings, search: search?.trim() || undefined };
|
|
198
228
|
const queries = {
|
|
199
229
|
settings: gql `
|
|
200
230
|
query {
|
|
@@ -212,7 +242,7 @@ let TrainingList = class TrainingList extends localize(i18next)(PageView) {
|
|
|
212
242
|
sessions: gql `
|
|
213
243
|
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {
|
|
214
244
|
responses: trainingSessions(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {
|
|
215
|
-
items { id kind year name method startsOn endsOn instructor organisation notes }
|
|
245
|
+
items { id kind year name method startsOn endsOn instructor organisation notes course { id name } }
|
|
216
246
|
total
|
|
217
247
|
}
|
|
218
248
|
}
|
|
@@ -294,7 +324,7 @@ let TrainingList = class TrainingList extends localize(i18next)(PageView) {
|
|
|
294
324
|
.filter((one) => one.id)
|
|
295
325
|
.map((one) => ({ id: one.id, cuFlag: 'M', ...Object.fromEntries(Object.keys(one.__dirtyfields__ ?? {}).map(field => [field, one[field] === '' ? null : one[field]])) }));
|
|
296
326
|
if (!patches.length)
|
|
297
|
-
return;
|
|
327
|
+
return notify({ level: 'info', message: i18next.t('text.compliance-nothing-to-save') });
|
|
298
328
|
await this.call([() => client.mutate({ mutation: gql `mutation ($patches: [TrainingSessionPatch!]!) { updateMultipleTrainingSession(patches: $patches) { id } }`, variables: { patches } })]);
|
|
299
329
|
}
|
|
300
330
|
async call(calls, said) {
|
|
@@ -321,10 +351,12 @@ __decorate([
|
|
|
321
351
|
__decorate([
|
|
322
352
|
state(),
|
|
323
353
|
__metadata("design:type", Object)
|
|
324
|
-
], TrainingList.prototype, "
|
|
354
|
+
], TrainingList.prototype, "gristConfig", void 0);
|
|
325
355
|
__decorate([
|
|
326
356
|
query('ox-grist'),
|
|
327
|
-
__metadata("design:type", DataGrist
|
|
357
|
+
__metadata("design:type", DataGrist
|
|
358
|
+
/** The year the list reads by and the year actions open - the grid's `year` filter. */
|
|
359
|
+
)
|
|
328
360
|
], TrainingList.prototype, "grist", void 0);
|
|
329
361
|
TrainingList = __decorate([
|
|
330
362
|
customElement('training-list')
|