@dssp/supervision 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/client/pages/building-inspection/building-inspection-detail-checklist.ts +227 -0
  2. package/client/pages/building-inspection/building-inspection-detail-drawing.ts +160 -0
  3. package/client/pages/building-inspection/building-inspection-list.ts +430 -0
  4. package/client/pages/building-inspection/component/building-inspection-detail-header.ts +94 -0
  5. package/client/pages/building-inspection/inspection-create-popup.ts +696 -0
  6. package/client/pages/checklist/checklist-view.ts +463 -0
  7. package/client/pages/checklist-template/checklist-template-item.ts +240 -0
  8. package/client/pages/checklist-template/checklist-template-list.ts +271 -0
  9. package/client/pages/checklist-template/checklist-type-management.ts +242 -0
  10. package/client/route.ts +14 -18
  11. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.d.ts +22 -0
  12. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +228 -0
  13. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -0
  14. package/dist-client/pages/building-inspection/building-inspection-detail-drawing.d.ts +21 -0
  15. package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js +169 -0
  16. package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js.map +1 -0
  17. package/dist-client/pages/building-inspection/building-inspection-list.d.ts +67 -0
  18. package/dist-client/pages/building-inspection/building-inspection-list.js +434 -0
  19. package/dist-client/pages/building-inspection/building-inspection-list.js.map +1 -0
  20. package/dist-client/pages/building-inspection/component/building-inspection-detail-header.d.ts +1 -0
  21. package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js +118 -0
  22. package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js.map +1 -0
  23. package/dist-client/pages/building-inspection/inspection-create-popup.d.ts +3 -0
  24. package/dist-client/pages/building-inspection/inspection-create-popup.js +735 -0
  25. package/dist-client/pages/building-inspection/inspection-create-popup.js.map +1 -0
  26. package/dist-client/pages/checklist/checklist-view.d.ts +6 -0
  27. package/dist-client/pages/checklist/checklist-view.js +468 -0
  28. package/dist-client/pages/checklist/checklist-view.js.map +1 -0
  29. package/dist-client/pages/checklist-template/checklist-template-item.d.ts +2 -0
  30. package/dist-client/pages/checklist-template/checklist-template-item.js +237 -0
  31. package/dist-client/pages/checklist-template/checklist-template-item.js.map +1 -0
  32. package/dist-client/pages/{check-item/check-item-list-page.d.ts → checklist-template/checklist-template-list.d.ts} +8 -27
  33. package/dist-client/pages/checklist-template/checklist-template-list.js +259 -0
  34. package/dist-client/pages/checklist-template/checklist-template-list.js.map +1 -0
  35. package/dist-client/pages/checklist-template/checklist-type-management.d.ts +48 -0
  36. package/dist-client/pages/checklist-template/checklist-type-management.js +229 -0
  37. package/dist-client/pages/checklist-template/checklist-type-management.js.map +1 -0
  38. package/dist-client/route.d.ts +1 -1
  39. package/dist-client/route.js +10 -13
  40. package/dist-client/route.js.map +1 -1
  41. package/dist-client/tsconfig.tsbuildinfo +1 -1
  42. package/dist-server/index.d.ts +1 -1
  43. package/dist-server/index.js +1 -1
  44. package/dist-server/index.js.map +1 -1
  45. package/dist-server/service/building-inspection/building-inspection-history.d.ts +17 -0
  46. package/dist-server/service/building-inspection/building-inspection-history.js +85 -0
  47. package/dist-server/service/building-inspection/building-inspection-history.js.map +1 -0
  48. package/dist-server/service/building-inspection/building-inspection-mutation.d.ts +9 -0
  49. package/dist-server/service/building-inspection/building-inspection-mutation.js +227 -0
  50. package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -0
  51. package/dist-server/service/building-inspection/building-inspection-query.d.ts +20 -0
  52. package/dist-server/service/building-inspection/building-inspection-query.js +235 -0
  53. package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -0
  54. package/dist-server/service/building-inspection/building-inspection-type.d.ts +60 -0
  55. package/dist-server/service/building-inspection/building-inspection-type.js +213 -0
  56. package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -0
  57. package/dist-server/service/building-inspection/building-inspection.d.ts +26 -0
  58. package/dist-server/service/building-inspection/building-inspection.js +113 -0
  59. package/dist-server/service/building-inspection/building-inspection.js.map +1 -0
  60. package/dist-server/service/building-inspection/event-subscriber.d.ts +7 -0
  61. package/dist-server/service/building-inspection/event-subscriber.js +21 -0
  62. package/dist-server/service/building-inspection/event-subscriber.js.map +1 -0
  63. package/dist-server/service/building-inspection/index.d.ts +10 -0
  64. package/dist-server/service/building-inspection/index.js +14 -0
  65. package/dist-server/service/building-inspection/index.js.map +1 -0
  66. package/dist-server/service/checklist/checklist-history.d.ts +24 -0
  67. package/dist-server/service/checklist/checklist-history.js +120 -0
  68. package/dist-server/service/checklist/checklist-history.js.map +1 -0
  69. package/dist-server/service/checklist/checklist-mutation.d.ts +8 -0
  70. package/dist-server/service/checklist/checklist-mutation.js +96 -0
  71. package/dist-server/service/checklist/checklist-mutation.js.map +1 -0
  72. package/dist-server/service/checklist/checklist-query.d.ts +12 -0
  73. package/dist-server/service/checklist/checklist-query.js +83 -0
  74. package/dist-server/service/checklist/checklist-query.js.map +1 -0
  75. package/dist-server/service/checklist/checklist-type.d.ts +18 -0
  76. package/dist-server/service/checklist/checklist-type.js +69 -0
  77. package/dist-server/service/checklist/checklist-type.js.map +1 -0
  78. package/dist-server/service/checklist/checklist.d.ts +31 -0
  79. package/dist-server/service/checklist/checklist.js +143 -0
  80. package/dist-server/service/checklist/checklist.js.map +1 -0
  81. package/dist-server/service/checklist/event-subscriber.d.ts +7 -0
  82. package/dist-server/service/checklist/event-subscriber.js +21 -0
  83. package/dist-server/service/checklist/event-subscriber.js.map +1 -0
  84. package/dist-server/service/checklist/index.d.ts +8 -0
  85. package/dist-server/service/checklist/index.js +12 -0
  86. package/dist-server/service/checklist/index.js.map +1 -0
  87. package/dist-server/service/checklist-item/checklist-item-mutation.d.ts +2 -0
  88. package/dist-server/service/checklist-item/checklist-item-mutation.js +13 -0
  89. package/dist-server/service/checklist-item/checklist-item-mutation.js.map +1 -0
  90. package/dist-server/service/checklist-item/checklist-item-query.d.ts +10 -0
  91. package/dist-server/service/checklist-item/checklist-item-query.js +68 -0
  92. package/dist-server/service/checklist-item/checklist-item-query.js.map +1 -0
  93. package/dist-server/service/checklist-item/checklist-item-type.d.ts +5 -0
  94. package/dist-server/service/checklist-item/checklist-item-type.js +21 -0
  95. package/dist-server/service/checklist-item/checklist-item-type.js.map +1 -0
  96. package/dist-server/service/checklist-item/checklist-item.d.ts +26 -0
  97. package/dist-server/service/checklist-item/checklist-item.js +113 -0
  98. package/dist-server/service/checklist-item/checklist-item.js.map +1 -0
  99. package/dist-server/service/checklist-item/index.d.ts +5 -0
  100. package/dist-server/service/checklist-item/index.js +10 -0
  101. package/dist-server/service/checklist-item/index.js.map +1 -0
  102. package/dist-server/service/checklist-template/checklist-template-mutation.d.ts +6 -0
  103. package/dist-server/service/checklist-template/checklist-template-mutation.js +64 -0
  104. package/dist-server/service/checklist-template/checklist-template-mutation.js.map +1 -0
  105. package/dist-server/service/checklist-template/checklist-template-query.d.ts +10 -0
  106. package/dist-server/service/checklist-template/checklist-template-query.js +65 -0
  107. package/dist-server/service/checklist-template/checklist-template-query.js.map +1 -0
  108. package/dist-server/service/checklist-template/checklist-template-type.d.ts +10 -0
  109. package/dist-server/service/checklist-template/checklist-template-type.js +39 -0
  110. package/dist-server/service/checklist-template/checklist-template-type.js.map +1 -0
  111. package/dist-server/service/checklist-template/checklist-template.d.ts +17 -0
  112. package/dist-server/service/checklist-template/checklist-template.js +78 -0
  113. package/dist-server/service/checklist-template/checklist-template.js.map +1 -0
  114. package/dist-server/service/checklist-template/index.d.ts +5 -0
  115. package/dist-server/service/checklist-template/index.js +9 -0
  116. package/dist-server/service/checklist-template/index.js.map +1 -0
  117. package/dist-server/service/checklist-template-item/checklist-template-item-mutation.d.ts +7 -0
  118. package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js +68 -0
  119. package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js.map +1 -0
  120. package/dist-server/service/checklist-template-item/checklist-template-item-query.d.ts +10 -0
  121. package/dist-server/service/checklist-template-item/checklist-template-item-query.js +66 -0
  122. package/dist-server/service/checklist-template-item/checklist-template-item-query.js.map +1 -0
  123. package/dist-server/service/checklist-template-item/checklist-template-item-type.d.ts +16 -0
  124. package/dist-server/service/checklist-template-item/checklist-template-item-type.js +60 -0
  125. package/dist-server/service/checklist-template-item/checklist-template-item-type.js.map +1 -0
  126. package/dist-server/service/checklist-template-item/checklist-template-item.d.ts +19 -0
  127. package/dist-server/service/checklist-template-item/checklist-template-item.js +87 -0
  128. package/dist-server/service/checklist-template-item/checklist-template-item.js.map +1 -0
  129. package/dist-server/service/checklist-template-item/index.d.ts +5 -0
  130. package/dist-server/service/checklist-template-item/index.js +9 -0
  131. package/dist-server/service/checklist-template-item/index.js.map +1 -0
  132. package/dist-server/service/checklist-type/checklist-type-mutation.d.ts +6 -0
  133. package/dist-server/service/checklist-type/checklist-type-mutation.js +64 -0
  134. package/dist-server/service/checklist-type/checklist-type-mutation.js.map +1 -0
  135. package/dist-server/service/checklist-type/checklist-type-query.d.ts +10 -0
  136. package/dist-server/service/checklist-type/checklist-type-query.js +65 -0
  137. package/dist-server/service/checklist-type/checklist-type-query.js.map +1 -0
  138. package/dist-server/service/checklist-type/checklist-type-type.d.ts +11 -0
  139. package/dist-server/service/checklist-type/checklist-type-type.js +43 -0
  140. package/dist-server/service/checklist-type/checklist-type-type.js.map +1 -0
  141. package/dist-server/service/checklist-type/checklist-type.d.ts +19 -0
  142. package/dist-server/service/checklist-type/checklist-type.js +78 -0
  143. package/dist-server/service/checklist-type/checklist-type.js.map +1 -0
  144. package/dist-server/service/checklist-type/index.d.ts +5 -0
  145. package/dist-server/service/checklist-type/index.js +9 -0
  146. package/dist-server/service/checklist-type/index.js.map +1 -0
  147. package/dist-server/service/index.d.ts +8 -3
  148. package/dist-server/service/index.js +26 -5
  149. package/dist-server/service/index.js.map +1 -1
  150. package/dist-server/service/issue/issue.d.ts +1 -3
  151. package/dist-server/service/issue/issue.js +1 -7
  152. package/dist-server/service/issue/issue.js.map +1 -1
  153. package/dist-server/service/supervisor/supervisor.d.ts +1 -3
  154. package/dist-server/service/supervisor/supervisor.js +1 -7
  155. package/dist-server/service/supervisor/supervisor.js.map +1 -1
  156. package/dist-server/tsconfig.tsbuildinfo +1 -1
  157. package/helps/supervision/checklist-item.md +160 -0
  158. package/helps/supervision/checklist.md +160 -0
  159. package/package.json +11 -7
  160. package/server/index.ts +1 -1
  161. package/server/service/building-inspection/building-inspection-history.ts +70 -0
  162. package/server/service/building-inspection/building-inspection-mutation.ts +239 -0
  163. package/server/service/building-inspection/building-inspection-query.ts +202 -0
  164. package/server/service/building-inspection/building-inspection-type.ts +142 -0
  165. package/server/service/building-inspection/building-inspection.ts +106 -0
  166. package/server/service/building-inspection/event-subscriber.ts +20 -0
  167. package/server/service/building-inspection/index.ts +11 -0
  168. package/server/service/checklist/checklist-history.ts +96 -0
  169. package/server/service/checklist/checklist-mutation.ts +103 -0
  170. package/server/service/checklist/checklist-query.ts +52 -0
  171. package/server/service/{check-item/check-item-type.ts → checklist/checklist-type.ts} +6 -18
  172. package/server/service/checklist/checklist.ts +127 -0
  173. package/server/service/checklist/event-subscriber.ts +17 -0
  174. package/server/service/checklist/index.ts +9 -0
  175. package/server/service/checklist-item/checklist-item-mutation.ts +5 -0
  176. package/server/service/checklist-item/checklist-item-query.ts +43 -0
  177. package/server/service/checklist-item/checklist-item-type.ts +12 -0
  178. package/server/service/checklist-item/checklist-item.ts +100 -0
  179. package/server/service/checklist-item/index.ts +7 -0
  180. package/server/service/checklist-template/checklist-template-mutation.ts +66 -0
  181. package/server/service/checklist-template/checklist-template-query.ts +39 -0
  182. package/server/service/checklist-template/checklist-template-type.ts +23 -0
  183. package/server/service/checklist-template/checklist-template.ts +71 -0
  184. package/server/service/checklist-template/index.ts +6 -0
  185. package/server/service/checklist-template-item/checklist-template-item-mutation.ts +64 -0
  186. package/server/service/checklist-template-item/checklist-template-item-query.ts +39 -0
  187. package/server/service/checklist-template-item/checklist-template-item-type.ts +39 -0
  188. package/server/service/checklist-template-item/checklist-template-item.ts +67 -0
  189. package/server/service/checklist-template-item/index.ts +6 -0
  190. package/server/service/checklist-type/checklist-type-mutation.ts +66 -0
  191. package/server/service/checklist-type/checklist-type-query.ts +39 -0
  192. package/server/service/checklist-type/checklist-type-type.ts +26 -0
  193. package/server/service/checklist-type/checklist-type.ts +64 -0
  194. package/server/service/checklist-type/index.ts +6 -0
  195. package/server/service/index.ts +60 -23
  196. package/server/service/issue/issue.ts +1 -6
  197. package/server/service/supervisor/supervisor.ts +1 -6
  198. package/things-factory.config.js +11 -7
  199. package/client/pages/check-item/check-item-importer.ts +0 -94
  200. package/client/pages/check-item/check-item-list-page.ts +0 -340
  201. package/dist-client/pages/check-item/check-item-importer.d.ts +0 -10
  202. package/dist-client/pages/check-item/check-item-importer.js +0 -101
  203. package/dist-client/pages/check-item/check-item-importer.js.map +0 -1
  204. package/dist-client/pages/check-item/check-item-list-page.js +0 -323
  205. package/dist-client/pages/check-item/check-item-list-page.js.map +0 -1
  206. package/dist-server/service/check-item/check-item-mutation.d.ts +0 -10
  207. package/dist-server/service/check-item/check-item-mutation.js +0 -168
  208. package/dist-server/service/check-item/check-item-mutation.js.map +0 -1
  209. package/dist-server/service/check-item/check-item-query.d.ts +0 -12
  210. package/dist-server/service/check-item/check-item-query.js +0 -97
  211. package/dist-server/service/check-item/check-item-query.js.map +0 -1
  212. package/dist-server/service/check-item/check-item-type.d.ts +0 -23
  213. package/dist-server/service/check-item/check-item-type.js +0 -86
  214. package/dist-server/service/check-item/check-item-type.js.map +0 -1
  215. package/dist-server/service/check-item/check-item.d.ts +0 -28
  216. package/dist-server/service/check-item/check-item.js +0 -117
  217. package/dist-server/service/check-item/check-item.js.map +0 -1
  218. package/dist-server/service/check-item/index.d.ts +0 -6
  219. package/dist-server/service/check-item/index.js +0 -10
  220. package/dist-server/service/check-item/index.js.map +0 -1
  221. package/server/service/check-item/check-item-mutation.ts +0 -198
  222. package/server/service/check-item/check-item-query.ts +0 -62
  223. package/server/service/check-item/check-item.ts +0 -111
  224. package/server/service/check-item/index.ts +0 -7
