
Merge branch 'admin' of http://210.180.118.83/yjryu/senior_care_system into admin
@cd13ca86888fbf1384af6255cd2dab3e9440b0d4
+++ client/views/component/Pagination.jsx
... | ... | @@ -0,0 +1,26 @@ |
1 | +import React from "react"; | |
2 | +import styled from "styled-components"; | |
3 | + | |
4 | +export default function Pagination({ total, limit, page, setPage }) { | |
5 | + const numPages = Math.ceil(total / limit); | |
6 | + | |
7 | + return ( | |
8 | + <> | |
9 | + <Paging> | |
10 | + <button onClick={() => setPage(page - 1)} disabled={page === 1}><</button> | |
11 | + {Array(numPages).fill().map((_, i) => ( | |
12 | + <button key={i + 1} onClick={() => setPage(i + 1)} aria-current={page === i + 1 ? "page" : null}> {i + 1} </button> | |
13 | + ))} | |
14 | + <button onClick={() => setPage(page + 1)} disabled={page === numPages}>></button> | |
15 | + </Paging> | |
16 | + </> | |
17 | + ); | |
18 | +} | |
19 | + | |
20 | +const Paging = styled.div` | |
21 | + display: flex; | |
22 | + justify-content: center; | |
23 | + align-items: center; | |
24 | + gap: 4px; | |
25 | + margin: 16px; | |
26 | +`;(No newline at end of file) |
--- client/views/component/Table.jsx
+++ client/views/component/Table.jsx
... | ... | @@ -1,7 +1,52 @@ |
1 | 1 |
import React from "react"; |
2 |
+import Button from "./Button.jsx"; |
|
2 | 3 |
// import styled from "styled-components"; |
3 | 4 |
|
4 |
-export default function Table({ head, contents, contentKey, onClick, className}) { |
|
5 |
+export default function Table({ head, contents, contentKey, onClick, className, view, offset, limit}) { |
|
6 |
+ const [modalOpen, setModalOpen] = React.useState(false); |
|
7 |
+ const openModal = () => { |
|
8 |
+ setModalOpen(true); |
|
9 |
+ }; |
|
10 |
+ |
|
11 |
+ const [modalOpen2, setModalOpen2] = React.useState(false); |
|
12 |
+ const openModal2 = () => { |
|
13 |
+ setModalOpen2(true); |
|
14 |
+ }; |
|
15 |
+ |
|
16 |
+ |
|
17 |
+ const buttonPrint = () => { |
|
18 |
+ if(view == 'mySenior'){ |
|
19 |
+ return( |
|
20 |
+ <td> |
|
21 |
+ <Button |
|
22 |
+ className={"btn-small gray-btn"} |
|
23 |
+ btnName={"보기"} |
|
24 |
+ onClick={openModal} |
|
25 |
+ /> |
|
26 |
+ </td>) |
|
27 |
+ } |
|
28 |
+ else if(view == 'allSenior'){ |
|
29 |
+ return( |
|
30 |
+ <> |
|
31 |
+ <td> |
|
32 |
+ <Button |
|
33 |
+ className={"btn-small gray-btn"} |
|
34 |
+ btnName={"선택"} |
|
35 |
+ onClick={openModal2} |
|
36 |
+ /> |
|
37 |
+ </td> |
|
38 |
+ <td> |
|
39 |
+ <Button |
|
40 |
+ className={"btn-small gray-btn"} |
|
41 |
+ btnName={"보기"} |
|
42 |
+ onClick={openModal} |
|
43 |
+ /> |
|
44 |
+ </td> |
|
45 |
+ </> |
|
46 |
+ ) |
|
47 |
+ } |
|
48 |
+ } |
|
49 |
+ |
|
5 | 50 |
return ( |
6 | 51 |
<table className={className}> |
7 | 52 |
<thead> |
... | ... | @@ -12,17 +57,30 @@ |
12 | 57 |
</tr> |
13 | 58 |
</thead> |
14 | 59 |
<tbody> |
15 |
- {contents.map((i, index) => { |
|
60 |
+ {contents.slice(offset, offset + limit).map((i, index) => { |
|
16 | 61 |
return ( |
17 | 62 |
<tr key={index}> |
18 |
- {contentKey.map((kes) => { |
|
19 |
- return <td onClick={onClick}>{i[kes]}</td>; |
|
20 |
- })} |
|
63 |
+ {/* // <td>{i.rn}</td> |
|
64 |
+ // <td>{i.user_name}</td> |
|
65 |
+ // <td>{i.user_phonenumber}</td> |
|
66 |
+ // <td>{i.user_gender}</td> |
|
67 |
+ // <td>{i.user_birth}</td> |
|
68 |
+ // <td>{i.user_address}</td> |
|
69 |
+ // {buttonPrint()} */} |
|
70 |
+ {contentKey.map((kes) => { |
|
71 |
+ return ( |
|
72 |
+ <> |
|
73 |
+ <td onClick={onClick}>{i[kes]}</td> |
|
74 |
+ </> |
|
75 |
+ ) |
|
76 |
+ })} |
|
77 |
+ {buttonPrint()} |
|
21 | 78 |
</tr> |
22 | 79 |
); |
23 | 80 |
})} |
24 | 81 |
</tbody> |
25 | 82 |
</table> |
83 |
+ |
|
26 | 84 |
); |
27 | 85 |
} |
28 | 86 |
|
--- client/views/pages/equipment/EquipmentManagementSelect.jsx
+++ client/views/pages/equipment/EquipmentManagementSelect.jsx
... | ... | @@ -9,6 +9,11 @@ |
9 | 9 |
|
10 | 10 |
export default function EquipmentManagementSelect() { |
11 | 11 |
|
12 |
+ // 시스템 코드 - 장비 상태 |
|
13 |
+ const [equipmentStates, setEquipmentStates] = React.useState({}); |
|
14 |
+ // 시스템 코드 - 장비 대여 상태 |
|
15 |
+ const [equipmentRentalStates, setEquipmentRentalStates] = React.useState({}); |
|
16 |
+ |
|
12 | 17 |
const [modalOpen, setModalOpen] = React.useState(false); |
13 | 18 |
const openModal = () => { |
14 | 19 |
setModalOpen(true); |
... | ... | @@ -16,7 +21,7 @@ |
16 | 21 |
const closeModal = () => { |
17 | 22 |
setModalOpen(false); |
18 | 23 |
}; |
19 |
- |
|
24 |
+ |
|
20 | 25 |
const [modalOpen3, setModalOpen3] = React.useState(false); |
21 | 26 |
const openModal3 = () => { |
22 | 27 |
// equipmentListData(); |
... | ... | @@ -26,15 +31,122 @@ |
26 | 31 |
setModalOpen3(false); |
27 | 32 |
}; |
28 | 33 |
|
29 |
- // 대상자 매칭 삭제 |
|
34 |
+ // 대상자 매칭 반납 |
|
30 | 35 |
const seniorMatchDelete = () => { |
31 |
- if(confirm('등록된 대상자를 삭제하시겠습니까?') == false) { |
|
36 |
+ if (confirm('아니다') == false) { |
|
32 | 37 |
return; |
33 | 38 |
} |
34 |
- // 대상자 매칭 삭제 함수 사용하기 |
|
39 |
+ // 대상자 매칭 반납 함수 사용하기 |
|
35 | 40 |
}; |
36 | 41 |
|
37 | 42 |
const navigate = useNavigate(); |
43 |
+ |
|
44 |
+ // 시스템 코드 - 장비 대여 상태 조회 |
|
45 |
+ const equipmentStatesSelect = () => { |
|
46 |
+ console.log('equipmentStatesSelect Function Run'); |
|
47 |
+ |
|
48 |
+ //fetch post |
|
49 |
+ fetch("/common/systemCode/equipmentStatesSelect.json", { |
|
50 |
+ method: "POST", |
|
51 |
+ headers: { |
|
52 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
53 |
+ }, |
|
54 |
+ body: JSON.stringify({}) |
|
55 |
+ }).then((response) => response.json()).then((data) => { |
|
56 |
+ console.log('equipmentStatesSelect response : ', data); |
|
57 |
+ setEquipmentStates(data); |
|
58 |
+ }).catch((error) => { |
|
59 |
+ console.log('equipmentStatesSelect error : ', error); |
|
60 |
+ }); |
|
61 |
+ } |
|
62 |
+ |
|
63 |
+ // 시스템 코드 - 장비 대여 상태 조회 |
|
64 |
+ const equipmentRentalStatesSelect = () => { |
|
65 |
+ console.log('equipmentRentalStatesSelect Function Run'); |
|
66 |
+ |
|
67 |
+ //fetch post |
|
68 |
+ fetch("/common/systemCode/equipmentRentalStatesSelect.json", { |
|
69 |
+ method: "POST", |
|
70 |
+ headers: { |
|
71 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
72 |
+ }, |
|
73 |
+ body: JSON.stringify({}) |
|
74 |
+ }).then((response) => response.json()).then((data) => { |
|
75 |
+ console.log('equipmentRentalStatesSelect response : ', data); |
|
76 |
+ setEquipmentRentalStates(data); |
|
77 |
+ }).catch((error) => { |
|
78 |
+ console.log('equipmentRentalStatesSelect error : ', error); |
|
79 |
+ }); |
|
80 |
+ |
|
81 |
+ //fetch get |
|
82 |
+ /* fetch('/common/systemCode/equipmentRentalStatesSelect.json') |
|
83 |
+ .then((response) => response.json()).then((data) => { |
|
84 |
+ console.log('equipmentRentalStatesSelect response : ', data); |
|
85 |
+ }).catch((error) => { |
|
86 |
+ console.log('equipmentRentalStatesSelect error : ', error); |
|
87 |
+ }); */ |
|
88 |
+ |
|
89 |
+ //axios get |
|
90 |
+ /* axios.get('/common/systemCode/equipmentRentalStatesSelect.json') |
|
91 |
+ .then(function (response) { |
|
92 |
+ console.log('equipmentRentalStatesSelect : ', response.data); |
|
93 |
+ }).catch(function (error) { |
|
94 |
+ console.log("equipmentRentalStatesSelect - error : ", error); |
|
95 |
+ }); */ |
|
96 |
+ |
|
97 |
+ //axios post |
|
98 |
+ /* axios({ |
|
99 |
+ url: '/common/systemCode/equipmentRentalStatesSelect.json', |
|
100 |
+ method: 'post', |
|
101 |
+ headers: { |
|
102 |
+ 'Content-Type': "application/json; charset=UTF-8", |
|
103 |
+ }, |
|
104 |
+ data: {} |
|
105 |
+ }).then(function (response) { |
|
106 |
+ console.log("equipmentRentalStatesSelect - response : ", response.data); |
|
107 |
+ }).catch(function (error) { |
|
108 |
+ console.log("equipmentRentalStatesSelect - error : ", error); |
|
109 |
+ }); */ |
|
110 |
+ } |
|
111 |
+ |
|
112 |
+ // 장비 비매칭 대상자 목록 조회 |
|
113 |
+ const equipmentNotMatchSeniorSelectList = () => { |
|
114 |
+ console.log('seniorSelectList Function Run'); |
|
115 |
+ fetch("/user/equipmentMatchStateSelectListBySenior.json", { |
|
116 |
+ method: "POST", |
|
117 |
+ headers: { |
|
118 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
119 |
+ }, |
|
120 |
+ body: JSON.stringify({ |
|
121 |
+ agency_id: 'AGENCY01', |
|
122 |
+ matchState: false |
|
123 |
+ }) |
|
124 |
+ }).then((response) => response.json()).then((data) => { |
|
125 |
+ console.log('equipmentNotMatchSeniorSelectList response : ', data); |
|
126 |
+ setEquipmentNotMatchSeniorList(data); |
|
127 |
+ }).catch((error) => { |
|
128 |
+ console.log('equipmentNotMatchSeniorSelectList error : ', error); |
|
129 |
+ }); |
|
130 |
+ } |
|
131 |
+ |
|
132 |
+ // 담당자 목록 조회 |
|
133 |
+ const workerSelectList = () => { |
|
134 |
+ console.log('workerSelectList Function Run'); |
|
135 |
+ fetch("/user/selectUserList.json", { |
|
136 |
+ method: "POST", |
|
137 |
+ headers: { |
|
138 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
139 |
+ }, |
|
140 |
+ body: JSON.stringify({ |
|
141 |
+ user_code: 'WORKER01' |
|
142 |
+ }) |
|
143 |
+ }).then((response) => response.json()).then((data) => { |
|
144 |
+ console.log('workerSelectList response : ', data); |
|
145 |
+ setWorkerList(data); |
|
146 |
+ }).catch((error) => { |
|
147 |
+ console.log('workerSelectList error : ', error); |
|
148 |
+ }); |
|
149 |
+ } |
|
38 | 150 |
|
39 | 151 |
/********************************** 관리자 장비 (시작) **********************************/ |
40 | 152 |
// 관리자 전체 장비 목록 |
... | ... | @@ -48,6 +160,7 @@ |
48 | 160 |
headers: { |
49 | 161 |
'Content-Type': 'application/json; charset=UTF-8' |
50 | 162 |
}, |
163 |
+ body: JSON.stringify({}) |
|
51 | 164 |
}).then((response) => response.json()).then((data) => { |
52 | 165 |
console.log('equipmentSelectList response : ', data); |
53 | 166 |
setEquipmentList(data); |
... | ... | @@ -72,7 +185,7 @@ |
72 | 185 |
"equipment_stock_date", |
73 | 186 |
"equipment_state", |
74 | 187 |
"agency_name", |
75 |
- "user_name", |
|
188 |
+ "senior_name", |
|
76 | 189 |
]; |
77 | 190 |
|
78 | 191 |
const thead2 = [ |
... | ... | @@ -99,16 +212,16 @@ |
99 | 212 |
date: "2022.12.02", |
100 | 213 |
agency: ( |
101 | 214 |
<Button |
102 |
- className={"btn-small lightgray-btn"} |
|
215 |
+ className={"btn-small gray-btn"} |
|
103 | 216 |
btnName={"선택"} |
104 | 217 |
onClick={openModal} |
105 | 218 |
/> |
106 | 219 |
), |
107 | 220 |
senior: ( |
108 | 221 |
<Button |
109 |
- className={"btn-small lightgray-btn"} |
|
222 |
+ className={"btn-small gray-btn"} |
|
110 | 223 |
btnName={"선택"} |
111 |
- // onClick={openModal2} |
|
224 |
+ // onClick={openModal2} |
|
112 | 225 |
/> |
113 | 226 |
), |
114 | 227 |
}, |
... | ... | @@ -118,15 +231,15 @@ |
118 | 231 |
serialNumber: "ABCD-1", |
119 | 232 |
date: "2022.12.02", |
120 | 233 |
agency: (<Button |
121 |
- className={"btn-small lightgray-btn"} |
|
234 |
+ className={"btn-small gray-btn"} |
|
122 | 235 |
btnName={"선택"} |
123 | 236 |
onClick={openModal} |
124 | 237 |
/>), |
125 | 238 |
senior: ( |
126 | 239 |
<Button |
127 |
- className={"btn-small lightgray-btn"} |
|
240 |
+ className={"btn-small gray-btn"} |
|
128 | 241 |
btnName={"선택"} |
129 |
- // onClick={openModal2} |
|
242 |
+ // onClick={openModal2} |
|
130 | 243 |
/> |
131 | 244 |
), |
132 | 245 |
}, |
... | ... | @@ -168,7 +281,7 @@ |
168 | 281 |
/********************************** 시행기관 장비 (시작) **********************************/ |
169 | 282 |
//로그 확인 |
170 | 283 |
const logCheck = () => { |
171 |
- console.log('seniorList - change: ', seniorList); |
|
284 |
+ console.log('equipmentNotMatchSeniorList - change: ', equipmentNotMatchSeniorList); |
|
172 | 285 |
}; |
173 | 286 |
|
174 | 287 |
// 시행기관 전체 장비 목록 |
... | ... | @@ -177,22 +290,27 @@ |
177 | 290 |
const [agencySeniorEquipmentList, setAgencySeniorEquipmentList] = React.useState([]); |
178 | 291 |
// 시행기관 재고 장비 목록 |
179 | 292 |
const [agencyStockEquipmentList, setAgencyStockEquipmentList] = React.useState([]); |
180 |
- // 선택 대상자 장비 |
|
293 |
+ // 선택한 대상자 장비 |
|
181 | 294 |
const [seniorEquipment, setSeniorEquipment] = React.useState({}); |
182 |
- // 대상자 목록 |
|
183 |
- const [seniorList, setSeniorList] = React.useState([]); |
|
184 | 295 |
// 대상자 장비 등록 모달창 |
185 |
- const [seniorMatchModal, setSeniorMatchModal] = React.useState(false); |
|
186 |
- |
|
296 |
+ const [seniorMatchInsertModal, setSeniorMatchInsertModal] = React.useState(false); |
|
297 |
+ // 대상자 장비 반납 모달창 |
|
298 |
+ const [seniorMatchReturnModal, setSeniorMatchReturnModal] = React.useState(false); |
|
299 |
+ |
|
300 |
+ // 장비 비매칭 대상자 목록 |
|
301 |
+ const [equipmentNotMatchSeniorList, setEquipmentNotMatchSeniorList] = React.useState([]); |
|
302 |
+ // 담당자 목록 |
|
303 |
+ const [workerList, setWorkerList] = React.useState([]); |
|
304 |
+ |
|
187 | 305 |
|
188 | 306 |
// 대상자 장비 등록 모달창 열기 |
189 |
- const seniorMatchModalOpen = (item) => { |
|
307 |
+ const seniorMatchInsertModalOpen = (item) => { |
|
190 | 308 |
setSeniorEquipment(item); // 선택한 장비 데이터 저장 |
191 |
- setSeniorMatchModal(true); |
|
309 |
+ setSeniorMatchInsertModal(true); |
|
192 | 310 |
}; |
193 | 311 |
// 대상자 장비 등록 모달창 닫기 |
194 |
- const seniorMatchModalClose = () => { |
|
195 |
- setSeniorMatchModal(false); |
|
312 |
+ const seniorMatchInsertModalClose = () => { |
|
313 |
+ setSeniorMatchInsertModal(false); |
|
196 | 314 |
}; |
197 | 315 |
|
198 | 316 |
// 대상자 장비 등록 - 대상자 |
... | ... | @@ -240,16 +358,53 @@ |
240 | 358 |
}; |
241 | 359 |
|
242 | 360 |
|
361 |
+ // 대상자 장비 반납 모달창 열기 |
|
362 |
+ const seniorMatchReturnModalOpen = (item) => { |
|
363 |
+ setSeniorEquipment(item); // 선택한 장비 데이터 저장 |
|
364 |
+ setSeniorMatchReturnModal(true); |
|
365 |
+ }; |
|
366 |
+ |
|
367 |
+ // 대상자 장비 반납 모달창 닫기 |
|
368 |
+ const seniorMatchReturnModalClose = () => { |
|
369 |
+ setSeniorMatchReturnModal(false); |
|
370 |
+ }; |
|
371 |
+ |
|
372 |
+ // 대상자 장비 - 반납일 |
|
373 |
+ const seniorEquipmentRentalReturnDateInsert = (e) => { |
|
374 |
+ console.log('@@@', e.target.value); |
|
375 |
+ // 원본 데이터 복사 및 수정 |
|
376 |
+ let data = { |
|
377 |
+ ...seniorEquipment, |
|
378 |
+ equipment_rental_return_date: e.target.value |
|
379 |
+ } |
|
380 |
+ // 복사 데이터를 원본 데이터에 덮어쓰기 |
|
381 |
+ setSeniorEquipment(data); |
|
382 |
+ }; |
|
383 |
+ |
|
384 |
+ // 대상자 장비 - 반납 담당자 |
|
385 |
+ const seniorEquipmentReturnUserIdInsert = (e) => { |
|
386 |
+ console.log('@@@@@', e.target.value); |
|
387 |
+ // 원본 데이터 복사 및 수정 |
|
388 |
+ let data = { |
|
389 |
+ ...seniorEquipment, |
|
390 |
+ return_user_id: e.target.value |
|
391 |
+ } |
|
392 |
+ // 복사 데이터를 원본 데이터에 덮어쓰기 |
|
393 |
+ setSeniorEquipment(data); |
|
394 |
+ }; |
|
395 |
+ |
|
396 |
+ |
|
243 | 397 |
// 시행기관 전체 장비 목록 조회 |
244 | 398 |
const agencyEquipmentSelectList = () => { |
245 | 399 |
console.log('agencyEquipmentSelectList Function Run'); |
246 |
- fetch("/equipment/agencyEquipmentSelectList.json", { |
|
400 |
+ fetch("/equipment/equipmentSelectList.json", { |
|
247 | 401 |
method: "POST", |
248 | 402 |
headers: { |
249 | 403 |
'Content-Type': 'application/json; charset=UTF-8' |
250 | 404 |
}, |
251 | 405 |
body: JSON.stringify({ |
252 | 406 |
agency_id: 'AGENCY01', |
407 |
+ searchAll: true |
|
253 | 408 |
}), |
254 | 409 |
}).then((response) => response.json()).then((data) => { |
255 | 410 |
console.log('agencyEquipmentSelectList response : ', data); |
... | ... | @@ -260,23 +415,44 @@ |
260 | 415 |
} |
261 | 416 |
|
262 | 417 |
// 시행기관 대상자 장비 목록 조회 |
263 |
- // const agencySeniorEquipmentSelectList = () => { |
|
264 |
- // console.log('agencySeniorEquipmentSelectList Function Run'); |
|
265 |
- // fetch("/equipment/agencySeniorEquipmentSelectList.json", { |
|
266 |
- // method: "POST", |
|
267 |
- // headers: { |
|
268 |
- // 'Content-Type': 'application/json; charset=UTF-8' |
|
269 |
- // }, |
|
270 |
- // body: JSON.stringify({ |
|
271 |
- // agency_id: 'AGENCY01', |
|
272 |
- // }), |
|
273 |
- // }).then((response) => response.json()).then((data) => { |
|
274 |
- // console.log('agencySeniorEquipmentSelectList response : ', data); |
|
275 |
- // setAgencySeniorEquipmentList(data); |
|
276 |
- // }).catch((error) => { |
|
277 |
- // console.log('agencySeniorEquipmentSelectList error : ', error); |
|
278 |
- // }); |
|
279 |
- // } |
|
418 |
+ const agencySeniorEquipmentSelectList = () => { |
|
419 |
+ console.log('agencySeniorEquipmentSelectList Function Run'); |
|
420 |
+ fetch("/equipment/equipmentSelectList.json", { |
|
421 |
+ method: "POST", |
|
422 |
+ headers: { |
|
423 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
424 |
+ }, |
|
425 |
+ body: JSON.stringify({ |
|
426 |
+ agency_id: 'AGENCY01', |
|
427 |
+ seniorCheck: true |
|
428 |
+ }), |
|
429 |
+ }).then((response) => response.json()).then((data) => { |
|
430 |
+ console.log('agencySeniorEquipmentSelectList response : ', data); |
|
431 |
+ setAgencySeniorEquipmentList(data); |
|
432 |
+ }).catch((error) => { |
|
433 |
+ console.log('agencySeniorEquipmentSelectList error : ', error); |
|
434 |
+ }); |
|
435 |
+ } |
|
436 |
+ |
|
437 |
+ // 시행기관 재고 장비 목록 조회 |
|
438 |
+ const agencyStockEquipmentSelectList = () => { |
|
439 |
+ console.log('agencyStockEquipmentList Function Run'); |
|
440 |
+ fetch("/equipment/equipmentSelectList.json", { |
|
441 |
+ method: "POST", |
|
442 |
+ headers: { |
|
443 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
444 |
+ }, |
|
445 |
+ body: JSON.stringify({ |
|
446 |
+ agency_id: 'AGENCY01', |
|
447 |
+ seniorCheck: false |
|
448 |
+ }), |
|
449 |
+ }).then((response) => response.json()).then((data) => { |
|
450 |
+ console.log('agencyStockEquipmentList response : ', data); |
|
451 |
+ setAgencyStockEquipmentList(data); |
|
452 |
+ }).catch((error) => { |
|
453 |
+ console.log('agencyStockEquipmentList error : ', error); |
|
454 |
+ }); |
|
455 |
+ } |
|
280 | 456 |
|
281 | 457 |
// 대상자 장비 등록 |
282 | 458 |
const seniorEquipmentInsert = () => { |
... | ... | @@ -284,14 +460,14 @@ |
284 | 460 |
|
285 | 461 |
// 대상자 아이디 유효성 검사 |
286 | 462 |
let check = 0; |
287 |
- for(let i = 0; i < seniorList.length; i++) { |
|
288 |
- // 입력한 데이터가 대상자 목록에 있을 경우 |
|
289 |
- if(seniorList[i]['user_id'] == seniorEquipment['senior_id']) { |
|
290 |
- console.log('success: ', seniorList[i]['user_id']); |
|
463 |
+ for (let i = 0; i < equipmentNotMatchSeniorList.length; i++) { |
|
464 |
+ // 입력한 대상자 아이디가 대상자 목록에 있을 경우 |
|
465 |
+ if (equipmentNotMatchSeniorList[i]['senior_id'] == seniorEquipment['senior_id']) { |
|
466 |
+ console.log('success: ', equipmentNotMatchSeniorList[i]['senior_id']); |
|
291 | 467 |
// 원본 데이터 복사 및 수정 |
292 | 468 |
let data = { |
293 | 469 |
...seniorEquipment, |
294 |
- user_name: seniorList[i]['user_name'] |
|
470 |
+ user_name: equipmentNotMatchSeniorList[i]['user_name'], |
|
295 | 471 |
} |
296 | 472 |
// 복사 데이터를 원본 데이터에 덮어쓰기 |
297 | 473 |
setSeniorEquipment(data); |
... | ... | @@ -299,12 +475,24 @@ |
299 | 475 |
check = 1; |
300 | 476 |
} |
301 | 477 |
} |
302 |
- // 입력한 데이터가 대상자 목록에 없을 경우 |
|
303 |
- if(check != 1) { |
|
304 |
- console.log('fail: ', seniorList, seniorEquipment['senior_id']); |
|
478 |
+ // 입력한 대상자 아이디가 대상자 목록에 없을 경우 |
|
479 |
+ if (check != 1) { |
|
480 |
+ console.log('fail: ', equipmentNotMatchSeniorList, seniorEquipment['senior_id']); |
|
305 | 481 |
alert('존재하지 않는 대상자입니다.'); |
306 | 482 |
return; |
307 | 483 |
} |
484 |
+ |
|
485 |
+ // 대여일 유효성 검사 |
|
486 |
+ /* if(seniorEquipment['equipment_rental_start_date'] == null) { |
|
487 |
+ alert('대여일을 입력해 주세요'); |
|
488 |
+ return; |
|
489 |
+ } */ |
|
490 |
+ |
|
491 |
+ // 반납 예정일 유효성 검사 |
|
492 |
+ /* if(seniorEquipment['equipment_rental_end_date'] == null) { |
|
493 |
+ alert('반납 예정일 입력해 주세요'); |
|
494 |
+ return; |
|
495 |
+ } */ |
|
308 | 496 |
|
309 | 497 |
fetch("/equipment/seniorEquipmentInsert.json", { |
310 | 498 |
method: "POST", |
... | ... | @@ -316,6 +504,15 @@ |
316 | 504 |
console.log('seniorEquipmentInsert response : ', data); |
317 | 505 |
// 대상자 장비 데이터 초기화 |
318 | 506 |
setSeniorEquipment({}); |
507 |
+ //장비 비매칭 대상자 목록 조회 |
|
508 |
+ equipmentNotMatchSeniorSelectList(); |
|
509 |
+ // 장비 목록 조회 |
|
510 |
+ agencyEquipmentSelectList(); |
|
511 |
+ agencySeniorEquipmentSelectList(); |
|
512 |
+ agencyStockEquipmentSelectList(); |
|
513 |
+ // 모달창 닫기 |
|
514 |
+ setSeniorMatchInsertModal(false); |
|
515 |
+ |
|
319 | 516 |
alert('등록이 완료됐습니다.'); |
320 | 517 |
}).catch((error) => { |
321 | 518 |
console.log('seniorEquipmentInsert error : ', error); |
... | ... | @@ -323,145 +520,146 @@ |
323 | 520 |
}); |
324 | 521 |
} |
325 | 522 |
|
326 |
- // 대상자 목록 조회 |
|
327 |
- const seniorSelectList = () => { |
|
328 |
- console.log('seniorSelectList Function Run'); |
|
329 |
- fetch("/user/selectSubjectList.json", { |
|
523 |
+ // 대상자 장비 반납 |
|
524 |
+ const seniorEquipmentReturn = () => { |
|
525 |
+ console.log('seniorEquipmentReturn Function Run'); |
|
526 |
+ |
|
527 |
+ // 담당자 아이디 유효성 검사 |
|
528 |
+ let check = 0; |
|
529 |
+ for (let i = 0; i < workerList.length; i++) { |
|
530 |
+ // 입력한 담당자 아이디가 담당자 목록에 있을 경우 |
|
531 |
+ if (workerList[i]['user_id'] == seniorEquipment['return_user_id']) { |
|
532 |
+ console.log('success: ', workerList[i]['user_id']); |
|
533 |
+ check = 1; |
|
534 |
+ } |
|
535 |
+ } |
|
536 |
+ // 입력한 담당자 아이디가 담당자 목록에 없을 경우 |
|
537 |
+ if (check != 1) { |
|
538 |
+ console.log('fail: ', workerList, seniorEquipment['return_user_id']); |
|
539 |
+ alert('존재하지 않는 담당자입니다.'); |
|
540 |
+ return; |
|
541 |
+ } |
|
542 |
+ |
|
543 |
+ // 반납 예정일 유효성 검사 |
|
544 |
+ /* if(seniorEquipment['equipment_rental_return_date'] == null) { |
|
545 |
+ alert('반납일 입력해 주세요'); |
|
546 |
+ return; |
|
547 |
+ } */ |
|
548 |
+ |
|
549 |
+ fetch("/equipment/seniorEquipmentReturn.json", { |
|
330 | 550 |
method: "POST", |
331 | 551 |
headers: { |
332 | 552 |
'Content-Type': 'application/json; charset=UTF-8' |
333 | 553 |
}, |
554 |
+ body: JSON.stringify(seniorEquipment), |
|
334 | 555 |
}).then((response) => response.json()).then((data) => { |
335 |
- console.log('seniorSelectList response : ', data); |
|
336 |
- setSeniorList(data); |
|
556 |
+ console.log('seniorEquipmentReturn response : ', data); |
|
557 |
+ // 대상자 장비 데이터 초기화 |
|
558 |
+ setSeniorEquipment({}); |
|
559 |
+ //장비 비매칭 대상자 목록 조회 |
|
560 |
+ equipmentNotMatchSeniorSelectList(); |
|
561 |
+ // 장비 목록 조회 |
|
562 |
+ agencyEquipmentSelectList(); |
|
563 |
+ agencySeniorEquipmentSelectList(); |
|
564 |
+ agencyStockEquipmentSelectList(); |
|
565 |
+ // 모달창 닫기 |
|
566 |
+ setSeniorMatchReturnModal(false); |
|
567 |
+ |
|
568 |
+ alert('반납이 완료됐습니다.'); |
|
337 | 569 |
}).catch((error) => { |
338 |
- console.log('seniorSelectList error : ', error); |
|
570 |
+ console.log('seniorEquipmentReturn error : ', error); |
|
571 |
+ alert('반납에 실패했습니다.'); |
|
339 | 572 |
}); |
340 | 573 |
} |
341 | 574 |
|
575 |
+ |
|
576 |
+ // 시행기관 전체 장비 thead, key |
|
342 | 577 |
const thead11 = [ |
343 | 578 |
"No", |
344 | 579 |
"모델 명", |
345 | 580 |
"시리얼 넘버", |
346 |
- "상태", |
|
347 |
- "대상자", |
|
348 |
- "대여일", |
|
349 |
- "반납예정일", |
|
350 |
- "반납일", |
|
351 |
- "관리" |
|
581 |
+ "기기 상태", |
|
582 |
+ "대여 상태", |
|
583 |
+ "동일 기기 매칭 순번", |
|
584 |
+ "대상자 관리", |
|
352 | 585 |
]; |
353 | 586 |
const key11 = [ |
354 | 587 |
"equipment_name", |
355 | 588 |
"equipment_serial_number", |
356 | 589 |
"equipment_state", |
357 |
- "user_name", |
|
358 |
- "equipment_rental_start_date", |
|
359 |
- "equipment_rental_end_date", |
|
360 |
- "equipment_rental_return_date" |
|
590 |
+ "equipment_rental_state", |
|
361 | 591 |
]; |
362 | 592 |
|
593 |
+ // 시행기관 대상자 장비 thead, key |
|
363 | 594 |
const thead22 = [ |
364 | 595 |
"No", |
365 | 596 |
"모델 명", |
366 | 597 |
"시리얼 넘버", |
367 |
- "상태", |
|
598 |
+ "기기 상태", |
|
368 | 599 |
"대상자", |
369 | 600 |
"대여일", |
370 | 601 |
"반납예정일", |
371 |
- "반납일", |
|
372 |
- "관리" |
|
602 |
+ "동일 기기 매칭 순번", |
|
603 |
+ "대상자 관리", |
|
373 | 604 |
]; |
374 | 605 |
const key22 = [ |
375 | 606 |
"equipment_name", |
376 | 607 |
"equipment_serial_number", |
377 | 608 |
"equipment_state", |
378 |
- "user_name", |
|
609 |
+ "senior_name", |
|
379 | 610 |
"equipment_rental_start_date", |
380 | 611 |
"equipment_rental_end_date", |
381 |
- "equipment_rental_return_date" |
|
612 |
+ "equipment_match_idx", |
|
382 | 613 |
]; |
383 | 614 |
|
615 |
+ // 시행기관 재고 장비 thead, key |
|
384 | 616 |
const thead33 = [ |
385 | 617 |
"No", |
386 |
- "장비명", |
|
618 |
+ "모델 명", |
|
387 | 619 |
"시리얼 넘버", |
388 |
- "입고일자", |
|
389 |
- "납품 기관",//관리기관, 올잇메디 |
|
390 |
- "대상자",//시행기관 |
|
620 |
+ "기기 상태", |
|
621 |
+ "대상자 관리", |
|
391 | 622 |
]; |
392 | 623 |
const key33 = [ |
393 |
- "No", |
|
394 |
- "equipment", |
|
395 |
- "serialNumber", |
|
396 |
- "date", |
|
397 |
- "agency", |
|
398 |
- "senior", |
|
624 |
+ "equipment_name", |
|
625 |
+ "equipment_serial_number", |
|
626 |
+ "equipment_state", |
|
399 | 627 |
]; |
400 |
- const content33 = [ |
|
401 |
- { |
|
402 |
- No: 1, |
|
403 |
- equipment: "스마트약상자", |
|
404 |
- serialNumber: "ABCD-1", |
|
405 |
- date: "2022.12.02", |
|
406 |
- agency: ( |
|
407 |
- <Button |
|
408 |
- className={"btn-small lightgray-btn"} |
|
409 |
- btnName={"선택"} |
|
410 |
- onClick={openModal} |
|
411 |
- /> |
|
412 |
- ), |
|
413 |
- senior: ( |
|
414 |
- <Button |
|
415 |
- className={"btn-small lightgray-btn"} |
|
416 |
- btnName={"선택"} |
|
417 |
- // onClick={openModal2} |
|
418 |
- /> |
|
419 |
- ), |
|
420 |
- }, |
|
421 |
- { |
|
422 |
- No: 2, |
|
423 |
- equipment: "스마트약상자", |
|
424 |
- serialNumber: "ABCD-1", |
|
425 |
- date: "2022.12.02", |
|
426 |
- agency: (<Button |
|
427 |
- className={"btn-small lightgray-btn"} |
|
428 |
- btnName={"선택"} |
|
429 |
- onClick={openModal} |
|
430 |
- />), |
|
431 |
- senior: ( |
|
432 |
- <Button |
|
433 |
- className={"btn-small lightgray-btn"} |
|
434 |
- btnName={"선택"} |
|
435 |
- // onClick={openModal2} |
|
436 |
- /> |
|
437 |
- ), |
|
438 |
- }, |
|
628 |
+ |
|
629 |
+ // 장비 대상자 등록 모달창 thead |
|
630 |
+ const thead44 = [ |
|
631 |
+ "대상자", |
|
632 |
+ "대여일", |
|
633 |
+ "반납예정일", |
|
634 |
+ "선택", |
|
635 |
+ ]; |
|
636 |
+ |
|
637 |
+ // 장비 대상자 반납 모달창 thead |
|
638 |
+ const thead55 = [ |
|
639 |
+ "반납일", |
|
640 |
+ "반납 담당자", |
|
641 |
+ "선택", |
|
439 | 642 |
]; |
440 | 643 |
|
441 | 644 |
// 마운트 시 실행 함수 |
442 | 645 |
React.useEffect(() => { |
646 |
+ equipmentStatesSelect(); |
|
647 |
+ equipmentRentalStatesSelect(); |
|
648 |
+ equipmentNotMatchSeniorSelectList(); |
|
649 |
+ workerSelectList(); |
|
650 |
+ |
|
651 |
+ //관리자 |
|
443 | 652 |
equipmentSelectList(); |
444 | 653 |
|
654 |
+ //시행기관 |
|
445 | 655 |
agencyEquipmentSelectList(); |
446 |
- // agencySeniorEquipmentSelectList(); |
|
447 |
- seniorSelectList(); |
|
656 |
+ agencySeniorEquipmentSelectList(); |
|
657 |
+ agencyStockEquipmentSelectList(); |
|
448 | 658 |
}, []) |
449 |
- |
|
450 |
- // 대상자, 재고 장비 목록 |
|
451 |
- React.useEffect(() => { |
|
452 |
- console.log('@@@', agencyEquipmentList); |
|
453 |
- let data = []; |
|
454 |
- for(let i = 0; i < agencyEquipmentList.length; i++) { |
|
455 |
- if(agencyEquipmentList[i]['senior_id'] != null) { |
|
456 |
- data.push(agencyEquipmentList[i]); |
|
457 |
- } |
|
458 |
- } |
|
459 |
- console.log('@@@data', data); |
|
460 |
- setAgencySeniorEquipmentList(data); |
|
461 |
- }, [agencyEquipmentList]) |
|
462 | 659 |
|
463 | 660 |
/********************************** 시행기관 장비 (끝) **********************************/ |
464 | 661 |
|
662 |
+ // 장비 납품 모달창 thead, key |
|
465 | 663 |
const thead4 = [ |
466 | 664 |
"No", |
467 | 665 |
"기관명", |
... | ... | @@ -476,7 +674,7 @@ |
476 | 674 |
{ |
477 | 675 |
No: 1, |
478 | 676 |
agency: ( |
479 |
- <div className="select-agency"> |
|
677 |
+ <div> |
|
480 | 678 |
<Category /> |
481 | 679 |
</div> |
482 | 680 |
) |
... | ... | @@ -488,41 +686,8 @@ |
488 | 686 |
|
489 | 687 |
}, |
490 | 688 |
]; |
491 |
- const thead5 = [ |
|
492 |
- "대상자", |
|
493 |
- "대여일", |
|
494 |
- "반납예정일", |
|
495 |
- "선택", |
|
496 |
- ]; |
|
497 |
- const key5 = [ |
|
498 |
- "senior", |
|
499 |
- "date", |
|
500 |
- "choice", |
|
501 |
- ]; |
|
502 |
- const content5 = [ |
|
503 |
- { |
|
504 |
- No: 1, |
|
505 |
- senior: ( |
|
506 |
- <div> |
|
507 |
- <input type="text" list="senior_list" /> |
|
508 |
- <datalist id="senior_list"> |
|
509 |
- <option value="대상자1(ID)"></option> |
|
510 |
- <option value="대상자2(ID)"></option> |
|
511 |
- <option value="대상자3(ID)"></option> |
|
512 |
- </datalist> |
|
513 |
- </div> |
|
514 |
- ) |
|
515 |
- , |
|
516 |
- choice: (<Button |
|
517 |
- className={"btn-small gray-btn"} |
|
518 |
- btnName={"선택"} |
|
519 |
- />) |
|
520 | 689 |
|
521 |
- }, |
|
522 |
- ]; |
|
523 |
- |
|
524 |
- |
|
525 |
- |
|
690 |
+ // 장비 탭별 화면 |
|
526 | 691 |
const data = [ |
527 | 692 |
{ |
528 | 693 |
id: 1, |
... | ... | @@ -533,7 +698,7 @@ |
533 | 698 |
<SubTitle explanation={"장비 클릭 시 지난 매칭이력을 확인할 수 있습니다."} /> |
534 | 699 |
<div className="btn-wrap flex-end margin-bottom "> |
535 | 700 |
<Button |
536 |
- className={"btn-small gray-btn"} |
|
701 |
+ className={"btn-small green-btn"} |
|
537 | 702 |
btnName={"등록"} |
538 | 703 |
onClick={openModal3} |
539 | 704 |
/> |
... | ... | @@ -548,39 +713,39 @@ |
548 | 713 |
navigate("/EquipmentManagementSelectOne"); |
549 | 714 |
}} |
550 | 715 |
/> */} |
551 |
- <table class = "caregiver-user"> |
|
716 |
+ <table class="caregiver-user"> |
|
552 | 717 |
<thead> |
553 | 718 |
<tr> |
554 |
- {thead1.map((i) => { |
|
555 |
- return <th>{i}</th>; |
|
556 |
- })} |
|
719 |
+ {thead1.map((i) => { |
|
720 |
+ return <th>{i}</th>; |
|
721 |
+ })} |
|
557 | 722 |
</tr> |
558 | 723 |
</thead> |
559 | 724 |
<tbody> |
560 | 725 |
{equipmentList.map((item, index) => { |
561 |
- return ( |
|
562 |
- <tr key={index}> |
|
563 |
- <td>{equipmentList.length - index}</td> |
|
564 |
- {key1.map((kes) => { |
|
565 |
- return <td>{item[kes]}</td> |
|
566 |
- })} |
|
567 |
- <td> |
|
568 |
- { |
|
569 |
- item['senior_id'] == null |
|
570 |
- ? <Button |
|
571 |
- className={"btn-small green-btn"} |
|
572 |
- btnName={"등록"} |
|
573 |
- onClick={() => seniorMatchModalOpen(item)} |
|
574 |
- /> |
|
575 |
- : <Button |
|
576 |
- className={"btn-small green-btn"} |
|
577 |
- btnName={"삭제"} |
|
578 |
- onClick={seniorMatchDelete} |
|
579 |
- /> |
|
580 |
- } |
|
581 |
- </td> |
|
582 |
- </tr> |
|
583 |
- ); |
|
726 |
+ return ( |
|
727 |
+ <tr key={index}> |
|
728 |
+ <td>{equipmentList.length - index}</td> |
|
729 |
+ {key1.map((kes) => { |
|
730 |
+ return <td>{item[kes]}</td> |
|
731 |
+ })} |
|
732 |
+ <td> |
|
733 |
+ { |
|
734 |
+ item['senior_id'] == null |
|
735 |
+ ? <Button |
|
736 |
+ className={"btn-small green-btn"} |
|
737 |
+ btnName={"등록"} |
|
738 |
+ onClick={() => seniorMatchInsertModalOpen(item)} |
|
739 |
+ /> |
|
740 |
+ : <Button |
|
741 |
+ className={"btn-small green-btn"} |
|
742 |
+ btnName={"반납"} |
|
743 |
+ onClick={seniorMatchDelete} |
|
744 |
+ /> |
|
745 |
+ } |
|
746 |
+ </td> |
|
747 |
+ </tr> |
|
748 |
+ ); |
|
584 | 749 |
})} |
585 | 750 |
</tbody> |
586 | 751 |
</table> |
... | ... | @@ -623,50 +788,64 @@ |
623 | 788 |
<SubTitle explanation={"장비 클릭 시 지난 매칭이력을 확인할 수 있습니다."} /> |
624 | 789 |
<div className="btn-wrap flex-end margin-bottom "> |
625 | 790 |
<Button |
626 |
- className={"btn-small gray-btn"} |
|
791 |
+ className={"btn-small green-btn"} |
|
627 | 792 |
btnName={"LOG"} |
628 | 793 |
onClick={logCheck} |
629 | 794 |
/> |
630 |
- <Button |
|
631 |
- className={"btn-small gray-btn"} |
|
632 |
- btnName={"등록"} |
|
633 |
- onClick={openModal3} |
|
634 |
- /> |
|
635 | 795 |
</div> |
636 | 796 |
</div> |
637 |
- <table class = "caregiver-user"> |
|
797 |
+ <table class="caregiver-user"> |
|
638 | 798 |
<thead> |
639 | 799 |
<tr> |
640 |
- {thead11.map((i) => { |
|
641 |
- return <th>{i}</th>; |
|
642 |
- })} |
|
800 |
+ {thead11.map((i) => { |
|
801 |
+ return <th>{i}</th>; |
|
802 |
+ })} |
|
643 | 803 |
</tr> |
644 | 804 |
</thead> |
645 | 805 |
<tbody> |
646 | 806 |
{agencyEquipmentList.map((item, index) => { |
647 |
- return ( |
|
648 |
- <tr key={index}> |
|
649 |
- <td>{agencyEquipmentList.length - index}</td> |
|
650 |
- {key11.map((kes) => { |
|
651 |
- return <td>{item[kes]}</td> |
|
652 |
- })} |
|
653 |
- <td> |
|
654 |
- { |
|
655 |
- item['senior_id'] == null |
|
656 |
- ? <Button |
|
657 |
- className={"btn-small green-btn"} |
|
658 |
- btnName={"등록"} |
|
659 |
- onClick={() => seniorMatchModalOpen(item)} |
|
660 |
- /> |
|
661 |
- : <Button |
|
662 |
- className={"btn-small green-btn"} |
|
663 |
- btnName={"삭제"} |
|
664 |
- onClick={seniorMatchDelete} |
|
665 |
- /> |
|
666 |
- } |
|
667 |
- </td> |
|
668 |
- </tr> |
|
669 |
- ); |
|
807 |
+ if(item) |
|
808 |
+ return ( |
|
809 |
+ <tr key={index}> |
|
810 |
+ <td>{agencyEquipmentList.length - index}</td> |
|
811 |
+ {/* {key11.map((kes) => { |
|
812 |
+ if(kes == "equipment_rental_state") { |
|
813 |
+ for(let i = 0; i < Object.keys(equipmentRentalStates).length; i++) { |
|
814 |
+ if(item[kes].toString().toUpperCase() == Object.keys(equipmentRentalStates)[i]) { |
|
815 |
+ item[kes] = Object.values(equipmentRentalStates)[i]; |
|
816 |
+ } |
|
817 |
+ } |
|
818 |
+ } |
|
819 |
+ return <td>{item[kes]}</td> |
|
820 |
+ })} */} |
|
821 |
+ <td>{item['equipment_name']}</td> |
|
822 |
+ <td>{item['equipment_serial_number']}</td> |
|
823 |
+ {Object.keys(equipmentStates).map((key, idx) => { |
|
824 |
+ if(item['equipment_state'] == key) |
|
825 |
+ return <td>{Object.values(equipmentStates)[idx]}</td> |
|
826 |
+ })} |
|
827 |
+ {Object.keys(equipmentRentalStates).map((key, idx) => { |
|
828 |
+ if(item['equipment_rental_state'] == key) |
|
829 |
+ return <td>{Object.values(equipmentRentalStates)[idx]}</td> |
|
830 |
+ })} |
|
831 |
+ <td>{item['equipment_match_idx']}</td> |
|
832 |
+ <td> |
|
833 |
+ { |
|
834 |
+ item['equipment_rental_state'] == 'RENTABLE' |
|
835 |
+ ? <Button |
|
836 |
+ className={"btn-small green-btn"} |
|
837 |
+ btnName={"등록"} |
|
838 |
+ onClick={() => seniorMatchInsertModalOpen(item)} |
|
839 |
+ /> |
|
840 |
+ : <Button |
|
841 |
+ className={"btn-small green-btn"} |
|
842 |
+ btnName={"반납"} |
|
843 |
+ onClick={() => seniorMatchReturnModalOpen(item)} |
|
844 |
+ /> |
|
845 |
+ } |
|
846 |
+ </td> |
|
847 |
+ </tr> |
|
848 |
+ ); |
|
670 | 849 |
})} |
671 | 850 |
</tbody> |
672 | 851 |
</table> |
... | ... | @@ -678,59 +857,36 @@ |
678 | 857 |
title: "대상자 장비(시행기관)" + "(" + agencySeniorEquipmentList.length + ")", |
679 | 858 |
description: ( |
680 | 859 |
<div> |
681 |
- {/* <table class = "caregiver-user"> |
|
860 |
+ <div className="flex"> |
|
861 |
+ <SubTitle explanation={"장비 클릭 시 지난 매칭이력을 확인할 수 있습니다."} /> |
|
862 |
+ </div> |
|
863 |
+ <table class="caregiver-user"> |
|
682 | 864 |
<thead> |
683 | 865 |
<tr> |
684 |
- {thead22.map((i) => { |
|
685 |
- return <th>{i}</th>; |
|
686 |
- })} |
|
866 |
+ {thead22.map((i) => { |
|
867 |
+ return <th>{i}</th>; |
|
868 |
+ })} |
|
687 | 869 |
</tr> |
688 | 870 |
</thead> |
689 | 871 |
<tbody> |
690 | 872 |
{agencySeniorEquipmentList.map((item, index) => { |
691 |
- return ( |
|
692 |
- <tr key={index}> |
|
693 |
- <td>{agencySeniorEquipmentList.length - index}</td> |
|
694 |
- {key22.map((kes) => { |
|
695 |
- return <td>{item[kes]}</td> |
|
696 |
- })} |
|
697 |
- <td> |
|
698 |
- <Button |
|
699 |
- className={"btn-small green-btn"} |
|
700 |
- btnName={"삭제"} |
|
701 |
- onClick={seniorMatchDelete} |
|
702 |
- /> |
|
703 |
- </td> |
|
704 |
- </tr> |
|
705 |
- ); |
|
706 |
- })} |
|
707 |
- </tbody> |
|
708 |
- </table> */} |
|
709 |
- <table class = "caregiver-user"> |
|
710 |
- <thead> |
|
711 |
- <tr> |
|
712 |
- {thead22.map((i) => { |
|
713 |
- return <th>{i}</th>; |
|
714 |
- })} |
|
715 |
- </tr> |
|
716 |
- </thead> |
|
717 |
- <tbody> |
|
718 |
- {agencySeniorEquipmentList.map((item, index) => { |
|
719 |
- return ( |
|
720 |
- <tr key={index}> |
|
721 |
- <td>{agencySeniorEquipmentList.length - index}</td> |
|
722 |
- {key22.map((kes) => { |
|
723 |
- return <td>{item[kes]}</td> |
|
724 |
- })} |
|
725 |
- <td> |
|
726 |
- <Button |
|
727 |
- className={"btn-small green-btn"} |
|
728 |
- btnName={"삭제"} |
|
729 |
- onClick={seniorMatchDelete} |
|
730 |
- /> |
|
731 |
- </td> |
|
732 |
- </tr> |
|
733 |
- ); |
|
873 |
+ return ( |
|
874 |
+ <tr key={index}> |
|
875 |
+ <td>{agencySeniorEquipmentList.length - index}</td> |
|
876 |
+ {key22.map((kes) => { |
|
877 |
+ return <td>{item[kes]}</td> |
|
878 |
+ })} |
|
879 |
+ <td> |
|
880 |
+ { |
|
881 |
+ <Button |
|
882 |
+ className={"btn-small green-btn"} |
|
883 |
+ btnName={"반납"} |
|
884 |
+ onClick={() => seniorMatchReturnModalOpen(item)} |
|
885 |
+ /> |
|
886 |
+ } |
|
887 |
+ </td> |
|
888 |
+ </tr> |
|
889 |
+ ); |
|
734 | 890 |
})} |
735 | 891 |
</tbody> |
736 | 892 |
</table> |
... | ... | @@ -739,20 +895,50 @@ |
739 | 895 |
}, |
740 | 896 |
{ |
741 | 897 |
id: 6, |
742 |
- title: "재고 장비(시행기관)" + "(" + ")", |
|
898 |
+ title: "재고 장비(시행기관)" + "(" + agencyStockEquipmentList.length + ")", |
|
743 | 899 |
description: ( |
744 |
- <Table |
|
745 |
- className={"caregiver-user"} |
|
746 |
- head={thead33} |
|
747 |
- contents={content33} |
|
748 |
- contentKey={key33} |
|
749 |
- /> |
|
900 |
+ <div> |
|
901 |
+ <div className="flex"> |
|
902 |
+ <SubTitle explanation={"장비 클릭 시 지난 매칭이력을 확인할 수 있습니다."} /> |
|
903 |
+ </div> |
|
904 |
+ <table class="caregiver-user"> |
|
905 |
+ <thead> |
|
906 |
+ <tr> |
|
907 |
+ {thead33.map((i) => { |
|
908 |
+ return <th>{i}</th>; |
|
909 |
+ })} |
|
910 |
+ </tr> |
|
911 |
+ </thead> |
|
912 |
+ <tbody> |
|
913 |
+ {agencyStockEquipmentList.map((item, index) => { |
|
914 |
+ return ( |
|
915 |
+ <tr key={index}> |
|
916 |
+ <td>{agencyStockEquipmentList.length - index}</td> |
|
917 |
+ {key33.map((kes) => { |
|
918 |
+ return <td>{item[kes]}</td> |
|
919 |
+ })} |
|
920 |
+ <td> |
|
921 |
+ { |
|
922 |
+ <Button |
|
923 |
+ className={"btn-small green-btn"} |
|
924 |
+ btnName={"등록"} |
|
925 |
+ onClick={() => seniorMatchInsertModalOpen(item)} |
|
926 |
+ /> |
|
927 |
+ } |
|
928 |
+ </td> |
|
929 |
+ </tr> |
|
930 |
+ ); |
|
931 |
+ })} |
|
932 |
+ </tbody> |
|
933 |
+ </table> |
|
934 |
+ </div> |
|
750 | 935 |
), |
751 | 936 |
}, |
752 | 937 |
]; |
753 | 938 |
|
754 | 939 |
//시작 탭 설정 |
755 | 940 |
const [index, setIndex] = React.useState(4); |
941 |
+ |
|
756 | 942 |
return ( |
757 | 943 |
<main> |
758 | 944 |
<Modal open={modalOpen} close={closeModal} header="납품 기관 선택"> |
... | ... | @@ -765,57 +951,16 @@ |
765 | 951 |
contentKey={key4} |
766 | 952 |
/> |
767 | 953 |
</div> |
768 |
- </div> |
|
769 |
- </Modal> |
|
770 |
- <Modal open={seniorMatchModal} close={seniorMatchModalClose} header="대상자 장비 등록"> |
|
771 |
- <div className="board-wrap"> |
|
772 |
- <div> |
|
773 |
- <table className={"caregiver-user"}> |
|
774 |
- <thead> |
|
775 |
- <tr> |
|
776 |
- {thead5.map((i) => { |
|
777 |
- return <th>{i}</th>; |
|
778 |
- })} |
|
779 |
- </tr> |
|
780 |
- </thead> |
|
781 |
- <tbody> |
|
782 |
- <tr> |
|
783 |
- <td> |
|
784 |
- <input type="text" list="senior_list" placeholder="대상자를 입력해 주세요" onChange={seniorEquipmentSeniorInsert}/> |
|
785 |
- <datalist id="senior_list"> |
|
786 |
- {seniorList.map((item) => { |
|
787 |
- // return <option value={item['user_name'] + " (" + item['user_id'] + ")"}></option> |
|
788 |
- return <option value={item['user_id']}>{item['user_name']}</option> |
|
789 |
- |
|
790 |
- })} |
|
791 |
- </datalist> |
|
792 |
- </td> |
|
793 |
- <td> |
|
794 |
- <input type="date" onChange={seniorEquipmentRentalStartDateInsert}/> |
|
795 |
- </td> |
|
796 |
- <td> |
|
797 |
- <input type="date" onChange={seniorEquipmentRentalEndDateInsert}/> |
|
798 |
- </td> |
|
799 |
- <td> |
|
800 |
- <Button |
|
801 |
- className={"btn-small gray-btn"} |
|
802 |
- btnName={"선택"} |
|
803 |
- onClick={seniorEquipmentInsert} |
|
804 |
- /> |
|
805 |
- </td> |
|
806 |
- </tr> |
|
807 |
- </tbody> |
|
808 |
- </table> |
|
809 |
- </div> |
|
810 | 954 |
<div> |
811 | 955 |
<Button |
812 | 956 |
className={"btn-100 green-btn"} |
813 | 957 |
btnName={"닫기"} |
814 |
- onClick={seniorMatchModalClose} |
|
958 |
+ onClick={closeModal} |
|
815 | 959 |
/> |
816 | 960 |
</div> |
817 | 961 |
</div> |
818 | 962 |
</Modal> |
963 |
+ |
|
819 | 964 |
<Modal open={modalOpen3} close={closeModal3} header="장비 등록"> |
820 | 965 |
<div className="board-wrap"> |
821 | 966 |
<div> |
... | ... | @@ -842,15 +987,112 @@ |
842 | 987 |
</tbody> |
843 | 988 |
</table> |
844 | 989 |
</div> |
845 |
- <div className="flex-center"> |
|
990 |
+ <div> |
|
846 | 991 |
<Button |
847 |
- className={"btn-small red-btn"} |
|
992 |
+ className={"btn-100 green-btn"} |
|
848 | 993 |
btnName={"저장"} |
849 | 994 |
onClick={closeModal3} |
850 | 995 |
/> |
851 | 996 |
</div> |
852 | 997 |
</div> |
853 | 998 |
</Modal> |
999 |
+ |
|
1000 |
+ <Modal open={seniorMatchInsertModal} close={seniorMatchInsertModalClose} header="대상자 장비 등록"> |
|
1001 |
+ <div className="board-wrap"> |
|
1002 |
+ <div> |
|
1003 |
+ <table className={"caregiver-user"}> |
|
1004 |
+ <thead> |
|
1005 |
+ <tr> |
|
1006 |
+ {thead44.map((i) => { |
|
1007 |
+ return <th>{i}</th>; |
|
1008 |
+ })} |
|
1009 |
+ </tr> |
|
1010 |
+ </thead> |
|
1011 |
+ <tbody> |
|
1012 |
+ <tr> |
|
1013 |
+ <td> |
|
1014 |
+ <input type="text" list="senior_list" placeholder="대상자를 입력해 주세요" onChange={seniorEquipmentSeniorInsert} /> |
|
1015 |
+ <datalist id="senior_list"> |
|
1016 |
+ {equipmentNotMatchSeniorList.map((item) => { |
|
1017 |
+ // return <option value={item['user_name'] + " (" + item['senior_id'] + ")"}></option> |
|
1018 |
+ return <option value={item['senior_id']}>{item['user_name']}</option> |
|
1019 |
+ |
|
1020 |
+ })} |
|
1021 |
+ </datalist> |
|
1022 |
+ </td> |
|
1023 |
+ <td> |
|
1024 |
+ <input type="date" onChange={seniorEquipmentRentalStartDateInsert} /> |
|
1025 |
+ </td> |
|
1026 |
+ <td> |
|
1027 |
+ <input type="date" onChange={seniorEquipmentRentalEndDateInsert} /> |
|
1028 |
+ </td> |
|
1029 |
+ <td> |
|
1030 |
+ <Button |
|
1031 |
+ className={"btn-small gray-btn"} |
|
1032 |
+ btnName={"선택"} |
|
1033 |
+ onClick={seniorEquipmentInsert} |
|
1034 |
+ /> |
|
1035 |
+ </td> |
|
1036 |
+ </tr> |
|
1037 |
+ </tbody> |
|
1038 |
+ </table> |
|
1039 |
+ </div> |
|
1040 |
+ <div> |
|
1041 |
+ <Button |
|
1042 |
+ className={"btn-100 green-btn"} |
|
1043 |
+ btnName={"닫기"} |
|
1044 |
+ onClick={seniorMatchInsertModalClose} |
|
1045 |
+ /> |
|
1046 |
+ </div> |
|
1047 |
+ </div> |
|
1048 |
+ </Modal> |
|
1049 |
+ |
|
1050 |
+ <Modal open={seniorMatchReturnModal} close={seniorMatchReturnModalClose} header="대상자 장비 반납"> |
|
1051 |
+ <div className="board-wrap"> |
|
1052 |
+ <div> |
|
1053 |
+ <table className={"caregiver-user"}> |
|
1054 |
+ <thead> |
|
1055 |
+ <tr> |
|
1056 |
+ {thead55.map((i) => { |
|
1057 |
+ return <th>{i}</th>; |
|
1058 |
+ })} |
|
1059 |
+ </tr> |
|
1060 |
+ </thead> |
|
1061 |
+ <tbody> |
|
1062 |
+ <tr> |
|
1063 |
+ <td> |
|
1064 |
+ <input type="date" onChange={seniorEquipmentRentalReturnDateInsert} /> |
|
1065 |
+ </td> |
|
1066 |
+ <td> |
|
1067 |
+ <input type="text" list="senior_list" placeholder="반납 담당자를 입력해 주세요" onChange={seniorEquipmentReturnUserIdInsert} /> |
|
1068 |
+ <datalist id="senior_list"> |
|
1069 |
+ {workerList.map((item) => { |
|
1070 |
+ return <option value={item['user_id']}>{item['user_name']}</option> |
|
1071 |
+ })} |
|
1072 |
+ </datalist> |
|
1073 |
+ </td> |
|
1074 |
+ <td> |
|
1075 |
+ <Button |
|
1076 |
+ className={"btn-small gray-btn"} |
|
1077 |
+ btnName={"선택"} |
|
1078 |
+ onClick={seniorEquipmentReturn} |
|
1079 |
+ /> |
|
1080 |
+ </td> |
|
1081 |
+ </tr> |
|
1082 |
+ </tbody> |
|
1083 |
+ </table> |
|
1084 |
+ </div> |
|
1085 |
+ <div> |
|
1086 |
+ <Button |
|
1087 |
+ className={"btn-100 green-btn"} |
|
1088 |
+ btnName={"닫기"} |
|
1089 |
+ onClick={seniorMatchInsertModalClose} |
|
1090 |
+ /> |
|
1091 |
+ </div> |
|
1092 |
+ </div> |
|
1093 |
+ </Modal> |
|
1094 |
+ |
|
1095 |
+ |
|
854 | 1096 |
<div className="tab-container"> |
855 | 1097 |
<ul className="tab-menu"> |
856 | 1098 |
{data.map((item) => ( |
--- client/views/pages/user_management/UserAuthoriySelect_agency.jsx
+++ client/views/pages/user_management/UserAuthoriySelect_agency.jsx
... | ... | @@ -4,13 +4,23 @@ |
4 | 4 |
import SubTitle from "../../component/SubTitle.jsx"; |
5 | 5 |
import Modal from "../../component/Modal.jsx"; |
6 | 6 |
import { useNavigate } from "react-router"; |
7 |
+import Pagination from "../../component/Pagination.jsx"; |
|
7 | 8 |
|
8 | 9 |
export default function UserAuthoriySelect_agency() { |
9 | 10 |
// 화면 진입 시 탭 별 노출될ㄹ 리스트 초기화 |
10 | 11 |
const [subjectList, setSubjectList] = React.useState([]); |
11 | 12 |
const [subjectMyList, setSubjectMyList] = React.useState([]); |
12 | 13 |
|
14 |
+ |
|
15 |
+ //페이징 작업 |
|
16 |
+ const limit = 10; // 페이지당 보여줄 공지 개수 |
|
17 |
+ const [page, setPage] = React.useState(1); //page index |
|
18 |
+ const offset = (page - 1) * limit; //게시물 위치 계산 |
|
19 |
+ const [myUserTotal, setMyUserTotal] = React.useState(0); //최대길이 넣을 변수 |
|
20 |
+ const [userTotal, setUserTotal] = React.useState(0); //최대길이 넣을 변수 |
|
21 |
+ |
|
13 | 22 |
// ------ 등록 버튼 클릭 시 노출되는 모달 데이터 ------// |
23 |
+ |
|
14 | 24 |
// 사용자 등록 시 초기값 세팅 |
15 | 25 |
const [userName, setUserName] = React.useState(""); |
16 | 26 |
const [gender, setGender] = React.useState(""); |
... | ... | @@ -22,7 +32,20 @@ |
22 | 32 |
const [medicineD, setMedicineD] = React.useState(false); |
23 | 33 |
const [medication, setMedication] = React.useState(""); |
24 | 34 |
const [note, setNote] = React.useState(""); |
25 |
- |
|
35 |
+ |
|
36 |
+ // 등록 후 초기화 진행 |
|
37 |
+ const dataReset = () => { |
|
38 |
+ setUserName(""); |
|
39 |
+ setGender(""); |
|
40 |
+ setBrith(""); |
|
41 |
+ setTelNum(""); |
|
42 |
+ setHomeAddress(""); |
|
43 |
+ setMedicineM(""); |
|
44 |
+ setMedicineL(""); |
|
45 |
+ setMedicineD(""); |
|
46 |
+ setMedication(""); |
|
47 |
+ setNote(""); |
|
48 |
+ } |
|
26 | 49 |
// 변경되는 데이터 Handler |
27 | 50 |
const handleUserName = (e) => { |
28 | 51 |
setUserName(e.target.value); |
... | ... | @@ -34,7 +57,7 @@ |
34 | 57 |
setBrith(e.target.value); |
35 | 58 |
}; |
36 | 59 |
const handleTelNum = (e) => { |
37 |
- e.target.value = e.target.value.replace(/[^0-9]/g, '').replace(/^(\d{2,3})(\d{3,4})(\d{4})$/, `$1-$2-$3`); |
|
60 |
+ e.target.value = e.target.value.replace(/[^0-9]/g, '').replace(/^(\d{2,3})(\d{3,4})(\d{4})$/, `$1-$2-$3`); |
|
38 | 61 |
setTelNum(e.target.value); |
39 | 62 |
}; |
40 | 63 |
const handleHomeAddress = (e) => { |
... | ... | @@ -57,82 +80,103 @@ |
57 | 80 |
}; |
58 | 81 |
|
59 | 82 |
// 대상자 등록 함수 |
60 |
- const seniorInsert = () => { |
|
61 |
- // userName,gender,brith, telNum, homeAddress, note, medicineM, medicineL, medicineD |
|
62 |
- // console.log("userName : ",userName); |
|
63 |
- // console.log("gender : ",gender); |
|
64 |
- // console.log("brith : ",brith); |
|
65 |
- // console.log("telNum : ",telNum); |
|
66 |
- // console.log("homeAddress : ",homeAddress); |
|
67 |
- // console.log("note : ",note); |
|
68 |
- // console.log("medicineM : ",medicineM); |
|
69 |
- // console.log("medicineL : ",medicineL); |
|
70 |
- // console.log("medicineD : ",medicineD); |
|
83 |
+ const InsertSenior = () => { |
|
71 | 84 |
var insertBtn = confirm("등록하시겠습니까?"); |
72 |
- if(insertBtn){ |
|
73 |
- fetch("/user/userInsert_userMadicationInsert.json", { |
|
74 |
- method: "POST", |
|
75 |
- headers: { |
|
76 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
77 |
- }, |
|
78 |
- body: JSON.stringify({ |
|
79 |
- userName:userName, |
|
80 |
- gender:gender, |
|
81 |
- brith :brith, |
|
82 |
- userTel :telNum, |
|
83 |
- homeAddress:homeAddress, |
|
84 |
- medicineM:medicineM, |
|
85 |
- medicineL:medicineL, |
|
86 |
- medicineD:medicineD, |
|
87 |
- medication:medication, |
|
88 |
- note:note, |
|
89 |
- agancyId:'agency1', |
|
90 |
- govId:'government1', |
|
91 |
- userCode : '4' |
|
92 |
- }), |
|
93 |
- }).then((response) => response.json()).then((data) => { |
|
94 |
- alert("등록 되었습니다."); |
|
95 |
- }).catch((error) => { |
|
96 |
- console.log('selectNotice() /Notice/selectNotice.json error : ', error); |
|
97 |
- }); |
|
98 |
- }else{ |
|
99 |
- return; |
|
85 |
+ if (insertBtn) { |
|
86 |
+ InsertUserData(); |
|
87 |
+ alert("등록 되었습니다."); |
|
88 |
+ dataReset(); |
|
89 |
+ closeModal3(); |
|
90 |
+ getSelectSubjectList(); |
|
91 |
+ getSelectMySubjectList(); |
|
92 |
+ } else { |
|
93 |
+ return; |
|
100 | 94 |
} |
101 |
- |
|
95 |
+ |
|
102 | 96 |
}; |
103 |
- |
|
97 |
+ // 대상자 정보 등록을 위한 함수 |
|
98 |
+ const InsertUserData = () => { |
|
99 |
+ fetch("/user/insertSeniorData.json", { |
|
100 |
+ method: "POST", |
|
101 |
+ headers: { |
|
102 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
103 |
+ }, |
|
104 |
+ body: JSON.stringify({ |
|
105 |
+ user_name: userName, |
|
106 |
+ user_gender: gender, |
|
107 |
+ user_birth: brith, |
|
108 |
+ user_phonenumber: telNum, |
|
109 |
+ user_address: homeAddress, |
|
110 |
+ agency_id: 'agency1', |
|
111 |
+ government_id: 'government1', |
|
112 |
+ user_code: '4' |
|
113 |
+ }), |
|
114 |
+ }).then((response) => response.json()).then((data) => { |
|
115 |
+ console.log("대상자 정보 등록"); |
|
116 |
+ InsertUserPillData(); |
|
117 |
+ }).catch((error) => { |
|
118 |
+ console.log('insertSeniorData() /Notice/insertSeniorData.json error : ', error); |
|
119 |
+ }); |
|
120 |
+ }; |
|
121 |
+ // 대상자 약 복용 정보 등록을 위한 함수 |
|
122 |
+ const InsertUserPillData = () => { |
|
123 |
+ fetch("/user/insertSeniorMadication.json", { |
|
124 |
+ method: "POST", |
|
125 |
+ headers: { |
|
126 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
127 |
+ }, |
|
128 |
+ body: JSON.stringify({ |
|
129 |
+ user_phonenumber: telNum, |
|
130 |
+ breakfast_medication_check: medicineM, |
|
131 |
+ lunch_medication_check: medicineL, |
|
132 |
+ dinner_medication_check: medicineD, |
|
133 |
+ medication_pill: medication, |
|
134 |
+ senior_note: note, |
|
135 |
+ }), |
|
136 |
+ }).then((response) => response.json()).then((data) => { |
|
137 |
+ console.log("약 정보 등록"); |
|
138 |
+ }).catch((error) => { |
|
139 |
+ console.log('InsertUserPillData() /user/insertSeniorMadication.json error : ', error); |
|
140 |
+ }); |
|
141 |
+ }; |
|
142 |
+ //select |
|
104 | 143 |
const getSelectSubjectList = () => { |
105 |
- fetch("/user/selectSubjectList.json", { |
|
106 |
- method: "POST", |
|
107 |
- headers: { |
|
108 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
109 |
- }, |
|
110 |
- }).then((response) => response.json()).then((data) => { |
|
111 |
- const rowData = data; |
|
112 |
- console.log(data); |
|
113 |
- setSubjectList(rowData) |
|
114 |
- |
|
115 |
- }).catch((error) => { |
|
116 |
- console.log('getSelectSubjectList() /user/selectSubjectList.json error : ', error); |
|
117 |
- }); |
|
144 |
+ fetch("/user/selectUserList.json", { |
|
145 |
+ method: "POST", |
|
146 |
+ headers: { |
|
147 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
148 |
+ }, |
|
149 |
+ body: JSON.stringify({ |
|
150 |
+ user_code: '4', |
|
151 |
+ }), |
|
152 |
+ }).then((response) => response.json()).then((data) => { |
|
153 |
+ const rowData = data; |
|
154 |
+ console.log(data); |
|
155 |
+ setSubjectList(rowData) |
|
156 |
+ setUserTotal(rowData.length) |
|
157 |
+ }).catch((error) => { |
|
158 |
+ console.log('getSelectSubjectList() /user/selectUserList.json error : ', error); |
|
159 |
+ }); |
|
118 | 160 |
}; |
119 | 161 |
|
120 | 162 |
const getSelectMySubjectList = () => { |
121 |
- fetch("/user/selectMySubjectList.json", { |
|
122 |
- method: "POST", |
|
123 |
- headers: { |
|
124 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
125 |
- }, |
|
126 |
- body: JSON.stringify({ |
|
127 |
- agancyId: 'agency1', |
|
128 |
- }), |
|
129 |
- }).then((response) => response.json()).then((data) => { |
|
130 |
- const rowData = data; |
|
131 |
- console.log(data); |
|
132 |
- setSubjectMyList(rowData) |
|
133 |
- }).catch((error) => { |
|
134 |
- console.log('getSubjectMySelect() /user/selectMySubjectList.json error : ', error); |
|
135 |
- }); |
|
163 |
+ fetch("/user/selectMyUserList.json", { |
|
164 |
+ method: "POST", |
|
165 |
+ headers: { |
|
166 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
167 |
+ }, |
|
168 |
+ body: JSON.stringify({ |
|
169 |
+ agency_id: 'agency1', |
|
170 |
+ user_code: '4', |
|
171 |
+ }), |
|
172 |
+ }).then((response) => response.json()).then((data) => { |
|
173 |
+ const rowData = data; |
|
174 |
+ console.log(data); |
|
175 |
+ setSubjectMyList(rowData) |
|
176 |
+ setMyUserTotal(rowData.length) |
|
177 |
+ }).catch((error) => { |
|
178 |
+ console.log('getSubjectMySelect() /user/selectMyUserList.json error : ', error); |
|
179 |
+ }); |
|
136 | 180 |
}; |
137 | 181 |
|
138 | 182 |
const navigate = useNavigate(); |
... | ... | @@ -181,7 +225,7 @@ |
181 | 225 |
"생년월일", |
182 | 226 |
"주소", |
183 | 227 |
"보호자", |
184 |
- |
|
228 |
+ |
|
185 | 229 |
]; |
186 | 230 |
const key1 = [ |
187 | 231 |
// "No", "name", "Id", "call", "gender", "birth", "address", "management" |
... | ... | @@ -339,12 +383,15 @@ |
339 | 383 |
id: 1, |
340 | 384 |
title: "내가 관리하는 대상자", |
341 | 385 |
description: ( |
342 |
- |
|
386 |
+ |
|
343 | 387 |
<Table |
344 | 388 |
className={"protector-user"} |
345 | 389 |
head={thead1} |
346 | 390 |
contents={subjectMyList} |
347 | 391 |
contentKey={key1} |
392 |
+ view={"mySenior"} |
|
393 |
+ offset={offset} |
|
394 |
+ limit={limit} |
|
348 | 395 |
/> |
349 | 396 |
), |
350 | 397 |
}, |
... | ... | @@ -357,6 +404,9 @@ |
357 | 404 |
head={thead2} |
358 | 405 |
contents={subjectList} |
359 | 406 |
contentKey={key2} |
407 |
+ view={"allSenior"} |
|
408 |
+ offset={offset} |
|
409 |
+ limit={limit} |
|
360 | 410 |
/> |
361 | 411 |
), |
362 | 412 |
}, |
... | ... | @@ -364,6 +414,7 @@ |
364 | 414 |
|
365 | 415 |
const [index, setIndex] = React.useState(1); |
366 | 416 |
|
417 |
+ |
|
367 | 418 |
React.useEffect(() => { |
368 | 419 |
getSelectSubjectList(); |
369 | 420 |
getSelectMySubjectList(); |
... | ... | @@ -429,7 +480,7 @@ |
429 | 480 |
</Modal> |
430 | 481 |
<Modal open={modalOpen2} close={closeModal2} header="담당자 배정"> |
431 | 482 |
<div className="board-wrap"> |
432 |
- <SubTitle explanation={"담당자 선택"} className="margin-bottom"/> |
|
483 |
+ <SubTitle explanation={"담당자 선택"} className="margin-bottom" /> |
|
433 | 484 |
<div className="flex-start protectorlist margin-bottom5"> |
434 | 485 |
<input type="text" list="protectorlist" /> |
435 | 486 |
<datalist id="protectorlist"> |
... | ... | @@ -456,9 +507,9 @@ |
456 | 507 |
</Modal> |
457 | 508 |
<Modal open={modalOpen3} close={closeModal3} header="대상자 등록"> |
458 | 509 |
<div className="board-wrap"> |
459 |
- <SubTitle explanation={"회원 등록 시 ID는 연락처, 패스워드는 생년월일 8자리입니다."} className="margin-bottom"/> |
|
510 |
+ <SubTitle explanation={"회원 등록 시 ID는 연락처, 패스워드는 생년월일 8자리입니다."} className="margin-bottom" /> |
|
460 | 511 |
<table className="margin-bottom2 senior-insert"> |
461 |
- {/* <tr> |
|
512 |
+ {/* <tr> |
|
462 | 513 |
<th>대상자등록번호</th> |
463 | 514 |
<td colSpan={3} className="flex"> |
464 | 515 |
<input type="text" placeholder="생성하기 버튼 클릭 시 자동으로 생성됩니다."/> |
... | ... | @@ -486,7 +537,7 @@ |
486 | 537 |
</td> |
487 | 538 |
</tr> |
488 | 539 |
<tr> |
489 |
- <th>생년월일</th> |
|
540 |
+ <th>생년월일</th> |
|
490 | 541 |
<td> |
491 | 542 |
<div className="flex"> |
492 | 543 |
<input type='date' value={brith} onChange={handleBrithday} /> |
... | ... | @@ -496,7 +547,7 @@ |
496 | 547 |
<td> |
497 | 548 |
<input type="text" /> |
498 | 549 |
</td> */} |
499 |
- |
|
550 |
+ |
|
500 | 551 |
</tr> |
501 | 552 |
<tr> |
502 | 553 |
<th>연락처</th> |
... | ... | @@ -513,10 +564,10 @@ |
513 | 564 |
<tr> |
514 | 565 |
<th>필요 복약</th> |
515 | 566 |
<td> |
516 |
- <div className="flex"> |
|
517 |
- <input type="checkbox" name="medicationSelect" checked={medicineM} onClick={(e) => {handleMedicineM(e)}} /><label for="medicationTime">아침</label> |
|
518 |
- <input type="checkbox" name="medicationSelect" checked={medicineL} onClick={(e) => {handleMedicineL(e)}}/><label for="medicationTime">점심</label> |
|
519 |
- <input type="checkbox" name="medicationSelect" checked={medicineD} onClick={(e) => {handleMedicineD(e)}}/><label for="medicationTime">저녁</label> |
|
567 |
+ <div className="flex"> |
|
568 |
+ <input type="checkbox" name="medicationSelect" checked={medicineM} onClick={(e) => { handleMedicineM(e) }} /><label for="medicationTime">아침</label> |
|
569 |
+ <input type="checkbox" name="medicationSelect" checked={medicineL} onClick={(e) => { handleMedicineL(e) }} /><label for="medicationTime">점심</label> |
|
570 |
+ <input type="checkbox" name="medicationSelect" checked={medicineD} onClick={(e) => { handleMedicineD(e) }} /><label for="medicationTime">저녁</label> |
|
520 | 571 |
</div> |
521 | 572 |
</td> |
522 | 573 |
</tr> |
... | ... | @@ -532,7 +583,7 @@ |
532 | 583 |
<textarea className="note" cols="30" rows="2" value={note} onChange={handleNote}></textarea> |
533 | 584 |
</td> |
534 | 585 |
</tr> |
535 |
- |
|
586 |
+ |
|
536 | 587 |
{/* <tr> |
537 | 588 |
<th>기저질환</th> |
538 | 589 |
<td colSpan={3}> |
... | ... | @@ -540,15 +591,15 @@ |
540 | 591 |
</td> |
541 | 592 |
</tr> */} |
542 | 593 |
</table> |
543 |
- <div className="btn-wrap flex-center"> |
|
544 |
- <Button |
|
545 |
- className={"btn-small green-btn"} |
|
546 |
- btnName={"등록"} |
|
547 |
- onClick={() => { |
|
548 |
- seniorInsert(userName,gender,brith, telNum, homeAddress, note, medicineM, medicineL, medicineD) |
|
549 |
- }} |
|
550 |
- /> |
|
551 |
- </div> |
|
594 |
+ <div className="btn-wrap flex-center"> |
|
595 |
+ <Button |
|
596 |
+ className={"btn-small green-btn"} |
|
597 |
+ btnName={"등록"} |
|
598 |
+ onClick={() => { |
|
599 |
+ InsertSenior(userName, gender, brith, telNum, homeAddress, note, medicineM, medicineL, medicineD) |
|
600 |
+ }} |
|
601 |
+ /> |
|
602 |
+ </div> |
|
552 | 603 |
</div> |
553 | 604 |
</Modal> |
554 | 605 |
|
... | ... | @@ -584,7 +635,7 @@ |
584 | 635 |
/> |
585 | 636 |
</div> |
586 | 637 |
<div className="btn-wrap flex-end"> |
587 |
- <Button className={"btn-small green-btn"} btnName={"등록"} onClick={openModal3}/> |
|
638 |
+ <Button className={"btn-small green-btn"} btnName={"등록"} onClick={openModal3} /> |
|
588 | 639 |
</div> |
589 | 640 |
<ul className="tab-content"> |
590 | 641 |
{data |
... | ... | @@ -593,6 +644,9 @@ |
593 | 644 |
<li>{item.description}</li> |
594 | 645 |
))} |
595 | 646 |
</ul> |
647 |
+ <div> |
|
648 |
+ <Pagination total={data.id == 1 ? myUserTotal:userTotal} limit={limit} page={page} setPage={setPage} /> |
|
649 |
+ </div> |
|
596 | 650 |
</div> |
597 | 651 |
</div> |
598 | 652 |
</main> |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?