@dssp/supervision 1.0.5 → 1.0.6
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/action-plan/action-plan-list-page.d.ts +6 -3
- package/dist-client/pages/action-plan/action-plan-list-page.js +26 -16
- package/dist-client/pages/action-plan/action-plan-list-page.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-ai-measurement.d.ts +3 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-ai-measurement.js +16 -4
- package/dist-client/pages/building-inspection/building-inspection-detail-ai-measurement.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-camera.d.ts +3 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-camera.js +17 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-camera.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.d.ts +3 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +22 -6
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-list.d.ts +3 -0
- package/dist-client/pages/building-inspection/building-inspection-list.js +27 -11
- package/dist-client/pages/building-inspection/building-inspection-list.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-management.d.ts +3 -0
- package/dist-client/pages/building-inspection/building-inspection-management.js +19 -5
- package/dist-client/pages/building-inspection/building-inspection-management.js.map +1 -1
- package/dist-client/pages/building-inspection/component/field-document/field-document-popup.d.ts +3 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-popup.js +24 -5
- package/dist-client/pages/building-inspection/component/field-document/field-document-popup.js.map +1 -1
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.d.ts +3 -0
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.js +27 -11
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.js.map +1 -1
- package/dist-client/pages/building-inspection-grid/component/notice-comment-popup.js +17 -2
- package/dist-client/pages/building-inspection-grid/component/notice-comment-popup.js.map +1 -1
- package/dist-client/pages/checklist/attachment-list-popup.js +22 -8
- package/dist-client/pages/checklist/attachment-list-popup.js.map +1 -1
- package/dist-client/pages/checklist/comment-list-popup.js +22 -8
- package/dist-client/pages/checklist/comment-list-popup.js.map +1 -1
- package/dist-client/pages/checklist/inspection-info-popup.d.ts +3 -0
- package/dist-client/pages/checklist/inspection-info-popup.js +12 -1
- package/dist-client/pages/checklist/inspection-info-popup.js.map +1 -1
- package/dist-client/pages/checklist-template/checklist-template-item.js +23 -3
- package/dist-client/pages/checklist-template/checklist-template-item.js.map +1 -1
- package/dist-client/pages/checklist-template/checklist-template-list.d.ts +3 -0
- package/dist-client/pages/checklist-template/checklist-template-list.js +21 -4
- package/dist-client/pages/checklist-template/checklist-template-list.js.map +1 -1
- package/dist-client/pages/checklist-template/checklist-type-management.d.ts +3 -0
- package/dist-client/pages/checklist-template/checklist-type-management.js +21 -4
- package/dist-client/pages/checklist-template/checklist-type-management.js.map +1 -1
- package/dist-client/pages/checklist-template/construction-checklist-template-item-popup.js +21 -3
- package/dist-client/pages/checklist-template/construction-checklist-template-item-popup.js.map +1 -1
- package/dist-client/pages/checklist-template/construction-checklist-template-list.d.ts +3 -0
- package/dist-client/pages/checklist-template/construction-checklist-template-list.js +18 -4
- package/dist-client/pages/checklist-template/construction-checklist-template-list.js.map +1 -1
- package/dist-client/pages/issue/issue-list-page.d.ts +6 -3
- package/dist-client/pages/issue/issue-list-page.js +26 -16
- package/dist-client/pages/issue/issue-list-page.js.map +1 -1
- package/dist-client/pages/project-checklist/project-checklist-management.d.ts +3 -0
- package/dist-client/pages/project-checklist/project-checklist-management.js +31 -9
- package/dist-client/pages/project-checklist/project-checklist-management.js.map +1 -1
- package/dist-client/pages/project-report/project-report-list-page.d.ts +6 -3
- package/dist-client/pages/project-report/project-report-list-page.js +26 -16
- package/dist-client/pages/project-report/project-report-list-page.js.map +1 -1
- package/dist-client/pages/supervisor/supervisor-list-page.d.ts +6 -3
- package/dist-client/pages/supervisor/supervisor-list-page.js +26 -16
- package/dist-client/pages/supervisor/supervisor-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notice-comment-popup.js","sourceRoot":"","sources":["../../../../client/pages/building-inspection-grid/component/notice-comment-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,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,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGtD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QA8F8B,oBAAe,GAAW,EAAE,CAAA;QAC5B,UAAK,GAAW,EAAE,CAAA;QAErC,SAAI,GAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;QACxB,mBAAc,GAAQ,EAAE,CAAA;QACxB,YAAO,GAAW,EAAE,CAAA;QACpB,SAAI,GAAS,EAAE,CAAA;IAiL1B,CAAC;IA7KC,MAAM;QACJ,OAAO,IAAI,CAAA;;cAED,IAAI,CAAC,KAAK;;;YAGZ,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YAClC,OAAO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A3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAmB;AAErC;IAAR,KAAK,EAAE;;gDAAyB;AACxB;IAAR,KAAK,EAAE;;0DAAyB;AACxB;IAAR,KAAK,EAAE;;mDAAqB;AACpB;IAAR,KAAK,EAAE;8BAAO,IAAI;gDAAK;AAEU;IAAjC,KAAK,CAAC,yBAAyB,CAAC;8BAAqB,cAAc;6DAAA;AAtGhE,kBAAkB;IADvB,aAAa,CAAC,sBAAsB,CAAC;GAChC,kBAAkB,CAqRvB","sourcesContent":["import '@material/web/icon/icon.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 { OxPrompt } from '@operato/popup/ox-prompt.js'\n\n@customElement('notice-comment-popup')\nclass NoticeCommentPopup extends 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 }\n\n div[body] {\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n div[comments-container] {\n overflow-y: auto;\n gap: 10px;\n display: flex;\n flex-direction: column;\n flex: 1;\n\n div[comment-row] {\n display: flex;\n flex-direction: column;\n padding-right: 10px;\n\n div[creator-container] {\n display: flex;\n justify-content: space-between;\n\n span[creator] {\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 3px;\n }\n span[createdAt] {\n display: flex;\n align-items: center;\n gap: 3px;\n\n md-icon[delete] {\n cursor: pointer;\n }\n }\n }\n\n div[comment] {\n margin-left: 20px;\n }\n }\n }\n\n h3 {\n position: relative;\n color: rgb(5, 149, 229);\n font-size: 17px;\n font-weight: 700;\n background-color: var(--md-sys-color-surface);\n margin-top: 0px;\n margin-bottom: 5px;\n }\n\n textarea {\n height: 75px;\n border: 1px solid #ccc;\n }\n\n div[button-container] {\n display: flex;\n justify-content: flex-end;\n gap: 10px;\n\n md-elevated-button[blue] {\n --md-elevated-button-container-color: #0595e5;\n\n --md-elevated-button-label-text-color: #fff;\n --md-elevated-button-hover-label-text-color: #fff;\n --md-elevated-button-pressed-label-text-color: #fff;\n --md-elevated-button-focus-label-text-color: #fff;\n --md-elevated-button-icon-color: #fff;\n --md-elevated-button-hover-icon-color: #fff;\n --md-elevated-button-pressed-icon-color: #fff;\n --md-elevated-button-focus-icon-color: #fff;\n }\n }\n `\n ]\n\n @property({ type: String }) buildingLevelId: string = ''\n @property({ type: String }) title: string = ''\n\n @state() item: any = { count: 0 }\n @state() noticeComments: any = []\n @state() comment: string = ''\n @state() user: User = {}\n\n @query('div[comments-container]') commentsContainer!: HTMLDivElement\n\n render() {\n return html`\n <div body>\n <h3>${this.title}</h3>\n\n <div comments-container>\n ${this.noticeComments.map(comment => {\n return html`\n <div comment-row>\n <div creator-container>\n <span creator><md-icon slot=\"icon\">account_circle</md-icon> ${comment.creator.name}</span>\n <span createdAt>\n <md-icon slot=\"icon\">schedule</md-icon> ${this._formatDate(comment.createdAt)}\n ${comment.creator.email === this.user.email\n ? html` <md-icon delete slot=\"icon\" @click=${() => this._deleteComment(comment.id)}>delete</md-icon>`\n : ''}\n </span>\n </div>\n <div comment>${comment.comment}</div>\n </div>\n `\n })}\n </div>\n\n <textarea .value=${this.comment || ''} @input=${this._onInputChange}></textarea>\n\n <div button-container>\n <md-elevated-button blue @click=${this._createComment}> <md-icon slot=\"icon\">task</md-icon>저장 </md-elevated-button>\n <md-elevated-button @click=${this._close}> <md-icon slot=\"icon\">cancel</md-icon>취소 </md-elevated-button>\n </div>\n </div>\n `\n }\n\n async firstUpdated() {\n this.user = (store.getState() as any).auth?.user\n this.comment = ''\n await this._loadComments()\n this._scrollBottom()\n }\n\n private async _loadComments() {\n const response = await client.query({\n query: gql`\n query NoticeComments($buildingLevelId: String!) {\n noticeComments(buildingLevelId: $buildingLevelId) {\n id\n comment\n creator {\n id\n email\n name\n }\n createdAt\n }\n }\n `,\n variables: {\n buildingLevelId: this.buildingLevelId\n }\n })\n\n if (response.errors) return\n\n const items = response.data.noticeComments\n this.noticeComments = [...items.reverse(), ...this.noticeComments]\n }\n\n private async _createComment() {\n if (!this.comment) {\n notify({ message: '코멘트를 입력해주세요.', level: 'warn' })\n return\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation CreateNoticeComment($noticeComment: NewNoticeComment!) {\n createNoticeComment(noticeComment: $noticeComment) {\n id\n comment\n creator {\n id\n email\n name\n }\n createdAt\n }\n }\n `,\n variables: {\n noticeComment: {\n comment: this.comment,\n buildingLevelId: this.buildingLevelId\n }\n }\n })\n\n if (!response.errors) {\n this.comment = ''\n this.noticeComments = [...this.noticeComments, { ...response.data.createNoticeComment }]\n this._scrollBottom()\n } else {\n notify({ message: response.errors?.[0]?.message || '코멘트 등록에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent('create')\n }\n\n private async _deleteComment(commentId: 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 DeleteNoticeComment($id: String!) {\n deleteNoticeComment(id: $id)\n }\n `,\n variables: {\n id: commentId\n }\n })\n\n if (!response.errors) {\n this.noticeComments = [...this.noticeComments.filter(comment => comment.id != commentId)]\n notify({ message: '코멘트를 삭제하였습니다.', level: 'info' })\n } else {\n notify({ message: response.errors?.[0]?.message || '코멘트 삭제에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent('delete')\n }\n }\n\n private _close() {\n history.back()\n }\n\n // Input 요소의 값이 변경될 때 호출되는 콜백 함수\n private _onInputChange(event: InputEvent) {\n const target = event.target as HTMLInputElement\n this.comment = target.value\n }\n\n private _formatDate(date) {\n const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }))\n\n const year = _date.getFullYear()\n const month = String(_date.getMonth() + 1).padStart(2, '0')\n const day = String(_date.getDate()).padStart(2, '0')\n const hours = String(_date.getHours()).padStart(2, '0')\n const minutes = String(_date.getMinutes()).padStart(2, '0')\n const seconds = String(_date.getSeconds()).padStart(2, '0')\n\n return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`\n }\n\n // 댓글 스크롤 맨 밑으로\n private async _scrollBottom() {\n setTimeout(() => {\n this.commentsContainer.scrollTop = this.commentsContainer.scrollHeight\n }, 100)\n }\n\n // 조치사항 변경 이벤트 디스패치\n _dispatchEvent(type: string = 'create') {\n this.dispatchEvent(new CustomEvent('change-comment', { detail: { buildingLevelId: this.buildingLevelId, type } }))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"notice-comment-popup.js","sourceRoot":"","sources":["../../../../client/pages/building-inspection-grid/component/notice-comment-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,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,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAA;AAGlF,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QA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B,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,iBAAiB,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAA;QACxE,CAAC,EAAE,GAAG,CAAC,CAAA;IACT,CAAC;IAED,mBAAmB;IACnB,cAAc,CAAC,OAAe,QAAQ;QACpC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAA;IACpH,CAAC;;AA9RM,yBAAM,GAAG;IACd,qBAAqB;IACrB,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuFF;CACF,AA3FY,CA2FZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2DAA6B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAmB;AAErC;IAAR,KAAK,EAAE;;gDAAyB;AACxB;IAAR,KAAK,EAAE;;0DAAyB;AACxB;IAAR,KAAK,EAAE;;mDAAqB;AACpB;IAAR,KAAK,EAAE;8BAAO,IAAI;gDAAK;AAEP;IAAhB,KAAK,EAAE;;qDAA0B;AAEA;IAAjC,KAAK,CAAC,yBAAyB,CAAC;8BAAqB,cAAc;6DAAA;AAxGhE,kBAAkB;IADvB,aAAa,CAAC,sBAAsB,CAAC;GAChC,kBAAkB,CAgSvB","sourcesContent":["import '@material/web/icon/icon.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 { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { canDcspMutate } from '@dssp/building-complex/dist-client/utils/privilege'\n\n@customElement('notice-comment-popup')\nclass NoticeCommentPopup extends 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 }\n\n div[body] {\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n div[comments-container] {\n overflow-y: auto;\n gap: 10px;\n display: flex;\n flex-direction: column;\n flex: 1;\n\n div[comment-row] {\n display: flex;\n flex-direction: column;\n padding-right: 10px;\n\n div[creator-container] {\n display: flex;\n justify-content: space-between;\n\n span[creator] {\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 3px;\n }\n span[createdAt] {\n display: flex;\n align-items: center;\n gap: 3px;\n\n md-icon[delete] {\n cursor: pointer;\n }\n }\n }\n\n div[comment] {\n margin-left: 20px;\n }\n }\n }\n\n h3 {\n position: relative;\n color: rgb(5, 149, 229);\n font-size: 17px;\n font-weight: 700;\n background-color: var(--md-sys-color-surface);\n margin-top: 0px;\n margin-bottom: 5px;\n }\n\n textarea {\n height: 75px;\n border: 1px solid #ccc;\n }\n\n div[button-container] {\n display: flex;\n justify-content: flex-end;\n gap: 10px;\n\n md-elevated-button[blue] {\n --md-elevated-button-container-color: #0595e5;\n\n --md-elevated-button-label-text-color: #fff;\n --md-elevated-button-hover-label-text-color: #fff;\n --md-elevated-button-pressed-label-text-color: #fff;\n --md-elevated-button-focus-label-text-color: #fff;\n --md-elevated-button-icon-color: #fff;\n --md-elevated-button-hover-icon-color: #fff;\n --md-elevated-button-pressed-icon-color: #fff;\n --md-elevated-button-focus-icon-color: #fff;\n }\n }\n `\n ]\n\n @property({ type: String }) buildingLevelId: string = ''\n @property({ type: String }) title: string = ''\n\n @state() item: any = { count: 0 }\n @state() noticeComments: any = []\n @state() comment: string = ''\n @state() user: User = {}\n /** 뮤테이션 가능 여부('dcsp guest' 권한 보유 시 false) — 게스트에게는 생성/수정/삭제 버튼을 숨긴다 */\n @state() private canMutate = false\n\n @query('div[comments-container]') commentsContainer!: HTMLDivElement\n\n async connectedCallback() {\n super.connectedCallback()\n this.canMutate = await canDcspMutate()\n }\n\n render() {\n return html`\n <div body>\n <h3>${this.title}</h3>\n\n <div comments-container>\n ${this.noticeComments.map(comment => {\n return html`\n <div comment-row>\n <div creator-container>\n <span creator><md-icon slot=\"icon\">account_circle</md-icon> ${comment.creator.name}</span>\n <span createdAt>\n <md-icon slot=\"icon\">schedule</md-icon> ${this._formatDate(comment.createdAt)}\n ${this.canMutate && comment.creator.email === this.user.email\n ? html` <md-icon delete slot=\"icon\" @click=${() => this._deleteComment(comment.id)}>delete</md-icon>`\n : ''}\n </span>\n </div>\n <div comment>${comment.comment}</div>\n </div>\n `\n })}\n </div>\n\n <textarea .value=${this.comment || ''} @input=${this._onInputChange}></textarea>\n\n <div button-container>\n ${this.canMutate\n ? html`<md-elevated-button blue @click=${this._createComment}>\n <md-icon slot=\"icon\">task</md-icon>저장\n </md-elevated-button>`\n : ''}\n <md-elevated-button @click=${this._close}> <md-icon slot=\"icon\">cancel</md-icon>취소 </md-elevated-button>\n </div>\n </div>\n `\n }\n\n async firstUpdated() {\n this.user = (store.getState() as any).auth?.user\n this.comment = ''\n await this._loadComments()\n this._scrollBottom()\n }\n\n private async _loadComments() {\n const response = await client.query({\n query: gql`\n query NoticeComments($buildingLevelId: String!) {\n noticeComments(buildingLevelId: $buildingLevelId) {\n id\n comment\n creator {\n id\n email\n name\n }\n createdAt\n }\n }\n `,\n variables: {\n buildingLevelId: this.buildingLevelId\n }\n })\n\n if (response.errors) return\n\n const items = response.data.noticeComments\n this.noticeComments = [...items.reverse(), ...this.noticeComments]\n }\n\n private async _createComment() {\n if (!this.comment) {\n notify({ message: '코멘트를 입력해주세요.', level: 'warn' })\n return\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation CreateNoticeComment($noticeComment: NewNoticeComment!) {\n createNoticeComment(noticeComment: $noticeComment) {\n id\n comment\n creator {\n id\n email\n name\n }\n createdAt\n }\n }\n `,\n variables: {\n noticeComment: {\n comment: this.comment,\n buildingLevelId: this.buildingLevelId\n }\n }\n })\n\n if (!response.errors) {\n this.comment = ''\n this.noticeComments = [...this.noticeComments, { ...response.data.createNoticeComment }]\n this._scrollBottom()\n } else {\n notify({ message: response.errors?.[0]?.message || '코멘트 등록에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent('create')\n }\n\n private async _deleteComment(commentId: 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 DeleteNoticeComment($id: String!) {\n deleteNoticeComment(id: $id)\n }\n `,\n variables: {\n id: commentId\n }\n })\n\n if (!response.errors) {\n this.noticeComments = [...this.noticeComments.filter(comment => comment.id != commentId)]\n notify({ message: '코멘트를 삭제하였습니다.', level: 'info' })\n } else {\n notify({ message: response.errors?.[0]?.message || '코멘트 삭제에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent('delete')\n }\n }\n\n private _close() {\n history.back()\n }\n\n // Input 요소의 값이 변경될 때 호출되는 콜백 함수\n private _onInputChange(event: InputEvent) {\n const target = event.target as HTMLInputElement\n this.comment = target.value\n }\n\n private _formatDate(date) {\n const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }))\n\n const year = _date.getFullYear()\n const month = String(_date.getMonth() + 1).padStart(2, '0')\n const day = String(_date.getDate()).padStart(2, '0')\n const hours = String(_date.getHours()).padStart(2, '0')\n const minutes = String(_date.getMinutes()).padStart(2, '0')\n const seconds = String(_date.getSeconds()).padStart(2, '0')\n\n return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`\n }\n\n // 댓글 스크롤 맨 밑으로\n private async _scrollBottom() {\n setTimeout(() => {\n this.commentsContainer.scrollTop = this.commentsContainer.scrollHeight\n }, 100)\n }\n\n // 조치사항 변경 이벤트 디스패치\n _dispatchEvent(type: string = 'create') {\n this.dispatchEvent(new CustomEvent('change-comment', { detail: { buildingLevelId: this.buildingLevelId, type } }))\n }\n}\n"]}
|
|
@@ -13,6 +13,7 @@ import './file-preview-popup';
|
|
|
13
13
|
import '../building-inspection/component/image-preview-popup';
|
|
14
14
|
import { BuildingInspectionStatus } from '../building-inspection/building-inspection-list';
|
|
15
15
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
16
|
+
import { canDcspMutate } from '@dssp/building-complex/dist-client/utils/privilege';
|
|
16
17
|
let AttachmentListPopup = class AttachmentListPopup extends connect(store)(LitElement) {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
@@ -23,6 +24,12 @@ let AttachmentListPopup = class AttachmentListPopup extends connect(store)(LitEl
|
|
|
23
24
|
this.checklistItemAttachments = [];
|
|
24
25
|
this.checklistItemAttachmentCount = 0;
|
|
25
26
|
this.user = {};
|
|
27
|
+
/** 뮤테이션 가능 여부('dcsp guest' 권한 보유 시 false) — 게스트에게는 생성/수정/삭제 버튼을 숨긴다 */
|
|
28
|
+
this.canMutate = false;
|
|
29
|
+
}
|
|
30
|
+
async connectedCallback() {
|
|
31
|
+
super.connectedCallback();
|
|
32
|
+
this.canMutate = await canDcspMutate();
|
|
26
33
|
}
|
|
27
34
|
render() {
|
|
28
35
|
return html `
|
|
@@ -69,7 +76,8 @@ let AttachmentListPopup = class AttachmentListPopup extends connect(store)(LitEl
|
|
|
69
76
|
>
|
|
70
77
|
<md-icon title="다운로드" style="color: #2196f3;">download</md-icon>
|
|
71
78
|
</a>
|
|
72
|
-
${
|
|
79
|
+
${this.canMutate &&
|
|
80
|
+
((_b = attachment.creator) === null || _b === void 0 ? void 0 : _b.email) === this.user.email &&
|
|
73
81
|
this.status != BuildingInspectionStatus.PASS &&
|
|
74
82
|
this.mode == "EDITOR" /* ChecklistMode.EDITOR */
|
|
75
83
|
? html `<md-icon
|
|
@@ -94,13 +102,15 @@ let AttachmentListPopup = class AttachmentListPopup extends connect(store)(LitEl
|
|
|
94
102
|
`}
|
|
95
103
|
</div>
|
|
96
104
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
${this.canMutate
|
|
106
|
+
? html `<ox-input-file
|
|
107
|
+
accept="*/*"
|
|
108
|
+
multiple="true"
|
|
109
|
+
hide-filelist
|
|
110
|
+
?disabled=${this.status == BuildingInspectionStatus.PASS || this.mode == "VIEWER" /* ChecklistMode.VIEWER */}
|
|
111
|
+
@change=${this.onCreateAttachment.bind(this)}
|
|
112
|
+
></ox-input-file>`
|
|
113
|
+
: ''}
|
|
104
114
|
|
|
105
115
|
<div button-container>
|
|
106
116
|
<md-elevated-button @click=${this._close}> <md-icon slot="icon">cancel</md-icon>취소 </md-elevated-button>
|
|
@@ -486,6 +496,10 @@ __decorate([
|
|
|
486
496
|
state(),
|
|
487
497
|
__metadata("design:type", User)
|
|
488
498
|
], AttachmentListPopup.prototype, "user", void 0);
|
|
499
|
+
__decorate([
|
|
500
|
+
state(),
|
|
501
|
+
__metadata("design:type", Object)
|
|
502
|
+
], AttachmentListPopup.prototype, "canMutate", void 0);
|
|
489
503
|
AttachmentListPopup = __decorate([
|
|
490
504
|
customElement('attachment-list-popup')
|
|
491
505
|
], AttachmentListPopup);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-list-popup.js","sourceRoot":"","sources":["../../../client/pages/checklist/attachment-list-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,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,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AAM,EAAE,CAAC;;mDAAiE;AAChE;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAA2C;AAE7D;IAAR,KAAK,EAAE;;iDAAyB;AACxB;IAAR,KAAK,EAAE;;qEAAmC;AAClC;IAAR,KAAK,EAAE;;yEAAyC;AACxC;IAAR,KAAK,EAAE;8BAAO,IAAI;iDAAK;AAjLpB,mBAAmB;IADxB,aAAa,CAAC,uBAAuB,CAAC;GACjC,mBAAmB,CA0dxB","sourcesContent":["import '@material/web/icon/icon.js'\nimport gql from 'graphql-tag'\nimport { client } from '@operato/graphql'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'\nimport { notify } from '@operato/layout'\nimport { store, User, connect } from '@operato/shell'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { openPopup } from '@operato/layout'\nimport './file-preview-popup'\nimport '../building-inspection/component/image-preview-popup'\nimport { BuildingInspectionStatus } from '../building-inspection/building-inspection-list'\nimport { ChecklistMode } from './checklist-view'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\n@customElement('attachment-list-popup')\nclass AttachmentListPopup extends connect(store)(LitElement) {\n static styles = [\n ButtonContainerStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: #fff;\n width: 100%;\n max-height: 80vh;\n }\n\n div[body] {\n flex: 1;\n overflow-y: auto;\n padding: 20px;\n\n div[file-list-container] {\n display: flex;\n flex-direction: column;\n gap: 15px;\n background-color: #f7f7f7;\n padding: 20px;\n border-radius: 8px;\n margin-bottom: 20px;\n\n div[file-item] {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 12px;\n background-color: #fff;\n border-radius: 6px;\n border: 1px solid #ddd;\n cursor: pointer;\n transition: all 0.2s ease;\n\n &:hover {\n background-color: #e3f2fd;\n border-color: #2196f3;\n transform: translateY(-1px);\n box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);\n }\n\n div[file-info] {\n flex: 1;\n display: flex;\n align-items: center;\n gap: 12px;\n\n div[file-icon] {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n border-radius: 8px;\n\n md-icon {\n --md-icon-size: 24px;\n color: #666;\n }\n }\n\n div[file-details] {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 4px;\n\n span[file-name] {\n font-size: 14px;\n font-weight: 500;\n color: #333;\n line-height: 1.2;\n }\n\n div[file-meta] {\n display: flex;\n gap: 15px;\n margin-top: 2px;\n\n span[file-creator] {\n font-size: 11px;\n color: #666;\n display: flex;\n align-items: center;\n gap: 3px;\n }\n\n span[file-date] {\n font-size: 11px;\n color: #666;\n display: flex;\n align-items: center;\n gap: 3px;\n }\n }\n }\n }\n\n div[action-buttons] {\n display: flex;\n gap: 8px;\n align-items: center;\n\n md-icon {\n --md-icon-size: 20px;\n color: #2196f3;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: background-color 0.2s;\n\n &:hover {\n background-color: rgba(33, 150, 243, 0.1);\n }\n }\n\n md-icon[delete] {\n color: #f44336;\n\n &:hover {\n background-color: rgba(244, 67, 54, 0.1);\n }\n }\n\n a {\n text-decoration: none;\n color: inherit;\n display: flex;\n align-items: center;\n }\n }\n }\n }\n\n div[empty-state] {\n text-align: center;\n color: #666;\n padding: 40px;\n\n md-icon {\n --md-icon-size: 48px;\n color: #ccc;\n margin-bottom: 16px;\n }\n }\n\n div[button-container] {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n margin-top: 20px;\n }\n }\n\n h3 {\n position: relative;\n color: rgb(5, 149, 229);\n font-size: 17px;\n font-weight: 700;\n margin: 0px 20px 10px 20px;\n padding-top: 20px;\n }\n `\n ]\n\n @property({ type: String }) checklistItemId: string = ''\n @property({ type: String }) status: BuildingInspectionStatus = BuildingInspectionStatus.WAIT\n @property({ type: String }) mode: ChecklistMode = ChecklistMode.VIEWER\n\n @state() item: any = { count: 0 }\n @state() checklistItemAttachments: any = []\n @state() checklistItemAttachmentCount: number = 0\n @state() user: User = {}\n\n render() {\n return html`\n <h3>제품검사에 대한 파일: ${this.checklistItemAttachmentCount || 0}건</h3>\n\n <div body>\n <div file-list-container>\n ${this.checklistItemAttachments.length > 0\n ? this.checklistItemAttachments.map(\n attachment => html`\n <div file-item @click=${() => this._onClickPreview(attachment.fullpath)}>\n <div file-info>\n <div file-icon>\n <md-icon>description</md-icon>\n </div>\n <div file-details>\n <span file-name>${attachment.name || ''}</span>\n <div file-meta>\n <span file-creator>\n <md-icon style=\"--md-icon-size: 12px;\">account_circle</md-icon>\n ${attachment.creator?.name || ''}\n </span>\n <span file-date>\n <md-icon style=\"--md-icon-size: 12px;\">schedule</md-icon>\n ${this._formatDate(attachment.createdAt)}\n </span>\n </div>\n </div>\n </div>\n <div action-buttons>\n <md-icon\n title=\"미리보기\"\n @click=${(e: Event) => {\n e.stopPropagation()\n this._onClickPreview(attachment.fullpath)\n }}\n >visibility</md-icon\n >\n <a\n href=${ifDefined(attachment.fullpath)}\n download=${ifDefined(attachment.name)}\n @click=${(e: Event) => e.stopPropagation()}\n >\n <md-icon title=\"다운로드\" style=\"color: #2196f3;\">download</md-icon>\n </a>\n ${attachment.creator?.email === this.user.email &&\n this.status != BuildingInspectionStatus.PASS &&\n this.mode == ChecklistMode.EDITOR\n ? html`<md-icon\n delete\n title=\"삭제\"\n @click=${(e: Event) => {\n e.stopPropagation()\n this._deleteAttachment(attachment.id)\n }}\n >delete</md-icon\n >`\n : ''}\n </div>\n </div>\n `\n )\n : html`\n <div empty-state>\n <md-icon>insert_drive_file</md-icon>\n <div>첨부된 파일이 없습니다.</div>\n </div>\n `}\n </div>\n\n <ox-input-file\n accept=\"*/*\"\n multiple=\"true\"\n hide-filelist\n ?disabled=${this.status == BuildingInspectionStatus.PASS || this.mode == ChecklistMode.VIEWER}\n @change=${this.onCreateAttachment.bind(this)}\n ></ox-input-file>\n\n <div button-container>\n <md-elevated-button @click=${this._close}> <md-icon slot=\"icon\">cancel</md-icon>취소 </md-elevated-button>\n </div>\n </div>\n `\n }\n\n async firstUpdated() {\n this.user = (store.getState() as any).auth?.user\n\n await this._loadAttachments()\n }\n\n private async _loadAttachments() {\n const response = await client.query({\n query: gql`\n query ChecklistItem($id: String!) {\n checklistItem(id: $id) {\n id\n checklistItemAttachmentCount\n checklistItemAttachments {\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.checklistItemId\n }\n })\n\n if (response.errors) return\n\n this.checklistItemAttachments = response.data.checklistItem.checklistItemAttachments || []\n this.checklistItemAttachmentCount = response.data.checklistItem.checklistItemAttachmentCount\n }\n\n private async _deleteAttachment(attachmentId: string) {\n if (this.status == BuildingInspectionStatus.PASS) {\n notify({ message: '완료 상태인 검측정보를 변경할 수 없습니다.', level: 'error' })\n return\n }\n\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.checklistItemAttachments = [...this.checklistItemAttachments.filter(attachment => attachment.id != attachmentId)]\n notify({ message: '첨부 자료를 삭제하였습니다.', level: 'info' })\n } else {\n notify({ message: response.errors?.[0]?.message || '첨부 자료 삭제에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent()\n }\n }\n\n private _close() {\n history.back()\n }\n\n // 파일 변경 시 파일을 저장할 핸들러\n private async onCreateAttachment(e: CustomEvent) {\n if (this.status == BuildingInspectionStatus.PASS) {\n notify({ message: '완료 상태인 검측정보를 변경할 수 없습니다.', level: 'error' })\n return\n }\n\n const files = e.detail\n\n await this._createAttachments(files)\n\n this._dispatchEvent()\n }\n\n async _createAttachments(files: File[]) {\n const checklistItemId = this.checklistItemId\n\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 return { file, refBy: checklistItemId, refType: 'ChecklistItem', description: this.status }\n })\n },\n context: {\n hasUpload: true\n }\n })\n\n const attachments = response.data.createAttachments\n\n this.checklistItemAttachments = [...attachments, ...this.checklistItemAttachments]\n this.checklistItemAttachmentCount = this.checklistItemAttachmentCount + attachments.length\n }\n\n private _formatDate(date) {\n const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }))\n\n const year = _date.getFullYear()\n const month = String(_date.getMonth() + 1).padStart(2, '0')\n const day = String(_date.getDate()).padStart(2, '0')\n const hours = String(_date.getHours()).padStart(2, '0')\n const minutes = String(_date.getMinutes()).padStart(2, '0')\n\n return `${year}.${month}.${day} ${hours}:${minutes}`\n }\n\n // 첨부 자료 변경 이벤트 디스패치\n _dispatchEvent() {\n this.dispatchEvent(new CustomEvent('change-attachment', { detail: { checklistItemId: this.checklistItemId } }))\n }\n\n private _onClickPreview(filepath: string) {\n if (!filepath) {\n return\n }\n\n // 파일 확장자로 타입 판단\n const fileExtension = filepath.toLowerCase().split('.').pop()\n const isImage = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg'].includes(fileExtension || '')\n const isPdf = fileExtension === 'pdf'\n\n if (isImage) {\n this._openImagePreview(filepath)\n } else if (isPdf) {\n this._openPdfPreview(filepath)\n } else {\n // 기타 파일은 기존 file-preview-popup 사용\n this._openGenericPreview(filepath)\n }\n }\n\n private _openImagePreview(filepath: string) {\n const imageData = this.checklistItemAttachments.filter(attachment => {\n const fileExtension = attachment.fullpath?.toLowerCase().split('.').pop()\n return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg'].includes(fileExtension || '')\n })\n\n const currentIndex = imageData.findIndex(attachment => attachment.fullpath === filepath)\n\n openPopup(\n html` <image-preview-popup .images=${imageData} .currentIndex=${Math.max(0, currentIndex)}></image-preview-popup> `,\n { backdrop: true, size: 'large', title: '이미지 미리보기' }\n )\n }\n\n private _openPdfPreview(filepath: string) {\n openPopup(\n html`\n <div style=\"display: flex; flex-direction: column;\">\n <div style=\"flex: 1; overflow: hidden; touch-action: pan-x pan-y;\">\n <iframe\n src=\"${filepath}#toolbar=1&navpanes=0&scrollbar=1&zoom=page-fit\"\n style=\"\n width: 100%; \n height: 100%; \n border: none; \n touch-action: pan-x pan-y;\n \"\n @error=${() => {\n // PDF 로드 실패시 새 탭에서 열기\n window.open(filepath, '_blank')\n }}\n ></iframe>\n </div>\n </div>\n `,\n { backdrop: true, size: 'large', title: '[PDF 미리보기]' }\n )\n }\n\n // 기타 파일 타입은 기존 방식 사용\n private _openGenericPreview(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"]}
|
|
1
|
+
{"version":3,"file":"attachment-list-popup.js","sourceRoot":"","sources":["../../../client/pages/checklist/attachment-list-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,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,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAA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,MAAM,EAAE,CAAC;;4DAA6B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAiE;AAChE;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAA2C;AAE7D;IAAR,KAAK,EAAE;;iDAAyB;AACxB;IAAR,KAAK,EAAE;;qEAAmC;AAClC;IAAR,KAAK,EAAE;;yEAAyC;AACxC;IAAR,KAAK,EAAE;8BAAO,IAAI;iDAAK;AAEP;IAAhB,KAAK,EAAE;;sDAA0B;AAnL9B,mBAAmB;IADxB,aAAa,CAAC,uBAAuB,CAAC;GACjC,mBAAmB,CAoexB","sourcesContent":["import '@material/web/icon/icon.js'\nimport gql from 'graphql-tag'\nimport { client } from '@operato/graphql'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'\nimport { notify } from '@operato/layout'\nimport { store, User, connect } from '@operato/shell'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { openPopup } from '@operato/layout'\nimport './file-preview-popup'\nimport '../building-inspection/component/image-preview-popup'\nimport { BuildingInspectionStatus } from '../building-inspection/building-inspection-list'\nimport { ChecklistMode } from './checklist-view'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { canDcspMutate } from '@dssp/building-complex/dist-client/utils/privilege'\n\n@customElement('attachment-list-popup')\nclass AttachmentListPopup extends connect(store)(LitElement) {\n static styles = [\n ButtonContainerStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: #fff;\n width: 100%;\n max-height: 80vh;\n }\n\n div[body] {\n flex: 1;\n overflow-y: auto;\n padding: 20px;\n\n div[file-list-container] {\n display: flex;\n flex-direction: column;\n gap: 15px;\n background-color: #f7f7f7;\n padding: 20px;\n border-radius: 8px;\n margin-bottom: 20px;\n\n div[file-item] {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 12px;\n background-color: #fff;\n border-radius: 6px;\n border: 1px solid #ddd;\n cursor: pointer;\n transition: all 0.2s ease;\n\n &:hover {\n background-color: #e3f2fd;\n border-color: #2196f3;\n transform: translateY(-1px);\n box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);\n }\n\n div[file-info] {\n flex: 1;\n display: flex;\n align-items: center;\n gap: 12px;\n\n div[file-icon] {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n border-radius: 8px;\n\n md-icon {\n --md-icon-size: 24px;\n color: #666;\n }\n }\n\n div[file-details] {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 4px;\n\n span[file-name] {\n font-size: 14px;\n font-weight: 500;\n color: #333;\n line-height: 1.2;\n }\n\n div[file-meta] {\n display: flex;\n gap: 15px;\n margin-top: 2px;\n\n span[file-creator] {\n font-size: 11px;\n color: #666;\n display: flex;\n align-items: center;\n gap: 3px;\n }\n\n span[file-date] {\n font-size: 11px;\n color: #666;\n display: flex;\n align-items: center;\n gap: 3px;\n }\n }\n }\n }\n\n div[action-buttons] {\n display: flex;\n gap: 8px;\n align-items: center;\n\n md-icon {\n --md-icon-size: 20px;\n color: #2196f3;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: background-color 0.2s;\n\n &:hover {\n background-color: rgba(33, 150, 243, 0.1);\n }\n }\n\n md-icon[delete] {\n color: #f44336;\n\n &:hover {\n background-color: rgba(244, 67, 54, 0.1);\n }\n }\n\n a {\n text-decoration: none;\n color: inherit;\n display: flex;\n align-items: center;\n }\n }\n }\n }\n\n div[empty-state] {\n text-align: center;\n color: #666;\n padding: 40px;\n\n md-icon {\n --md-icon-size: 48px;\n color: #ccc;\n margin-bottom: 16px;\n }\n }\n\n div[button-container] {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n margin-top: 20px;\n }\n }\n\n h3 {\n position: relative;\n color: rgb(5, 149, 229);\n font-size: 17px;\n font-weight: 700;\n margin: 0px 20px 10px 20px;\n padding-top: 20px;\n }\n `\n ]\n\n @property({ type: String }) checklistItemId: string = ''\n @property({ type: String }) status: BuildingInspectionStatus = BuildingInspectionStatus.WAIT\n @property({ type: String }) mode: ChecklistMode = ChecklistMode.VIEWER\n\n @state() item: any = { count: 0 }\n @state() checklistItemAttachments: any = []\n @state() checklistItemAttachmentCount: number = 0\n @state() user: User = {}\n /** 뮤테이션 가능 여부('dcsp guest' 권한 보유 시 false) — 게스트에게는 생성/수정/삭제 버튼을 숨긴다 */\n @state() private canMutate = false\n\n async connectedCallback() {\n super.connectedCallback()\n this.canMutate = await canDcspMutate()\n }\n\n render() {\n return html`\n <h3>제품검사에 대한 파일: ${this.checklistItemAttachmentCount || 0}건</h3>\n\n <div body>\n <div file-list-container>\n ${this.checklistItemAttachments.length > 0\n ? this.checklistItemAttachments.map(\n attachment => html`\n <div file-item @click=${() => this._onClickPreview(attachment.fullpath)}>\n <div file-info>\n <div file-icon>\n <md-icon>description</md-icon>\n </div>\n <div file-details>\n <span file-name>${attachment.name || ''}</span>\n <div file-meta>\n <span file-creator>\n <md-icon style=\"--md-icon-size: 12px;\">account_circle</md-icon>\n ${attachment.creator?.name || ''}\n </span>\n <span file-date>\n <md-icon style=\"--md-icon-size: 12px;\">schedule</md-icon>\n ${this._formatDate(attachment.createdAt)}\n </span>\n </div>\n </div>\n </div>\n <div action-buttons>\n <md-icon\n title=\"미리보기\"\n @click=${(e: Event) => {\n e.stopPropagation()\n this._onClickPreview(attachment.fullpath)\n }}\n >visibility</md-icon\n >\n <a\n href=${ifDefined(attachment.fullpath)}\n download=${ifDefined(attachment.name)}\n @click=${(e: Event) => e.stopPropagation()}\n >\n <md-icon title=\"다운로드\" style=\"color: #2196f3;\">download</md-icon>\n </a>\n ${this.canMutate &&\n attachment.creator?.email === this.user.email &&\n this.status != BuildingInspectionStatus.PASS &&\n this.mode == ChecklistMode.EDITOR\n ? html`<md-icon\n delete\n title=\"삭제\"\n @click=${(e: Event) => {\n e.stopPropagation()\n this._deleteAttachment(attachment.id)\n }}\n >delete</md-icon\n >`\n : ''}\n </div>\n </div>\n `\n )\n : html`\n <div empty-state>\n <md-icon>insert_drive_file</md-icon>\n <div>첨부된 파일이 없습니다.</div>\n </div>\n `}\n </div>\n\n ${this.canMutate\n ? html`<ox-input-file\n accept=\"*/*\"\n multiple=\"true\"\n hide-filelist\n ?disabled=${this.status == BuildingInspectionStatus.PASS || this.mode == ChecklistMode.VIEWER}\n @change=${this.onCreateAttachment.bind(this)}\n ></ox-input-file>`\n : ''}\n\n <div button-container>\n <md-elevated-button @click=${this._close}> <md-icon slot=\"icon\">cancel</md-icon>취소 </md-elevated-button>\n </div>\n </div>\n `\n }\n\n async firstUpdated() {\n this.user = (store.getState() as any).auth?.user\n\n await this._loadAttachments()\n }\n\n private async _loadAttachments() {\n const response = await client.query({\n query: gql`\n query ChecklistItem($id: String!) {\n checklistItem(id: $id) {\n id\n checklistItemAttachmentCount\n checklistItemAttachments {\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.checklistItemId\n }\n })\n\n if (response.errors) return\n\n this.checklistItemAttachments = response.data.checklistItem.checklistItemAttachments || []\n this.checklistItemAttachmentCount = response.data.checklistItem.checklistItemAttachmentCount\n }\n\n private async _deleteAttachment(attachmentId: string) {\n if (this.status == BuildingInspectionStatus.PASS) {\n notify({ message: '완료 상태인 검측정보를 변경할 수 없습니다.', level: 'error' })\n return\n }\n\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.checklistItemAttachments = [...this.checklistItemAttachments.filter(attachment => attachment.id != attachmentId)]\n notify({ message: '첨부 자료를 삭제하였습니다.', level: 'info' })\n } else {\n notify({ message: response.errors?.[0]?.message || '첨부 자료 삭제에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent()\n }\n }\n\n private _close() {\n history.back()\n }\n\n // 파일 변경 시 파일을 저장할 핸들러\n private async onCreateAttachment(e: CustomEvent) {\n if (this.status == BuildingInspectionStatus.PASS) {\n notify({ message: '완료 상태인 검측정보를 변경할 수 없습니다.', level: 'error' })\n return\n }\n\n const files = e.detail\n\n await this._createAttachments(files)\n\n this._dispatchEvent()\n }\n\n async _createAttachments(files: File[]) {\n const checklistItemId = this.checklistItemId\n\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 return { file, refBy: checklistItemId, refType: 'ChecklistItem', description: this.status }\n })\n },\n context: {\n hasUpload: true\n }\n })\n\n const attachments = response.data.createAttachments\n\n this.checklistItemAttachments = [...attachments, ...this.checklistItemAttachments]\n this.checklistItemAttachmentCount = this.checklistItemAttachmentCount + attachments.length\n }\n\n private _formatDate(date) {\n const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }))\n\n const year = _date.getFullYear()\n const month = String(_date.getMonth() + 1).padStart(2, '0')\n const day = String(_date.getDate()).padStart(2, '0')\n const hours = String(_date.getHours()).padStart(2, '0')\n const minutes = String(_date.getMinutes()).padStart(2, '0')\n\n return `${year}.${month}.${day} ${hours}:${minutes}`\n }\n\n // 첨부 자료 변경 이벤트 디스패치\n _dispatchEvent() {\n this.dispatchEvent(new CustomEvent('change-attachment', { detail: { checklistItemId: this.checklistItemId } }))\n }\n\n private _onClickPreview(filepath: string) {\n if (!filepath) {\n return\n }\n\n // 파일 확장자로 타입 판단\n const fileExtension = filepath.toLowerCase().split('.').pop()\n const isImage = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg'].includes(fileExtension || '')\n const isPdf = fileExtension === 'pdf'\n\n if (isImage) {\n this._openImagePreview(filepath)\n } else if (isPdf) {\n this._openPdfPreview(filepath)\n } else {\n // 기타 파일은 기존 file-preview-popup 사용\n this._openGenericPreview(filepath)\n }\n }\n\n private _openImagePreview(filepath: string) {\n const imageData = this.checklistItemAttachments.filter(attachment => {\n const fileExtension = attachment.fullpath?.toLowerCase().split('.').pop()\n return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg'].includes(fileExtension || '')\n })\n\n const currentIndex = imageData.findIndex(attachment => attachment.fullpath === filepath)\n\n openPopup(\n html` <image-preview-popup .images=${imageData} .currentIndex=${Math.max(0, currentIndex)}></image-preview-popup> `,\n { backdrop: true, size: 'large', title: '이미지 미리보기' }\n )\n }\n\n private _openPdfPreview(filepath: string) {\n openPopup(\n html`\n <div style=\"display: flex; flex-direction: column;\">\n <div style=\"flex: 1; overflow: hidden; touch-action: pan-x pan-y;\">\n <iframe\n src=\"${filepath}#toolbar=1&navpanes=0&scrollbar=1&zoom=page-fit\"\n style=\"\n width: 100%; \n height: 100%; \n border: none; \n touch-action: pan-x pan-y;\n \"\n @error=${() => {\n // PDF 로드 실패시 새 탭에서 열기\n window.open(filepath, '_blank')\n }}\n ></iframe>\n </div>\n </div>\n `,\n { backdrop: true, size: 'large', title: '[PDF 미리보기]' }\n )\n }\n\n // 기타 파일 타입은 기존 방식 사용\n private _openGenericPreview(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"]}
|
|
@@ -9,6 +9,7 @@ import { notify } from '@operato/layout';
|
|
|
9
9
|
import { store, User, connect } from '@operato/shell';
|
|
10
10
|
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
11
11
|
import { BuildingInspectionStatus } from '../building-inspection/building-inspection-list';
|
|
12
|
+
import { canDcspMutate } from '@dssp/building-complex/dist-client/utils/privilege';
|
|
12
13
|
let CommentListPopup = class CommentListPopup extends connect(store)(LitElement) {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
@@ -23,6 +24,12 @@ let CommentListPopup = class CommentListPopup extends connect(store)(LitElement)
|
|
|
23
24
|
this.page = 1;
|
|
24
25
|
this.loading = false;
|
|
25
26
|
this.hasMoreComments = true;
|
|
27
|
+
/** 뮤테이션 가능 여부('dcsp guest' 권한 보유 시 false) — 게스트에게는 생성/수정/삭제 버튼을 숨긴다 */
|
|
28
|
+
this.canMutate = false;
|
|
29
|
+
}
|
|
30
|
+
async connectedCallback() {
|
|
31
|
+
super.connectedCallback();
|
|
32
|
+
this.canMutate = await canDcspMutate();
|
|
26
33
|
}
|
|
27
34
|
render() {
|
|
28
35
|
return html `
|
|
@@ -37,7 +44,8 @@ let CommentListPopup = class CommentListPopup extends connect(store)(LitElement)
|
|
|
37
44
|
<span creator><md-icon slot="icon">account_circle</md-icon> ${comment.creator.name}</span>
|
|
38
45
|
<span createdAt>
|
|
39
46
|
<md-icon slot="icon">schedule</md-icon> ${this._formatDate(comment.createdAt)}
|
|
40
|
-
${
|
|
47
|
+
${this.canMutate &&
|
|
48
|
+
comment.creator.email === this.user.email &&
|
|
41
49
|
this.status != BuildingInspectionStatus.PASS &&
|
|
42
50
|
this.mode == "EDITOR" /* ChecklistMode.EDITOR */
|
|
43
51
|
? html ` <md-icon delete slot="icon" @click=${() => this._deleteComment(comment.id)}>delete</md-icon>`
|
|
@@ -57,13 +65,15 @@ let CommentListPopup = class CommentListPopup extends connect(store)(LitElement)
|
|
|
57
65
|
></textarea>
|
|
58
66
|
|
|
59
67
|
<div button-container>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
${this.canMutate
|
|
69
|
+
? html `<md-elevated-button
|
|
70
|
+
blue
|
|
71
|
+
?disabled=${this.status == BuildingInspectionStatus.PASS || this.mode == "VIEWER" /* ChecklistMode.VIEWER */}
|
|
72
|
+
@click=${this._createComment}
|
|
73
|
+
>
|
|
74
|
+
<md-icon slot="icon">task</md-icon>저장
|
|
75
|
+
</md-elevated-button>`
|
|
76
|
+
: ''}
|
|
67
77
|
<md-elevated-button @click=${this._close}> <md-icon slot="icon">cancel</md-icon>취소 </md-elevated-button>
|
|
68
78
|
</div>
|
|
69
79
|
</div>
|
|
@@ -357,6 +367,10 @@ __decorate([
|
|
|
357
367
|
state(),
|
|
358
368
|
__metadata("design:type", Boolean)
|
|
359
369
|
], CommentListPopup.prototype, "hasMoreComments", void 0);
|
|
370
|
+
__decorate([
|
|
371
|
+
state(),
|
|
372
|
+
__metadata("design:type", Object)
|
|
373
|
+
], CommentListPopup.prototype, "canMutate", void 0);
|
|
360
374
|
__decorate([
|
|
361
375
|
query('div[comments-container]'),
|
|
362
376
|
__metadata("design:type", HTMLDivElement)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment-list-popup.js","sourceRoot":"","sources":["../../../client/pages/checklist/comment-list-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,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,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAA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AAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAA;IAC9G,CAAC;;AA/TM,uBAAM,GAAG;IACd,qBAAqB;IACrB,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuFF;CACF,AA3FY,CA2FZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAA6B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAiE;AAChE;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAA2C;AAE7D;IAAR,KAAK,EAAE;;8CAAyB;AACxB;IAAR,KAAK,EAAE;;+DAAgC;AAC/B;IAAR,KAAK,EAAE;;iDAAqB;AACpB;IAAR,KAAK,EAAE;;mEAAsC;AACrC;IAAR,KAAK,EAAE;8BAAO,IAAI;8CAAK;AACf;IAAR,KAAK,EAAE;;8CAAiB;AAChB;IAAR,KAAK,EAAE;;iDAAyB;AACxB;IAAR,KAAK,EAAE;;yDAAgC;AAEN;IAAjC,KAAK,CAAC,yBAAyB,CAAC;8BAAqB,cAAc;2DAAA;AA3GhE,gBAAgB;IADrB,aAAa,CAAC,oBAAoB,CAAC;GAC9B,gBAAgB,CAiUrB","sourcesContent":["import '@material/web/icon/icon.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, connect } from '@operato/shell'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { BuildingInspectionStatus } from '../building-inspection/building-inspection-list'\nimport { ChecklistMode } from './checklist-view'\n\n@customElement('comment-list-popup')\nclass CommentListPopup 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 }\n\n div[body] {\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n div[comments-container] {\n overflow-y: auto;\n gap: 10px;\n display: flex;\n flex-direction: column;\n flex: 1;\n\n div[comment-row] {\n display: flex;\n flex-direction: column;\n padding-right: 10px;\n\n div[creator-container] {\n display: flex;\n justify-content: space-between;\n\n span[creator] {\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 3px;\n }\n span[createdAt] {\n display: flex;\n align-items: center;\n gap: 3px;\n\n md-icon[delete] {\n cursor: pointer;\n }\n }\n }\n\n div[comment] {\n margin-left: 20px;\n }\n }\n }\n\n h3 {\n position: relative;\n color: rgb(5, 149, 229);\n font-size: 17px;\n font-weight: 700;\n background-color: var(--md-sys-color-surface);\n margin-top: 0px;\n margin-bottom: 5px;\n }\n\n textarea {\n height: 75px;\n border: 1px solid #ccc;\n }\n\n div[button-container] {\n display: flex;\n justify-content: flex-end;\n gap: 10px;\n\n md-elevated-button[blue] {\n --md-elevated-button-container-color: #0595e5;\n\n --md-elevated-button-label-text-color: #fff;\n --md-elevated-button-hover-label-text-color: #fff;\n --md-elevated-button-pressed-label-text-color: #fff;\n --md-elevated-button-focus-label-text-color: #fff;\n --md-elevated-button-icon-color: #fff;\n --md-elevated-button-hover-icon-color: #fff;\n --md-elevated-button-pressed-icon-color: #fff;\n --md-elevated-button-focus-icon-color: #fff;\n }\n }\n `\n ]\n\n @property({ type: String }) checklistItemId: string = ''\n @property({ type: String }) status: BuildingInspectionStatus = BuildingInspectionStatus.WAIT\n @property({ type: String }) mode: ChecklistMode = ChecklistMode.VIEWER\n\n @state() item: any = { count: 0 }\n @state() checklistItemComments: any = []\n @state() comment: string = ''\n @state() checklistItemCommentCount: number = 0\n @state() user: User = {}\n @state() page: number = 1\n @state() loading: boolean = false\n @state() hasMoreComments: boolean = true\n\n @query('div[comments-container]') commentsContainer!: HTMLDivElement\n\n render() {\n return html`\n <div body>\n <h3>제품검사에 대한 확인: ${this.checklistItemCommentCount || 0}건</h3>\n\n <div comments-container @scroll=${this._onScroll}>\n ${this.checklistItemComments.map(comment => {\n return html`\n <div comment-row>\n <div creator-container>\n <span creator><md-icon slot=\"icon\">account_circle</md-icon> ${comment.creator.name}</span>\n <span createdAt>\n <md-icon slot=\"icon\">schedule</md-icon> ${this._formatDate(comment.createdAt)}\n ${comment.creator.email === this.user.email &&\n this.status != BuildingInspectionStatus.PASS &&\n this.mode == ChecklistMode.EDITOR\n ? html` <md-icon delete slot=\"icon\" @click=${() => this._deleteComment(comment.id)}>delete</md-icon>`\n : ''}\n </span>\n </div>\n <div comment>${comment.comment}</div>\n </div>\n `\n })}\n </div>\n\n <textarea\n .value=${this.comment || ''}\n ?disabled=${this.status == BuildingInspectionStatus.PASS || this.mode == ChecklistMode.VIEWER}\n @input=${this._onInputChange}\n ></textarea>\n\n <div button-container>\n <md-elevated-button\n blue\n ?disabled=${this.status == BuildingInspectionStatus.PASS || this.mode == ChecklistMode.VIEWER}\n @click=${this._createComment}\n >\n <md-icon slot=\"icon\">task</md-icon>저장\n </md-elevated-button>\n <md-elevated-button @click=${this._close}> <md-icon slot=\"icon\">cancel</md-icon>취소 </md-elevated-button>\n </div>\n </div>\n `\n }\n\n async firstUpdated() {\n this.user = (store.getState() as any).auth?.user\n this.comment = ''\n this.page = 1\n await this._loadComments()\n this._scrollBottom()\n }\n\n private async _loadComments() {\n if (this.loading || !this.hasMoreComments) return\n\n this.loading = true\n\n const response = await client.query({\n query: gql`\n query ChecklistItemComments($pagination: Pagination!, $checklistItemId: String!) {\n checklistItemComments(pagination: $pagination, checklistItemId: $checklistItemId) {\n id\n comment\n creator {\n id\n email\n name\n }\n createdAt\n }\n\n checklistItem(id: $checklistItemId) {\n id\n checklistItemCommentCount\n }\n }\n `,\n variables: {\n checklistItemId: this.checklistItemId,\n pagination: {\n page: this.page,\n limit: 10\n }\n }\n })\n\n if (response.errors) return\n\n const items = response.data.checklistItemComments\n if (items.length < 10) this.hasMoreComments = false\n\n this.checklistItemComments = [...items.reverse(), ...this.checklistItemComments]\n this.page += 1\n this.checklistItemCommentCount = response.data.checklistItem.checklistItemCommentCount\n this.loading = false\n }\n\n // 스크롤이 맨 위에 가까울 때 데이터 요청\n private _onScroll() {\n const { scrollTop } = this.commentsContainer\n if (scrollTop <= 5) {\n this._loadComments()\n }\n }\n\n private async _createComment() {\n if (!this.comment) {\n notify({ message: '조치사항을 입력해주세요.', level: 'warn' })\n return\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation CreateChecklistItemComment($checklistItemComment: NewChecklistItemComment!) {\n createChecklistItemComment(checklistItemComment: $checklistItemComment) {\n id\n comment\n creator {\n id\n email\n }\n createdAt\n }\n }\n `,\n variables: {\n checklistItemComment: {\n comment: this.comment,\n checklistItemId: this.checklistItemId\n }\n }\n })\n\n if (!response.errors) {\n this.comment = ''\n this.checklistItemComments = [...this.checklistItemComments, { ...response.data.createChecklistItemComment }]\n this._scrollBottom()\n this.checklistItemCommentCount++\n } else {\n notify({ message: response.errors?.[0]?.message || '조치사항 등록에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent()\n }\n\n private async _deleteComment(commentId: 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 DeleteChecklistItemComment($id: String!) {\n deleteChecklistItemComment(id: $id)\n }\n `,\n variables: {\n id: commentId\n }\n })\n\n if (!response.errors) {\n this.checklistItemComments = [...this.checklistItemComments.filter(comment => comment.id != commentId)]\n notify({ message: '조치사항을 삭제하였습니다.', level: 'info' })\n } else {\n notify({ message: response.errors?.[0]?.message || '조치사항 삭제에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent()\n }\n }\n\n private _close() {\n history.back()\n }\n\n // Input 요소의 값이 변경될 때 호출되는 콜백 함수\n private _onInputChange(event: InputEvent) {\n const target = event.target as HTMLInputElement\n this.comment = target.value\n }\n\n private _formatDate(date) {\n const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }))\n\n const year = _date.getFullYear()\n const month = String(_date.getMonth() + 1).padStart(2, '0')\n const day = String(_date.getDate()).padStart(2, '0')\n const hours = String(_date.getHours()).padStart(2, '0')\n const minutes = String(_date.getMinutes()).padStart(2, '0')\n const seconds = String(_date.getSeconds()).padStart(2, '0')\n\n return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`\n }\n\n // 댓글 스크롤 맨 밑으로\n private async _scrollBottom() {\n setTimeout(() => {\n this.commentsContainer.scrollTop = this.commentsContainer.scrollHeight\n }, 100)\n }\n\n // 조치사항 변경 이벤트 디스패치\n _dispatchEvent() {\n this.dispatchEvent(new CustomEvent('change-comment', { detail: { checklistItemId: this.checklistItemId } }))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"comment-list-popup.js","sourceRoot":"","sources":["../../../client/pages/checklist/comment-list-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,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,C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ACf;IAAR,KAAK,EAAE;;8CAAiB;AAChB;IAAR,KAAK,EAAE;;iDAAyB;AACxB;IAAR,KAAK,EAAE;;yDAAgC;AAEvB;IAAhB,KAAK,EAAE;;mDAA0B;AAEA;IAAjC,KAAK,CAAC,yBAAyB,CAAC;8BAAqB,cAAc;2DAAA;AA7GhE,gBAAgB;IADrB,aAAa,CAAC,oBAAoB,CAAC;GAC9B,gBAAgB,CA2UrB","sourcesContent":["import '@material/web/icon/icon.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, connect } from '@operato/shell'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { BuildingInspectionStatus } from '../building-inspection/building-inspection-list'\nimport { ChecklistMode } from './checklist-view'\nimport { canDcspMutate } from '@dssp/building-complex/dist-client/utils/privilege'\n\n@customElement('comment-list-popup')\nclass CommentListPopup 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 }\n\n div[body] {\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n div[comments-container] {\n overflow-y: auto;\n gap: 10px;\n display: flex;\n flex-direction: column;\n flex: 1;\n\n div[comment-row] {\n display: flex;\n flex-direction: column;\n padding-right: 10px;\n\n div[creator-container] {\n display: flex;\n justify-content: space-between;\n\n span[creator] {\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 3px;\n }\n span[createdAt] {\n display: flex;\n align-items: center;\n gap: 3px;\n\n md-icon[delete] {\n cursor: pointer;\n }\n }\n }\n\n div[comment] {\n margin-left: 20px;\n }\n }\n }\n\n h3 {\n position: relative;\n color: rgb(5, 149, 229);\n font-size: 17px;\n font-weight: 700;\n background-color: var(--md-sys-color-surface);\n margin-top: 0px;\n margin-bottom: 5px;\n }\n\n textarea {\n height: 75px;\n border: 1px solid #ccc;\n }\n\n div[button-container] {\n display: flex;\n justify-content: flex-end;\n gap: 10px;\n\n md-elevated-button[blue] {\n --md-elevated-button-container-color: #0595e5;\n\n --md-elevated-button-label-text-color: #fff;\n --md-elevated-button-hover-label-text-color: #fff;\n --md-elevated-button-pressed-label-text-color: #fff;\n --md-elevated-button-focus-label-text-color: #fff;\n --md-elevated-button-icon-color: #fff;\n --md-elevated-button-hover-icon-color: #fff;\n --md-elevated-button-pressed-icon-color: #fff;\n --md-elevated-button-focus-icon-color: #fff;\n }\n }\n `\n ]\n\n @property({ type: String }) checklistItemId: string = ''\n @property({ type: String }) status: BuildingInspectionStatus = BuildingInspectionStatus.WAIT\n @property({ type: String }) mode: ChecklistMode = ChecklistMode.VIEWER\n\n @state() item: any = { count: 0 }\n @state() checklistItemComments: any = []\n @state() comment: string = ''\n @state() checklistItemCommentCount: number = 0\n @state() user: User = {}\n @state() page: number = 1\n @state() loading: boolean = false\n @state() hasMoreComments: boolean = true\n /** 뮤테이션 가능 여부('dcsp guest' 권한 보유 시 false) — 게스트에게는 생성/수정/삭제 버튼을 숨긴다 */\n @state() private canMutate = false\n\n @query('div[comments-container]') commentsContainer!: HTMLDivElement\n\n async connectedCallback() {\n super.connectedCallback()\n this.canMutate = await canDcspMutate()\n }\n\n render() {\n return html`\n <div body>\n <h3>제품검사에 대한 확인: ${this.checklistItemCommentCount || 0}건</h3>\n\n <div comments-container @scroll=${this._onScroll}>\n ${this.checklistItemComments.map(comment => {\n return html`\n <div comment-row>\n <div creator-container>\n <span creator><md-icon slot=\"icon\">account_circle</md-icon> ${comment.creator.name}</span>\n <span createdAt>\n <md-icon slot=\"icon\">schedule</md-icon> ${this._formatDate(comment.createdAt)}\n ${this.canMutate &&\n comment.creator.email === this.user.email &&\n this.status != BuildingInspectionStatus.PASS &&\n this.mode == ChecklistMode.EDITOR\n ? html` <md-icon delete slot=\"icon\" @click=${() => this._deleteComment(comment.id)}>delete</md-icon>`\n : ''}\n </span>\n </div>\n <div comment>${comment.comment}</div>\n </div>\n `\n })}\n </div>\n\n <textarea\n .value=${this.comment || ''}\n ?disabled=${this.status == BuildingInspectionStatus.PASS || this.mode == ChecklistMode.VIEWER}\n @input=${this._onInputChange}\n ></textarea>\n\n <div button-container>\n ${this.canMutate\n ? html`<md-elevated-button\n blue\n ?disabled=${this.status == BuildingInspectionStatus.PASS || this.mode == ChecklistMode.VIEWER}\n @click=${this._createComment}\n >\n <md-icon slot=\"icon\">task</md-icon>저장\n </md-elevated-button>`\n : ''}\n <md-elevated-button @click=${this._close}> <md-icon slot=\"icon\">cancel</md-icon>취소 </md-elevated-button>\n </div>\n </div>\n `\n }\n\n async firstUpdated() {\n this.user = (store.getState() as any).auth?.user\n this.comment = ''\n this.page = 1\n await this._loadComments()\n this._scrollBottom()\n }\n\n private async _loadComments() {\n if (this.loading || !this.hasMoreComments) return\n\n this.loading = true\n\n const response = await client.query({\n query: gql`\n query ChecklistItemComments($pagination: Pagination!, $checklistItemId: String!) {\n checklistItemComments(pagination: $pagination, checklistItemId: $checklistItemId) {\n id\n comment\n creator {\n id\n email\n name\n }\n createdAt\n }\n\n checklistItem(id: $checklistItemId) {\n id\n checklistItemCommentCount\n }\n }\n `,\n variables: {\n checklistItemId: this.checklistItemId,\n pagination: {\n page: this.page,\n limit: 10\n }\n }\n })\n\n if (response.errors) return\n\n const items = response.data.checklistItemComments\n if (items.length < 10) this.hasMoreComments = false\n\n this.checklistItemComments = [...items.reverse(), ...this.checklistItemComments]\n this.page += 1\n this.checklistItemCommentCount = response.data.checklistItem.checklistItemCommentCount\n this.loading = false\n }\n\n // 스크롤이 맨 위에 가까울 때 데이터 요청\n private _onScroll() {\n const { scrollTop } = this.commentsContainer\n if (scrollTop <= 5) {\n this._loadComments()\n }\n }\n\n private async _createComment() {\n if (!this.comment) {\n notify({ message: '조치사항을 입력해주세요.', level: 'warn' })\n return\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation CreateChecklistItemComment($checklistItemComment: NewChecklistItemComment!) {\n createChecklistItemComment(checklistItemComment: $checklistItemComment) {\n id\n comment\n creator {\n id\n email\n }\n createdAt\n }\n }\n `,\n variables: {\n checklistItemComment: {\n comment: this.comment,\n checklistItemId: this.checklistItemId\n }\n }\n })\n\n if (!response.errors) {\n this.comment = ''\n this.checklistItemComments = [...this.checklistItemComments, { ...response.data.createChecklistItemComment }]\n this._scrollBottom()\n this.checklistItemCommentCount++\n } else {\n notify({ message: response.errors?.[0]?.message || '조치사항 등록에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent()\n }\n\n private async _deleteComment(commentId: 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 DeleteChecklistItemComment($id: String!) {\n deleteChecklistItemComment(id: $id)\n }\n `,\n variables: {\n id: commentId\n }\n })\n\n if (!response.errors) {\n this.checklistItemComments = [...this.checklistItemComments.filter(comment => comment.id != commentId)]\n notify({ message: '조치사항을 삭제하였습니다.', level: 'info' })\n } else {\n notify({ message: response.errors?.[0]?.message || '조치사항 삭제에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent()\n }\n }\n\n private _close() {\n history.back()\n }\n\n // Input 요소의 값이 변경될 때 호출되는 콜백 함수\n private _onInputChange(event: InputEvent) {\n const target = event.target as HTMLInputElement\n this.comment = target.value\n }\n\n private _formatDate(date) {\n const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }))\n\n const year = _date.getFullYear()\n const month = String(_date.getMonth() + 1).padStart(2, '0')\n const day = String(_date.getDate()).padStart(2, '0')\n const hours = String(_date.getHours()).padStart(2, '0')\n const minutes = String(_date.getMinutes()).padStart(2, '0')\n const seconds = String(_date.getSeconds()).padStart(2, '0')\n\n return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`\n }\n\n // 댓글 스크롤 맨 밑으로\n private async _scrollBottom() {\n setTimeout(() => {\n this.commentsContainer.scrollTop = this.commentsContainer.scrollHeight\n }, 100)\n }\n\n // 조치사항 변경 이벤트 디스패치\n _dispatchEvent() {\n this.dispatchEvent(new CustomEvent('change-comment', { detail: { checklistItemId: this.checklistItemId } }))\n }\n}\n"]}
|
|
@@ -23,9 +23,12 @@ export declare class InspectionInfoPopup extends InspectionInfoPopup_base {
|
|
|
23
23
|
user: User;
|
|
24
24
|
isCapturing: boolean;
|
|
25
25
|
stream: MediaStream | null;
|
|
26
|
+
/** 뮤테이션 가능 여부('dcsp guest' 권한 보유 시 false) — 게스트에게는 생성/수정/삭제 버튼을 숨긴다 */
|
|
27
|
+
private canMutate;
|
|
26
28
|
video: HTMLVideoElement;
|
|
27
29
|
cameraInput: HTMLInputElement;
|
|
28
30
|
fileInput: any;
|
|
31
|
+
connectedCallback(): Promise<void>;
|
|
29
32
|
render(): import("lit-html").TemplateResult<1>;
|
|
30
33
|
firstUpdated(): Promise<void>;
|
|
31
34
|
private _loadInspectionInfo;
|
|
@@ -14,6 +14,7 @@ import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
|
14
14
|
import { openPopup } from '@operato/layout';
|
|
15
15
|
import './file-preview-popup';
|
|
16
16
|
import { BuildingInspectionStatus } from '../building-inspection/building-inspection-list';
|
|
17
|
+
import { canDcspMutate } from '@dssp/building-complex/dist-client/utils/privilege';
|
|
17
18
|
let InspectionInfoPopup = class InspectionInfoPopup extends connect(store)(LitElement) {
|
|
18
19
|
constructor() {
|
|
19
20
|
super(...arguments);
|
|
@@ -25,9 +26,15 @@ let InspectionInfoPopup = class InspectionInfoPopup extends connect(store)(LitEl
|
|
|
25
26
|
this.user = {};
|
|
26
27
|
this.isCapturing = false;
|
|
27
28
|
this.stream = null;
|
|
29
|
+
/** 뮤테이션 가능 여부('dcsp guest' 권한 보유 시 false) — 게스트에게는 생성/수정/삭제 버튼을 숨긴다 */
|
|
30
|
+
this.canMutate = false;
|
|
31
|
+
}
|
|
32
|
+
async connectedCallback() {
|
|
33
|
+
super.connectedCallback();
|
|
34
|
+
this.canMutate = await canDcspMutate();
|
|
28
35
|
}
|
|
29
36
|
render() {
|
|
30
|
-
const canEdit = this.status !== BuildingInspectionStatus.PASS && this.mode === "EDITOR" /* ChecklistMode.EDITOR */;
|
|
37
|
+
const canEdit = this.canMutate && this.status !== BuildingInspectionStatus.PASS && this.mode === "EDITOR" /* ChecklistMode.EDITOR */;
|
|
31
38
|
const isCameraSupported = navigator.mediaDevices && 'mediaDevices' in navigator;
|
|
32
39
|
return html `
|
|
33
40
|
<div class="section">
|
|
@@ -664,6 +671,10 @@ __decorate([
|
|
|
664
671
|
state(),
|
|
665
672
|
__metadata("design:type", Object)
|
|
666
673
|
], InspectionInfoPopup.prototype, "stream", void 0);
|
|
674
|
+
__decorate([
|
|
675
|
+
state(),
|
|
676
|
+
__metadata("design:type", Object)
|
|
677
|
+
], InspectionInfoPopup.prototype, "canMutate", void 0);
|
|
667
678
|
__decorate([
|
|
668
679
|
query('#video'),
|
|
669
680
|
__metadata("design:type", HTMLVideoElement)
|