@dssp/supervision 1.0.0-alpha.21 → 1.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js.map +1 -1
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.d.ts +3 -2
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.js +57 -27
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.js.map +1 -1
- package/dist-client/pages/checklist/inspection-info-popup.d.ts +47 -0
- package/dist-client/pages/checklist/inspection-info-popup.js +563 -0
- package/dist-client/pages/checklist/inspection-info-popup.js.map +1 -0
- package/dist-client/pages/checklist/inspection-tab-popup.d.ts +17 -0
- package/dist-client/pages/checklist/inspection-tab-popup.js +189 -0
- package/dist-client/pages/checklist/inspection-tab-popup.js.map +1 -0
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/building-inspection/building-inspection-mutation.d.ts +2 -2
- package/dist-server/service/building-inspection/building-inspection-mutation.js +1 -1
- package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-query.d.ts +1 -1
- package/dist-server/service/building-inspection/building-inspection-query.js +2 -2
- package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-type.d.ts +2 -1
- package/dist-server/service/building-inspection/building-inspection-type.js +11 -7
- package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection.d.ts +1 -0
- package/dist-server/service/building-inspection/building-inspection.js +5 -0
- package/dist-server/service/building-inspection/building-inspection.js.map +1 -1
- package/dist-server/service/building-inspection/index.d.ts +1 -1
- package/dist-server/service/index.d.ts +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
3
|
+
import '@material/web/button/elevated-button.js';
|
|
4
|
+
import '@material/web/textfield/outlined-text-field.js';
|
|
5
|
+
import '@operato/input/ox-input-file.js';
|
|
6
|
+
import gql from 'graphql-tag';
|
|
7
|
+
import { client } from '@operato/graphql';
|
|
8
|
+
import { css, html, LitElement } from 'lit';
|
|
9
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
10
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles';
|
|
11
|
+
import { notify } from '@operato/layout';
|
|
12
|
+
import { store, User } from '@operato/shell';
|
|
13
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
14
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
15
|
+
import { openPopup } from '@operato/layout';
|
|
16
|
+
import './file-preview-popup';
|
|
17
|
+
import { BuildingInspectionStatus } from '../building-inspection/building-inspection-list';
|
|
18
|
+
let InspectionInfoPopup = class InspectionInfoPopup extends connect(store)(LitElement) {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.buildingInspectionId = '';
|
|
22
|
+
this.status = BuildingInspectionStatus.WAIT;
|
|
23
|
+
this.mode = "VIEWER" /* ChecklistMode.VIEWER */;
|
|
24
|
+
this.memo = '';
|
|
25
|
+
this.attachments = [];
|
|
26
|
+
this.user = {};
|
|
27
|
+
this.isCapturing = false;
|
|
28
|
+
this.stream = null;
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const canEdit = this.status !== BuildingInspectionStatus.PASS && this.mode === "EDITOR" /* ChecklistMode.EDITOR */;
|
|
32
|
+
const isCameraSupported = navigator.mediaDevices && 'mediaDevices' in navigator;
|
|
33
|
+
return html `
|
|
34
|
+
<div class="section">
|
|
35
|
+
<h3 class="section-title">검측 메모</h3>
|
|
36
|
+
<div class="memo-container">
|
|
37
|
+
<textarea
|
|
38
|
+
class="memo-textarea"
|
|
39
|
+
.value=${this.memo}
|
|
40
|
+
?disabled=${!canEdit}
|
|
41
|
+
@input=${this._onMemoChange}
|
|
42
|
+
placeholder="검측과 관련된 메모를 입력하세요..."
|
|
43
|
+
></textarea>
|
|
44
|
+
${canEdit
|
|
45
|
+
? html `
|
|
46
|
+
<div style="display: flex; justify-content: flex-end;">
|
|
47
|
+
<md-elevated-button @click=${this._saveMemo}> <md-icon slot="icon">save</md-icon>메모 저장 </md-elevated-button>
|
|
48
|
+
</div>
|
|
49
|
+
`
|
|
50
|
+
: ''}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="section file-section">
|
|
55
|
+
<h3 class="section-title">첨부 자료</h3>
|
|
56
|
+
|
|
57
|
+
${canEdit
|
|
58
|
+
? html `
|
|
59
|
+
<div class="upload-controls">
|
|
60
|
+
${isCameraSupported
|
|
61
|
+
? html `
|
|
62
|
+
<button class="camera-button" @click=${this._toggleCamera} ?disabled=${this.isCapturing}>
|
|
63
|
+
<md-icon>camera_alt</md-icon>
|
|
64
|
+
${this.isCapturing ? '촬영 중지' : '사진 촬영'}
|
|
65
|
+
</button>
|
|
66
|
+
`
|
|
67
|
+
: ''}
|
|
68
|
+
|
|
69
|
+
<ox-input-file accept="image/*,application/pdf,*/*" multiple="true" hide-filelist @change=${this._onFileSelect}>
|
|
70
|
+
<button class="file-button" slot="trigger">
|
|
71
|
+
<md-icon>attach_file</md-icon>
|
|
72
|
+
파일 선택
|
|
73
|
+
</button>
|
|
74
|
+
</ox-input-file>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div class="video-container ${this.isCapturing ? '' : 'hidden'}">
|
|
78
|
+
<video id="video" autoplay playsinline></video>
|
|
79
|
+
<div class="camera-controls">
|
|
80
|
+
<md-elevated-button @click=${this._capturePhoto}>
|
|
81
|
+
<md-icon slot="icon">camera</md-icon>촬영
|
|
82
|
+
</md-elevated-button>
|
|
83
|
+
<md-elevated-button @click=${this._stopCamera}> <md-icon slot="icon">close</md-icon>취소 </md-elevated-button>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
`
|
|
87
|
+
: ''}
|
|
88
|
+
|
|
89
|
+
<div class="attachment-list">
|
|
90
|
+
${this.attachments.length === 0
|
|
91
|
+
? html ` <div class="empty-state">첨부된 파일이 없습니다.</div> `
|
|
92
|
+
: this.attachments.map(attachment => html `
|
|
93
|
+
<div class="attachment-item">
|
|
94
|
+
<div class="attachment-info" @click=${() => this._previewFile(attachment.fullpath)}>
|
|
95
|
+
<md-icon> ${this._getFileIcon(attachment.name)} </md-icon>
|
|
96
|
+
<div>
|
|
97
|
+
<div>${attachment.name}</div>
|
|
98
|
+
<div class="creator-info">${attachment.creator.name} • ${this._formatDate(attachment.createdAt)}</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
<div class="attachment-actions">
|
|
102
|
+
<a href="${attachment.fullpath}" download="${attachment.name}">
|
|
103
|
+
<md-icon>download</md-icon>
|
|
104
|
+
</a>
|
|
105
|
+
${attachment.creator.email === this.user.email && canEdit
|
|
106
|
+
? html ` <md-icon @click=${() => this._deleteAttachment(attachment.id)}>delete</md-icon> `
|
|
107
|
+
: ''}
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
`)}
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
async firstUpdated() {
|
|
116
|
+
var _a;
|
|
117
|
+
this.user = (_a = store.getState().auth) === null || _a === void 0 ? void 0 : _a.user;
|
|
118
|
+
await this._loadInspectionInfo();
|
|
119
|
+
}
|
|
120
|
+
async _loadInspectionInfo() {
|
|
121
|
+
var _a;
|
|
122
|
+
const response = await client.query({
|
|
123
|
+
query: gql `
|
|
124
|
+
query BuildingInspection($id: String!) {
|
|
125
|
+
buildingInspection(id: $id) {
|
|
126
|
+
id
|
|
127
|
+
memo
|
|
128
|
+
attachments {
|
|
129
|
+
id
|
|
130
|
+
name
|
|
131
|
+
fullpath
|
|
132
|
+
creator {
|
|
133
|
+
id
|
|
134
|
+
name
|
|
135
|
+
email
|
|
136
|
+
}
|
|
137
|
+
createdAt
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`,
|
|
142
|
+
variables: {
|
|
143
|
+
id: this.buildingInspectionId
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
if ((_a = response.data) === null || _a === void 0 ? void 0 : _a.buildingInspection) {
|
|
147
|
+
this.memo = response.data.buildingInspection.memo || '';
|
|
148
|
+
this.attachments = response.data.buildingInspection.attachments || [];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
_onMemoChange(e) {
|
|
152
|
+
const target = e.target;
|
|
153
|
+
this.memo = target.value;
|
|
154
|
+
}
|
|
155
|
+
async _saveMemo() {
|
|
156
|
+
const response = await client.mutate({
|
|
157
|
+
mutation: gql `
|
|
158
|
+
mutation UpdateBuildingInspection($patch: UpdateBuildingInspection!) {
|
|
159
|
+
updateBuildingInspection(patch: $patch) {
|
|
160
|
+
id
|
|
161
|
+
memo
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`,
|
|
165
|
+
variables: {
|
|
166
|
+
patch: {
|
|
167
|
+
id: this.buildingInspectionId,
|
|
168
|
+
memo: this.memo
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
if (!response.errors) {
|
|
173
|
+
notify({ message: '메모가 저장되었습니다.', level: 'info' });
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
notify({ message: '메모 저장에 실패했습니다.', level: 'error' });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
async _toggleCamera() {
|
|
180
|
+
if (this.isCapturing) {
|
|
181
|
+
this._stopCamera();
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
await this._startCamera();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
async _startCamera() {
|
|
188
|
+
try {
|
|
189
|
+
this.stream = await navigator.mediaDevices.getUserMedia({
|
|
190
|
+
video: { facingMode: 'environment' }, // 후면 카메라 우선
|
|
191
|
+
audio: false
|
|
192
|
+
});
|
|
193
|
+
this.isCapturing = true;
|
|
194
|
+
await this.updateComplete;
|
|
195
|
+
if (this.video) {
|
|
196
|
+
this.video.srcObject = this.stream;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
notify({ message: '카메라에 접근할 수 없습니다.', level: 'error' });
|
|
201
|
+
console.error('Camera access error:', error);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
_stopCamera() {
|
|
205
|
+
if (this.stream) {
|
|
206
|
+
this.stream.getTracks().forEach(track => track.stop());
|
|
207
|
+
this.stream = null;
|
|
208
|
+
}
|
|
209
|
+
this.isCapturing = false;
|
|
210
|
+
}
|
|
211
|
+
async _capturePhoto() {
|
|
212
|
+
if (!this.video || !this.stream)
|
|
213
|
+
return;
|
|
214
|
+
const canvas = document.createElement('canvas');
|
|
215
|
+
const context = canvas.getContext('2d');
|
|
216
|
+
canvas.width = this.video.videoWidth;
|
|
217
|
+
canvas.height = this.video.videoHeight;
|
|
218
|
+
context.drawImage(this.video, 0, 0);
|
|
219
|
+
canvas.toBlob(async (blob) => {
|
|
220
|
+
if (blob) {
|
|
221
|
+
const now = new Date();
|
|
222
|
+
const koreaTime = new Date(now.getTime() + 9 * 60 * 60 * 1000); // UTC + 9시간
|
|
223
|
+
const timestamp = koreaTime.toISOString().slice(0, 19).replace('T', '_').replace(/:/g, '-');
|
|
224
|
+
const file = new File([blob], `photo-${timestamp}.jpg`, { type: 'image/jpeg' });
|
|
225
|
+
await this._uploadFiles([file]); // 단일 파일도 배열로 감싸서 전송
|
|
226
|
+
}
|
|
227
|
+
}, 'image/jpeg', 0.8);
|
|
228
|
+
this._stopCamera();
|
|
229
|
+
}
|
|
230
|
+
async _onFileSelect(e) {
|
|
231
|
+
const files = e.detail;
|
|
232
|
+
await this._uploadFiles(files);
|
|
233
|
+
}
|
|
234
|
+
async _uploadFiles(files) {
|
|
235
|
+
if (files.length === 0)
|
|
236
|
+
return;
|
|
237
|
+
try {
|
|
238
|
+
const response = await client.mutate({
|
|
239
|
+
mutation: gql `
|
|
240
|
+
mutation ($attachments: [NewAttachment!]!) {
|
|
241
|
+
createAttachments(attachments: $attachments) {
|
|
242
|
+
id
|
|
243
|
+
name
|
|
244
|
+
fullpath
|
|
245
|
+
creator {
|
|
246
|
+
id
|
|
247
|
+
name
|
|
248
|
+
email
|
|
249
|
+
}
|
|
250
|
+
createdAt
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
`,
|
|
254
|
+
variables: {
|
|
255
|
+
attachments: files.map(file => ({
|
|
256
|
+
file,
|
|
257
|
+
refBy: this.buildingInspectionId,
|
|
258
|
+
refType: 'BuildingInspection'
|
|
259
|
+
}))
|
|
260
|
+
},
|
|
261
|
+
context: {
|
|
262
|
+
hasUpload: true
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
if (!response.errors) {
|
|
266
|
+
const uploadedFiles = response.data.createAttachments;
|
|
267
|
+
this.attachments = [...this.attachments, ...uploadedFiles];
|
|
268
|
+
if (files.length === 1) {
|
|
269
|
+
notify({ message: '파일이 업로드되었습니다.', level: 'info' });
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
notify({ message: `${files.length}개 파일이 모두 업로드되었습니다.`, level: 'info' });
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
notify({ message: '파일 업로드에 실패했습니다.', level: 'error' });
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
notify({ message: '파일 업로드 중 오류가 발생했습니다.', level: 'error' });
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
async _deleteAttachment(attachmentId) {
|
|
284
|
+
var _a, _b;
|
|
285
|
+
if (await OxPrompt.open({
|
|
286
|
+
title: '첨부 자료 삭제',
|
|
287
|
+
text: '첨부 자료를 삭제하시겠습니까?',
|
|
288
|
+
confirmButton: { text: '삭제' },
|
|
289
|
+
cancelButton: { text: '취소' }
|
|
290
|
+
})) {
|
|
291
|
+
const response = await client.mutate({
|
|
292
|
+
mutation: gql `
|
|
293
|
+
mutation DeleteAttachment($deleteAttachmentId: String!) {
|
|
294
|
+
deleteAttachment(id: $deleteAttachmentId)
|
|
295
|
+
}
|
|
296
|
+
`,
|
|
297
|
+
variables: {
|
|
298
|
+
deleteAttachmentId: attachmentId
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
if (!response.errors) {
|
|
302
|
+
this.attachments = this.attachments.filter(attachment => attachment.id !== attachmentId);
|
|
303
|
+
notify({ message: '첨부 자료를 삭제하였습니다.', level: 'info' });
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
notify({ message: ((_b = (_a = response.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) || '첨부 자료 삭제에 실패하였습니다.', level: 'error' });
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
_previewFile(filepath) {
|
|
311
|
+
openPopup(html `<file-preview-popup .filepath=${filepath}></file-preview-popup>`, {
|
|
312
|
+
backdrop: true,
|
|
313
|
+
size: 'large',
|
|
314
|
+
title: '미리보기'
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
_getFileIcon(filename) {
|
|
318
|
+
var _a;
|
|
319
|
+
const ext = (_a = filename.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
320
|
+
if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(ext || '')) {
|
|
321
|
+
return 'image';
|
|
322
|
+
}
|
|
323
|
+
else if (ext === 'pdf') {
|
|
324
|
+
return 'picture_as_pdf';
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
return 'description';
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
_formatDate(date) {
|
|
331
|
+
const _date = new Date(date);
|
|
332
|
+
return _date.toLocaleDateString('ko-KR', {
|
|
333
|
+
year: 'numeric',
|
|
334
|
+
month: '2-digit',
|
|
335
|
+
day: '2-digit',
|
|
336
|
+
hour: '2-digit',
|
|
337
|
+
minute: '2-digit'
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
disconnectedCallback() {
|
|
341
|
+
super.disconnectedCallback();
|
|
342
|
+
this._stopCamera();
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
InspectionInfoPopup.styles = [
|
|
346
|
+
ButtonContainerStyles,
|
|
347
|
+
ScrollbarStyles,
|
|
348
|
+
css `
|
|
349
|
+
:host {
|
|
350
|
+
display: flex;
|
|
351
|
+
flex-direction: column;
|
|
352
|
+
padding: 15px 20px;
|
|
353
|
+
background-color: var(--md-sys-color-surface);
|
|
354
|
+
height: 100%;
|
|
355
|
+
gap: 16px;
|
|
356
|
+
overflow-y: auto;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.section {
|
|
360
|
+
display: flex;
|
|
361
|
+
flex-direction: column;
|
|
362
|
+
gap: 12px;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.section-title {
|
|
366
|
+
color: rgb(5, 149, 229);
|
|
367
|
+
font-size: 17px;
|
|
368
|
+
font-weight: 700;
|
|
369
|
+
margin: 0;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.memo-container {
|
|
373
|
+
display: flex;
|
|
374
|
+
flex-direction: column;
|
|
375
|
+
gap: 8px;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.memo-textarea {
|
|
379
|
+
min-height: 120px;
|
|
380
|
+
border: 1px solid #ccc;
|
|
381
|
+
border-radius: 8px;
|
|
382
|
+
padding: 12px;
|
|
383
|
+
font-family: inherit;
|
|
384
|
+
font-size: 14px;
|
|
385
|
+
resize: vertical;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.file-section {
|
|
389
|
+
flex: 1;
|
|
390
|
+
display: flex;
|
|
391
|
+
flex-direction: column;
|
|
392
|
+
gap: 12px;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.upload-controls {
|
|
396
|
+
display: flex;
|
|
397
|
+
gap: 8px;
|
|
398
|
+
flex-wrap: wrap;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.camera-button,
|
|
402
|
+
.file-button {
|
|
403
|
+
display: flex;
|
|
404
|
+
align-items: center;
|
|
405
|
+
gap: 8px;
|
|
406
|
+
padding: 8px 16px;
|
|
407
|
+
border: 1px solid #ccc;
|
|
408
|
+
border-radius: 8px;
|
|
409
|
+
background: #fff;
|
|
410
|
+
cursor: pointer;
|
|
411
|
+
transition: background 0.2s;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.camera-button:hover,
|
|
415
|
+
.file-button:hover {
|
|
416
|
+
background: #f5f5f5;
|
|
417
|
+
color: #000;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.camera-button:disabled,
|
|
421
|
+
.file-button:disabled {
|
|
422
|
+
opacity: 0.6;
|
|
423
|
+
cursor: not-allowed;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.attachment-list {
|
|
427
|
+
flex: 1;
|
|
428
|
+
overflow-y: auto;
|
|
429
|
+
display: flex;
|
|
430
|
+
flex-direction: column;
|
|
431
|
+
gap: 8px;
|
|
432
|
+
max-height: 300px;
|
|
433
|
+
border: 1px solid #eee;
|
|
434
|
+
border-radius: 8px;
|
|
435
|
+
padding: 8px;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.attachment-item {
|
|
439
|
+
display: flex;
|
|
440
|
+
align-items: center;
|
|
441
|
+
justify-content: space-between;
|
|
442
|
+
padding: 8px;
|
|
443
|
+
border: 1px solid #ddd;
|
|
444
|
+
border-radius: 6px;
|
|
445
|
+
background: #fafafa;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.attachment-info {
|
|
449
|
+
display: flex;
|
|
450
|
+
align-items: center;
|
|
451
|
+
gap: 8px;
|
|
452
|
+
flex: 1;
|
|
453
|
+
cursor: pointer;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.attachment-actions {
|
|
457
|
+
display: flex;
|
|
458
|
+
gap: 4px;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.attachment-actions md-icon {
|
|
462
|
+
cursor: pointer;
|
|
463
|
+
padding: 4px;
|
|
464
|
+
border-radius: 4px;
|
|
465
|
+
transition: background 0.2s;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.attachment-actions md-icon:hover {
|
|
469
|
+
background: #e0e0e0;
|
|
470
|
+
color: #000;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.creator-info {
|
|
474
|
+
font-size: 12px;
|
|
475
|
+
color: #666;
|
|
476
|
+
margin-top: 4px;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.empty-state {
|
|
480
|
+
text-align: center;
|
|
481
|
+
color: #666;
|
|
482
|
+
font-style: italic;
|
|
483
|
+
padding: 20px;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
#cameraInput {
|
|
487
|
+
display: none;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.video-container {
|
|
491
|
+
position: relative;
|
|
492
|
+
margin-bottom: 12px;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
#video {
|
|
496
|
+
width: 100%;
|
|
497
|
+
max-width: 400px;
|
|
498
|
+
height: auto;
|
|
499
|
+
border: 1px solid #ccc;
|
|
500
|
+
border-radius: 8px;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.camera-controls {
|
|
504
|
+
display: flex;
|
|
505
|
+
gap: 8px;
|
|
506
|
+
margin-top: 8px;
|
|
507
|
+
justify-content: center;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.hidden {
|
|
511
|
+
display: none;
|
|
512
|
+
}
|
|
513
|
+
`
|
|
514
|
+
];
|
|
515
|
+
__decorate([
|
|
516
|
+
property({ type: String }),
|
|
517
|
+
__metadata("design:type", String)
|
|
518
|
+
], InspectionInfoPopup.prototype, "buildingInspectionId", void 0);
|
|
519
|
+
__decorate([
|
|
520
|
+
property({ type: String }),
|
|
521
|
+
__metadata("design:type", String)
|
|
522
|
+
], InspectionInfoPopup.prototype, "status", void 0);
|
|
523
|
+
__decorate([
|
|
524
|
+
property({ type: String }),
|
|
525
|
+
__metadata("design:type", String)
|
|
526
|
+
], InspectionInfoPopup.prototype, "mode", void 0);
|
|
527
|
+
__decorate([
|
|
528
|
+
state(),
|
|
529
|
+
__metadata("design:type", String)
|
|
530
|
+
], InspectionInfoPopup.prototype, "memo", void 0);
|
|
531
|
+
__decorate([
|
|
532
|
+
state(),
|
|
533
|
+
__metadata("design:type", Array)
|
|
534
|
+
], InspectionInfoPopup.prototype, "attachments", void 0);
|
|
535
|
+
__decorate([
|
|
536
|
+
state(),
|
|
537
|
+
__metadata("design:type", User)
|
|
538
|
+
], InspectionInfoPopup.prototype, "user", void 0);
|
|
539
|
+
__decorate([
|
|
540
|
+
state(),
|
|
541
|
+
__metadata("design:type", Boolean)
|
|
542
|
+
], InspectionInfoPopup.prototype, "isCapturing", void 0);
|
|
543
|
+
__decorate([
|
|
544
|
+
state(),
|
|
545
|
+
__metadata("design:type", Object)
|
|
546
|
+
], InspectionInfoPopup.prototype, "stream", void 0);
|
|
547
|
+
__decorate([
|
|
548
|
+
query('#video'),
|
|
549
|
+
__metadata("design:type", HTMLVideoElement)
|
|
550
|
+
], InspectionInfoPopup.prototype, "video", void 0);
|
|
551
|
+
__decorate([
|
|
552
|
+
query('#cameraInput'),
|
|
553
|
+
__metadata("design:type", HTMLInputElement)
|
|
554
|
+
], InspectionInfoPopup.prototype, "cameraInput", void 0);
|
|
555
|
+
__decorate([
|
|
556
|
+
query('ox-input-file'),
|
|
557
|
+
__metadata("design:type", Object)
|
|
558
|
+
], InspectionInfoPopup.prototype, "fileInput", void 0);
|
|
559
|
+
InspectionInfoPopup = __decorate([
|
|
560
|
+
customElement('inspection-info-popup')
|
|
561
|
+
], InspectionInfoPopup);
|
|
562
|
+
export { InspectionInfoPopup };
|
|
563
|
+
//# sourceMappingURL=inspection-info-popup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspection-info-popup.js","sourceRoot":"","sources":["../../../client/pages/checklist/inspection-info-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,gDAAgD,CAAA;AACvD,OAAO,iCAAiC,CAAA;AACxC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,sBAAsB,CAAA;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAA;AAInF,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;IAA5D;;QA4KuB,yBAAoB,GAAW,EAAE,CAA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-button.js'\nimport '@material/web/textfield/outlined-text-field.js'\nimport '@operato/input/ox-input-file.js'\nimport gql from 'graphql-tag'\nimport { client } from '@operato/graphql'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'\nimport { notify } from '@operato/layout'\nimport { store, User } from '@operato/shell'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { openPopup } from '@operato/layout'\nimport './file-preview-popup'\nimport { BuildingInspectionStatus } from '../building-inspection/building-inspection-list'\nimport { ChecklistMode } from './checklist-view'\n\n@customElement('inspection-info-popup')\nexport class InspectionInfoPopup extends connect(store)(LitElement) {\n static styles = [\n ButtonContainerStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n padding: 15px 20px;\n background-color: var(--md-sys-color-surface);\n height: 100%;\n gap: 16px;\n overflow-y: auto;\n }\n\n .section {\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .section-title {\n color: rgb(5, 149, 229);\n font-size: 17px;\n font-weight: 700;\n margin: 0;\n }\n\n .memo-container {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n .memo-textarea {\n min-height: 120px;\n border: 1px solid #ccc;\n border-radius: 8px;\n padding: 12px;\n font-family: inherit;\n font-size: 14px;\n resize: vertical;\n }\n\n .file-section {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .upload-controls {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n }\n\n .camera-button,\n .file-button {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 16px;\n border: 1px solid #ccc;\n border-radius: 8px;\n background: #fff;\n cursor: pointer;\n transition: background 0.2s;\n }\n\n .camera-button:hover,\n .file-button:hover {\n background: #f5f5f5;\n color: #000;\n }\n\n .camera-button:disabled,\n .file-button:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .attachment-list {\n flex: 1;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: 8px;\n max-height: 300px;\n border: 1px solid #eee;\n border-radius: 8px;\n padding: 8px;\n }\n\n .attachment-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px;\n border: 1px solid #ddd;\n border-radius: 6px;\n background: #fafafa;\n }\n\n .attachment-info {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n cursor: pointer;\n }\n\n .attachment-actions {\n display: flex;\n gap: 4px;\n }\n\n .attachment-actions md-icon {\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: background 0.2s;\n }\n\n .attachment-actions md-icon:hover {\n background: #e0e0e0;\n color: #000;\n }\n\n .creator-info {\n font-size: 12px;\n color: #666;\n margin-top: 4px;\n }\n\n .empty-state {\n text-align: center;\n color: #666;\n font-style: italic;\n padding: 20px;\n }\n\n #cameraInput {\n display: none;\n }\n\n .video-container {\n position: relative;\n margin-bottom: 12px;\n }\n\n #video {\n width: 100%;\n max-width: 400px;\n height: auto;\n border: 1px solid #ccc;\n border-radius: 8px;\n }\n\n .camera-controls {\n display: flex;\n gap: 8px;\n margin-top: 8px;\n justify-content: center;\n }\n\n .hidden {\n display: none;\n }\n `\n ]\n\n @property({ type: String }) buildingInspectionId: string = ''\n @property({ type: String }) status: BuildingInspectionStatus = BuildingInspectionStatus.WAIT\n @property({ type: String }) mode: ChecklistMode = ChecklistMode.VIEWER\n\n @state() memo: string = ''\n @state() attachments: any[] = []\n @state() user: User = {}\n @state() isCapturing: boolean = false\n @state() stream: MediaStream | null = null\n\n @query('#video') video!: HTMLVideoElement\n @query('#cameraInput') cameraInput!: HTMLInputElement\n @query('ox-input-file') fileInput!: any\n\n render() {\n const canEdit = this.status !== BuildingInspectionStatus.PASS && this.mode === ChecklistMode.EDITOR\n const isCameraSupported = navigator.mediaDevices && 'mediaDevices' in navigator\n\n return html`\n <div class=\"section\">\n <h3 class=\"section-title\">검측 메모</h3>\n <div class=\"memo-container\">\n <textarea\n class=\"memo-textarea\"\n .value=${this.memo}\n ?disabled=${!canEdit}\n @input=${this._onMemoChange}\n placeholder=\"검측과 관련된 메모를 입력하세요...\"\n ></textarea>\n ${canEdit\n ? html`\n <div style=\"display: flex; justify-content: flex-end;\">\n <md-elevated-button @click=${this._saveMemo}> <md-icon slot=\"icon\">save</md-icon>메모 저장 </md-elevated-button>\n </div>\n `\n : ''}\n </div>\n </div>\n\n <div class=\"section file-section\">\n <h3 class=\"section-title\">첨부 자료</h3>\n\n ${canEdit\n ? html`\n <div class=\"upload-controls\">\n ${isCameraSupported\n ? html`\n <button class=\"camera-button\" @click=${this._toggleCamera} ?disabled=${this.isCapturing}>\n <md-icon>camera_alt</md-icon>\n ${this.isCapturing ? '촬영 중지' : '사진 촬영'}\n </button>\n `\n : ''}\n\n <ox-input-file accept=\"image/*,application/pdf,*/*\" multiple=\"true\" hide-filelist @change=${this._onFileSelect}>\n <button class=\"file-button\" slot=\"trigger\">\n <md-icon>attach_file</md-icon>\n 파일 선택\n </button>\n </ox-input-file>\n </div>\n\n <div class=\"video-container ${this.isCapturing ? '' : 'hidden'}\">\n <video id=\"video\" autoplay playsinline></video>\n <div class=\"camera-controls\">\n <md-elevated-button @click=${this._capturePhoto}>\n <md-icon slot=\"icon\">camera</md-icon>촬영\n </md-elevated-button>\n <md-elevated-button @click=${this._stopCamera}> <md-icon slot=\"icon\">close</md-icon>취소 </md-elevated-button>\n </div>\n </div>\n `\n : ''}\n\n <div class=\"attachment-list\">\n ${this.attachments.length === 0\n ? html` <div class=\"empty-state\">첨부된 파일이 없습니다.</div> `\n : this.attachments.map(\n attachment => html`\n <div class=\"attachment-item\">\n <div class=\"attachment-info\" @click=${() => this._previewFile(attachment.fullpath)}>\n <md-icon> ${this._getFileIcon(attachment.name)} </md-icon>\n <div>\n <div>${attachment.name}</div>\n <div class=\"creator-info\">${attachment.creator.name} • ${this._formatDate(attachment.createdAt)}</div>\n </div>\n </div>\n <div class=\"attachment-actions\">\n <a href=\"${attachment.fullpath}\" download=\"${attachment.name}\">\n <md-icon>download</md-icon>\n </a>\n ${attachment.creator.email === this.user.email && canEdit\n ? html` <md-icon @click=${() => this._deleteAttachment(attachment.id)}>delete</md-icon> `\n : ''}\n </div>\n </div>\n `\n )}\n </div>\n </div>\n `\n }\n\n async firstUpdated() {\n this.user = (store.getState() as any).auth?.user\n await this._loadInspectionInfo()\n }\n\n private async _loadInspectionInfo() {\n const response = await client.query({\n query: gql`\n query BuildingInspection($id: String!) {\n buildingInspection(id: $id) {\n id\n memo\n attachments {\n id\n name\n fullpath\n creator {\n id\n name\n email\n }\n createdAt\n }\n }\n }\n `,\n variables: {\n id: this.buildingInspectionId\n }\n })\n\n if (response.data?.buildingInspection) {\n this.memo = response.data.buildingInspection.memo || ''\n this.attachments = response.data.buildingInspection.attachments || []\n }\n }\n\n private _onMemoChange(e: Event) {\n const target = e.target as HTMLTextAreaElement\n this.memo = target.value\n }\n\n private async _saveMemo() {\n const response = await client.mutate({\n mutation: gql`\n mutation UpdateBuildingInspection($patch: UpdateBuildingInspection!) {\n updateBuildingInspection(patch: $patch) {\n id\n memo\n }\n }\n `,\n variables: {\n patch: {\n id: this.buildingInspectionId,\n memo: this.memo\n }\n }\n })\n\n if (!response.errors) {\n notify({ message: '메모가 저장되었습니다.', level: 'info' })\n } else {\n notify({ message: '메모 저장에 실패했습니다.', level: 'error' })\n }\n }\n\n private async _toggleCamera() {\n if (this.isCapturing) {\n this._stopCamera()\n } else {\n await this._startCamera()\n }\n }\n\n private async _startCamera() {\n try {\n this.stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: 'environment' }, // 후면 카메라 우선\n audio: false\n })\n\n this.isCapturing = true\n await this.updateComplete\n\n if (this.video) {\n this.video.srcObject = this.stream\n }\n } catch (error) {\n notify({ message: '카메라에 접근할 수 없습니다.', level: 'error' })\n console.error('Camera access error:', error)\n }\n }\n\n private _stopCamera() {\n if (this.stream) {\n this.stream.getTracks().forEach(track => track.stop())\n this.stream = null\n }\n this.isCapturing = false\n }\n\n private async _capturePhoto() {\n if (!this.video || !this.stream) return\n\n const canvas = document.createElement('canvas')\n const context = canvas.getContext('2d')!\n\n canvas.width = this.video.videoWidth\n canvas.height = this.video.videoHeight\n\n context.drawImage(this.video, 0, 0)\n\n canvas.toBlob(\n async blob => {\n if (blob) {\n const now = new Date()\n const koreaTime = new Date(now.getTime() + 9 * 60 * 60 * 1000) // UTC + 9시간\n const timestamp = koreaTime.toISOString().slice(0, 19).replace('T', '_').replace(/:/g, '-')\n const file = new File([blob], `photo-${timestamp}.jpg`, { type: 'image/jpeg' })\n await this._uploadFiles([file]) // 단일 파일도 배열로 감싸서 전송\n }\n },\n 'image/jpeg',\n 0.8\n )\n\n this._stopCamera()\n }\n\n private async _onFileSelect(e: CustomEvent) {\n const files = e.detail as File[]\n await this._uploadFiles(files)\n }\n\n private async _uploadFiles(files: File[]) {\n if (files.length === 0) return\n\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($attachments: [NewAttachment!]!) {\n createAttachments(attachments: $attachments) {\n id\n name\n fullpath\n creator {\n id\n name\n email\n }\n createdAt\n }\n }\n `,\n variables: {\n attachments: files.map(file => ({\n file,\n refBy: this.buildingInspectionId,\n refType: 'BuildingInspection'\n }))\n },\n context: {\n hasUpload: true\n }\n })\n\n if (!response.errors) {\n const uploadedFiles = response.data.createAttachments\n this.attachments = [...this.attachments, ...uploadedFiles]\n\n if (files.length === 1) {\n notify({ message: '파일이 업로드되었습니다.', level: 'info' })\n } else {\n notify({ message: `${files.length}개 파일이 모두 업로드되었습니다.`, level: 'info' })\n }\n } else {\n notify({ message: '파일 업로드에 실패했습니다.', level: 'error' })\n }\n } catch (error) {\n notify({ message: '파일 업로드 중 오류가 발생했습니다.', level: 'error' })\n }\n }\n\n private async _deleteAttachment(attachmentId: string) {\n if (\n await OxPrompt.open({\n title: '첨부 자료 삭제',\n text: '첨부 자료를 삭제하시겠습니까?',\n confirmButton: { text: '삭제' },\n cancelButton: { text: '취소' }\n })\n ) {\n const response = await client.mutate({\n mutation: gql`\n mutation DeleteAttachment($deleteAttachmentId: String!) {\n deleteAttachment(id: $deleteAttachmentId)\n }\n `,\n variables: {\n deleteAttachmentId: attachmentId\n }\n })\n\n if (!response.errors) {\n this.attachments = this.attachments.filter(attachment => attachment.id !== attachmentId)\n notify({ message: '첨부 자료를 삭제하였습니다.', level: 'info' })\n } else {\n notify({ message: response.errors?.[0]?.message || '첨부 자료 삭제에 실패하였습니다.', level: 'error' })\n }\n }\n }\n\n private _previewFile(filepath: string) {\n openPopup(html`<file-preview-popup .filepath=${filepath}></file-preview-popup>`, {\n backdrop: true,\n size: 'large',\n title: '미리보기'\n })\n }\n\n private _getFileIcon(filename: string): string {\n const ext = filename.split('.').pop()?.toLowerCase()\n\n if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(ext || '')) {\n return 'image'\n } else if (ext === 'pdf') {\n return 'picture_as_pdf'\n } else {\n return 'description'\n }\n }\n\n private _formatDate(date: string): string {\n const _date = new Date(date)\n return _date.toLocaleDateString('ko-KR', {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit'\n })\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._stopCamera()\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js';
|
|
2
|
+
import '@material/web/button/elevated-button.js';
|
|
3
|
+
import { LitElement } from 'lit';
|
|
4
|
+
import './inspection-info-popup';
|
|
5
|
+
export declare class InspectionTabPopup extends LitElement {
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
|
+
selectedInspection: any;
|
|
8
|
+
project: any;
|
|
9
|
+
initialTab: number;
|
|
10
|
+
activeTab: number;
|
|
11
|
+
firstUpdated(): void;
|
|
12
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
13
|
+
private _renderChecklistTab;
|
|
14
|
+
private _renderInfoTab;
|
|
15
|
+
private _setActiveTab;
|
|
16
|
+
private _onModifyChecklist;
|
|
17
|
+
}
|