@things-factory/kpi 9.0.23 → 9.0.25

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 (76) hide show
  1. package/client/pages/kpi/kpi-viz-editor.ts +1 -1
  2. package/client/pages/kpi-category-value/kpi-category-value-list-page.ts +404 -0
  3. package/client/pages/kpi-metric-value/kpi-metric-value-editor-page.ts +763 -0
  4. package/client/pages/kpi-metric-value/kpi-metric-value-list-page.ts +12 -0
  5. package/client/pages/kpi-value/kpi-value-editor-page.ts +774 -0
  6. package/client/pages/kpi-value/kpi-value-list-page.ts +13 -0
  7. package/client/route.ts +16 -0
  8. package/dist-client/pages/kpi/kpi-viz-editor.d.ts +0 -1
  9. package/dist-client/pages/kpi/kpi-viz-editor.js +1 -1
  10. package/dist-client/pages/kpi/kpi-viz-editor.js.map +1 -1
  11. package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.d.ts +63 -0
  12. package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.js +393 -0
  13. package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.js.map +1 -0
  14. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +58 -0
  15. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +736 -0
  16. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +1 -0
  17. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +1 -0
  18. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +11 -0
  19. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -1
  20. package/dist-client/pages/kpi-value/kpi-value-editor-page.d.ts +55 -0
  21. package/dist-client/pages/kpi-value/kpi-value-editor-page.js +748 -0
  22. package/dist-client/pages/kpi-value/kpi-value-editor-page.js.map +1 -0
  23. package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +9 -2
  24. package/dist-client/pages/kpi-value/kpi-value-list-page.js +12 -0
  25. package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
  26. package/dist-client/route.d.ts +1 -1
  27. package/dist-client/route.js +12 -0
  28. package/dist-client/route.js.map +1 -1
  29. package/dist-client/tsconfig.tsbuildinfo +1 -1
  30. package/dist-server/service/index.d.ts +4 -2
  31. package/dist-server/service/index.js +5 -0
  32. package/dist-server/service/index.js.map +1 -1
  33. package/dist-server/service/kpi-category/kpi-category-mutation.d.ts +2 -3
  34. package/dist-server/service/kpi-category/kpi-category-mutation.js +149 -78
  35. package/dist-server/service/kpi-category/kpi-category-mutation.js.map +1 -1
  36. package/dist-server/service/kpi-category/kpi-category-query.d.ts +1 -9
  37. package/dist-server/service/kpi-category/kpi-category-query.js +3 -165
  38. package/dist-server/service/kpi-category/kpi-category-query.js.map +1 -1
  39. package/dist-server/service/kpi-category-value/index.d.ts +6 -0
  40. package/dist-server/service/kpi-category-value/index.js +10 -0
  41. package/dist-server/service/kpi-category-value/index.js.map +1 -0
  42. package/dist-server/service/kpi-category-value/kpi-category-value-mutation.d.ts +8 -0
  43. package/dist-server/service/kpi-category-value/kpi-category-value-mutation.js +102 -0
  44. package/dist-server/service/kpi-category-value/kpi-category-value-mutation.js.map +1 -0
  45. package/dist-server/service/kpi-category-value/kpi-category-value-query.d.ts +13 -0
  46. package/dist-server/service/kpi-category-value/kpi-category-value-query.js +91 -0
  47. package/dist-server/service/kpi-category-value/kpi-category-value-query.js.map +1 -0
  48. package/dist-server/service/kpi-category-value/kpi-category-value-type.d.ts +19 -0
  49. package/dist-server/service/kpi-category-value/kpi-category-value-type.js +73 -0
  50. package/dist-server/service/kpi-category-value/kpi-category-value-type.js.map +1 -0
  51. package/dist-server/service/kpi-category-value/kpi-category-value.d.ts +19 -0
  52. package/dist-server/service/kpi-category-value/kpi-category-value.js +91 -0
  53. package/dist-server/service/kpi-category-value/kpi-category-value.js.map +1 -0
  54. package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +20 -0
  55. package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +1 -1
  56. package/dist-server/service/kpi-value/kpi-value-mutation.d.ts +1 -0
  57. package/dist-server/service/kpi-value/kpi-value-mutation.js +60 -0
  58. package/dist-server/service/kpi-value/kpi-value-mutation.js.map +1 -1
  59. package/dist-server/tsconfig.tsbuildinfo +1 -1
  60. package/package.json +5 -5
  61. package/server/service/index.ts +5 -0
  62. package/server/service/kpi-category/kpi-category-mutation.ts +154 -81
  63. package/server/service/kpi-category/kpi-category-query.ts +1 -155
  64. package/server/service/kpi-category-value/index.ts +7 -0
  65. package/server/service/kpi-category-value/kpi-category-value-mutation.ts +88 -0
  66. package/server/service/kpi-category-value/kpi-category-value-query.ts +62 -0
  67. package/server/service/kpi-category-value/kpi-category-value-type.ts +48 -0
  68. package/server/service/kpi-category-value/kpi-category-value.ts +79 -0
  69. package/server/service/kpi-metric-value/kpi-metric-value-mutation.ts +28 -0
  70. package/server/service/kpi-value/kpi-value-mutation.ts +66 -0
  71. package/things-factory.config.js +3 -0
  72. package/translations/en.json +3 -0
  73. package/translations/ja.json +3 -0
  74. package/translations/ko.json +3 -0
  75. package/translations/ms.json +3 -0
  76. package/translations/zh.json +3 -0
