@dssp/supervision 1.0.0-alpha.0 → 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 (99) 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/route.d.ts +1 -1
  4. package/dist-client/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +5 -5
  6. package/client/bootstrap.ts +0 -1
  7. package/client/index.ts +0 -0
  8. package/client/pages/action-plan/action-plan-importer.ts +0 -94
  9. package/client/pages/action-plan/action-plan-list-page.ts +0 -340
  10. package/client/pages/building-inspection/building-inspection-detail-camera.ts +0 -277
  11. package/client/pages/building-inspection/building-inspection-detail-checklist.ts +0 -258
  12. package/client/pages/building-inspection/building-inspection-detail-drawing.ts +0 -288
  13. package/client/pages/building-inspection/building-inspection-list.ts +0 -565
  14. package/client/pages/building-inspection/component/building-inspection-detail-header.ts +0 -123
  15. package/client/pages/building-inspection/component/inspection-event-provider.ts +0 -81
  16. package/client/pages/building-inspection/inspection-create-popup.ts +0 -785
  17. package/client/pages/checklist/attachment-list-popup.ts +0 -301
  18. package/client/pages/checklist/checklist-view.ts +0 -581
  19. package/client/pages/checklist/comment-list-popup.ts +0 -328
  20. package/client/pages/checklist/file-preview-popup.ts +0 -70
  21. package/client/pages/checklist-template/checklist-template-item.ts +0 -240
  22. package/client/pages/checklist-template/checklist-template-list.ts +0 -368
  23. package/client/pages/checklist-template/checklist-type-management.ts +0 -262
  24. package/client/pages/issue/issue-importer.ts +0 -94
  25. package/client/pages/issue/issue-list-page.ts +0 -340
  26. package/client/pages/project-report/project-report-importer.ts +0 -94
  27. package/client/pages/project-report/project-report-list-page.ts +0 -340
  28. package/client/pages/supervisor/supervisor-importer.ts +0 -94
  29. package/client/pages/supervisor/supervisor-list-page.ts +0 -340
  30. package/client/route.ts +0 -27
  31. package/client/tsconfig.json +0 -11
  32. package/server/controllers/index.ts +0 -0
  33. package/server/index.ts +0 -4
  34. package/server/middlewares/index.ts +0 -3
  35. package/server/migrations/index.ts +0 -9
  36. package/server/routes.ts +0 -28
  37. package/server/service/action-plan/action-plan-mutation.ts +0 -198
  38. package/server/service/action-plan/action-plan-query.ts +0 -62
  39. package/server/service/action-plan/action-plan-type.ts +0 -61
  40. package/server/service/action-plan/action-plan.ts +0 -103
  41. package/server/service/action-plan/index.ts +0 -7
  42. package/server/service/building-inspection/building-inspection-history.ts +0 -72
  43. package/server/service/building-inspection/building-inspection-mutation.ts +0 -276
  44. package/server/service/building-inspection/building-inspection-query.ts +0 -242
  45. package/server/service/building-inspection/building-inspection-type.ts +0 -145
  46. package/server/service/building-inspection/building-inspection.ts +0 -108
  47. package/server/service/building-inspection/event-subscriber.ts +0 -20
  48. package/server/service/building-inspection/index.ts +0 -11
  49. package/server/service/checklist/checklist-history.ts +0 -96
  50. package/server/service/checklist/checklist-mutation.ts +0 -103
  51. package/server/service/checklist/checklist-query.ts +0 -58
  52. package/server/service/checklist/checklist-type.ts +0 -49
  53. package/server/service/checklist/checklist.ts +0 -127
  54. package/server/service/checklist/event-subscriber.ts +0 -17
  55. package/server/service/checklist/index.ts +0 -9
  56. package/server/service/checklist-item/checklist-item-mutation.ts +0 -5
  57. package/server/service/checklist-item/checklist-item-query.ts +0 -84
  58. package/server/service/checklist-item/checklist-item-type.ts +0 -12
  59. package/server/service/checklist-item/checklist-item.ts +0 -103
  60. package/server/service/checklist-item/index.ts +0 -7
  61. package/server/service/checklist-item-comment/checklist-item-comment-history.ts +0 -69
  62. package/server/service/checklist-item-comment/checklist-item-comment-mutation.ts +0 -80
  63. package/server/service/checklist-item-comment/checklist-item-comment-query.ts +0 -36
  64. package/server/service/checklist-item-comment/checklist-item-comment-type.ts +0 -32
  65. package/server/service/checklist-item-comment/checklist-item-comment.ts +0 -56
  66. package/server/service/checklist-item-comment/event-subscriber.ts +0 -17
  67. package/server/service/checklist-item-comment/index.ts +0 -9
  68. package/server/service/checklist-template/checklist-template-mutation.ts +0 -66
  69. package/server/service/checklist-template/checklist-template-query.ts +0 -39
  70. package/server/service/checklist-template/checklist-template-type.ts +0 -23
  71. package/server/service/checklist-template/checklist-template.ts +0 -71
  72. package/server/service/checklist-template/index.ts +0 -6
  73. package/server/service/checklist-template-item/checklist-template-item-mutation.ts +0 -64
  74. package/server/service/checklist-template-item/checklist-template-item-query.ts +0 -44
  75. package/server/service/checklist-template-item/checklist-template-item-type.ts +0 -39
  76. package/server/service/checklist-template-item/checklist-template-item.ts +0 -68
  77. package/server/service/checklist-template-item/index.ts +0 -6
  78. package/server/service/checklist-type/checklist-type-mutation.ts +0 -66
  79. package/server/service/checklist-type/checklist-type-query.ts +0 -39
  80. package/server/service/checklist-type/checklist-type-type.ts +0 -26
  81. package/server/service/checklist-type/checklist-type.ts +0 -64
  82. package/server/service/checklist-type/index.ts +0 -6
  83. package/server/service/index.ts +0 -88
  84. package/server/service/issue/index.ts +0 -7
  85. package/server/service/issue/issue-mutation.ts +0 -198
  86. package/server/service/issue/issue-query.ts +0 -62
  87. package/server/service/issue/issue-type.ts +0 -61
  88. package/server/service/issue/issue.ts +0 -100
  89. package/server/service/project-report/index.ts +0 -7
  90. package/server/service/project-report/project-report-mutation.ts +0 -198
  91. package/server/service/project-report/project-report-query.ts +0 -62
  92. package/server/service/project-report/project-report-type.ts +0 -61
  93. package/server/service/project-report/project-report.ts +0 -113
  94. package/server/service/supervisor/index.ts +0 -7
  95. package/server/service/supervisor/supervisor-mutation.ts +0 -198
  96. package/server/service/supervisor/supervisor-query.ts +0 -62
  97. package/server/service/supervisor/supervisor-type.ts +0 -61
  98. package/server/service/supervisor/supervisor.ts +0 -108
  99. package/server/tsconfig.json +0 -10
