@dssp/project 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 (100) hide show
  1. package/dist-client/pages/project/project-schedule.js +31 -22
  2. package/dist-client/pages/project/project-schedule.js.map +1 -1
  3. package/dist-client/tsconfig.tsbuildinfo +1 -1
  4. package/dist-server/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +11 -11
  6. package/client/bootstrap.ts +0 -0
  7. package/client/index.ts +0 -0
  8. package/client/pages/lib/select2-component.ts +0 -175
  9. package/client/pages/lib/waether.ts +0 -159
  10. package/client/pages/project/component/project-update-header.ts +0 -88
  11. package/client/pages/project/popup/popup-plan-upload.ts +0 -138
  12. package/client/pages/project/popup/popup-project-create.ts +0 -147
  13. package/client/pages/project/popup/popup-schedule-upload.ts +0 -102
  14. package/client/pages/project/project-completed-list.ts +0 -281
  15. package/client/pages/project/project-detail.ts +0 -738
  16. package/client/pages/project/project-list.ts +0 -418
  17. package/client/pages/project/project-plan-management.ts +0 -476
  18. package/client/pages/project/project-schedule-list.ts +0 -294
  19. package/client/pages/project/project-schedule.ts +0 -393
  20. package/client/pages/project/project-setting-list.ts +0 -393
  21. package/client/pages/project/project-update.ts +0 -876
  22. package/client/pages/resource/construction-detail-type-popup.ts +0 -201
  23. package/client/pages/resource/construction-type-management.ts +0 -212
  24. package/client/pages/resource/inspection-drawing-type-management.ts +0 -245
  25. package/client/pages/resource/inspection-part-popup.ts +0 -201
  26. package/client/pages/resource/resource-importer.ts +0 -97
  27. package/client/pages/resource/resource-list-page.ts +0 -356
  28. package/client/pages/resource/worker-type-management.ts +0 -192
  29. package/client/pages/task/task-importer.ts +0 -94
  30. package/client/pages/task/task-list-page.ts +0 -340
  31. package/client/pages/task-resource/task-resource-importer.ts +0 -97
  32. package/client/pages/task-resource/task-resource-list-page.ts +0 -356
  33. package/client/route.ts +0 -55
  34. package/client/tsconfig.json +0 -11
  35. package/server/controllers/export-tasks.ts +0 -40
  36. package/server/controllers/import-task.ts +0 -134
  37. package/server/controllers/index.ts +0 -0
  38. package/server/controllers/parse-excel.ts +0 -86
  39. package/server/controllers/types.ts +0 -20
  40. package/server/index.ts +0 -4
  41. package/server/middlewares/index.ts +0 -3
  42. package/server/migrations/1723861466413-seed-roles.ts +0 -128
  43. package/server/migrations/1723861466414-seed-codes.ts +0 -157
  44. package/server/migrations/1723861476419-seed-resources.ts +0 -62
  45. package/server/migrations/1723861478420-seed-/bsample-project.ts +0 -87
  46. package/server/migrations/1723861478421-seed-/bsample-tasks.ts +0 -194
  47. package/server/migrations/index.ts +0 -9
  48. package/server/routes.ts +0 -108
  49. package/server/service/construction-detail-type/construction-detail-type-mutation.ts +0 -57
  50. package/server/service/construction-detail-type/construction-detail-type-query.ts +0 -31
  51. package/server/service/construction-detail-type/construction-detail-type-type.ts +0 -26
  52. package/server/service/construction-detail-type/construction-detail-type.ts +0 -52
  53. package/server/service/construction-detail-type/index.ts +0 -6
  54. package/server/service/construction-type/construction-type-mutation.ts +0 -66
  55. package/server/service/construction-type/construction-type-query.ts +0 -56
  56. package/server/service/construction-type/construction-type-type.ts +0 -26
  57. package/server/service/construction-type/construction-type.ts +0 -74
  58. package/server/service/construction-type/index.ts +0 -6
  59. package/server/service/index.ts +0 -56
  60. package/server/service/inspection-drawing-type/index.ts +0 -6
  61. package/server/service/inspection-drawing-type/inspection-drawing-type-mutation.ts +0 -69
  62. package/server/service/inspection-drawing-type/inspection-drawing-type-query.ts +0 -55
  63. package/server/service/inspection-drawing-type/inspection-drawing-type-type.ts +0 -23
  64. package/server/service/inspection-drawing-type/inspection-drawing-type.ts +0 -68
  65. package/server/service/inspection-part/index.ts +0 -6
  66. package/server/service/inspection-part/inspection-part-mutation.ts +0 -52
  67. package/server/service/inspection-part/inspection-part-query.ts +0 -41
  68. package/server/service/inspection-part/inspection-part-type.ts +0 -26
  69. package/server/service/inspection-part/inspection-part.ts +0 -51
  70. package/server/service/manager/index.ts +0 -6
  71. package/server/service/manager/manager-mutation.ts +0 -42
  72. package/server/service/manager/manager-query.ts +0 -28
  73. package/server/service/manager/manager-type.ts +0 -40
  74. package/server/service/manager/manager.ts +0 -29
  75. package/server/service/project/index.ts +0 -6
  76. package/server/service/project/project-mutation.ts +0 -255
  77. package/server/service/project/project-query.ts +0 -105
  78. package/server/service/project/project-type.ts +0 -72
  79. package/server/service/project/project.ts +0 -134
  80. package/server/service/resource/index.ts +0 -7
  81. package/server/service/resource/resource-mutation.ts +0 -137
  82. package/server/service/resource/resource-query.ts +0 -50
  83. package/server/service/resource/resource-type.ts +0 -41
  84. package/server/service/resource/resource.ts +0 -82
  85. package/server/service/task/index.ts +0 -6
  86. package/server/service/task/task-mutation.ts +0 -135
  87. package/server/service/task/task-query.ts +0 -169
  88. package/server/service/task/task-type.ts +0 -75
  89. package/server/service/task/task.ts +0 -130
  90. package/server/service/task-resource/index.ts +0 -7
  91. package/server/service/task-resource/task-resource-mutation.ts +0 -140
  92. package/server/service/task-resource/task-resource-query.ts +0 -36
  93. package/server/service/task-resource/task-resource-type.ts +0 -41
  94. package/server/service/task-resource/task-resource.ts +0 -51
  95. package/server/service/worker-type/index.ts +0 -6
  96. package/server/service/worker-type/worker-type-mutation.ts +0 -66
  97. package/server/service/worker-type/worker-type-query.ts +0 -47
  98. package/server/service/worker-type/worker-type-type.ts +0 -26
  99. package/server/service/worker-type/worker-type.ts +0 -68
  100. package/server/tsconfig.json +0 -10
