@dssp/supervision 0.0.36 → 1.0.0-alpha.1

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 (106) hide show
  1. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +1 -1
  2. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
  3. package/dist-client/pages/checklist/checklist-view.js +2 -5
  4. package/dist-client/pages/checklist/checklist-view.js.map +1 -1
  5. package/dist-client/route.d.ts +1 -1
  6. package/dist-client/tsconfig.tsbuildinfo +1 -1
  7. package/dist-server/service/index.d.ts +1 -1
  8. package/dist-server/tsconfig.tsbuildinfo +1 -1
  9. package/package.json +13 -13
  10. package/client/bootstrap.ts +0 -1
  11. package/client/index.ts +0 -0
  12. package/client/pages/action-plan/action-plan-importer.ts +0 -94
  13. package/client/pages/action-plan/action-plan-list-page.ts +0 -340
  14. package/client/pages/building-inspection/building-inspection-detail-camera.ts +0 -277
  15. package/client/pages/building-inspection/building-inspection-detail-checklist.ts +0 -258
  16. package/client/pages/building-inspection/building-inspection-detail-drawing.ts +0 -288
  17. package/client/pages/building-inspection/building-inspection-list.ts +0 -565
  18. package/client/pages/building-inspection/component/building-inspection-detail-header.ts +0 -123
  19. package/client/pages/building-inspection/component/inspection-event-provider.ts +0 -81
  20. package/client/pages/building-inspection/inspection-create-popup.ts +0 -785
  21. package/client/pages/checklist/attachment-list-popup.ts +0 -301
  22. package/client/pages/checklist/checklist-view.ts +0 -581
  23. package/client/pages/checklist/comment-list-popup.ts +0 -328
  24. package/client/pages/checklist/file-preview-popup.ts +0 -70
  25. package/client/pages/checklist-template/checklist-template-item.ts +0 -240
  26. package/client/pages/checklist-template/checklist-template-list.ts +0 -368
  27. package/client/pages/checklist-template/checklist-type-management.ts +0 -262
  28. package/client/pages/issue/issue-importer.ts +0 -94
  29. package/client/pages/issue/issue-list-page.ts +0 -340
  30. package/client/pages/project-report/project-report-importer.ts +0 -94
  31. package/client/pages/project-report/project-report-list-page.ts +0 -340
  32. package/client/pages/supervisor/supervisor-importer.ts +0 -94
  33. package/client/pages/supervisor/supervisor-list-page.ts +0 -340
  34. package/client/route.ts +0 -27
  35. package/client/tsconfig.json +0 -11
  36. package/dist-client/pages/checklist/comment-list-popup copy.d.ts +0 -2
  37. package/dist-client/pages/checklist/comment-list-popup copy.js +0 -344
  38. package/dist-client/pages/checklist/comment-list-popup copy.js.map +0 -1
  39. package/server/controllers/index.ts +0 -0
  40. package/server/index.ts +0 -4
  41. package/server/middlewares/index.ts +0 -3
  42. package/server/migrations/index.ts +0 -9
  43. package/server/routes.ts +0 -28
  44. package/server/service/action-plan/action-plan-mutation.ts +0 -198
  45. package/server/service/action-plan/action-plan-query.ts +0 -62
  46. package/server/service/action-plan/action-plan-type.ts +0 -61
  47. package/server/service/action-plan/action-plan.ts +0 -103
  48. package/server/service/action-plan/index.ts +0 -7
  49. package/server/service/building-inspection/building-inspection-history.ts +0 -72
  50. package/server/service/building-inspection/building-inspection-mutation.ts +0 -276
  51. package/server/service/building-inspection/building-inspection-query.ts +0 -242
  52. package/server/service/building-inspection/building-inspection-type.ts +0 -145
  53. package/server/service/building-inspection/building-inspection.ts +0 -108
  54. package/server/service/building-inspection/event-subscriber.ts +0 -20
  55. package/server/service/building-inspection/index.ts +0 -11
  56. package/server/service/checklist/checklist-history.ts +0 -96
  57. package/server/service/checklist/checklist-mutation.ts +0 -103
  58. package/server/service/checklist/checklist-query.ts +0 -58
  59. package/server/service/checklist/checklist-type.ts +0 -49
  60. package/server/service/checklist/checklist.ts +0 -127
  61. package/server/service/checklist/event-subscriber.ts +0 -17
  62. package/server/service/checklist/index.ts +0 -9
  63. package/server/service/checklist-item/checklist-item-mutation.ts +0 -5
  64. package/server/service/checklist-item/checklist-item-query.ts +0 -84
  65. package/server/service/checklist-item/checklist-item-type.ts +0 -12
  66. package/server/service/checklist-item/checklist-item.ts +0 -103
  67. package/server/service/checklist-item/index.ts +0 -7
  68. package/server/service/checklist-item-comment/checklist-item-comment-history.ts +0 -69
  69. package/server/service/checklist-item-comment/checklist-item-comment-mutation.ts +0 -80
  70. package/server/service/checklist-item-comment/checklist-item-comment-query.ts +0 -36
  71. package/server/service/checklist-item-comment/checklist-item-comment-type.ts +0 -32
  72. package/server/service/checklist-item-comment/checklist-item-comment.ts +0 -56
  73. package/server/service/checklist-item-comment/event-subscriber.ts +0 -17
  74. package/server/service/checklist-item-comment/index.ts +0 -9
  75. package/server/service/checklist-template/checklist-template-mutation.ts +0 -66
  76. package/server/service/checklist-template/checklist-template-query.ts +0 -39
  77. package/server/service/checklist-template/checklist-template-type.ts +0 -23
  78. package/server/service/checklist-template/checklist-template.ts +0 -71
  79. package/server/service/checklist-template/index.ts +0 -6
  80. package/server/service/checklist-template-item/checklist-template-item-mutation.ts +0 -64
  81. package/server/service/checklist-template-item/checklist-template-item-query.ts +0 -44
  82. package/server/service/checklist-template-item/checklist-template-item-type.ts +0 -39
  83. package/server/service/checklist-template-item/checklist-template-item.ts +0 -68
  84. package/server/service/checklist-template-item/index.ts +0 -6
  85. package/server/service/checklist-type/checklist-type-mutation.ts +0 -66
  86. package/server/service/checklist-type/checklist-type-query.ts +0 -39
  87. package/server/service/checklist-type/checklist-type-type.ts +0 -26
  88. package/server/service/checklist-type/checklist-type.ts +0 -64
  89. package/server/service/checklist-type/index.ts +0 -6
  90. package/server/service/index.ts +0 -88
  91. package/server/service/issue/index.ts +0 -7
  92. package/server/service/issue/issue-mutation.ts +0 -198
  93. package/server/service/issue/issue-query.ts +0 -62
  94. package/server/service/issue/issue-type.ts +0 -61
  95. package/server/service/issue/issue.ts +0 -100
  96. package/server/service/project-report/index.ts +0 -7
  97. package/server/service/project-report/project-report-mutation.ts +0 -198
  98. package/server/service/project-report/project-report-query.ts +0 -62
  99. package/server/service/project-report/project-report-type.ts +0 -61
  100. package/server/service/project-report/project-report.ts +0 -113
  101. package/server/service/supervisor/index.ts +0 -7
  102. package/server/service/supervisor/supervisor-mutation.ts +0 -198
  103. package/server/service/supervisor/supervisor-query.ts +0 -62
  104. package/server/service/supervisor/supervisor-type.ts +0 -61
  105. package/server/service/supervisor/supervisor.ts +0 -108
  106. package/server/tsconfig.json +0 -10