@@ -0,0 +1,463 @@
1
+ import '@material/web/icon/icon.js'
2
+ import { css, html, LitElement, PropertyValues } from 'lit'
3
+ import { customElement, property, query } from 'lit/decorators.js'
4
+ import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
5
+ import { CHECKLIST_MAIN_TYPE_LIST, BuildingInspectionStatus } from '../building-inspection/building-inspection-list'
6
+ import '@operato/input/ox-input-signature.js'
7
+
8
+ export const enum ChecklistMode {
9
+ VIEWER = 'VIEWER',
10
+ EDITOR = 'EDITOR'
11
+ }
12
+
13
+ @customElement('checklist-view')
14
+ class ChecklistView extends LitElement {
15
+ static styles = [
16
+ ButtonContainerStyles,
17
+ ScrollbarStyles,
18
+ css`
19
+ :host {
20
+ display: flex;
21
+ flex-direction: column;
22
+ font-size: 14px;
23
+ padding: 20px;
24
+ min-width: 800px;
25
+
26
+ background-color: var(--md-sys-color-surface);
27
+ }
28
+
29
+ [bold] {
30
+ font-weight: bold;
31
+ }
32
+
33
+ div[name] {
34
+ display: flex;
35
+ color: #586878;
36
+ font-size: 24px;
37
+ font-weight: bold;
38
+ align-items: center;
39
+ justify-content: center;
40
+ }
41
+
42
+ table {
43
+ width: 100%;
44
+ font-size: 15px;
45
+ color: #586878;
46
+ text-align: left;
47
+ border-collapse: collapse;
48
+ td,
49
+ th {
50
+ border: 1px #999999 solid;
51
+ padding-inline: 8px;
52
+ }
53
+ th {
54
+ background-color: #efefef;
55
+ font-weight: bold;
56
+ }
57
+ td {
58
+ height: 35px;
59
+ &[radio] {
60
+ text-align: center;
61
+ vertical-align: middle;
62
+ width: 55px;
63
+ }
64
+ &[attachment] {
65
+ width: 90px;
66
+ }
67
+ }
68
+ }
69
+
70
+ table[header] {
71
+ margin-top: 5px;
72
+
73
+ td {
74
+ min-width: 180px;
75
+ border-left: none;
76
+ }
77
+ th {
78
+ width: 110px;
79
+ border-right: none;
80
+ }
81
+ }
82
+
83
+ table[body] {
84
+ border: 2px solid #999999;
85
+ border-bottom: none;
86
+ margin-top: 10px;
87
+
88
+ th {
89
+ text-align: center;
90
+
91
+ &[type] {
92
+ min-width: 150px;
93
+ }
94
+ &[inspection-name] {
95
+ min-width: 250px;
96
+ }
97
+ &[result] {
98
+ width: 270px;
99
+ }
100
+ &[criteria] {
101
+ width: 90px;
102
+ }
103
+ &[small] {
104
+ width: 60px;
105
+ }
106
+ }
107
+ td {
108
+ &[main-type] {
109
+ width: 50px;
110
+ text-align: center;
111
+ word-break: keep-all;
112
+ }
113
+ }
114
+ }
115
+
116
+ table[tail] {
117
+ border: 2px solid #999999;
118
+ border-top: none;
119
+ margin-top: -1px;
120
+
121
+ tr[first] td {
122
+ border-top: none;
123
+ }
124
+ td {
125
+ width: 25%;
126
+ border-left: none;
127
+ text-align: center;
128
+ position: relative;
129
+ }
130
+ th {
131
+ width: 25%;
132
+ border-right: none;
133
+ }
134
+
135
+ span[sign-text] {
136
+ position: absolute;
137
+ top: 50%;
138
+ left: 50%;
139
+ transform: translate(-50%, -50%);
140
+ pointer-events: none;
141
+ }
142
+ ox-input-signature {
143
+ margin: 10px;
144
+
145
+ &[disabled] {
146
+ background: #eee;
147
+ }
148
+ }
149
+ }
150
+
151
+ div[footer] {
152
+ display: flex;
153
+ flex-direction: column;
154
+ gap: 3px;
155
+ font-size: 12px;
156
+ margin-top: 10px;
157
+ color: #586878;
158
+ text-indent: -9px;
159
+ padding-left: 9px;
160
+ }
161
+ `
162
+ ]
163
+
164
+ @property({ type: String }) mode: ChecklistMode = ChecklistMode.VIEWER
165
+ @property({ type: Object }) checklist: any = {}
166
+ @property({ type: String }) status: BuildingInspectionStatus = BuildingInspectionStatus.WAIT
167
+
168
+ @query('ox-input-signature[name="overallConstructorSignature"]') private elOverallConstructorSignature
169
+ @query('ox-input-signature[name="taskConstructorSignature"]') private elTaskConstructorSignature
170
+ @query('ox-input-signature[name="overallSupervisorySignature"]') private elOverallSupervisorySignature
171
+ @query('ox-input-signature[name="taskSupervisorySignature"]') private elTaskSupervisorySignature
172
+
173
+ render() {
174
+ const today = this._getDate(new Date())
175
+ const isConstructorStep = this.status == BuildingInspectionStatus.WAIT || this.status == BuildingInspectionStatus.FAIL
176
+ const isSupervisoryStep = this.status == BuildingInspectionStatus.REQUEST
177
+
178
+ // 체크리스트 아이템 정렬
179
+ this.checklist?.checklistItems?.sort((a, b) => {
180
+ // 1순위: mainType 오름차순
181
+ if (a.mainType < b.mainType) return -1
182
+ if (a.mainType > b.mainType) return 1
183
+
184
+ // 2순위: detailType 오름차순
185
+ if (a.detailType < b.detailType) return -1
186
+ if (a.detailType > b.detailType) return 1
187
+
188
+ // 3순위: sequence 오름차순
189
+ return a.sequence - b.sequence
190
+ })
191
+
192
+ const processedItems = this.drawChecklistItems(this.checklist?.checklistItems || [])
193
+
194
+ console.log('this.checklist :', this.checklist)
195
+
196
+ return html`
197
+ <div wrapper>
198
+ <div name>${this.checklist.name}</div>
199
+
200
+ <table header>
201
+ <tr>
202
+ <th>공종</th>
203
+ <td>${this.checklist.constructionType}</td>
204
+ <th>문서 번호</th>
205
+ <td>${this.checklist.documentNo}</td>
206
+ </tr>
207
+ <tr>
208
+ <th>세부 공종</th>
209
+ <td>${this.checklist.constructionDetailType}</td>
210
+ <th>위치 및 부위</th>
211
+ <td>${this.checklist.location}</td>
212
+ </tr>
213
+ <tr>
214
+ <th>검측 부위</th>
215
+ <td>${this.checklist?.inspectionParts?.join(', ') || ''}</td>
216
+ <th></th>
217
+ <td></td>
218
+ </tr>
219
+ </table>
220
+
221
+ <table body>
222
+ <thead>
223
+ <tr>
224
+ <th colspan="2" rowspan="3" type>구분</th>
225
+ <th rowspan="3" inspection-name>검사항목</th>
226
+ <th rowspan="3" criteria>검사기준</th>
227
+ <th colspan="4" result>검사결과</th>
228
+ <th rowspan="3" small>첨부자료</th>
229
+ <th rowspan="3" small>조치사항</th>
230
+ </tr>
231
+ <tr>
232
+ <th colspan="2">시공자</th>
233
+ <th colspan="2">감리자</th>
234
+ </tr>
235
+ <tr>
236
+ <th>적합</th>
237
+ <th>부적합</th>
238
+ <th>적합</th>
239
+ <th>부적합</th>
240
+ </tr>
241
+ </thead>
242
+ <tbody>
243
+ ${processedItems.map(({ item, showMainTypeCell, mainTypeRowspan, showDetailTypeCell, detailTypeRowspan }, idx) => {
244
+ return html` <tr>
245
+ ${showMainTypeCell
246
+ ? html`<td main-type bold rowspan="${mainTypeRowspan}">${CHECKLIST_MAIN_TYPE_LIST[item.mainType]}</td>`
247
+ : ''}
248
+ ${showDetailTypeCell ? html` <td bold rowspan="${detailTypeRowspan}">${item.detailType}</td> ` : ''}
249
+
250
+ <td bold>${idx + 1}. ${item.name}</td>
251
+ <td>${item.inspctionCriteria}</td>
252
+ <td radio>
253
+ <md-radio
254
+ item-id=${item.id}
255
+ item-name="constructionConfirmStatus"
256
+ name=${'radio-construction-' + item.id}
257
+ value="T"
258
+ .checked=${item.constructionConfirmStatus === 'T'}
259
+ ?disabled=${!isConstructorStep}
260
+ @change=${this._onChangeConfirmStatus}
261
+ ></md-radio>
262
+ </td>
263
+ <td radio>
264
+ <md-radio
265
+ item-id=${item.id}
266
+ item-name="constructionConfirmStatus"
267
+ name=${'radio-construction-' + item.id}
268
+ value="F"
269
+ .checked=${item.constructionConfirmStatus === 'F'}
270
+ ?disabled=${!isConstructorStep}
271
+ @change=${this._onChangeConfirmStatus}
272
+ ></md-radio>
273
+ </td>
274
+ <td radio>
275
+ <md-radio
276
+ item-id=${item.id}
277
+ item-name="supervisoryConfirmStatus"
278
+ name=${'radio-supervisory-' + item.id}
279
+ value="T"
280
+ .checked=${item.supervisoryConfirmStatus === 'T'}
281
+ ?disabled=${!isSupervisoryStep}
282
+ @change=${this._onChangeConfirmStatus}
283
+ ></md-radio>
284
+ </td>
285
+ <td radio>
286
+ <md-radio
287
+ item-id=${item.id}
288
+ item-name="supervisoryConfirmStatus"
289
+ name=${'radio-supervisory-' + item.id}
290
+ value="F"
291
+ .checked=${item.supervisoryConfirmStatus === 'F'}
292
+ ?disabled=${!isSupervisoryStep}
293
+ @change=${this._onChangeConfirmStatus}
294
+ ></md-radio>
295
+ </td>
296
+ <td attachment></td>
297
+ <td></td>
298
+ </tr>`
299
+ })}
300
+ </tbody>
301
+ </table>
302
+
303
+ <table tail>
304
+ <tbody>
305
+ <tr first>
306
+ <th rowspan="2">시공자점검일</th>
307
+ <td rowspan="2">
308
+ ${this.mode == ChecklistMode.VIEWER ? today : this._getDate(this.checklist.constructionInspectionDate)}
309
+ </td>
310
+ <th>총괄 시공책임자</th>
311
+ <td>
312
+ <span sign-text>(인)</span>
313
+ <ox-input-signature
314
+ .value=${this.checklist.overallConstructorSignature || ''}
315
+ name="overallConstructorSignature"
316
+ @change=${this._onChangeSignature}
317
+ ?disabled=${!isConstructorStep}
318
+ >
319
+ </ox-input-signature>
320
+ </td>
321
+ </tr>
322
+ <tr>
323
+ <th>공종별 시공관리자</th>
324
+ <td>
325
+ <span sign-text>(인)</span>
326
+ <ox-input-signature
327
+ .value=${this.checklist.taskConstructorSignature || ''}
328
+ name="taskConstructorSignature"
329
+ @change=${this._onChangeSignature}
330
+ ?disabled=${!isConstructorStep}
331
+ >
332
+ </ox-input-signature>
333
+ </td>
334
+ </tr>
335
+ <tr>
336
+ <th rowspan="2">감리자점검일</th>
337
+ <td rowspan="2">
338
+ ${this.mode == ChecklistMode.VIEWER ? today : this._getDate(this.checklist.supervisorInspectionDate)}
339
+ </td>
340
+ <th>총괄 감리책임자</th>
341
+ <td>
342
+ <span sign-text>(인)</span>
343
+ <ox-input-signature
344
+ .value=${this.checklist.overallSupervisorySignature || ''}
345
+ name="overallSupervisorySignature"
346
+ @change=${this._onChangeSignature}
347
+ ?disabled=${!isSupervisoryStep}
348
+ >
349
+ </ox-input-signature>
350
+ </td>
351
+ </tr>
352
+ <tr>
353
+ <th>공종별 감리 책임자</th>
354
+ <td>
355
+ <span sign-text>(인)</span>
356
+ <ox-input-signature
357
+ .value=${this.checklist.taskSupervisorySignature || ''}
358
+ name="taskSupervisorySignature"
359
+ @change=${this._onChangeSignature}
360
+ ?disabled=${!isSupervisoryStep}
361
+ >
362
+ </ox-input-signature>
363
+ </td>
364
+ </tr>
365
+ </tbody>
366
+ </table>
367
+
368
+ <div footer>
369
+ <div>
370
+ - 검사결과는 1차, 2차로 구분 재검측시 2차에 기록하고 검사기준도 검사결과와 비교될 수 있도록 시방서 또는 도면 등에 있는
371
+ 수치를 작성하며, 수치가 없는 검사항목은 시방서 또는 설계도서에 있는 내용과 검사한 내용으로 작성함
372
+ </div>
373
+ <div>- 검사항목 및 검사기준은 각 공종별로 감리원과 협의하여 작성할 것</div>
374
+ </div>
375
+ </div>
376
+ `
377
+ }
378
+
379
+ updated(_changed: PropertyValues): void {
380
+ if (_changed.has('checklist')) {
381
+ if (this.checklist?.overallConstructorSignature)
382
+ this.elOverallConstructorSignature.loadSignature(this.checklist?.overallConstructorSignature)
383
+ if (this.checklist?.taskConstructorSignature)
384
+ this.elTaskConstructorSignature.loadSignature(this.checklist?.taskConstructorSignature)
385
+ if (this.checklist?.overallSupervisorySignature)
386
+ this.elOverallSupervisorySignature.loadSignature(this.checklist?.overallSupervisorySignature)
387
+ if (this.checklist?.taskSupervisorySignature)
388
+ this.elTaskSupervisorySignature.loadSignature(this.checklist?.taskSupervisorySignature)
389
+ }
390
+ }
391
+
392
+ private _onChangeConfirmStatus(e: Event) {
393
+ const target = e.target as HTMLInputElement
394
+ const itemId = target.getAttribute('item-id')
395
+ const name = target.getAttribute('item-name') || ''
396
+ const value = target.value
397
+
398
+ this.checklist.checklistItems = this.checklist?.checklistItems?.map(item =>
399
+ item.id == itemId ? { ...item, [name]: value } : item
400
+ )
401
+ }
402
+
403
+ private _onChangeSignature(e: Event) {
404
+ const target = e.target as HTMLInputElement
405
+
406
+ this.checklist[target.name] = target.value
407
+ }
408
+
409
+ private _getDate(date) {
410
+ if (!date) return ' 년 월 일'
411
+
412
+ const _date = new Date(date) || new Date()
413
+ return _date.toLocaleDateString('ko-KR', {
414
+ timeZone: 'Asia/Seoul',
415
+ year: 'numeric',
416
+ month: 'long',
417
+ day: 'numeric'
418
+ })
419
+ }
420
+
421
+ private drawChecklistItems(checklistItems) {
422
+ const mainTypeRowspans = {}
423
+ const detailTypeRowspans = {}
424
+ let previousMainType = null
425
+ let previousDetailType = null
426
+
427
+ return checklistItems.map((item, index) => {
428
+ const mainType = item.mainType
429
+ const detailType = item.detailType
430
+
431
+ // mainType이 변경되면 rowspan을 계산
432
+ if (mainType !== previousMainType) {
433
+ mainTypeRowspans[mainType] = checklistItems.filter(i => i.mainType === mainType).length
434
+ previousDetailType = null // detailType 초기화
435
+ }
436
+
437
+ // detailType이 변경되면 rowspan을 계산
438
+ if (detailType !== previousDetailType) {
439
+ detailTypeRowspans[`${mainType}-${detailType}`] = checklistItems.filter(
440
+ i => i.mainType === mainType && i.detailType === detailType
441
+ ).length
442
+ }
443
+
444
+ const showMainTypeCell = mainType !== previousMainType
445
+ const showDetailTypeCell = detailType !== previousDetailType
446
+
447
+ const mainTypeRowspan = mainTypeRowspans[mainType]
448
+ const detailTypeRowspan = detailTypeRowspans[`${mainType}-${detailType}`]
449
+
450
+ // 이전 값을 업데이트
451
+ previousMainType = mainType
452
+ previousDetailType = detailType
453
+
454
+ return {
455
+ item,
456
+ showMainTypeCell,
457
+ mainTypeRowspan,
458
+ showDetailTypeCell,
459
+ detailTypeRowspan
460
+ }
461
+ })
462
+ }
463
+ }
@@ -0,0 +1,240 @@
1
+ import '@material/web/icon/icon.js'
2
+ import '@operato/data-grist/ox-grist.js'
3
+
4
+ import gql from 'graphql-tag'
5
+ import { css, html, LitElement } from 'lit'
6
+ import { customElement, property, query } from 'lit/decorators.js'
7
+
8
+ import { DataGrist } from '@operato/data-grist/ox-grist.js'
9
+ import { client } from '@operato/graphql'
10
+ import { ButtonContainerStyles } from '@operato/styles'
11
+ import { FetchOption } from '@operato/data-grist'
12
+ import { notify } from '@operato/layout'
13
+ import { CHECKLIST_MAIN_TYPE_LIST } from './checklist-type-management'
14
+
15
+ @customElement('checklist-template-item')
16
+ class ChecklistTemplateItem extends LitElement {
17
+ static styles = [
18
+ ButtonContainerStyles,
19
+ css`
20
+ :host {
21
+ display: flex;
22
+ flex-direction: column;
23
+
24
+ background-color: var(--md-sys-color-surface);
25
+ }
26
+
27
+ ox-grist {
28
+ flex: 1;
29
+ }
30
+ `
31
+ ]
32
+
33
+ @property({ type: Object }) checklistDetailTypes: any
34
+ @property({ type: Object }) checklistTemplate: any
35
+ @property({ type: Object }) gristConfig: any
36
+
37
+ @query('ox-grist') grist!: DataGrist
38
+
39
+ render() {
40
+ return html`
41
+ <ox-grist .mode=${'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}></ox-grist>
42
+ <div class="button-container">
43
+ <button danger @click=${this._deleteChecklistTemplateItems.bind(this)}><md-icon>delete</md-icon>삭제</button>
44
+ <button @click=${this._updateChecklistTemplateItems.bind(this)}><md-icon>save</md-icon>저장</button>
45
+ </div>
46
+ `
47
+ }
48
+
49
+ async firstUpdated() {
50
+ this.gristConfig = {
51
+ columns: [
52
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
53
+ {
54
+ type: 'gutter',
55
+ gutterName: 'button',
56
+ fixed: true,
57
+ icon: 'add',
58
+ handlers: {
59
+ click: 'record-copy'
60
+ }
61
+ },
62
+ { type: 'gutter', gutterName: 'sequence' },
63
+ {
64
+ type: 'gutter',
65
+ gutterName: 'button',
66
+ icon: 'arrow_upward',
67
+ handlers: {
68
+ click: 'move-up'
69
+ }
70
+ },
71
+ {
72
+ type: 'gutter',
73
+ gutterName: 'button',
74
+ icon: 'arrow_downward',
75
+ handlers: {
76
+ click: 'move-down'
77
+ }
78
+ },
79
+ {
80
+ type: 'number',
81
+ name: 'sequence',
82
+ hidden: true
83
+ },
84
+ {
85
+ type: 'string',
86
+ name: 'id',
87
+ hidden: true
88
+ },
89
+ {
90
+ type: 'select',
91
+ name: 'mainType',
92
+ header: '구분',
93
+ record: {
94
+ editable: true,
95
+ options: [{ display: '', value: '' }].concat(
96
+ Object.keys(CHECKLIST_MAIN_TYPE_LIST).map(key => ({ display: CHECKLIST_MAIN_TYPE_LIST[key], value: key }))
97
+ )
98
+ },
99
+ width: 150
100
+ },
101
+ {
102
+ type: 'select',
103
+ name: 'detailType',
104
+ header: '상세 구분',
105
+ record: {
106
+ editable: true,
107
+ options: (columns, data, column) => [
108
+ { display: '', value: '' },
109
+ ...this.checklistDetailTypes.filter(v => v.mainType == column.mainType)
110
+ ]
111
+ },
112
+ width: 250
113
+ },
114
+ {
115
+ type: 'string',
116
+ name: 'name',
117
+ header: '검사 항목',
118
+ record: {
119
+ editable: true
120
+ },
121
+ width: 200
122
+ },
123
+ {
124
+ type: 'string',
125
+ name: 'inspctionCriteria',
126
+ header: '검사 기준',
127
+ record: {
128
+ editable: true
129
+ },
130
+ width: 200
131
+ }
132
+ ],
133
+ rows: {
134
+ selectable: {
135
+ multiple: true
136
+ }
137
+ },
138
+ pagination: {
139
+ infinite: true
140
+ },
141
+ sorters: [{ name: 'mainType' }, { name: 'sequence' }]
142
+ }
143
+ }
144
+
145
+ async fetchHandler({ page, limit, sorters = [] }: FetchOption) {
146
+ const response = await client.query({
147
+ query: gql`
148
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
149
+ checklistTemplateItems(filters: $filters, pagination: $pagination, sortings: $sortings) {
150
+ items {
151
+ id
152
+ sequence
153
+ name
154
+ inspctionCriteria
155
+ mainType
156
+ detailType
157
+ }
158
+ }
159
+ }
160
+ `,
161
+ variables: {
162
+ filters: {
163
+ name: 'checklistTemplateId',
164
+ value: this.checklistTemplate.id,
165
+ operator: 'eq'
166
+ },
167
+ sortings: [{ name: 'mainType' }, { name: 'sequence' }]
168
+ }
169
+ })
170
+
171
+ return {
172
+ total: response.data.checklistTemplateItems.total || 0,
173
+ records: response.data.checklistTemplateItems.items || []
174
+ }
175
+ }
176
+
177
+ private async _deleteChecklistTemplateItems() {
178
+ if (confirm('삭제하시겠습니까?')) {
179
+ const ids = this.grist.selected.map(record => record.id)
180
+ if (ids && ids.length > 0) {
181
+ const response = await client.mutate({
182
+ mutation: gql`
183
+ mutation ($ids: [String!]!) {
184
+ deleteChecklistTemplateItems(ids: $ids)
185
+ }
186
+ `,
187
+ variables: {
188
+ ids
189
+ }
190
+ })
191
+
192
+ if (!response.errors) {
193
+ this.grist.fetch()
194
+ notify({ message: '삭제되었습니다.' })
195
+ }
196
+ }
197
+ }
198
+ }
199
+
200
+ async _updateChecklistTemplateItems() {
201
+ let patches = this.grist.dirtyData.records
202
+ if (patches) {
203
+ patches = patches.map(patch => {
204
+ const { __origin__: { __typename, ...patchField } = {}, __dirtyfields__ } = patch
205
+
206
+ for (let key in __dirtyfields__) {
207
+ patchField[key] = __dirtyfields__[key].after
208
+ }
209
+
210
+ return patchField
211
+ })
212
+
213
+ const response = await client.mutate({
214
+ mutation: gql`
215
+ mutation UpdateMultipleChecklistTemplateItems($checklistTemplateId: String!, $patches: [ChecklistTemplateItemPatch!]!) {
216
+ updateMultipleChecklistTemplateItems(checklistTemplateId: $checklistTemplateId, patches: $patches) {
217
+ id
218
+ }
219
+ }
220
+ `,
221
+ variables: {
222
+ checklistTemplateId: this.checklistTemplate.id,
223
+ patches
224
+ }
225
+ })
226
+
227
+ if (!response.errors) {
228
+ this.grist.fetch()
229
+ notify({ message: '저장되었습니다.' })
230
+ this.requestRefresh()
231
+ } else {
232
+ notify({ message: '저장에 실패하였습니다.', level: 'error' })
233
+ }
234
+ }
235
+ }
236
+
237
+ requestRefresh() {
238
+ this.dispatchEvent(new CustomEvent('requestRefresh'))
239
+ }
240
+ }