@@ -0,0 +1,393 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/icon/icon.js';
3
+ import '@material/web/button/elevated-button.js';
4
+ import '@operato/data-grist/ox-grist.js';
5
+ import '@operato/data-grist/ox-filters-form.js';
6
+ import '@operato/data-grist/ox-record-creator.js';
7
+ import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
8
+ import { PageView, store } from '@operato/shell';
9
+ import { css, html } from 'lit';
10
+ import { customElement, property, query } from 'lit/decorators.js';
11
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
12
+ import { DataGrist } from '@operato/data-grist';
13
+ import { client } from '@operato/graphql';
14
+ import { i18next, localize } from '@operato/i18n';
15
+ import { notify, openPopup } from '@operato/layout';
16
+ import { OxPrompt } from '@operato/popup';
17
+ import { isMobileDevice } from '@operato/utils';
18
+ import { connect } from 'pwa-helpers/connect-mixin';
19
+ import gql from 'graphql-tag';
20
+ let KpiCategoryValueListPage = class KpiCategoryValueListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
21
+ constructor() {
22
+ super(...arguments);
23
+ this.mode = isMobileDevice() ? 'CARD' : 'GRID';
24
+ }
25
+ static { this.styles = [
26
+ ScrollbarStyles,
27
+ CommonGristStyles,
28
+ CommonHeaderStyles,
29
+ css `
30
+ :host {
31
+ display: flex;
32
+
33
+ width: 100%;
34
+
35
+ --grid-record-emphasized-background-color: #8b0000;
36
+ --grid-record-emphasized-color: #ff6b6b;
37
+ }
38
+
39
+ ox-grist {
40
+ overflow-y: auto;
41
+ flex: 1;
42
+ }
43
+
44
+ ox-filters-form {
45
+ flex: 1;
46
+ }
47
+ `
48
+ ]; }
49
+ get context() {
50
+ return {
51
+ title: i18next.t('title.kpi category value list'),
52
+ search: {
53
+ handler: (search) => {
54
+ this.grist.searchText = search;
55
+ },
56
+ value: this.grist.searchText
57
+ },
58
+ filter: {
59
+ handler: () => {
60
+ this.grist.toggleHeadroom();
61
+ }
62
+ },
63
+ help: 'kpi/kpi-category-value',
64
+ actions: [
65
+ {
66
+ title: i18next.t('button.save'),
67
+ action: this._updateKpiCategoryValue.bind(this),
68
+ ...CommonButtonStyles.save
69
+ },
70
+ {
71
+ title: i18next.t('button.delete'),
72
+ action: this._deleteKpiCategoryValue.bind(this),
73
+ ...CommonButtonStyles.delete
74
+ }
75
+ ],
76
+ exportable: {
77
+ name: i18next.t('title.kpi category value list'),
78
+ data: this.exportHandler.bind(this)
79
+ },
80
+ importable: {
81
+ handler: this.importHandler.bind(this)
82
+ }
83
+ };
84
+ }
85
+ render() {
86
+ const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
87
+ return html `
88
+ <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
89
+ <div slot="headroom" class="header">
90
+ <div class="filters">
91
+ <ox-filters-form autofocus without-search></ox-filters-form>
92
+
93
+ <div id="modes">
94
+ <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
95
+ <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
96
+ <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
97
+ </div>
98
+
99
+ <ox-record-creator id="add" .callback=${this.creationCallback.bind(this)}>
100
+ <button>
101
+ <md-icon>add</md-icon>
102
+ </button>
103
+ </ox-record-creator>
104
+ </div>
105
+ </div>
106
+ </ox-grist>
107
+ `;
108
+ }
109
+ async pageInitialized(lifecycle) {
110
+ this.gristConfig = {
111
+ list: {
112
+ fields: ['category', 'valueDate', 'score', 'group', 'createdAt', 'updatedAt', 'creator', 'updater'],
113
+ details: ['category', 'valueDate', 'score', 'group', 'createdAt', 'updatedAt', 'creator', 'updater']
114
+ },
115
+ columns: [
116
+ { type: 'gutter', gutterName: 'sequence' },
117
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
118
+ // KPI Category Value 계산 버튼 추가
119
+ {
120
+ type: 'gutter',
121
+ gutterName: 'button',
122
+ icon: 'calculate',
123
+ title: '계산',
124
+ handlers: {
125
+ click: (columns, data, column, record, rowIndex) => {
126
+ this._calculateKpiCategoryValue(record);
127
+ }
128
+ }
129
+ },
130
+ {
131
+ type: 'string',
132
+ name: 'category',
133
+ header: '카테고리',
134
+ record: { editable: false, renderer: (v, c, r) => r.category?.name },
135
+ width: 150
136
+ },
137
+ { type: 'string', name: 'valueDate', header: '실적일', record: { editable: true }, width: 120 },
138
+ { type: 'number', name: 'score', header: '성과점수', record: { editable: false }, width: 120 },
139
+ { type: 'string', name: 'group', header: '그룹', record: { editable: false }, width: 120 },
140
+ { type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },
141
+ { type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },
142
+ {
143
+ type: 'resource-object',
144
+ name: 'creator',
145
+ header: '생성자',
146
+ record: { editable: false, renderer: (v, c, r) => r.creator?.name },
147
+ width: 120
148
+ },
149
+ {
150
+ type: 'resource-object',
151
+ name: 'updater',
152
+ header: '수정자',
153
+ record: { editable: false, renderer: (v, c, r) => r.updater?.name },
154
+ width: 120
155
+ }
156
+ ]
157
+ };
158
+ }
159
+ async pageUpdated(changes, lifecycle) {
160
+ if (changes.has('mode')) {
161
+ this.grist.mode = this.mode;
162
+ }
163
+ }
164
+ async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
165
+ const response = await client.query({
166
+ query: gql `
167
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
168
+ responses: kpiCategoryValues(filters: $filters, pagination: $pagination, sortings: $sortings) {
169
+ items {
170
+ id
171
+ category {
172
+ id
173
+ name
174
+ }
175
+ valueDate
176
+ score
177
+ group
178
+ updater {
179
+ id
180
+ name
181
+ }
182
+ updatedAt
183
+ creator {
184
+ id
185
+ name
186
+ }
187
+ createdAt
188
+ }
189
+ total
190
+ }
191
+ }
192
+ `,
193
+ variables: {
194
+ filters,
195
+ pagination: { page, limit },
196
+ sortings
197
+ }
198
+ });
199
+ return {
200
+ total: response.data.responses.total || 0,
201
+ records: response.data.responses.items || []
202
+ };
203
+ }
204
+ async _deleteKpiCategoryValue() {
205
+ if (await OxPrompt.open({
206
+ title: i18next.t('text.are_you_sure'),
207
+ text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
208
+ confirmButton: { text: i18next.t('button.confirm') },
209
+ cancelButton: { text: i18next.t('button.cancel') }
210
+ })) {
211
+ const ids = this.grist.selected.map(record => record.id);
212
+ if (ids && ids.length > 0) {
213
+ const response = await client.mutate({
214
+ mutation: gql `
215
+ mutation ($ids: [String!]!) {
216
+ deleteKpiCategoryValues(ids: $ids)
217
+ }
218
+ `,
219
+ variables: {
220
+ ids
221
+ }
222
+ });
223
+ if (!response.errors) {
224
+ this.grist.fetch();
225
+ notify({
226
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
227
+ });
228
+ }
229
+ }
230
+ }
231
+ }
232
+ async _updateKpiCategoryValue() {
233
+ let patches = this.grist.dirtyRecords;
234
+ if (patches && patches.length) {
235
+ patches = patches.map(patch => {
236
+ let patchField = patch.id ? { id: patch.id } : {};
237
+ const dirtyFields = patch.__dirtyfields__;
238
+ for (let key in dirtyFields) {
239
+ patchField[key] = dirtyFields[key].after;
240
+ }
241
+ patchField.cuFlag = patch.__dirty__;
242
+ return patchField;
243
+ });
244
+ const response = await client.mutate({
245
+ mutation: gql `
246
+ mutation ($patches: [KpiCategoryValuePatch!]!) {
247
+ updateMultipleKpiCategoryValue(patches: $patches) {
248
+ id
249
+ category {
250
+ id
251
+ name
252
+ }
253
+ valueDate
254
+ score
255
+ group
256
+ updater {
257
+ id
258
+ name
259
+ }
260
+ updatedAt
261
+ creator {
262
+ id
263
+ name
264
+ }
265
+ createdAt
266
+ }
267
+ }
268
+ `,
269
+ variables: {
270
+ patches
271
+ }
272
+ });
273
+ if (!response.errors) {
274
+ this.grist.fetch();
275
+ notify({
276
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.save') })
277
+ });
278
+ }
279
+ }
280
+ }
281
+ async _calculateKpiCategoryValue(kpiCategoryValue) {
282
+ try {
283
+ const response = await client.mutate({
284
+ mutation: gql `
285
+ mutation ($categoryId: String!, $valueDate: String, $group: String) {
286
+ calculateKpiValue(categoryId: $categoryId, valueDate: $valueDate, group: $group) {
287
+ score
288
+ valueDate
289
+ group
290
+ }
291
+ }
292
+ `,
293
+ variables: {
294
+ categoryId: kpiCategoryValue.category.id,
295
+ valueDate: kpiCategoryValue.valueDate,
296
+ group: kpiCategoryValue.group
297
+ }
298
+ });
299
+ if (!response.errors) {
300
+ const result = response.data.calculateKpiValue;
301
+ // 팝업으로 결과 표시
302
+ await openPopup(html `
303
+ <div style="padding: 20px;">
304
+ <h3>KPI Category Value 계산 결과</h3>
305
+ <p><strong>성과점수:</strong> ${result.score || 'N/A'}</p>
306
+ <p><strong>실적일:</strong> ${result.valueDate || 'N/A'}</p>
307
+ <p><strong>그룹:</strong> ${result.group || 'N/A'}</p>
308
+ </div>
309
+ `);
310
+ // 목록 새로고침
311
+ this.grist.fetch();
312
+ notify({
313
+ message: 'KPI Category Value 계산이 완료되었습니다.'
314
+ });
315
+ }
316
+ }
317
+ catch (error) {
318
+ console.error('KPI Category Value 계산 중 오류:', error);
319
+ notify({
320
+ message: 'KPI Category Value 계산 중 오류가 발생했습니다.'
321
+ });
322
+ }
323
+ }
324
+ async creationCallback(kpiCategoryValue) {
325
+ const response = await client.mutate({
326
+ mutation: gql `
327
+ mutation ($kpiCategoryValue: NewKpiCategoryValue!) {
328
+ createKpiCategoryValue(kpiCategoryValue: $kpiCategoryValue) {
329
+ id
330
+ category {
331
+ id
332
+ name
333
+ }
334
+ valueDate
335
+ score
336
+ group
337
+ updater {
338
+ id
339
+ name
340
+ }
341
+ updatedAt
342
+ creator {
343
+ id
344
+ name
345
+ }
346
+ createdAt
347
+ }
348
+ }
349
+ `,
350
+ variables: {
351
+ kpiCategoryValue
352
+ }
353
+ });
354
+ if (!response.errors) {
355
+ this.grist.fetch();
356
+ notify({
357
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.create') })
358
+ });
359
+ }
360
+ }
361
+ async exportHandler() {
362
+ // 임시로 빈 배열 반환
363
+ return [];
364
+ }
365
+ async importHandler(records) {
366
+ const kpiCategoryValues = records.map(record => ({
367
+ categoryId: record.category?.id || record.category,
368
+ valueDate: record.valueDate,
369
+ score: record.score,
370
+ group: record.group
371
+ }));
372
+ for (const kpiCategoryValue of kpiCategoryValues) {
373
+ await this.creationCallback(kpiCategoryValue);
374
+ }
375
+ }
376
+ };
377
+ __decorate([
378
+ property({ type: Object }),
379
+ __metadata("design:type", Object)
380
+ ], KpiCategoryValueListPage.prototype, "gristConfig", void 0);
381
+ __decorate([
382
+ property({ type: String }),
383
+ __metadata("design:type", String)
384
+ ], KpiCategoryValueListPage.prototype, "mode", void 0);
385
+ __decorate([
386
+ query('ox-grist'),
387
+ __metadata("design:type", DataGrist)
388
+ ], KpiCategoryValueListPage.prototype, "grist", void 0);
389
+ KpiCategoryValueListPage = __decorate([
390
+ customElement('kpi-category-value-list-page')
391
+ ], KpiCategoryValueListPage);
392
+ export { KpiCategoryValueListPage };
393
+ //# sourceMappingURL=kpi-category-value-list-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kpi-category-value-list-page.js","sourceRoot":"","sources":["../../../client/pages/kpi-category-value/kpi-category-value-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,0CAA0C,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAgB,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAW,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,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\nimport '@material/web/button/elevated-button.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-record-creator.js'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup, OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\n@customElement('kpi-category-value-list-page')\nexport class KpiCategoryValueListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.kpi category value list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist.searchText\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'kpi/kpi-category-value',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateKpiCategoryValue.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteKpiCategoryValue.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.kpi category value list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n\n <ox-record-creator id=\"add\" .callback=${this.creationCallback.bind(this)}>\n <button>\n <md-icon>add</md-icon>\n </button>\n </ox-record-creator>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['category', 'valueDate', 'score', 'group', 'createdAt', 'updatedAt', 'creator', 'updater'],\n details: ['category', 'valueDate', 'score', 'group', 'createdAt', 'updatedAt', 'creator', 'updater']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n // KPI Category Value 계산 버튼 추가\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'calculate',\n title: '계산',\n handlers: {\n click: (columns, data, column, record, rowIndex) => {\n this._calculateKpiCategoryValue(record)\n }\n }\n },\n {\n type: 'string',\n name: 'category',\n header: '카테고리',\n record: { editable: false, renderer: (v, c, r) => r.category?.name },\n width: 150\n },\n { type: 'string', name: 'valueDate', header: '실적일', record: { editable: true }, width: 120 },\n { type: 'number', name: 'score', header: '성과점수', record: { editable: false }, width: 120 },\n { type: 'string', name: 'group', header: '그룹', record: { editable: false }, width: 120 },\n { type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },\n { type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },\n {\n type: 'resource-object',\n name: 'creator',\n header: '생성자',\n record: { editable: false, renderer: (v, c, r) => r.creator?.name },\n width: 120\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: '수정자',\n record: { editable: false, renderer: (v, c, r) => r.updater?.name },\n width: 120\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (changes.has('mode')) {\n this.grist.mode = this.mode\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: kpiCategoryValues(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n category {\n id\n name\n }\n valueDate\n score\n group\n updater {\n id\n name\n }\n updatedAt\n creator {\n id\n name\n }\n createdAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteKpiCategoryValue() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteKpiCategoryValues(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateKpiCategoryValue() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [KpiCategoryValuePatch!]!) {\n updateMultipleKpiCategoryValue(patches: $patches) {\n id\n category {\n id\n name\n }\n valueDate\n score\n group\n updater {\n id\n name\n }\n updatedAt\n creator {\n id\n name\n }\n createdAt\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.save') })\n })\n }\n }\n }\n\n async _calculateKpiCategoryValue(kpiCategoryValue) {\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($categoryId: String!, $valueDate: String, $group: String) {\n calculateKpiValue(categoryId: $categoryId, valueDate: $valueDate, group: $group) {\n score\n valueDate\n group\n }\n }\n `,\n variables: {\n categoryId: kpiCategoryValue.category.id,\n valueDate: kpiCategoryValue.valueDate,\n group: kpiCategoryValue.group\n }\n })\n\n if (!response.errors) {\n const result = response.data.calculateKpiValue\n\n // 팝업으로 결과 표시\n await openPopup(html`\n <div style=\"padding: 20px;\">\n <h3>KPI Category Value 계산 결과</h3>\n <p><strong>성과점수:</strong> ${result.score || 'N/A'}</p>\n <p><strong>실적일:</strong> ${result.valueDate || 'N/A'}</p>\n <p><strong>그룹:</strong> ${result.group || 'N/A'}</p>\n </div>\n `)\n\n // 목록 새로고침\n this.grist.fetch()\n\n notify({\n message: 'KPI Category Value 계산이 완료되었습니다.'\n })\n }\n } catch (error) {\n console.error('KPI Category Value 계산 중 오류:', error)\n notify({\n message: 'KPI Category Value 계산 중 오류가 발생했습니다.'\n })\n }\n }\n\n async creationCallback(kpiCategoryValue) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($kpiCategoryValue: NewKpiCategoryValue!) {\n createKpiCategoryValue(kpiCategoryValue: $kpiCategoryValue) {\n id\n category {\n id\n name\n }\n valueDate\n score\n group\n updater {\n id\n name\n }\n updatedAt\n creator {\n id\n name\n }\n createdAt\n }\n }\n `,\n variables: {\n kpiCategoryValue\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.create') })\n })\n }\n }\n\n async exportHandler() {\n // 임시로 빈 배열 반환\n return []\n }\n\n async importHandler(records) {\n const kpiCategoryValues = records.map(record => ({\n categoryId: record.category?.id || record.category,\n valueDate: record.valueDate,\n score: record.score,\n group: record.group\n }))\n\n for (const kpiCategoryValue of kpiCategoryValues) {\n await this.creationCallback(kpiCategoryValue)\n }\n }\n}\n"]}
@@ -0,0 +1,58 @@
1
+ import '@material/web/icon/icon.js';
2
+ import '@material/web/button/elevated-button.js';
3
+ import '@material/web/textfield/outlined-text-field.js';
4
+ import { PageView } from '@operato/shell';
5
+ declare const KpiMetricValueEditorPage_base: (new (...args: any[]) => {
6
+ _storeUnsubscribe: import("redux").Unsubscribe;
7
+ connectedCallback(): void;
8
+ disconnectedCallback(): void;
9
+ stateChanged(_state: unknown): void;
10
+ readonly isConnected: boolean;
11
+ }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
12
+ export declare class KpiMetricValueEditorPage extends KpiMetricValueEditorPage_base {
13
+ static styles: import("lit").CSSResult[];
14
+ group: string;
15
+ startDate: string;
16
+ endDate: string;
17
+ private metrics;
18
+ private dates;
19
+ private loading;
20
+ private error;
21
+ private editingCell;
22
+ private _existingValues;
23
+ get context(): {
24
+ title: string;
25
+ actions: {
26
+ icon: string;
27
+ emphasis: {
28
+ raised: boolean;
29
+ outlined: boolean;
30
+ dense: boolean;
31
+ danger: boolean;
32
+ };
33
+ title: string;
34
+ action: () => void;
35
+ }[];
36
+ };
37
+ render(): import("lit-html").TemplateResult<1>;
38
+ private _renderCellContent;
39
+ private _formatDate;
40
+ private _startEdit;
41
+ private _finishEdit;
42
+ private _loadData;
43
+ private _generateDateArray;
44
+ private _saveValues;
45
+ private _findExistingValue;
46
+ private _getMonthKey;
47
+ private _getQuarterKey;
48
+ private _getYearKey;
49
+ private _getWeekKey;
50
+ private _getMondayOfWeek;
51
+ private _getFirstDayOfMonth;
52
+ private _getFirstDayOfQuarter;
53
+ private _getFirstDayOfYear;
54
+ private _normalizeDateByPeriodType;
55
+ private _cancel;
56
+ pageInitialized(lifecycle: any): Promise<void>;
57
+ }
58
+ export {};