@@ -1,368 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@operato/context/ox-context-page-toolbar.js'
3
- import '@operato/data-grist'
4
- import './checklist-template-item'
5
- import '../checklist/checklist-view'
6
-
7
- import { CommonGristStyles, CommonButtonStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
8
- import { PageView } from '@operato/shell'
9
- import { css, html } from 'lit'
10
- import { customElement, query, state } from 'lit/decorators.js'
11
- import { DataGrist, FetchOption } from '@operato/data-grist'
12
- import { client } from '@operato/graphql'
13
- import { notify, openPopup } from '@operato/layout'
14
- import { i18next, localize } from '@operato/i18n'
15
- import { p13n } from '@operato/p13n'
16
-
17
- import gql from 'graphql-tag'
18
- import { ChecklistMode } from '../checklist/checklist-view'
19
- import { BuildingInspectionStatus } from '../building-inspection/building-inspection-list'
20
-
21
- @customElement('checklist-template-list')
22
- export class ChecklistTemplateListPage extends p13n(localize(i18next)(PageView)) {
23
- static styles = [
24
- ScrollbarStyles,
25
- CommonGristStyles,
26
- CommonHeaderStyles,
27
- css`
28
- :host {
29
- display: flex;
30
- flex-direction: column;
31
-
32
- width: 100%;
33
-
34
- --grid-record-emphasized-background-color: red;
35
- --grid-record-emphasized-color: yellow;
36
- }
37
-
38
- ox-grist {
39
- overflow-y: auto;
40
- flex: 1;
41
- }
42
-
43
- .header {
44
- grid-template-areas: 'filters actions';
45
- }
46
- `
47
- ]
48
-
49
- @state() private gristConfig: any
50
- @state() private checklistDetailTypes
51
- @query('ox-grist') private grist!: DataGrist
52
-
53
- get context() {
54
- return {
55
- title: '체크리스트 템플릿 리스트',
56
- search: {
57
- handler: (search: string) => {
58
- this.grist.searchText = search
59
- },
60
- value: this.grist?.searchText
61
- },
62
- filter: {
63
- handler: () => {
64
- this.grist.toggleHeadroom()
65
- }
66
- },
67
- actions: [
68
- {
69
- title: '저장',
70
- action: this._updateChecklistTemplate.bind(this),
71
- ...CommonButtonStyles.submit
72
- },
73
- {
74
- title: '삭제',
75
- action: this.deleteChecklistTemplate.bind(this),
76
- ...CommonButtonStyles.delete
77
- }
78
- ],
79
- toolbar: false
80
- }
81
- }
82
-
83
- render() {
84
- return html`
85
- <ox-grist
86
- .mode=${'GRID'}
87
- .config=${this.gristConfig}
88
- .fetchHandler=${this.fetchHandler.bind(this)}
89
- .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}
90
- >
91
- <div slot="headroom" class="header">
92
- <div class="filters">
93
- <ox-filters-form autofocus without-search></ox-filters-form>
94
- </div>
95
-
96
- <ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
97
- </div>
98
-
99
- <ox-grist-personalizer slot="setting"></ox-grist-personalizer>
100
- </ox-grist>
101
- `
102
- }
103
-
104
- async pageUpdated(changes: any, lifecycle) {
105
- if (this.active) {
106
- this.getchecklistTypes()
107
- }
108
- }
109
-
110
- async pageInitialized(lifecycle: any) {
111
- this.gristConfig = {
112
- columns: [
113
- { type: 'gutter', gutterName: 'sequence' },
114
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
115
- {
116
- type: 'gutter',
117
- gutterName: 'button',
118
- fixed: true,
119
- icon: 'reorder',
120
- handlers: {
121
- click: (columns, data, column, record, rowIndex) => {
122
- if (!record.id) return
123
- openPopup(
124
- html`
125
- <checklist-template-item
126
- .checklistTemplate=${record}
127
- .checklistDetailTypes=${this.checklistDetailTypes}
128
- @requestRefresh="${() => this.grist.fetch()}"
129
- ></checklist-template-item>
130
- `,
131
- {
132
- backdrop: true,
133
- size: 'large',
134
- title: '체크 리스트 아이템 템플릿'
135
- }
136
- )
137
- }
138
- }
139
- },
140
- {
141
- type: 'gutter',
142
- gutterName: 'button',
143
- fixed: true,
144
- icon: 'preview',
145
- handlers: {
146
- click: async (columns, data, column, record, rowIndex) => {
147
- if (!record.id) return
148
-
149
- const checklistItems = await this._getChecklistTemplateItems(record.id)
150
-
151
- const checklist = {
152
- name: record.name,
153
- constructionType: '공종',
154
- constructionDetailType: '세부 공종',
155
- location: `xxx동 xxx층`,
156
- documentNo: '0000-000-000000',
157
- inspectionParts: ['창, 바닥, 천장'],
158
- buildingInspection: {
159
- status: BuildingInspectionStatus.WAIT
160
- },
161
- checklistItems: checklistItems
162
- }
163
-
164
- openPopup(
165
- html`
166
- <div style="overflow-y: auto;">
167
- <checklist-view
168
- .mode=${ChecklistMode.VIEWER}
169
- .checklist=${checklist}
170
- style="pointer-events: none;"
171
- ></checklist-view>
172
- </div>
173
- `,
174
- {
175
- backdrop: true,
176
- size: 'large',
177
- title: '체크 리스트 미리보기'
178
- }
179
- )
180
- }
181
- }
182
- },
183
- {
184
- type: 'string',
185
- name: 'name',
186
- header: '이름',
187
- record: {
188
- editable: true
189
- },
190
- filter: 'search',
191
- sortable: true,
192
- width: 200
193
- },
194
- {
195
- type: 'resource-object',
196
- name: 'updater',
197
- header: '수정자',
198
- record: {
199
- editable: false
200
- },
201
- width: 120
202
- },
203
- {
204
- type: 'datetime',
205
- name: 'updatedAt',
206
- header: '수정일시',
207
- record: {
208
- editable: false
209
- },
210
- width: 180
211
- }
212
- ],
213
- rows: {
214
- selectable: {
215
- multiple: true
216
- }
217
- },
218
- sorters: [
219
- {
220
- name: 'name'
221
- }
222
- ]
223
- }
224
- }
225
-
226
- async getchecklistTypes() {
227
- const response = await client.query({
228
- query: gql`
229
- query ChecklistTypes {
230
- checklistTypes {
231
- items {
232
- id
233
- mainType
234
- detailType
235
- }
236
- }
237
- }
238
- `
239
- })
240
-
241
- this.checklistDetailTypes = response.data.checklistTypes?.items?.map(v => {
242
- return {
243
- display: v.detailType,
244
- value: v.id,
245
- mainType: v.mainType
246
- }
247
- })
248
- }
249
-
250
- async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
251
- const response = await client.query({
252
- query: gql`
253
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
254
- responses: checklistTemplates(filters: $filters, pagination: $pagination, sortings: $sortings) {
255
- items {
256
- id
257
- name
258
- updater {
259
- id
260
- name
261
- }
262
- updatedAt
263
- }
264
- total
265
- }
266
- }
267
- `,
268
- variables: {
269
- filters,
270
- pagination: { page, limit },
271
- sortings
272
- }
273
- })
274
-
275
- return {
276
- total: response.data.responses.total || 0,
277
- records: response.data.responses.items || []
278
- }
279
- }
280
-
281
- private async deleteChecklistTemplate() {
282
- if (confirm('삭제하시겠습니까?')) {
283
- const ids = this.grist.selected.map(record => record.id)
284
- if (ids && ids.length > 0) {
285
- const response = await client.mutate({
286
- mutation: gql`
287
- mutation ($ids: [String!]!) {
288
- deleteChecklistTemplates(ids: $ids)
289
- }
290
- `,
291
- variables: {
292
- ids
293
- }
294
- })
295
-
296
- if (!response.errors) {
297
- this.grist.fetch()
298
- notify({ message: '삭제되었습니다.' })
299
- }
300
- }
301
- }
302
- }
303
-
304
- private async _updateChecklistTemplate() {
305
- let patches = this.grist.dirtyRecords
306
- if (patches && patches.length) {
307
- patches = patches.map(patch => {
308
- let patchField: any = patch.id ? { id: patch.id } : {}
309
- const dirtyFields = patch.__dirtyfields__
310
- for (let key in dirtyFields) {
311
- patchField[key] = dirtyFields[key].after
312
- }
313
- patchField.cuFlag = patch.__dirty__
314
-
315
- return patchField
316
- })
317
-
318
- const response = await client.mutate({
319
- mutation: gql`
320
- mutation ($patches: [ChecklistTemplatePatch!]!) {
321
- updateMultipleChecklistTemplate(patches: $patches) {
322
- name
323
- }
324
- }
325
- `,
326
- variables: {
327
- patches
328
- }
329
- })
330
-
331
- if (!response.errors) {
332
- this.grist.fetch()
333
- notify({ message: '저장되었습니다.' })
334
- } else {
335
- notify({ message: '저장에 실패하였습니다.', level: 'error' })
336
- }
337
- }
338
- }
339
-
340
- private async _getChecklistTemplateItems(checklistTemplateId) {
341
- const response = await client.query({
342
- query: gql`
343
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
344
- checklistTemplateItems(filters: $filters, pagination: $pagination, sortings: $sortings) {
345
- items {
346
- id
347
- sequence
348
- name
349
- inspctionCriteria
350
- mainType
351
- detailType: detailTypeName
352
- }
353
- }
354
- }
355
- `,
356
- variables: {
357
- filters: {
358
- name: 'checklistTemplateId',
359
- value: checklistTemplateId,
360
- operator: 'eq'
361
- },
362
- sortings: [{ name: 'mainType' }, { name: 'sequence' }]
363
- }
364
- })
365
-
366
- return response.data.checklistTemplateItems.items || []
367
- }
368
- }
@@ -1,262 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@operato/context/ox-context-page-toolbar.js'
3
- import '@operato/data-grist'
4
-
5
- import gql from 'graphql-tag'
6
- import { css, html } from 'lit'
7
- import { CommonGristStyles, CommonButtonStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
8
- import { PageView } from '@operato/shell'
9
- import { customElement, query, state } from 'lit/decorators.js'
10
- import { DataGrist, FetchOption } from '@operato/data-grist'
11
- import { client } from '@operato/graphql'
12
- import { notify } from '@operato/layout'
13
- import { i18next, localize } from '@operato/i18n'
14
- import { p13n } from '@operato/p13n'
15
-
16
- export enum ChecklistTypeMainType {
17
- BASIC = '10',
18
- NON_BASIC = '20'
19
- }
20
- export const CHECKLIST_MAIN_TYPE_LIST = {
21
- [ChecklistTypeMainType.BASIC]: '기본 업무',
22
- [ChecklistTypeMainType.NON_BASIC]: '기본 외 업무'
23
- }
24
-
25
- @customElement('checklist-type-management')
26
- export class ChecklistTypeManagement extends p13n(localize(i18next)(PageView)) {
27
- static styles = [
28
- ScrollbarStyles,
29
- CommonGristStyles,
30
- CommonHeaderStyles,
31
- css`
32
- :host {
33
- display: flex;
34
- flex-direction: column;
35
-
36
- --grid-record-emphasized-background-color: red;
37
- --grid-record-emphasized-color: yellow;
38
- }
39
-
40
- ox-grist {
41
- overflow-y: auto;
42
- flex: 1;
43
- }
44
-
45
- .header {
46
- grid-template-areas: 'filters actions';
47
- }
48
- `
49
- ]
50
-
51
- @state() private gristConfig: any
52
- @query('ox-grist') private grist!: DataGrist
53
-
54
- get context() {
55
- return {
56
- title: '체크리스트 구분 관리',
57
- search: {
58
- handler: (search: string) => {
59
- this.grist.searchText = search
60
- },
61
- value: this.grist?.searchText
62
- },
63
- filter: {
64
- handler: () => {
65
- this.grist.toggleHeadroom()
66
- }
67
- },
68
- actions: [
69
- {
70
- title: '저장',
71
- action: this._updateChecklistType.bind(this),
72
- ...CommonButtonStyles.submit
73
- },
74
- {
75
- title: '삭제',
76
- action: this._deleteChecklistType.bind(this),
77
- ...CommonButtonStyles.delete
78
- }
79
- ],
80
- toolbar: false
81
- }
82
- }
83
-
84
- render() {
85
- return html`
86
- <ox-grist
87
- .mode=${'GRID'}
88
- .config=${this.gristConfig}
89
- .fetchHandler=${this.fetchHandler.bind(this)}
90
- .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}
91
- >
92
- <div slot="headroom" class="header">
93
- <div class="filters">
94
- <ox-filters-form autofocus without-search></ox-filters-form>
95
- </div>
96
-
97
- <ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
98
- </div>
99
-
100
- <ox-grist-personalizer slot="setting"></ox-grist-personalizer>
101
- </ox-grist>
102
- `
103
- }
104
-
105
- async pageInitialized(lifecycle: any) {
106
- this.gristConfig = {
107
- columns: [
108
- { type: 'gutter', gutterName: 'sequence' },
109
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
110
- {
111
- type: 'select',
112
- name: 'mainType',
113
- header: '메인 구분',
114
- record: {
115
- editable: true,
116
- options: [{ display: '', value: '' }].concat(
117
- Object.keys(CHECKLIST_MAIN_TYPE_LIST).map(key => ({ display: CHECKLIST_MAIN_TYPE_LIST[key], value: key }))
118
- )
119
- },
120
- filter: true,
121
- sortable: true,
122
- width: 150
123
- },
124
- {
125
- type: 'string',
126
- name: 'detailType',
127
- header: '상세 구분',
128
- record: {
129
- editable: true
130
- },
131
- filter: 'search',
132
- sortable: true,
133
- width: 250
134
- },
135
- {
136
- type: 'resource-object',
137
- name: 'updater',
138
- header: '수정자',
139
- record: {
140
- editable: false
141
- },
142
- width: 120
143
- },
144
- {
145
- type: 'datetime',
146
- name: 'updatedAt',
147
- header: '수정일시',
148
- record: {
149
- editable: false
150
- },
151
- sortable: true,
152
- width: 180
153
- }
154
- ],
155
- rows: {
156
- selectable: {
157
- multiple: true
158
- },
159
- classifier: (record, rowIndex) => {
160
- return {
161
- emphasized:
162
- record.mainType == ChecklistTypeMainType.BASIC
163
- ? ['var(--grid-record-odd-background-color)', 'var(--grid-record-color)']
164
- : ['var(--grid-record-background-color)', 'var(--grid-record-color)']
165
- }
166
- }
167
- },
168
- sorters: [{ name: 'mainType' }, { name: 'updatedAt', desc: true }, { name: 'detailType' }]
169
- }
170
- }
171
-
172
- async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
173
- const response = await client.query({
174
- query: gql`
175
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
176
- responses: checklistTypes(filters: $filters, pagination: $pagination, sortings: $sortings) {
177
- items {
178
- id
179
- mainType
180
- detailType
181
- updater {
182
- id
183
- name
184
- }
185
- updatedAt
186
- }
187
- total
188
- }
189
- }
190
- `,
191
- variables: {
192
- filters,
193
- pagination: { page, limit },
194
- sortings
195
- }
196
- })
197
-
198
- return {
199
- total: response.data.responses.total || 0,
200
- records: response.data.responses.items || []
201
- }
202
- }
203
-
204
- private async _deleteChecklistType() {
205
- if (confirm('삭제하시겠습니까?')) {
206
- const ids = this.grist.selected.map(record => record.id)
207
- if (ids && ids.length > 0) {
208
- const response = await client.mutate({
209
- mutation: gql`
210
- mutation ($ids: [String!]!) {
211
- deleteChecklistTypes(ids: $ids)
212
- }
213
- `,
214
- variables: {
215
- ids
216
- }
217
- })
218
-
219
- if (!response.errors) {
220
- this.grist.fetch()
221
- notify({ message: '삭제되었습니다.' })
222
- }
223
- }
224
- }
225
- }
226
-
227
- private async _updateChecklistType() {
228
- let patches = this.grist.dirtyRecords
229
- if (patches && patches.length) {
230
- patches = patches.map(patch => {
231
- let patchField: any = patch.id ? { id: patch.id } : {}
232
- const dirtyFields = patch.__dirtyfields__
233
- for (let key in dirtyFields) {
234
- patchField[key] = dirtyFields[key].after
235
- }
236
- patchField.cuFlag = patch.__dirty__
237
-
238
- return patchField
239
- })
240
-
241
- const response = await client.mutate({
242
- mutation: gql`
243
- mutation ($patches: [ChecklistTypePatch!]!) {
244
- updateMultipleChecklistType(patches: $patches) {
245
- id
246
- }
247
- }
248
- `,
249
- variables: {
250
- patches
251
- }
252
- })
253
-
254
- if (!response.errors) {
255
- this.grist.fetch()
256
- notify({ message: '저장되었습니다.' })
257
- } else {
258
- notify({ message: '저장에 실패하였습니다.', level: 'error' })
259
- }
260
- }
261
- }
262
- }
@@ -1,94 +0,0 @@
1
- import '@material/web/button/elevated-button.js'
2
- import '@operato/data-grist'
3
-
4
- import gql from 'graphql-tag'
5
- import { css, html, LitElement } from 'lit'
6
- import { property, state } from 'lit/decorators.js'
7
-
8
- import { client } from '@operato/graphql'
9
- import { i18next } from '@operato/i18n'
10
- import { isMobileDevice } from '@operato/utils'
11
-
12
- export class IssueImporter extends LitElement {
13
- static styles = [
14
- css`
15
- :host {
16
- display: flex;
17
- flex-direction: column;
18
-
19
- background-color: #fff;
20
- }
21
-
22
- ox-grist {
23
- flex: 1;
24
- }
25
-
26
- .button-container {
27
- display: flex;
28
- margin-left: auto;
29
- padding: var(--padding-default);
30
- }
31
-
32
- md-elevated-button {
33
- margin-left: var(--margin-default);
34
- }
35
- `
36
- ]
37
-
38
- @state() private issues: any[] = []
39
- @state() private columns = {
40
- list: { fields: ['name', 'description'] },
41
- pagination: { infinite: true },
42
- columns: [
43
- {
44
- type: 'string',
45
- name: 'name',
46
- header: i18next.t('field.name'),
47
- width: 150
48
- },
49
- {
50
- type: 'string',
51
- name: 'description',
52
- header: i18next.t('field.description'),
53
- width: 200
54
- },
55
- {
56
- type: 'checkbox',
57
- name: 'active',
58
- header: i18next.t('field.active'),
59
- width: 60
60
- }
61
- ]
62
- }
63
-
64
- render() {
65
- return html`
66
- <ox-grist
67
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
68
- .config=${this.columns}
69
- .data=${{
70
- records: this.issues
71
- }}
72
- ></ox-grist>
73
-
74
- <div class="button-container">
75
- <md-elevated-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</md-elevated-button>
76
- </div>
77
- `
78
- }
79
-
80
- private async save() {
81
- const response = await client.mutate({
82
- mutation: gql`
83
- mutation importIssues($issues: [IssuePatch!]!) {
84
- importIssues(issues: $issues)
85
- }
86
- `,
87
- variables: { issues: this.issues }
88
- })
89
-
90
- if (response.errors?.length) return
91
-
92
- this.dispatchEvent(new CustomEvent('imported'))
93
- }
94
- }