@@ -1,192 +0,0 @@
1
- import '@operato/data-grist'
2
- import '@operato/context/ox-context-page-toolbar.js'
3
-
4
- import { CommonGristStyles, CommonButtonStyles, ScrollbarStyles } from '@operato/styles'
5
- import { PageView } from '@operato/shell'
6
- import { css, html } from 'lit'
7
- import { customElement, property, query } from 'lit/decorators.js'
8
- import { DataGrist } from '@operato/data-grist'
9
- import { client } from '@operato/graphql'
10
- import { notify } from '@operato/layout'
11
- import gql from 'graphql-tag'
12
- import { FetchOption } from '@operato/data-grist'
13
-
14
- @customElement('worker-type-management')
15
- export class WorkerTypeManagement extends PageView {
16
- static styles = [
17
- ScrollbarStyles,
18
- CommonGristStyles,
19
- css`
20
- :host {
21
- display: flex;
22
- flex-direction: column;
23
-
24
- width: 100%;
25
-
26
- --grid-record-emphasized-background-color: red;
27
- --grid-record-emphasized-color: yellow;
28
- }
29
- `
30
- ]
31
-
32
- @property({ type: Object }) gristConfig: any
33
- @query('ox-grist') private grist!: DataGrist
34
-
35
- get context() {
36
- return {
37
- title: '인력 관리',
38
- actions: [
39
- {
40
- title: '저장',
41
- action: this._updateWorkerTypes.bind(this),
42
- ...CommonButtonStyles.save
43
- },
44
- {
45
- title: '삭제',
46
- action: this._deleteWorkerTypes.bind(this),
47
- ...CommonButtonStyles.delete
48
- }
49
- ]
50
- }
51
- }
52
-
53
- render() {
54
- return html`
55
- <ox-grist .mode=${'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist>
56
- `
57
- }
58
-
59
- async pageInitialized(lifecycle: any) {
60
- this.gristConfig = {
61
- columns: [
62
- { type: 'gutter', gutterName: 'sequence' },
63
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
64
- {
65
- type: 'string',
66
- name: 'name',
67
- header: '이름',
68
- record: {
69
- editable: true
70
- },
71
- width: 150
72
- },
73
- {
74
- type: 'string',
75
- name: 'description',
76
- header: '설명',
77
- record: {
78
- editable: true
79
- },
80
- width: 200
81
- },
82
- {
83
- type: 'datetime',
84
- name: 'createdAt',
85
- header: '생성 시간',
86
- width: 200
87
- },
88
- {
89
- type: 'datetime',
90
- name: 'updatedAt',
91
- header: '수정 시간',
92
- width: 200
93
- }
94
- ],
95
- rows: {
96
- selectable: {
97
- multiple: true
98
- }
99
- },
100
- pagination: { infinite: true }
101
- }
102
- }
103
-
104
- async fetchHandler(_: FetchOption) {
105
- const response = await client.query({
106
- query: gql`
107
- query WorkerTypes {
108
- workerTypes {
109
- items {
110
- id
111
- name
112
- description
113
- createdAt
114
- updatedAt
115
- }
116
- total
117
- }
118
- }
119
- `
120
- })
121
-
122
- if (response.errors) return {}
123
-
124
- return {
125
- total: response.data.workerTypes.total || 0,
126
- records: response.data.workerTypes.items || []
127
- }
128
- }
129
-
130
- async _updateWorkerTypes() {
131
- let patches = this.grist.dirtyRecords
132
- if (patches && patches.length) {
133
- patches = patches.map(patch => {
134
- let patchField: any = patch.id ? { id: patch.id } : {}
135
- const dirtyFields = patch.__dirtyfields__
136
- for (let key in dirtyFields) {
137
- patchField[key] = dirtyFields[key].after
138
- }
139
- patchField.cuFlag = patch.__dirty__
140
-
141
- return patchField
142
- })
143
-
144
- const response = await client.mutate({
145
- mutation: gql`
146
- mutation UpdateMultipleWorkerType($patches: [WorkerTypePatch!]!) {
147
- updateMultipleWorkerType(patches: $patches) {
148
- id
149
- }
150
- }
151
- `,
152
- variables: {
153
- patches
154
- }
155
- })
156
-
157
- if (!response.errors) {
158
- this.grist.fetch()
159
- notify({ message: '저장되었습니다.' })
160
- } else {
161
- notify({ message: '저장에 실패하였습니다.', level: 'error' })
162
- }
163
- }
164
- }
165
-
166
- async _deleteWorkerTypes() {
167
- if (confirm('삭제하시겠습니까?')) {
168
- const a = this.grist
169
- console.log('this.grist :', a)
170
- console.log('selected : ', a.selected)
171
-
172
- const ids = this.grist.selected.map(record => record.id)
173
- if (ids && ids.length > 0) {
174
- const response = await client.mutate({
175
- mutation: gql`
176
- mutation DeleteWorkerTypes($ids: [String!]!) {
177
- deleteWorkerTypes(ids: $ids)
178
- }
179
- `,
180
- variables: {
181
- ids
182
- }
183
- })
184
-
185
- if (!response.errors) {
186
- this.grist.fetch()
187
- notify({ message: '삭제되었습니다.' })
188
- }
189
- }
190
- }
191
- }
192
- }
@@ -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 TaskImporter 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 tasks: 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.tasks
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 importTasks($tasks: [TaskPatch!]!) {
84
- importTasks(tasks: $tasks)
85
- }
86
- `,
87
- variables: { tasks: this.tasks }
88
- })
89
-
90
- if (response.errors?.length) return
91
-
92
- this.dispatchEvent(new CustomEvent('imported'))
93
- }
94
- }
@@ -1,340 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@operato/data-grist'
3
-
4
- import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
5
- import { PageView, store } from '@operato/shell'
6
- import { css, html } from 'lit'
7
- import { customElement, property, query, state } from 'lit/decorators.js'
8
- import { ScopedElementsMixin } from '@open-wc/scoped-elements'
9
- import { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
10
- import { client } from '@operato/graphql'
11
- import { i18next, localize } from '@operato/i18n'
12
- import { notify, openPopup } from '@operato/layout'
13
- import { OxPopup, OxPrompt } from '@operato/popup'
14
- import { isMobileDevice } from '@operato/utils'
15
-
16
- import { connect } from 'pwa-helpers/connect-mixin'
17
- import gql from 'graphql-tag'
18
-
19
- import { TaskImporter } from './task-importer'
20
-
21
- @customElement('task-list-page')
22
- export class TaskListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
23
- static styles = [
24
- ScrollbarStyles,
25
- CommonGristStyles,
26
- css`
27
- :host {
28
- display: flex;
29
-
30
- width: 100%;
31
-
32
- --grid-record-emphasized-background-color: red;
33
- --grid-record-emphasized-color: yellow;
34
- }
35
- `
36
- ]
37
-
38
- static get scopedElements() {
39
- return {
40
- 'task-importer': TaskImporter
41
- }
42
- }
43
-
44
- @state() private gristConfig: any
45
- @state() private mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
46
-
47
- @query('ox-grist') private grist!: DataGrist
48
- @query('#sorter-control') private sortersControl!: OxPopup
49
-
50
- get context() {
51
- return {
52
- title: i18next.t('title.task list'),
53
- search: {
54
- handler: (search: string) => {
55
- this.grist.searchText = search
56
- },
57
- value: this.grist.searchText
58
- },
59
- filter: {
60
- handler: () => {
61
- this.grist.toggleHeadroom()
62
- }
63
- },
64
- help: 'project/task',
65
- actions: [
66
- {
67
- title: i18next.t('button.save'),
68
- action: this.updateTask.bind(this),
69
- ...CommonButtonStyles.save
70
- },
71
- {
72
- title: i18next.t('button.delete'),
73
- action: this.deleteTask.bind(this),
74
- ...CommonButtonStyles.delete
75
- }
76
- ],
77
- exportable: {
78
- name: i18next.t('title.task list'),
79
- data: this.exportHandler.bind(this)
80
- },
81
- importable: {
82
- handler: this.importHandler.bind(this)
83
- }
84
- }
85
- }
86
-
87
- render() {
88
- const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
89
-
90
- return html`
91
- <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
92
- <div slot="headroom">
93
- <div id="filters">
94
- <ox-filters-form autofocus></ox-filters-form>
95
- </div>
96
-
97
- <div id="sorters">
98
- Sort
99
- <md-icon
100
- @click=${e => {
101
- const target = e.currentTarget
102
- this.sortersControl.open({
103
- right: 0,
104
- top: target.offsetTop + target.offsetHeight
105
- })
106
- }}
107
- >expand_more</md-icon
108
- >
109
- <ox-popup id="sorter-control">
110
- <ox-sorters-control> </ox-sorters-control>
111
- </ox-popup>
112
- </div>
113
-
114
- <div id="modes">
115
- <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
116
- <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
117
- <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
118
- </div>
119
- </div>
120
- </ox-grist>
121
- `
122
- }
123
-
124
- async pageInitialized(lifecycle: any) {
125
- this.gristConfig = {
126
- list: {
127
- fields: ['name', 'description'],
128
- details: ['active', 'updatedAt']
129
- },
130
- columns: [
131
- { type: 'gutter', gutterName: 'sequence' },
132
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
133
- {
134
- type: 'string',
135
- name: 'name',
136
- header: i18next.t('field.name'),
137
- record: {
138
- editable: true
139
- },
140
- filter: 'search',
141
- sortable: true,
142
- width: 150
143
- },
144
- {
145
- type: 'string',
146
- name: 'description',
147
- header: i18next.t('field.description'),
148
- record: {
149
- editable: true
150
- },
151
- filter: 'search',
152
- width: 200
153
- },
154
- {
155
- type: 'checkbox',
156
- name: 'active',
157
- label: true,
158
- header: i18next.t('field.active'),
159
- record: {
160
- editable: true
161
- },
162
- filter: true,
163
- sortable: true,
164
- width: 60
165
- },
166
- {
167
- type: 'resource-object',
168
- name: 'updater',
169
- header: i18next.t('field.updater'),
170
- record: {
171
- editable: false
172
- },
173
- sortable: true,
174
- width: 120
175
- },
176
- {
177
- type: 'datetime',
178
- name: 'updatedAt',
179
- header: i18next.t('field.updated_at'),
180
- record: {
181
- editable: false
182
- },
183
- sortable: true,
184
- width: 180
185
- }
186
- ],
187
- rows: {
188
- selectable: {
189
- multiple: true
190
- }
191
- },
192
- sorters: [
193
- {
194
- name: 'name'
195
- }
196
- ]
197
- }
198
- }
199
-
200
- async pageUpdated(changes: any, lifecycle: any) {
201
- if (this.active) {
202
- // do something here when this page just became as active
203
- }
204
- }
205
-
206
- async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
207
- const response = await client.query({
208
- query: gql`
209
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
210
- responses: tasks(filters: $filters, pagination: $pagination, sortings: $sortings) {
211
- items {
212
- id
213
- name
214
- description
215
- active
216
- updater {
217
- id
218
- name
219
- }
220
- updatedAt
221
- }
222
- total
223
- }
224
- }
225
- `,
226
- variables: {
227
- filters,
228
- pagination: { page, limit },
229
- sortings
230
- }
231
- })
232
-
233
- return {
234
- total: response.data.responses.total || 0,
235
- records: response.data.responses.items || []
236
- }
237
- }
238
-
239
- private async deleteTask() {
240
- if (
241
- await OxPrompt.open({
242
- title: i18next.t('text.are_you_sure'),
243
- text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
244
- confirmButton: { text: i18next.t('button.confirm') },
245
- cancelButton: { text: i18next.t('button.cancel') }
246
- })
247
- ) {
248
- const ids = this.grist.selected.map(record => record.id)
249
- if (ids && ids.length > 0) {
250
- const response = await client.mutate({
251
- mutation: gql`
252
- mutation ($ids: [String!]!) {
253
- deleteTasks(ids: $ids)
254
- }
255
- `,
256
- variables: {
257
- ids
258
- }
259
- })
260
-
261
- if (!response.errors) {
262
- this.grist.fetch()
263
- notify({
264
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
265
- })
266
- }
267
- }
268
- }
269
- }
270
-
271
- private async updateTask() {
272
- let patches = this.grist.dirtyRecords
273
- if (patches && patches.length) {
274
- patches = patches.map(patch => {
275
- let patchField: any = patch.id ? { id: patch.id } : {}
276
- const dirtyFields = patch.__dirtyfields__
277
- for (let key in dirtyFields) {
278
- patchField[key] = dirtyFields[key].after
279
- }
280
- patchField.cuFlag = patch.__dirty__
281
-
282
- return patchField
283
- })
284
-
285
- const response = await client.mutate({
286
- mutation: gql`
287
- mutation ($patches: [TaskPatch!]!) {
288
- updateMultipleTask(patches: $patches) {
289
- name
290
- }
291
- }
292
- `,
293
- variables: {
294
- patches
295
- }
296
- })
297
-
298
- if (!response.errors) {
299
- this.grist.fetch()
300
- }
301
- }
302
- }
303
-
304
- private async exportHandler() {
305
- const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
306
- const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
307
-
308
- return exportTargets.map(task => {
309
- let tempObj = {}
310
- for (const field of targetFieldSet) {
311
- tempObj[field] = task[field]
312
- }
313
-
314
- return tempObj
315
- })
316
- }
317
-
318
- private async importHandler(records) {
319
- const popup = openPopup(
320
- html`
321
- <task-importer
322
- .tasks=${records}
323
- @imported=${() => {
324
- history.back()
325
- this.grist.fetch()
326
- }}
327
- ></task-importer>
328
- `,
329
- {
330
- backdrop: true,
331
- size: 'large',
332
- title: i18next.t('title.import task')
333
- }
334
- )
335
-
336
- popup.onclosed = () => {
337
- this.grist.fetch()
338
- }
339
- }
340
- }
@@ -1,97 +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 TaskResourceImporter 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 taskResources: 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
- {
71
- records: this.taskResources
72
- }
73
- }
74
- ></ox-grist>
75
-
76
- <div class="button-container">
77
- <md-elevated-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</md-elevated-button>
78
- </div>
79
- `
80
- }
81
-
82
- private async save() {
83
- const response = await client.mutate({
84
- mutation: gql`
85
- mutation importTaskResources($taskResources: [TaskResourcePatch!]!) {
86
- importTaskResources(taskResources: $taskResources)
87
- }
88
- `,
89
- variables: { taskResources: this.taskResources }
90
- })
91
-
92
- if (response.errors?.length) return
93
-
94
- this.dispatchEvent(new CustomEvent('imported'))
95
- }
96
- }
97
-