@@ -1,301 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import gql from 'graphql-tag'
3
- import { client } from '@operato/graphql'
4
- import { css, html, LitElement } from 'lit'
5
- import { customElement, property, query, state } from 'lit/decorators.js'
6
- import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
7
- import { notify } from '@operato/layout'
8
- import { store, User } from '@operato/shell'
9
- import { connect } from 'pwa-helpers/connect-mixin.js'
10
- import { OxPrompt } from '@operato/popup/ox-prompt.js'
11
- import { openPopup } from '@operato/layout'
12
- import './file-preview-popup'
13
- import { BuildingInspectionStatus } from '../building-inspection/building-inspection-list'
14
-
15
- @customElement('attachment-list-popup')
16
- class AttachmentListPopup extends connect(store)(LitElement) {
17
- static styles = [
18
- ButtonContainerStyles,
19
- ScrollbarStyles,
20
- css`
21
- :host {
22
- display: flex;
23
- flex-direction: column;
24
- padding: 15px 20px;
25
- background-color: var(--md-sys-color-surface);
26
- }
27
-
28
- div[body] {
29
- height: 100%;
30
- display: flex;
31
- flex-direction: column;
32
- gap: 12px;
33
- }
34
-
35
- div[attachment-container] {
36
- overflow-y: auto;
37
- gap: 10px;
38
- display: flex;
39
- flex-direction: column;
40
- flex: 1;
41
-
42
- div[attachment-row] {
43
- display: flex;
44
- flex-direction: column;
45
-
46
- div[creator-container] {
47
- display: flex;
48
- justify-content: space-between;
49
-
50
- span[creator] {
51
- font-weight: 600;
52
- display: flex;
53
- align-items: center;
54
- gap: 3px;
55
- }
56
- span[createdAt] {
57
- display: flex;
58
- align-items: center;
59
- gap: 3px;
60
-
61
- md-icon[delete] {
62
- cursor: pointer;
63
- }
64
-
65
- a[button-download] {
66
- display: flex;
67
- color: #000;
68
- }
69
- }
70
- }
71
-
72
- a[attachment] {
73
- margin-left: 20px;
74
- text-decoration: none;
75
- color: #000;
76
- }
77
- }
78
- }
79
-
80
- h3 {
81
- position: relative;
82
- color: rgb(5, 149, 229);
83
- font-size: 17px;
84
- font-weight: 700;
85
- background-color: var(--md-sys-color-surface);
86
- margin-top: 0px;
87
- margin-bottom: 5px;
88
- }
89
-
90
- div[button-container] {
91
- display: flex;
92
- justify-content: flex-end;
93
- gap: 10px;
94
- }
95
- `
96
- ]
97
-
98
- @property({ type: String }) checklistItemId: string = ''
99
- @property({ type: String }) status: BuildingInspectionStatus = BuildingInspectionStatus.WAIT
100
-
101
- @state() item: any = { count: 0 }
102
- @state() checklistItemAttachments: any = []
103
- @state() checklistItemAttachmentCount: number = 0
104
- @state() user: User = {}
105
- @query('div[attachment-container]') attachmentContainer!: HTMLDivElement
106
-
107
- render() {
108
- return html`
109
- <div body>
110
- <h3>제품검사에 대한 파일: ${this.checklistItemAttachmentCount || 0}건</h3>
111
-
112
- <div attachment-container>
113
- ${this.checklistItemAttachments.map(attachment => {
114
- return html`
115
- <div attachment-row>
116
- <div creator-container>
117
- <span creator><md-icon slot="icon">account_circle</md-icon> ${attachment.creator.name}</span>
118
- <span createdAt>
119
- <md-icon slot="icon">schedule</md-icon> ${this._formatDate(attachment.createdAt)}
120
- ${attachment.creator.email === this.user.email && this.status != BuildingInspectionStatus.PASS
121
- ? html` <md-icon delete slot="icon" @click=${() => this._deleteAttachment(attachment.id)}>delete</md-icon>`
122
- : ''}
123
- <a button-download href=${attachment.fullpath} download=${attachment.name}>
124
- <md-icon slot="icon">download</md-icon></a
125
- >
126
- </span>
127
- </div>
128
- <a attachment @click=${() => this._onClickPreview(attachment.fullpath)}>${attachment.name}</a>
129
- </div>
130
- `
131
- })}
132
- </div>
133
-
134
- <ox-input-file
135
- accept="*/*"
136
- multiple="true"
137
- hide-filelist
138
- ?disabled=${this.status == BuildingInspectionStatus.PASS}
139
- @change=${this.onCreateAttachment.bind(this)}
140
- ></ox-input-file>
141
-
142
- <div button-container>
143
- <md-elevated-button @click=${this._close}> <md-icon slot="icon">cancel</md-icon>취소 </md-elevated-button>
144
- </div>
145
- </div>
146
- `
147
- }
148
-
149
- async firstUpdated() {
150
- this.user = (store.getState() as any).auth?.user
151
-
152
- await this._loadAttachments()
153
- }
154
-
155
- private async _loadAttachments() {
156
- const response = await client.query({
157
- query: gql`
158
- query ChecklistItem($id: String!) {
159
- checklistItem(id: $id) {
160
- id
161
- checklistItemAttachmentCount
162
- checklistItemAttachments {
163
- id
164
- name
165
- fullpath
166
- creator {
167
- id
168
- name
169
- email
170
- }
171
- createdAt
172
- }
173
- }
174
- }
175
- `,
176
- variables: {
177
- id: this.checklistItemId
178
- }
179
- })
180
-
181
- if (response.errors) return
182
-
183
- this.checklistItemAttachments = response.data.checklistItem.checklistItemAttachments || []
184
- this.checklistItemAttachmentCount = response.data.checklistItem.checklistItemAttachmentCount
185
- }
186
-
187
- private async _deleteAttachment(attachmentId: string) {
188
- if (this.status == BuildingInspectionStatus.PASS) {
189
- notify({ message: '완료 상태인 검측정보를 변경할 수 없습니다.', level: 'error' })
190
- return
191
- }
192
-
193
- if (
194
- await OxPrompt.open({
195
- title: '첨부 자료를 삭제',
196
- text: '첨부 자료를 삭제 하시겠습니까?',
197
- confirmButton: { text: '삭제' },
198
- cancelButton: { text: '취소' }
199
- })
200
- ) {
201
- const response = await client.mutate({
202
- mutation: gql`
203
- mutation DeleteAttachment($deleteAttachmentId: String!) {
204
- deleteAttachment(id: $deleteAttachmentId)
205
- }
206
- `,
207
- variables: {
208
- deleteAttachmentId: attachmentId
209
- }
210
- })
211
-
212
- if (!response.errors) {
213
- this.checklistItemAttachments = [...this.checklistItemAttachments.filter(attachment => attachment.id != attachmentId)]
214
- notify({ message: '첨부 자료를 삭제하였습니다.', level: 'info' })
215
- } else {
216
- notify({ message: response.errors?.[0]?.message || '첨부 자료 삭제에 실패하였습니다.', level: 'error' })
217
- }
218
-
219
- this._dispatchEvent()
220
- }
221
- }
222
-
223
- private _close() {
224
- history.back()
225
- }
226
-
227
- // 파일 변경 시 파일을 저장할 핸들러
228
- private async onCreateAttachment(e: CustomEvent) {
229
- if (this.status == BuildingInspectionStatus.PASS) {
230
- notify({ message: '완료 상태인 검측정보를 변경할 수 없습니다.', level: 'error' })
231
- return
232
- }
233
-
234
- const files = e.detail
235
-
236
- await this._createAttachments(files)
237
-
238
- this._dispatchEvent()
239
- }
240
-
241
- async _createAttachments(files: File[]) {
242
- const checklistItemId = this.checklistItemId
243
-
244
- const response = await client.mutate({
245
- mutation: gql`
246
- mutation ($attachments: [NewAttachment!]!) {
247
- createAttachments(attachments: $attachments) {
248
- id
249
- name
250
- fullpath
251
- creator {
252
- id
253
- name
254
- email
255
- }
256
- createdAt
257
- }
258
- }
259
- `,
260
- variables: {
261
- attachments: files.map(file => {
262
- return { file, refBy: checklistItemId, refType: 'ChecklistItem' }
263
- })
264
- },
265
- context: {
266
- hasUpload: true
267
- }
268
- })
269
-
270
- const attachments = response.data.createAttachments
271
-
272
- this.checklistItemAttachments = [...attachments, ...this.checklistItemAttachments]
273
- this.checklistItemAttachmentCount = this.checklistItemAttachmentCount + attachments.length
274
- }
275
-
276
- private _formatDate(date) {
277
- const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }))
278
-
279
- const year = _date.getFullYear()
280
- const month = String(_date.getMonth() + 1).padStart(2, '0')
281
- const day = String(_date.getDate()).padStart(2, '0')
282
- const hours = String(_date.getHours()).padStart(2, '0')
283
- const minutes = String(_date.getMinutes()).padStart(2, '0')
284
- const seconds = String(_date.getSeconds()).padStart(2, '0')
285
-
286
- return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`
287
- }
288
-
289
- // 첨부 자료 변경 이벤트 디스패치
290
- _dispatchEvent() {
291
- this.dispatchEvent(new CustomEvent('change-attachment', { detail: { checklistItemId: this.checklistItemId } }))
292
- }
293
-
294
- private _onClickPreview(filepath: string) {
295
- openPopup(html` <file-preview-popup .filepath=${filepath}></file-preview-popup> `, {
296
- backdrop: true,
297
- size: 'large',
298
- title: '미리보기'
299
- })
300
- }
301
- }