
--- client/resources/css/common.css
+++ client/resources/css/common.css
... | ... | @@ -391,23 +391,29 @@ |
391 | 391 |
.margin-bottom { |
392 | 392 |
margin-bottom: 1rem; |
393 | 393 |
} |
394 |
- |
|
395 | 394 |
.margin-bottom2 { |
396 | 395 |
margin-bottom: 2rem; |
397 | 396 |
} |
398 |
-.margin-top { |
|
399 |
- margin-top: 2rem; |
|
400 |
-} |
|
401 |
- |
|
402 | 397 |
.margin-bottom5 { |
403 | 398 |
margin-bottom: 5rem; |
404 | 399 |
} |
405 |
- |
|
406 | 400 |
.margin-bottom10 { |
407 | 401 |
margin-bottom: 10rem; |
408 | 402 |
} |
409 |
-.margin-left{ |
|
410 |
- margin-left: 1rem; |
|
403 |
+.margin-top { |
|
404 |
+ margin-top: 1rem; |
|
405 |
+} |
|
406 |
+.margin-top2 { |
|
407 |
+ margin-top: 2rem; |
|
408 |
+} |
|
409 |
+.margin-top5 { |
|
410 |
+ margin-top: 5rem; |
|
411 |
+} |
|
412 |
+.margin-top10 { |
|
413 |
+ margin-top: 10rem; |
|
414 |
+} |
|
415 |
+.margin-left2{ |
|
416 |
+ margin-left: 2rem; |
|
411 | 417 |
} |
412 | 418 |
|
413 | 419 |
|
--- client/views/component/Modal_SeniorInsert.jsx
+++ client/views/component/Modal_SeniorInsert.jsx
... | ... | @@ -327,7 +327,7 @@ |
327 | 327 |
/> |
328 | 328 |
<label for="user_gender_f">여</label> |
329 | 329 |
</div> |
330 |
- </div > |
|
330 |
+ </div> |
|
331 | 331 |
</td> |
332 | 332 |
</tr> |
333 | 333 |
<tr> |
--- client/views/pages/App.jsx
+++ client/views/pages/App.jsx
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 |
import { useLocation, /* useNavigate */ } from "react-router"; |
9 | 9 |
|
10 | 10 |
//Application의 전역 상태값(변수) 저장소(Store) 관리 Component |
11 |
-import { setLoginUser } from "./AppStore.jsx"; |
|
11 |
+import { setLoginUser, setSeniorList } from "./AppStore.jsx"; |
|
12 | 12 |
|
13 | 13 |
//Application의 Route 정보를 관리하는 Component |
14 | 14 |
import {AdminApp, GovernmentApp, AgencyApp, GuardianApp} from "./AppRoute.jsx"; |
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 |
import Menu from "../layout/Menu.jsx"; |
19 | 19 |
import Login from "./login/Login.jsx"; |
20 | 20 |
import Weather from "./main/Weather.jsx"; |
21 |
+import CommonUtil from "../../resources/js/CommonUtil.js"; |
|
21 | 22 |
|
22 | 23 |
function App() { |
23 | 24 |
const location = useLocation(); |
... | ... | @@ -53,6 +54,25 @@ |
53 | 54 |
}); |
54 | 55 |
}; |
55 | 56 |
|
57 |
+ //특정 보호자의 대상자(시니어) 목록 조회 |
|
58 |
+ const seniorSelectListByGuardian = (loginUser) => { |
|
59 |
+ fetch("/user/seniorSelectListByGuardian.json", { |
|
60 |
+ method: "POST", |
|
61 |
+ headers: { |
|
62 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
63 |
+ }, |
|
64 |
+ body: JSON.stringify({ |
|
65 |
+ 'guardian_id': loginUser['user_id'] |
|
66 |
+ }), |
|
67 |
+ }).then((response) => response.json()).then((data) => { |
|
68 |
+ console.log("특정 보호자의 대상자(시니어) 목록 조회 : ", data); |
|
69 |
+ //로그인 사용자 정보 전역 변수에 저장 |
|
70 |
+ dispatch(setSeniorList(data)); |
|
71 |
+ }).catch((error) => { |
|
72 |
+ console.log('login() /user/seniorSelectListByGuardian.json error : ', error); |
|
73 |
+ }); |
|
74 |
+ }; |
|
75 |
+ |
|
56 | 76 |
//URL 변경 시, 발생 이벤트(hook) |
57 | 77 |
React.useEffect(() => { |
58 | 78 |
loginUserSelectOne((loginResultData) => { |
... | ... | @@ -74,9 +94,12 @@ |
74 | 94 |
} else if (loginResultData['authority'] == 'ROLE_AGENCY') { |
75 | 95 |
setMenuItems(AgencyApp.menuItems); |
76 | 96 |
setAppRoute(<AgencyApp.AppRoute/>); |
77 |
- } else if (loginResultData['authority'] == 'ROLE_GUARDIAN') { |
|
97 |
+ } else if (loginResultData['authority'] == 'ROLE_GUARDIAN' || loginResultData['authority'] == 'ROLE_SENIOR') { |
|
78 | 98 |
setMenuItems(GuardianApp.menuItems); |
79 | 99 |
setAppRoute(<GuardianApp.AppRoute/>); |
100 |
+ if (CommonUtil.isEmpty(state.seniorList) == true) { |
|
101 |
+ seniorSelectListByGuardian(loginResultData); |
|
102 |
+ } |
|
80 | 103 |
} else { |
81 | 104 |
alert('권한 관련 에러 - 관리자에게 문의바랍니다.'); |
82 | 105 |
console.log('권한 관련 에러 - 관리자에게 문의바랍니다 : ', loginResultData); |
--- client/views/pages/AppRoute.jsx
+++ client/views/pages/AppRoute.jsx
... | ... | @@ -39,11 +39,14 @@ |
39 | 39 |
import UserSelect from "./user_management/UserSelect.jsx"; |
40 | 40 |
import AgencySeniorSelect from "./user_management/AgencySeniorSelect.jsx"; |
41 | 41 |
import QandASelect from "./callcenter/QandASelect.jsx"; |
42 |
-import QandAConfirm from "./callcenter/QandAConfirm.jsx"; |
|
42 |
+import QandASelectOne from "./callcenter/QandASelectOne.jsx"; |
|
43 |
+import QandAInsert from "./callcenter/QandAInsert.jsx"; |
|
44 |
+import QandAUpdate from "./callcenter/QandAUpdate.jsx"; |
|
45 |
+ |
|
43 | 46 |
import EquipmentManagementInsert from "./equipment/EquipmentManagementInsert.jsx"; |
44 | 47 |
import EquipmentManagementSelectAdd from "./equipment/EquipmentManagementSelectAdd.jsx"; |
45 | 48 |
import RiskSet from "./setting/RiskSet.jsx"; |
46 |
-import QandAInsert from "./callcenter/QandAInsert.jsx"; |
|
49 |
+ |
|
47 | 50 |
import QuestionConfirm from "./callcenter/QuestionConfirm.jsx"; |
48 | 51 |
import UserSelectOk from "./user_management/UserSelectOk.jsx"; |
49 | 52 |
import AuthorityManagement from "./setting/AuthorityManagement.jsx"; |
... | ... | @@ -139,10 +142,11 @@ |
139 | 142 |
<Route path="/TemperatureManagementSelectOne" element={<TemperatureManagementSelectOne />}></Route> |
140 | 143 |
<Route path="/VisitSelectOne" element={<VisitSelectOne />}></Route> |
141 | 144 |
<Route path="/QandAInsert" element={<QandAInsert />}></Route> |
145 |
+ <Route path="/QandAUpdate" element={<QandAUpdate />}></Route> |
|
142 | 146 |
<Route path="/QandASelect" element={<QandASelect />}></Route> |
143 | 147 |
<Route path="/EquipmentManagementSelectAdd" element={<EquipmentManagementSelectAdd />}></Route> |
144 | 148 |
<Route path="/UserSelect" element={<UserSelect />}></Route> |
145 |
- <Route path="/QandAConfirm" element={<QandAConfirm />}></Route> |
|
149 |
+ <Route path="/QandASelectOne" element={<QandASelectOne />}></Route> |
|
146 | 150 |
<Route path="/Join" element={<Join />}></Route> |
147 | 151 |
<Route path="/SeniorEdit" element={<SeniorEdit />}></Route> |
148 | 152 |
<Route path="/SeniorSelectOne" element={<SeniorSelectOne />}></Route> |
... | ... | @@ -225,18 +229,19 @@ |
225 | 229 |
}, */ |
226 | 230 |
{ |
227 | 231 |
title: "위험 기준 관리", |
232 |
+ path: "/RiskSet", |
|
228 | 233 |
icon: ( |
229 | 234 |
<SettingsIcon sx={{ fontSize: 20, marginRight: 1 }} /> |
230 |
- ), |
|
231 |
- path: "/RiskSet" |
|
235 |
+ ) |
|
232 | 236 |
}, |
233 | 237 |
{ |
234 |
- title: "문의 현황 관리", |
|
238 |
+ title: "문의 현황 조회", |
|
239 |
+ path: "/QandASelect", |
|
235 | 240 |
icon: ( |
236 | 241 |
<ContactSupportIcon |
237 | 242 |
sx={{ fontSize: 20, marginRight: 1 }} |
238 | 243 |
/> |
239 |
- ), |
|
244 |
+ ) |
|
240 | 245 |
} |
241 | 246 |
]; |
242 | 247 |
function GovernmentAppRoute() { |
... | ... | @@ -257,8 +262,9 @@ |
257 | 262 |
<Route path="/RiskSet" element={<RiskSet />}></Route> |
258 | 263 |
{/* <Route path="/AuthorityManagement" element={<AuthorityManagement />}></Route> */} |
259 | 264 |
<Route path="/QandASelect" element={<QandASelect />}></Route> |
260 |
- <Route path="/QandAConfirm" element={<QandAConfirm />}></Route> |
|
265 |
+ <Route path="/QandASelectOne" element={<QandASelectOne />}></Route> |
|
261 | 266 |
<Route path="/QandAInsert" element={<QandAInsert />}></Route> |
267 |
+ <Route path="/QandAUpdate" element={<QandAUpdate />}></Route> |
|
262 | 268 |
<Route path="/ProtectorSelect" element={<ProtectorSelect />}></Route> |
263 | 269 |
<Route path="/AgencyInsert" element={<AgencyInsert />}></Route> |
264 | 270 |
<Route path="/Join" element={<Join />}></Route> |
... | ... | @@ -306,7 +312,7 @@ |
306 | 312 |
), |
307 | 313 |
}, |
308 | 314 |
{ |
309 |
- title: "Q&A", |
|
315 |
+ title: "문의하기", |
|
310 | 316 |
path: "/QandASelect", |
311 | 317 |
icon: ( |
312 | 318 |
<ContactSupportIcon |
... | ... | @@ -352,14 +358,9 @@ |
352 | 358 |
path="/QandASelect" |
353 | 359 |
element={<QandASelect />} |
354 | 360 |
></Route> |
355 |
- <Route |
|
356 |
- path="/QandAInsert" |
|
357 |
- element={<QandAInsert />} |
|
358 |
- ></Route> |
|
359 |
- <Route |
|
360 |
- path="/QandAConfirm" |
|
361 |
- element={<QandAConfirm />} |
|
362 |
- ></Route> |
|
361 |
+ <Route path="/QandAInsert" element={<QandAInsert />}></Route> |
|
362 |
+ <Route path="/QandAUpdate" element={<QandAUpdate />}></Route> |
|
363 |
+ <Route path="/QandASelectOne" element={<QandASelectOne />}></Route> |
|
363 | 364 |
</Routes> |
364 | 365 |
); |
365 | 366 |
} |
... | ... | @@ -375,7 +376,7 @@ |
375 | 376 |
icon: <EqualizerIcon sx={{ fontSize: 20, marginRight: 1 }} />, |
376 | 377 |
}, |
377 | 378 |
{ |
378 |
- title: "Q&A", |
|
379 |
+ title: "문의하기", |
|
379 | 380 |
path: "/QandASelect", |
380 | 381 |
icon: ( |
381 | 382 |
<ContactSupportIcon |
... | ... | @@ -389,8 +390,10 @@ |
389 | 390 |
<Routes> |
390 | 391 |
<Route path="/GuardianStatistics" element={<GuardianStatistics />}></Route> |
391 | 392 |
<Route path="/Main" element={<Main_guardian />}></Route> |
393 |
+ <Route path="/QandAInsert" element={<QandAInsert />}></Route> |
|
392 | 394 |
<Route path="/QandASelect" element={<QandASelect />}></Route> |
393 |
- |
|
395 |
+ <Route path="/QandASelectOne" element={<QandASelectOne />}></Route> |
|
396 |
+ <Route path="/QandAUpdate" element={<QandAUpdate />}></Route> |
|
394 | 397 |
</Routes> |
395 | 398 |
); |
396 | 399 |
} |
--- client/views/pages/AppStore.jsx
+++ client/views/pages/AppStore.jsx
... | ... | @@ -15,10 +15,44 @@ |
15 | 15 |
//로그인 정보 변경 |
16 | 16 |
const { setLoginUser } = loginUser.actions; |
17 | 17 |
|
18 |
+ |
|
19 |
+//특정 로그인 유저의 대상자(시니어)목록 정보 |
|
20 |
+const seniorList = createSlice({ |
|
21 |
+ name: 'createSlice', |
|
22 |
+ initialState: [], |
|
23 |
+ reducers: { |
|
24 |
+ setSeniorList(stats, action) { |
|
25 |
+ for (let key in action.payload) { |
|
26 |
+ stats[key] = action.payload[key]; |
|
27 |
+ } |
|
28 |
+ } |
|
29 |
+ } |
|
30 |
+}) |
|
31 |
+//특정 로그인 유저의 대상자(시니어)목록 정보 변경 |
|
32 |
+const { setSeniorList } = seniorList.actions; |
|
33 |
+ |
|
34 |
+ |
|
35 |
+//특정 로그인 유저가 지정한 조회 할 대상자(시니어) Index |
|
36 |
+const currentSeniorIndex = createSlice({ |
|
37 |
+ name: 'createSlice', |
|
38 |
+ initialState: 0, |
|
39 |
+ reducers: { |
|
40 |
+ setCurrentSeniorIndex(stats, action) { |
|
41 |
+ for (let key in action.payload) { |
|
42 |
+ stats[key] = action.payload[key]; |
|
43 |
+ } |
|
44 |
+ } |
|
45 |
+ } |
|
46 |
+}) |
|
47 |
+//특정 로그인 유저가 지정한 조회 할 대상자(시니어) Index 변경 |
|
48 |
+const { setCurrentSeniorIndex } = currentSeniorIndex.actions; |
|
49 |
+ |
|
18 | 50 |
export default configureStore({ |
19 | 51 |
reducer: { |
20 | 52 |
loginUser: loginUser.reducer, |
53 |
+ seniorList: seniorList.reducer, |
|
54 |
+ currentSeniorIndex: currentSeniorIndex.reducer, |
|
21 | 55 |
} |
22 | 56 |
}) |
23 | 57 |
|
24 |
-export { setLoginUser };(No newline at end of file) |
|
58 |
+export { setLoginUser, setSeniorList, setCurrentSeniorIndex };(No newline at end of file) |
--- client/views/pages/callcenter/QandAInsert.jsx
+++ client/views/pages/callcenter/QandAInsert.jsx
... | ... | @@ -1,115 +1,455 @@ |
1 | 1 |
import React from "react"; |
2 |
-import Button from "../../component/Button.jsx"; |
|
2 |
+import { useNavigate, useLocation } from "react-router"; |
|
3 |
+import { useSelector } from "react-redux"; |
|
4 |
+ |
|
5 |
+import Modal from "../../component/Modal.jsx"; |
|
3 | 6 |
import ContentTitle from "../../component/ContentTitle.jsx"; |
4 | 7 |
import SubTitle from "../../component/SubTitle.jsx"; |
5 |
-import { useNavigate } from "react-router"; |
|
8 |
+import Pagination from "../../component/Pagination.jsx"; |
|
9 |
+ |
|
10 |
+import CommonUtil from "../../../resources/js/CommonUtil.js"; |
|
6 | 11 |
|
7 | 12 |
export default function QandAInsert() { |
8 |
- const navigate = useNavigate(); |
|
13 |
+ const navigate = useNavigate(); |
|
14 |
+ const location = useLocation(); |
|
15 |
+ |
|
16 |
+ //전역 변수 저장 객체 |
|
17 |
+ const state = useSelector((state) => {return state}); |
|
18 |
+ const defaultGovernmentId = CommonUtil.isEmpty(state.loginUser) ? null : state.loginUser['government_id']; |
|
19 |
+ const defaultAgencyId = CommonUtil.isEmpty(state.loginUser) ? null : state.loginUser['agency_id']; |
|
20 |
+ let defaultSeniorId = null; |
|
21 |
+ if (CommonUtil.isEmpty(state.loginUser) == false) { |
|
22 |
+ if (state.loginUser['authority'] == 'ROLE_SENIOR') { |
|
23 |
+ defaultSeniorId = state.loginUser['user_id']; |
|
24 |
+ } else if (state.loginUser['authority'] == 'ROLE_GUARDIAN' && CommonUtil.isEmpty(state.seniorList) == false) { |
|
25 |
+ defaultSeniorId = state.seniorList[state.currentSeniorIndex]['user_id']; |
|
26 |
+ } |
|
27 |
+ } else { |
|
28 |
+ defaultSeniorId = null; |
|
29 |
+ } |
|
30 |
+ |
|
31 |
+ // 시스템 코드 - 장비 상태 |
|
32 |
+ const [equipmentStates, setEquipmentStates] = React.useState({}); |
|
33 |
+ // 시스템 코드 - 장비 상태 조회 |
|
34 |
+ const equipmentStatesSelect = () => { |
|
35 |
+ console.log('equipmentStatesSelect Function Run'); |
|
36 |
+ |
|
37 |
+ //fetch post |
|
38 |
+ fetch("/common/systemCode/equipmentStatesSelect.json", { |
|
39 |
+ method: "POST", |
|
40 |
+ headers: { |
|
41 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
42 |
+ }, |
|
43 |
+ body: JSON.stringify({}) |
|
44 |
+ }).then((response) => response.json()).then((data) => { |
|
45 |
+ console.log('equipmentStatesSelect response : ', data); |
|
46 |
+ setEquipmentStates(data); |
|
47 |
+ }).catch((error) => { |
|
48 |
+ console.log('equipmentStatesSelect error : ', error); |
|
49 |
+ }); |
|
50 |
+ } |
|
51 |
+ |
|
52 |
+ |
|
53 |
+ //입고 및 미대여 장비 검색 정보 |
|
54 |
+ const [equipmentSearch, setEquipmentSearch] = React.useState({ |
|
55 |
+ 'government_id': defaultGovernmentId, |
|
56 |
+ 'agency_id': defaultAgencyId, |
|
57 |
+ 'senior_id': defaultSeniorId, |
|
58 |
+ 'currentPage': 1, |
|
59 |
+ 'perPage': 10, |
|
60 |
+ 'searchType': null, |
|
61 |
+ 'searchText': null, |
|
62 |
+ |
|
63 |
+ 'equipment_state': null, |
|
64 |
+ }); |
|
65 |
+ //장비 정보 변경 |
|
66 |
+ const equipmentSearchChange = (targetKey, value) => { |
|
67 |
+ equipmentSearch[targetKey] = value; |
|
68 |
+ setEquipmentSearch({...equipmentSearch}); |
|
69 |
+ } |
|
70 |
+ //장비 검색 |
|
71 |
+ const equipmentSearching = () => { |
|
72 |
+ equipmentSelectList(1); |
|
73 |
+ } |
|
74 |
+ const equipmentSearchingEnter = (key) => { |
|
75 |
+ if (key == 'Enter') { |
|
76 |
+ equipmentSearching(); |
|
77 |
+ } else { |
|
78 |
+ return; |
|
79 |
+ } |
|
80 |
+ } |
|
81 |
+ //입고 및 미대여 목록 |
|
82 |
+ const [equipment, setEquipment] = React.useState({equipmentList: [], equipmentListCount: 0}); |
|
83 |
+ //입고 및 미대여 목록 조회 |
|
84 |
+ const equipmentSelectList = (currentPage) => { |
|
85 |
+ equipmentSearch.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage; |
|
86 |
+ setEquipmentSearch({...equipmentSearch}); |
|
87 |
+ |
|
88 |
+ fetch("/equipment/equipmentSelectList.json", { |
|
89 |
+ method: "POST", |
|
90 |
+ headers: { |
|
91 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
92 |
+ }, |
|
93 |
+ body: JSON.stringify(equipmentSearch) |
|
94 |
+ }).then((response) => response.json()).then((data) => { |
|
95 |
+ console.log('equipmentSelectList response : ', data); |
|
96 |
+ setEquipment(data); |
|
97 |
+ if (CommonUtil.isEmpty(data.equipmentList) == false && equipmentInquiry['equipment_serial_number'] == '') { |
|
98 |
+ equipmentInquirySelect(data.equipmentList[0]); |
|
99 |
+ } |
|
100 |
+ }).catch((error) => { |
|
101 |
+ console.log('equipmentSelectList error : ', error); |
|
102 |
+ }); |
|
103 |
+ } |
|
104 |
+ |
|
105 |
+ //장비 모달 여부 |
|
106 |
+ const [modalEquipmentIsOpen, setModalEquipmentIsOpen] = React.useState(false); |
|
107 |
+ //장비 오픈 |
|
108 |
+ const modalEquipmentOpen = () => { |
|
109 |
+ setModalEquipmentIsOpen(true); |
|
110 |
+ }; |
|
111 |
+ //장비 닫기 |
|
112 |
+ const modalEquipmentClose = () => { |
|
113 |
+ setModalEquipmentIsOpen(false); |
|
114 |
+ }; |
|
115 |
+ |
|
116 |
+ const equipmentInit = { |
|
117 |
+ 'equipment_serial_number': null, |
|
118 |
+ 'equipment_name': null, |
|
119 |
+ 'agency_name': null, |
|
120 |
+ 'rental_detail_insert_user_name': null, |
|
121 |
+ 'rental_detail_insert_user_id': null, |
|
122 |
+ 'user_name': null, |
|
123 |
+ 'user_id': null, |
|
124 |
+ 'user_address': null, |
|
125 |
+ 'equipment_state': null, |
|
126 |
+ } |
|
127 |
+ //등록할 문의 정보 |
|
128 |
+ const [equipmentInquiry, setEquipmentInquiry] = React.useState({ |
|
129 |
+ 'inquiry_idx': 0, |
|
130 |
+ 'inquiry_type': null, |
|
131 |
+ 'inquiry_title': null, |
|
132 |
+ 'inquiry_content': null, |
|
133 |
+ 'inquiry_state': null, |
|
134 |
+ 'inquiry_insert_user_id': null, |
|
135 |
+ 'inquiry_insert_datetime': null, |
|
136 |
+ 'inquiry_answer_content': null, |
|
137 |
+ 'inquiry_answer_user_id': null, |
|
138 |
+ 'inquiry_update_datetime': null, |
|
139 |
+ |
|
140 |
+ 'equipment_serial_number': null, |
|
141 |
+ //문의할 장비 정보 |
|
142 |
+ equipment: {...equipmentInit} |
|
143 |
+ }); |
|
144 |
+ const equipmentInquiryRef = React.useRef({...equipmentInquiry}); |
|
145 |
+ |
|
146 |
+ //문의할 장비 선택 |
|
147 |
+ const equipmentInquirySelect = (equipment) => { |
|
148 |
+ equipmentInquiry.equipment = equipment; |
|
149 |
+ equipmentInquiry['equipment_serial_number'] = equipment['equipment_serial_number']; |
|
150 |
+ setEquipmentInquiry({...equipmentInquiry}); |
|
151 |
+ } |
|
152 |
+ |
|
153 |
+ //문의할 장비 선택 취소 |
|
154 |
+ const equipmentInquirySelectCancel = () => { |
|
155 |
+ equipmentInquiry['equipment_serial_number'] = ''; |
|
156 |
+ equipmentInquiry.equipment = {...equipmentInit}; |
|
157 |
+ |
|
158 |
+ setEquipmentInquiry({...equipmentInquiry}); |
|
159 |
+ } |
|
160 |
+ |
|
161 |
+ //등록할 문의 구분이 '장비문의'로 바꼈을 때만 작동 |
|
162 |
+ React.useEffect(() => { |
|
163 |
+ if (equipmentInquiry['equipment_serial_number'] == '') { |
|
164 |
+ equipmentInquiry['inquiry_type'] = '기타'; |
|
165 |
+ setEquipmentInquiry({...equipmentInquiry}); |
|
166 |
+ } else if (equipmentInquiry['equipment_serial_number'] == null) { |
|
167 |
+ equipmentInquiry.equipment = {...equipmentInit}; |
|
168 |
+ equipmentInquiry['inquiry_type'] = null; |
|
169 |
+ setEquipmentInquiry({...equipmentInquiry}); |
|
170 |
+ } |
|
171 |
+ }, [equipmentInquiry['equipment_serial_number']]); |
|
172 |
+ |
|
173 |
+ //등록할 문의 구분이 '장비문의 구분'이 바꼈을 때만 작동 |
|
174 |
+ React.useEffect(() => { |
|
175 |
+ if (equipmentInquiry['equipment_serial_number'] == '' |
|
176 |
+ && (equipmentInquiry['inquiry_type'] == '교환' |
|
177 |
+ || equipmentInquiry['inquiry_type'] == '수리')) { |
|
178 |
+ equipmentSelectList(1); |
|
179 |
+ } else if (CommonUtil.isEmpty(equipmentInquiry['equipment_serial_number']) == false |
|
180 |
+ && equipmentInquiry['inquiry_type'] == '추가') { |
|
181 |
+ equipmentInquirySelectCancel(); |
|
182 |
+ } |
|
183 |
+ }, [equipmentInquiry['inquiry_type']]); |
|
184 |
+ |
|
185 |
+ |
|
186 |
+ //문의 등록 유효성 검사 |
|
187 |
+ const equipmentInquiryValidation = () => { |
|
188 |
+ const target = equipmentInquiry; |
|
189 |
+ const targetRef = equipmentInquiryRef; |
|
190 |
+ if (CommonUtil.isEmpty(target['inquiry_title']) == true) { |
|
191 |
+ targetRef.current['inquiry_title'].focus(); |
|
192 |
+ alert("문의제목을 입력해 주세요."); |
|
193 |
+ return false; |
|
194 |
+ } |
|
195 |
+ if (CommonUtil.isEmpty(target['inquiry_content']) == true) { |
|
196 |
+ targetRef.current['inquiry_content'].focus(); |
|
197 |
+ alert("내용을 입력해 주세요."); |
|
198 |
+ return false; |
|
199 |
+ } |
|
200 |
+ if ((equipmentInquiry['inquiry_type'] == '교환' || equipmentInquiry['inquiry_type'] == '수리') |
|
201 |
+ && CommonUtil.isEmpty(target['equipment_serial_number'])) { |
|
202 |
+ alert(`장비 ${equipmentInquiry['inquiry_type']}은(는) 장비 정보를 필수로 선택하셔야 됩니다.`); |
|
203 |
+ return false; |
|
204 |
+ } |
|
205 |
+ |
|
206 |
+ return true; |
|
207 |
+ } |
|
208 |
+ |
|
209 |
+ //문의 등록 |
|
210 |
+ const equipmentInquiryInsert = () => { |
|
211 |
+ if (equipmentInquiryValidation() == false) { |
|
212 |
+ return; |
|
213 |
+ } |
|
214 |
+ |
|
215 |
+ if (equipmentInquiry['equipment_serial_number'] == '') { |
|
216 |
+ equipmentInquiry['equipment_serial_number'] = null; |
|
217 |
+ } |
|
218 |
+ |
|
219 |
+ fetch("/equipment/equipmentInquiryInsert.json", { |
|
220 |
+ method: "POST", |
|
221 |
+ headers: { |
|
222 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
223 |
+ }, |
|
224 |
+ body: JSON.stringify(equipmentInquiry), |
|
225 |
+ }).then((response) => response.json()).then((data) => { |
|
226 |
+ console.log("문의 등록 결과(건수) : ", data); |
|
227 |
+ if (data > 0) { |
|
228 |
+ alert("등록완료"); |
|
229 |
+ navigate('/QandASelect'); |
|
230 |
+ } else { |
|
231 |
+ alert("등록에 실패하였습니다. 관리자에게 문의바랍니다."); |
|
232 |
+ } |
|
233 |
+ }).catch((error) => { |
|
234 |
+ console.log('equipmentInquiryInsert() /equipment/equipmentInquiryInsert.json error : ', error); |
|
235 |
+ }); |
|
236 |
+ } |
|
237 |
+ |
|
238 |
+ |
|
239 |
+ |
|
240 |
+ React.useEffect(() => { |
|
241 |
+ equipmentStatesSelect(); |
|
242 |
+ }, []) |
|
243 |
+ |
|
9 | 244 |
return ( |
10 | 245 |
<main> |
11 |
- <div className="content-wrap row"> |
|
12 |
- <ContentTitle contentTitle={"문의글 작성"} /> |
|
13 |
- <SubTitle explanation={"작성자 정보"} /> |
|
14 |
- <table className="margin-bottom2 qna-insert senior-detail"> |
|
15 |
- <tr> |
|
16 |
- <th>작성자</th> |
|
17 |
- <td> |
|
18 |
- <input type="text" placeholder="자동입력부분" /> |
|
19 |
- </td> |
|
20 |
- </tr> |
|
246 |
+ |
|
247 |
+ <Modal open={modalEquipmentIsOpen} close={modalEquipmentClose} header="문의대상 장비 선택"> |
|
248 |
+ <div className="board-wrap"> |
|
249 |
+ <div> |
|
250 |
+ |
|
251 |
+ <div className="search-management flex-end margin-bottom2 margin-top gap"> |
|
252 |
+ <select style={{maxWidth: '150px'}} |
|
253 |
+ onChange={(e) => equipmentSearchChange('equipment_state', e.target.value)}> |
|
254 |
+ <option value="">상태</option> |
|
255 |
+ {Object.keys(equipmentStates).map((key, idx) => { return ( |
|
256 |
+ <option key={key} value={key}> |
|
257 |
+ {equipmentStates[key]} |
|
258 |
+ </option> |
|
259 |
+ )})} |
|
260 |
+ </select> |
|
261 |
+ <select style={{maxWidth: '150px'}} |
|
262 |
+ onChange={(e) => equipmentSearchChange('searchType', e.target.value)}> |
|
263 |
+ <option value="">전체</option> |
|
264 |
+ <option value="equipment_name">모델명</option> |
|
265 |
+ <option value="equipment_serial_number">시리얼넘버</option> |
|
266 |
+ </select> |
|
267 |
+ <input type="text" |
|
268 |
+ value={equipmentSearch.searchText} |
|
269 |
+ onChange={(e) => equipmentSearchChange('searchText', e.target.value)} |
|
270 |
+ onKeyUp={(e) => equipmentSearchingEnter(e.key)} |
|
271 |
+ /> |
|
272 |
+ <button className={"btn-small gray-btn"} style={{maxWidth: '150px'}} onClick={equipmentSearching}>검색</button> |
|
273 |
+ </div> |
|
21 | 274 |
|
22 |
- <tr> |
|
23 |
- <th>소속 기관</th> |
|
24 |
- <td colSpan={3}> |
|
25 |
- <input type="text" placeholder="자동입력부분" /> |
|
26 |
- </td> |
|
27 |
- </tr> |
|
28 |
- <tr> |
|
29 |
- <th>연락처</th> |
|
30 |
- <td colSpan={3}> |
|
31 |
- <input type="text" placeholder="자동입력부분" /> |
|
32 |
- </td> |
|
33 |
- </tr> |
|
34 |
- <tr> |
|
35 |
- <th>구분</th> |
|
36 |
- <td colSpan={3} className="flex"> |
|
37 |
- <select name="year" id="year"> |
|
38 |
- {/* <option value="">반납</option> */} |
|
39 |
- <option value="">교환</option> |
|
40 |
- <option value="">수리</option> |
|
41 |
- {/* <option value="">추가</option> */} |
|
42 |
- <option value="">기타</option> |
|
43 |
- </select> |
|
44 |
- </td> |
|
45 |
- </tr> |
|
46 |
- <tr> |
|
47 |
- <th>내용</th> |
|
48 |
- <td colSpan={3}> |
|
49 |
- <textarea className="medicine" cols="30" rows="2"></textarea> |
|
50 |
- </td> |
|
51 |
- </tr> |
|
52 |
- </table> |
|
53 |
- <SubTitle explanation={"대상자 정보"} /> |
|
54 |
- <table className="margin-bottom2 qna-insert senior-detail"> |
|
55 |
- <tr> |
|
56 |
- <th>대상자 선택</th> |
|
57 |
- <td colSpan={3} className="flex width"> |
|
58 |
- <select> |
|
59 |
- <option value="">대상자1</option> |
|
60 |
- <option value="">대상자2</option> |
|
61 |
- </select> |
|
62 |
- </td> |
|
63 |
- </tr> |
|
64 |
- <tr> |
|
65 |
- <th>대상자 이름</th> |
|
66 |
- <td> |
|
67 |
- <input type="text" placeholder="자동입력부분" /> |
|
68 |
- </td> |
|
69 |
- <th>대상자 등록번호</th> |
|
70 |
- <td> |
|
71 |
- <input type="text" placeholder="자동입력부분" /> |
|
72 |
- </td> |
|
73 |
- </tr> |
|
74 |
- <tr> |
|
75 |
- <th>대상자 연락처</th> |
|
76 |
- <td> |
|
77 |
- <input type="text" placeholder="자동입력부분" /> |
|
78 |
- </td> |
|
79 |
- <th>대상자 주소</th> |
|
80 |
- <td> |
|
81 |
- <input type="text" placeholder="자동입력부분" /> |
|
82 |
- </td> |
|
83 |
- </tr> |
|
84 |
- <tr> |
|
85 |
- <th>장비명</th> |
|
86 |
- <td> |
|
87 |
- <input type="text" placeholder="자동입력부분" /> |
|
88 |
- </td> |
|
89 |
- <th>장비시리얼넘버</th> |
|
90 |
- <td> |
|
91 |
- <input type="text" placeholder="자동입력부분" /> |
|
92 |
- </td> |
|
93 |
- </tr> |
|
94 |
- </table> |
|
95 |
- |
|
96 |
- <div className="btn-wrap flex-center"> |
|
97 |
- <Button |
|
98 |
- className={"btn-large gray-btn"} |
|
99 |
- btnName={"이전"} |
|
100 |
- onClick={() => { |
|
101 |
- navigate("/QandASelect"); |
|
102 |
- }} |
|
103 |
- /> |
|
104 |
- <Button |
|
105 |
- className={"btn-large red-btn"} |
|
106 |
- btnName={"등록"} |
|
107 |
- onClick={() => { |
|
108 |
- navigate("/QandASelect"); |
|
109 |
- }} |
|
110 |
- /> |
|
111 |
- </div> |
|
112 |
- </div> |
|
113 |
- </main> |
|
275 |
+ <table class="caregiver-user protector-user"> |
|
276 |
+ <thead> |
|
277 |
+ <tr> |
|
278 |
+ <th>No</th> |
|
279 |
+ <th>장비사용대상자</th> |
|
280 |
+ <th>모델명</th> |
|
281 |
+ <th>시리얼넘버</th> |
|
282 |
+ <th>장비상태</th> |
|
283 |
+ <th>기관</th> |
|
284 |
+ <th>선택</th> |
|
285 |
+ </tr> |
|
286 |
+ </thead> |
|
287 |
+ <tbody> |
|
288 |
+ {equipment.equipmentList.map((item, idx) => { return ( |
|
289 |
+ <tr> |
|
290 |
+ <td data-label="No">{equipment.equipmentListCount - idx - (equipmentSearch.currentPage - 1) * equipmentSearch.perPage}</td> |
|
291 |
+ <td data-label="장비사용대상자"> |
|
292 |
+ {item['user_id'] == null ? '미대여' : item['user_name']} |
|
293 |
+ </td> |
|
294 |
+ <td data-label="모델명">{item['equipment_name']}</td> |
|
295 |
+ <td data-label="시리얼넘버">{item['equipment_serial_number']}</td> |
|
296 |
+ <td data-label="장비상태">{equipmentStates[item['equipment_state']]}</td> |
|
297 |
+ <td> |
|
298 |
+ {item['agency_id'] == null ? item['government_name'] : item['agency_name']} |
|
299 |
+ </td> |
|
300 |
+ <td data-label="대여시행자"> |
|
301 |
+ {equipmentInquiry.equipment['equipment_serial_number'] != item['equipment_serial_number'] |
|
302 |
+ ? <button className={"btn-small gray-btn"} style={{maxWidth: '150px'}} |
|
303 |
+ onClick={() => {equipmentInquirySelect(item); modalEquipmentClose();}}>선택</button> |
|
304 |
+ : <button className={"btn-small red-btn"} style={{maxWidth: '150px'}} |
|
305 |
+ onClick={() => {equipmentInquirySelectCancel(); modalEquipmentClose();}}>취소</button> |
|
306 |
+ } |
|
307 |
+ </td> |
|
308 |
+ </tr> |
|
309 |
+ )})} |
|
310 |
+ {CommonUtil.isEmpty(equipment.equipmentList) ? |
|
311 |
+ <tr> |
|
312 |
+ <td colSpan={7}>조회된 데이터가 없습니다</td> |
|
313 |
+ </tr> |
|
314 |
+ : null} |
|
315 |
+ </tbody> |
|
316 |
+ </table> |
|
317 |
+ <Pagination |
|
318 |
+ currentPage={equipmentSearch.currentPage} |
|
319 |
+ perPage={equipmentSearch.perPage} |
|
320 |
+ totalCount={equipment.equipmentListCount} |
|
321 |
+ maxRange={5} |
|
322 |
+ click={equipmentSelectList} |
|
323 |
+ /> |
|
324 |
+ </div> |
|
325 |
+ </div> |
|
326 |
+ </Modal> |
|
327 |
+ |
|
328 |
+ <div className="content-wrap row"> |
|
329 |
+ <ContentTitle contentTitle={"문의글 작성"} className={"margin-bottom2"} /> |
|
330 |
+ <SubTitle explanation={"문의 정보"} className={"margin-bottom2"}/> |
|
331 |
+ <table className="margin-bottom2 qna-insert senior-detail"> |
|
332 |
+ <tr> |
|
333 |
+ <th><span style={{color : "red"}}>*</span>구분</th> |
|
334 |
+ <td colSpan={3}> |
|
335 |
+ <div className="gender flex-start gap5"> |
|
336 |
+ <div className="flex-start"> |
|
337 |
+ <input type="radio" id="normal_question" name="question_type" value="일반문의" style={{width: '25px'}} |
|
338 |
+ checked={equipmentInquiry['equipment_serial_number'] == null} |
|
339 |
+ onChange={(e) => {equipmentInquiry['equipment_serial_number'] = null; setEquipmentInquiry({...equipmentInquiry});}}/> |
|
340 |
+ <label for="normal_question">일반문의</label> |
|
341 |
+ </div> |
|
342 |
+ <div className="flex-start"> |
|
343 |
+ <input type="radio" id="equipment_question" name="question_type" value="장비문의" style={{width: '25px'}} |
|
344 |
+ checked={equipmentInquiry['equipment_serial_number'] != null} |
|
345 |
+ onChange={(e) => {equipmentInquiry['equipment_serial_number'] = ''; setEquipmentInquiry({...equipmentInquiry});}}/> |
|
346 |
+ <label for="equipment_question" >장비문의</label> |
|
347 |
+ </div> |
|
348 |
+ </div> |
|
349 |
+ </td> |
|
350 |
+ </tr> |
|
351 |
+ {equipmentInquiry['equipment_serial_number'] != null ? |
|
352 |
+ <tr> |
|
353 |
+ <th><span style={{color : "red"}}>*</span>장비문의 구분</th> |
|
354 |
+ <td colSpan={3}> |
|
355 |
+ <select onChange={(e) => {equipmentInquiry['inquiry_type'] = e.target.value; setEquipmentInquiry({...equipmentInquiry});}}> |
|
356 |
+ <option selected={equipmentInquiry['inquiry_type'] == '수리'}>수리</option> |
|
357 |
+ <option selected={equipmentInquiry['inquiry_type'] == '교환'}>교환</option> |
|
358 |
+ <option selected={equipmentInquiry['inquiry_type'] == '추가'}>추가</option> |
|
359 |
+ <option selected={equipmentInquiry['inquiry_type'] == '기타'}>기타</option> |
|
360 |
+ </select> |
|
361 |
+ </td> |
|
362 |
+ </tr> |
|
363 |
+ : null} |
|
364 |
+ <tr> |
|
365 |
+ <th><span style={{color : "red"}}>*</span>문의제목</th> |
|
366 |
+ <td colSpan={3}> |
|
367 |
+ <input type="text" placeholder="문의글의 제목을 입력해주세요." |
|
368 |
+ onChange={(e) => {equipmentInquiry['inquiry_title'] = e.target.value; setEquipmentInquiry({...equipmentInquiry});}} |
|
369 |
+ ref={el => equipmentInquiryRef.current['inquiry_title'] = el} |
|
370 |
+ /> |
|
371 |
+ </td> |
|
372 |
+ </tr> |
|
373 |
+ <tr> |
|
374 |
+ <th><span style={{color : "red"}}>*</span>내용</th> |
|
375 |
+ <td colSpan={3}> |
|
376 |
+ <textarea className="medicine" cols="30" rows="2" |
|
377 |
+ onChange={(e) => {equipmentInquiry['inquiry_content'] = e.target.value; setEquipmentInquiry({...equipmentInquiry});}} |
|
378 |
+ ref={el => equipmentInquiryRef.current['inquiry_content'] = el} |
|
379 |
+ ></textarea> |
|
380 |
+ </td> |
|
381 |
+ </tr> |
|
382 |
+ </table> |
|
383 |
+ |
|
384 |
+ {equipmentInquiry['equipment_serial_number'] != null |
|
385 |
+ ?<> |
|
386 |
+ <SubTitle explanation={equipmentInquiry['inquiry_type'] == '교환' || equipmentInquiry['inquiry_type'] == '수리' |
|
387 |
+ ? <span>장비 정보 <span style={{color : "red"}}>(필수)</span></span> |
|
388 |
+ : <span>장비 정보 (선택)</span> |
|
389 |
+ } className={"display-inline-block margin-bottom2"}/> |
|
390 |
+ <button className={"btn-small gray-btn"} style={{maxWidth: '150px'}} onClick={() => {equipmentSelectList(1); modalEquipmentOpen();}}>검색</button> |
|
391 |
+ {CommonUtil.isEmpty(equipmentInquiry.equipment['equipment_serial_number']) == false ? |
|
392 |
+ <> |
|
393 |
+ <button className={"btn-small red-btn"} style={{maxWidth: '150px'}} onClick={equipmentInquirySelectCancel}>취소</button> |
|
394 |
+ <table className="margin-bottom2 qna-insert senior-detail"> |
|
395 |
+ <tr> |
|
396 |
+ <th>장비 시리얼넘버</th> |
|
397 |
+ <td colSpan={3}> |
|
398 |
+ {equipmentInquiry.equipment['equipment_serial_number']} |
|
399 |
+ </td> |
|
400 |
+ </tr> |
|
401 |
+ <tr> |
|
402 |
+ <th>모델명</th> |
|
403 |
+ <td> |
|
404 |
+ {equipmentInquiry.equipment['equipment_name']} |
|
405 |
+ </td> |
|
406 |
+ <th>장비상태</th> |
|
407 |
+ <td> |
|
408 |
+ {equipmentStates[equipmentInquiry.equipment['equipment_state']]} |
|
409 |
+ </td> |
|
410 |
+ </tr> |
|
411 |
+ <tr> |
|
412 |
+ <th>소속기관</th> |
|
413 |
+ <td> |
|
414 |
+ {equipmentInquiry.equipment['agency_id'] == null ? equipmentInquiry.equipment['government_name'] : equipmentInquiry.equipment['agency_name']} |
|
415 |
+ </td> |
|
416 |
+ <th>대여시행자</th> |
|
417 |
+ <td> |
|
418 |
+ {CommonUtil.isEmpty(equipmentInquiry.equipment['equipment_serial_number']) == false |
|
419 |
+ && CommonUtil.isEmpty(equipmentInquiry.equipment['rental_detail_insert_user_id']) == false |
|
420 |
+ ? <> |
|
421 |
+ {equipmentInquiry.equipment['rental_detail_insert_user_name']} |
|
422 |
+ ({equipmentInquiry.equipment['rental_detail_insert_user_id']}) |
|
423 |
+ </> |
|
424 |
+ : '미대여'} |
|
425 |
+ </td> |
|
426 |
+ </tr> |
|
427 |
+ <tr> |
|
428 |
+ <th>장비사용대상자</th> |
|
429 |
+ <td> |
|
430 |
+ {equipmentInquiry.equipment['user_id'] == null ? '미대여' : equipmentInquiry.equipment['user_name']} |
|
431 |
+ </td> |
|
432 |
+ <th>대상자 ID</th> |
|
433 |
+ <td> |
|
434 |
+ {equipmentInquiry.equipment['user_id'] == null ? '미대여' : equipmentInquiry.equipment['user_id']} |
|
435 |
+ </td> |
|
436 |
+ </tr> |
|
437 |
+ <tr> |
|
438 |
+ <th>대상자 주소</th> |
|
439 |
+ <td colSpan={3}> |
|
440 |
+ {equipmentInquiry.equipment['user_id'] == null ? '미대여' : equipmentInquiry.equipment['user_address']} |
|
441 |
+ </td> |
|
442 |
+ </tr> |
|
443 |
+ </table> |
|
444 |
+ </>: null} |
|
445 |
+ </>: null} |
|
446 |
+ |
|
447 |
+ <div className="btn-wrap flex-center margin-top5"> |
|
448 |
+ <button className="btn-large gray-btn" onClick={() => navigate(-1)}>취소</button> |
|
449 |
+ <button className="btn-large red-btn" onClick={() => equipmentInquiryInsert()}>등록</button> |
|
450 |
+ </div> |
|
451 |
+ |
|
452 |
+ </div> |
|
453 |
+ </main> |
|
114 | 454 |
); |
115 | 455 |
} |
--- client/views/pages/callcenter/QandASelect.jsx
+++ client/views/pages/callcenter/QandASelect.jsx
... | ... | @@ -1,101 +1,203 @@ |
1 | 1 |
import React from "react"; |
2 |
-import Button from "../../component/Button.jsx"; |
|
3 |
-import Table from "../../component/Table.jsx"; |
|
4 |
-import Modal from "../../component/Modal.jsx"; |
|
2 |
+import { useNavigate, useLocation } from "react-router"; |
|
3 |
+import { useSelector } from "react-redux"; |
|
5 | 4 |
import DetailTitle from "../../component/DetailTitle.jsx"; |
6 |
-import { useNavigate } from "react-router"; |
|
7 |
-import ContentTitle from "../../component/ContentTitle.jsx"; |
|
8 |
-import RestoreFromTrashIcon from '@mui/icons-material/RestoreFromTrash'; |
|
9 |
-import HomeRepairServiceIcon from '@mui/icons-material/HomeRepairService'; |
|
5 |
+import Pagination from "../../component/Pagination.jsx"; |
|
10 | 6 |
|
7 |
+import CommonUtil from "../../../resources/js/CommonUtil.js"; |
|
11 | 8 |
|
12 | 9 |
export default function QandASelect() { |
13 |
- const navigate = useNavigate(); |
|
14 |
- //게시판 |
|
15 |
- const thead = [ |
|
16 |
- "No", |
|
17 |
- "장비명", |
|
18 |
- "시리얼 넘버", |
|
19 |
- "작성자", |
|
20 |
- "기관명",//시행기관에서는 빼면됨 |
|
21 |
- "요청일자", |
|
22 |
- "구분", |
|
23 |
- "처리여부", |
|
24 |
- "내용상세보기", |
|
25 |
- "삭제" |
|
26 |
- ]; |
|
27 |
- const key = [ |
|
28 |
- "No", |
|
29 |
- "equipment_name", |
|
30 |
- "serialNumber", |
|
31 |
- "writer", |
|
32 |
- "name", |
|
33 |
- "date", |
|
34 |
- "category", |
|
35 |
- "finish", |
|
36 |
- "show", |
|
37 |
- "delete" |
|
38 |
- ]; |
|
39 |
- const content = [ |
|
40 |
- { |
|
41 |
- No: ( |
|
42 |
- <p><span><HomeRepairServiceIcon sx={{fontSize:20 }} />{thead[0]}</span> 1</p> |
|
43 |
- ), |
|
44 |
- equipment_name: |
|
45 |
- ( |
|
46 |
- <p><span>{thead[1]}</span> 스마트약상자</p> |
|
47 |
- ), |
|
48 |
- serialNumber: ( |
|
49 |
- <p><span>{thead[2]}</span> ABCD-1</p> |
|
50 |
- ), |
|
51 |
- writer: ( |
|
52 |
- <p><span>{thead[3]}</span> 홍길동</p> |
|
53 |
- ), |
|
54 |
- name: ( |
|
55 |
- <p><span>{thead[4]}</span> A복지관</p> |
|
56 |
- ), |
|
57 |
- date: ( |
|
58 |
- <p><span>{thead[5]}</span> 2023-01-27</p> |
|
59 |
- ), |
|
60 |
- category: ( |
|
61 |
- <p><span>{thead[6]}</span> 교환</p> |
|
62 |
- ), |
|
63 |
- finish:( |
|
64 |
- <p><span>{thead[7]}</span> 처리중</p> |
|
65 |
- ), |
|
66 |
- show: ( |
|
67 |
- <Button |
|
68 |
- className={"btn-small lightgray-btn"} |
|
69 |
- btnName={"상세보기"} |
|
70 |
- onClick={() => { |
|
71 |
- navigate("/QandAConfirm"); |
|
72 |
- }} |
|
73 |
- /> |
|
74 |
- ), |
|
75 |
- delete: ( |
|
76 |
- <RestoreFromTrashIcon sx={{ width: "30px", height: "30px", }} /> |
|
77 |
- ), |
|
78 |
- }, |
|
10 |
+ const navigate = useNavigate(); |
|
11 |
+ const location = useLocation(); |
|
79 | 12 |
|
80 |
- ]; |
|
81 |
- return ( |
|
82 |
- <main> |
|
83 |
- <div className="content-wrap"> |
|
84 |
- <DetailTitle contentTitle={"장비 문의 요청"} /> |
|
85 |
- <div className="board-wrap" style={{ marginTop: "3rem" }} > |
|
86 |
- <div className="btn-wrap flex-end margin-bottom"> |
|
87 |
- |
|
88 |
- <Button |
|
89 |
- className={"btn-small gray-btn"} |
|
90 |
- btnName={"등록"} |
|
91 |
- onClick={() => { |
|
92 |
- navigate("/QandAInsert"); |
|
93 |
- }} |
|
94 |
- /> |
|
95 |
- </div> |
|
96 |
- <Table className="equipment-detail senior-table" head={thead} contents={content} contentKey={key} /> |
|
97 |
- </div> |
|
98 |
- </div> |
|
99 |
- </main> |
|
100 |
- ); |
|
13 |
+ //전역 변수 저장 객체 |
|
14 |
+ const state = useSelector((state) => {return state}); |
|
15 |
+ const defaultGovernmentId = CommonUtil.isEmpty(state.loginUser) ? null : state.loginUser['government_id']; |
|
16 |
+ const defaultAgencyId = CommonUtil.isEmpty(state.loginUser) ? null : state.loginUser['agency_id']; |
|
17 |
+ const defaultUserId = CommonUtil.isEmpty(state.loginUser) == false |
|
18 |
+ && (state.loginUser['authority'] == 'ROLE_SENIOR' |
|
19 |
+ || state.loginUser['authority'] == 'ROLE_GUARDIAN') |
|
20 |
+ ? state.loginUser['user_id'] : null; |
|
21 |
+ |
|
22 |
+ |
|
23 |
+ //기관 계층 구조 목록 |
|
24 |
+ const [orgListOfHierarchy, setOrgListOfHierarchy] = React.useState([]); |
|
25 |
+ //기관(관리, 시행) 계층 구조 목록 조회 |
|
26 |
+ const orgSelectListOfHierarchy = () => { |
|
27 |
+ const param = { |
|
28 |
+ 'government_id': defaultGovernmentId, |
|
29 |
+ 'agency_id': defaultAgencyId |
|
30 |
+ } |
|
31 |
+ if (CommonUtil.isEmpty(state.loginUser) == false |
|
32 |
+ && state.loginUser['authority'] == 'ROLE_ADMIN') { |
|
33 |
+ param['government_id'] = null; |
|
34 |
+ param['agency_id'] = null; |
|
35 |
+ } |
|
36 |
+ |
|
37 |
+ fetch("/org/orgSelectListOfHierarchy.json", { |
|
38 |
+ method: "POST", |
|
39 |
+ headers: { |
|
40 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
41 |
+ }, |
|
42 |
+ body: JSON.stringify(param), |
|
43 |
+ }).then((response) => response.json()).then((data) => { |
|
44 |
+ console.log("기관(관리, 시행) 계층 구조 목록 조회 : ", data); |
|
45 |
+ setOrgListOfHierarchy(data); |
|
46 |
+ }).catch((error) => { |
|
47 |
+ console.log('orgSelectListOfHierarchy() /org/orgSelectListOfHierarchy.json error : ', error); |
|
48 |
+ }); |
|
49 |
+ }; |
|
50 |
+ |
|
51 |
+ const [search, setSearch] = React.useState({ |
|
52 |
+ 'government_id': defaultGovernmentId, |
|
53 |
+ 'agency_id': defaultAgencyId, |
|
54 |
+ 'user_id': defaultUserId, |
|
55 |
+ |
|
56 |
+ 'equipment_serial_number': null, |
|
57 |
+ 'inquiry_answer_user_id': null, |
|
58 |
+ |
|
59 |
+ 'searchType': null, |
|
60 |
+ 'searchText': null, |
|
61 |
+ 'currentPage': 0, |
|
62 |
+ 'perPage': 10, |
|
63 |
+ }); |
|
64 |
+ const searchingEnter = (key) => { |
|
65 |
+ if (key == 'Enter') { |
|
66 |
+ searching(); |
|
67 |
+ } else { |
|
68 |
+ return; |
|
69 |
+ } |
|
70 |
+ } |
|
71 |
+ const searching = () => { |
|
72 |
+ equipmentInquirySelectList(1); |
|
73 |
+ } |
|
74 |
+ |
|
75 |
+ //문의 목록 |
|
76 |
+ const [equipmentInquiry, setEquipmentInquiry] = React.useState({ |
|
77 |
+ equipmentInquiryList: [], |
|
78 |
+ equipmentInquiryListCount: 0, |
|
79 |
+ }); |
|
80 |
+ //문의 목록 조회 |
|
81 |
+ const equipmentInquirySelectList = (currentPage) => { |
|
82 |
+ search.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage; |
|
83 |
+ fetch("/equipment/equipmentInquirySelectList.json", { |
|
84 |
+ method: "POST", |
|
85 |
+ headers: { |
|
86 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
87 |
+ }, |
|
88 |
+ body: JSON.stringify(search), |
|
89 |
+ }).then((response) => response.json()).then((data) => { |
|
90 |
+ console.log("문의 목록 조회 : ", data); |
|
91 |
+ setEquipmentInquiry(data); |
|
92 |
+ }).catch((error) => { |
|
93 |
+ console.log('equipmentInquirySelectList() /equipment/equipmentInquirySelectList.json error : ', error); |
|
94 |
+ }); |
|
95 |
+ }; |
|
96 |
+ |
|
97 |
+ |
|
98 |
+ //문의 상세조회 페이지 이동 |
|
99 |
+ const equipmentInquirySelectOnePage = (item) => { |
|
100 |
+ navigate("/QandASelectOne", {state: { |
|
101 |
+ 'inquiry_idx': item['inquiry_idx'], |
|
102 |
+ }}); |
|
103 |
+ } |
|
104 |
+ |
|
105 |
+ |
|
106 |
+ React.useEffect(() => { |
|
107 |
+ orgSelectListOfHierarchy(); |
|
108 |
+ searching(); |
|
109 |
+ }, []); |
|
110 |
+ |
|
111 |
+ return ( |
|
112 |
+ <main> |
|
113 |
+ <div className="search-management flex-end margin-bottom2 margin-top gap"> |
|
114 |
+ <select style={{maxWidth: '150px'}} value={search['equipment_serial_number']} |
|
115 |
+ onChange={(e) => {search['equipment_serial_number'] = e.target.value; setSearch({...search});}}> |
|
116 |
+ <option value="">문의구분</option> |
|
117 |
+ <option value="IS_NULL">일반문의</option> |
|
118 |
+ <option value="IS_NOT_NULL">장비문의</option> |
|
119 |
+ </select> |
|
120 |
+ <select style={{maxWidth: '150px'}} value={search['inquiry_answer_user_id']} |
|
121 |
+ onChange={(e) => {search['inquiry_answer_user_id'] = e.target.value; setSearch({...search});}}> |
|
122 |
+ <option value="">상태</option> |
|
123 |
+ <option value="IS_NULL">답변대기중</option> |
|
124 |
+ <option value="IS_NOT_NULL">답변완료</option> |
|
125 |
+ </select> |
|
126 |
+ <select style={{maxWidth: '150px'}} value={search['searchType']} |
|
127 |
+ onChange={(e) => {search['searchType'] = e.target.value; setSearch({...search});}}> |
|
128 |
+ <option value="">전체</option> |
|
129 |
+ <option value="user_name">문의자 이름</option> |
|
130 |
+ <option value="user_id">문의자 ID</option> |
|
131 |
+ <option value="user_phonenumber">문의자 연락처</option> |
|
132 |
+ <option value="inquiry_title">제목</option> |
|
133 |
+ <option value="inquiry_content">문의내용</option> |
|
134 |
+ <option value="inquiry_answer_content">답변내용</option> |
|
135 |
+ <option value="equipment_serial_number">시리얼 넘버</option> |
|
136 |
+ </select> |
|
137 |
+ <input type="text" |
|
138 |
+ value={search['searchText']} |
|
139 |
+ onChange={(e) => {search['searchText'] = e.target.value; setSearch({...search});}} |
|
140 |
+ onKeyUp={(e) => searchingEnter(e.key)} |
|
141 |
+ /> |
|
142 |
+ <button className="btn-small gray-btn" style={{maxWidth: '150px'}} onClick={searching}>검색</button> |
|
143 |
+ </div> |
|
144 |
+ |
|
145 |
+ <div className="content-wrap"> |
|
146 |
+ <DetailTitle contentTitle={"Q&A"} /> |
|
147 |
+ <div className="board-wrap" style={{ marginTop: "3rem" }} > |
|
148 |
+ {CommonUtil.isEmpty(state.loginUser) == false && state.loginUser['authority'] != 'ROLE_ADMIN' ? |
|
149 |
+ <div className="btn-wrap flex-end margin-bottom"> |
|
150 |
+ <button className="btn-small gray-btn" onClick={() => {navigate("/QandAInsert");}}>문의하기</button> |
|
151 |
+ </div> |
|
152 |
+ : null} |
|
153 |
+ <table class="equipment-detail senior-table"> |
|
154 |
+ <thead> |
|
155 |
+ <tr> |
|
156 |
+ <th>No</th> |
|
157 |
+ <th>관리기관</th> |
|
158 |
+ <th>시행기관</th> |
|
159 |
+ <th>제목</th> |
|
160 |
+ <th>작성자</th> |
|
161 |
+ <th>작성일시</th> |
|
162 |
+ <th>문의구분</th> |
|
163 |
+ <th>처리여부</th> |
|
164 |
+ </tr> |
|
165 |
+ </thead> |
|
166 |
+ <tbody> |
|
167 |
+ {equipmentInquiry.equipmentInquiryList.map((item, idx) => { return ( |
|
168 |
+ <tr key={idx} onClick={() => equipmentInquirySelectOnePage(item)}> |
|
169 |
+ <td data-label="No">{equipmentInquiry.equipmentInquiryListCount - idx - (search.currentPage - 1) * search.perPage}</td> |
|
170 |
+ <td data-label="관리기관">{item['insert_user_government_name']}</td> |
|
171 |
+ <td data-label="시행기관">{item['insert_user_agency_name']}</td> |
|
172 |
+ <td data-label="제목">{item['inquiry_title']}</td> |
|
173 |
+ <td data-label="작성자">{item['insert_user_name']}</td> |
|
174 |
+ <td data-label="작성일시">{item['inquiry_insert_datetime']}</td> |
|
175 |
+ <td data-label="문의구분"> |
|
176 |
+ {CommonUtil.isEmpty(item['inquiry_type']) == false ? `장비(${item['inquiry_type']})` : '일반문의'} |
|
177 |
+ </td> |
|
178 |
+ <td data-label="처리여부"> |
|
179 |
+ {CommonUtil.isEmpty(item['inquiry_answer_user_id']) == false ? '답변완료' : '답변대기중'} |
|
180 |
+ </td> |
|
181 |
+ </tr> |
|
182 |
+ )})} |
|
183 |
+ {CommonUtil.isEmpty(equipmentInquiry.equipmentInquiryList) ? |
|
184 |
+ <tr> |
|
185 |
+ <td colSpan={8}>조회된 데이터가 없습니다</td> |
|
186 |
+ </tr> |
|
187 |
+ : null} |
|
188 |
+ </tbody> |
|
189 |
+ </table> |
|
190 |
+ <Pagination |
|
191 |
+ currentPage={search.currentPage} |
|
192 |
+ perPage={search.perPage} |
|
193 |
+ totalCount={equipmentInquiry.equipmentInquiryListCount} |
|
194 |
+ maxRange={5} |
|
195 |
+ click={equipmentInquirySelectList} |
|
196 |
+ /> |
|
197 |
+ |
|
198 |
+ </div> |
|
199 |
+ </div> |
|
200 |
+ </main> |
|
201 |
+ ); |
|
101 | 202 |
} |
203 |
+ |
+++ client/views/pages/callcenter/QandASelectOne.jsx
... | ... | @@ -0,0 +1,360 @@ |
1 | +import React from "react"; | |
2 | +import { useNavigate, useLocation } from "react-router"; | |
3 | +import { useSelector } from "react-redux"; | |
4 | + | |
5 | +import Modal from "../../component/Modal.jsx"; | |
6 | +import ContentTitle from "../../component/ContentTitle.jsx"; | |
7 | +import SubTitle from "../../component/SubTitle.jsx"; | |
8 | +import Pagination from "../../component/Pagination.jsx"; | |
9 | + | |
10 | +import CommonUtil from "../../../resources/js/CommonUtil.js"; | |
11 | + | |
12 | +export default function QandASelectOne() { | |
13 | + const navigate = useNavigate(); | |
14 | + const location = useLocation(); | |
15 | + | |
16 | + //전역 변수 저장 객체 | |
17 | + const state = useSelector((state) => {return state}); | |
18 | + const defaultGovernmentId = CommonUtil.isEmpty(state.loginUser) ? null : state.loginUser['government_id']; | |
19 | + const defaultAgencyId = CommonUtil.isEmpty(state.loginUser) ? null : state.loginUser['agency_id']; | |
20 | + let defaultSeniorId = null; | |
21 | + if (CommonUtil.isEmpty(state.loginUser) == false) { | |
22 | + if (state.loginUser['authority'] == 'ROLE_SENIOR') { | |
23 | + defaultSeniorId = state.loginUser['user_id']; | |
24 | + } else if (state.loginUser['authority'] == 'ROLE_GUARDIAN' && CommonUtil.isEmpty(state.seniorList) == false) { | |
25 | + defaultSeniorId = state.seniorList[state.currentSeniorIndex]['user_id']; | |
26 | + } | |
27 | + } else { | |
28 | + defaultSeniorId = null; | |
29 | + } | |
30 | + | |
31 | + //권한 타입 종류 | |
32 | + const [authorities, setAuthorities] = React.useState([]); | |
33 | + //권한 타입 종류 목록 조회 | |
34 | + const authoritiesSelect = () => { | |
35 | + fetch("/common/systemCode/authoritiesSelect.json", { | |
36 | + method: "POST", | |
37 | + headers: { | |
38 | + 'Content-Type': 'application/json; charset=UTF-8' | |
39 | + }, | |
40 | + body: JSON.stringify({}), | |
41 | + }).then((response) => response.json()).then((data) => { | |
42 | + console.log("권한 타입 종류 목록 조회 : ", data); | |
43 | + setAuthorities(data); | |
44 | + }).catch((error) => { | |
45 | + console.log('authoritiesSelect() /common/systemCode/authoritiesSelect.json error : ', error); | |
46 | + }); | |
47 | + }; | |
48 | + | |
49 | + // 시스템 코드 - 장비 상태 | |
50 | + const [equipmentStates, setEquipmentStates] = React.useState({}); | |
51 | + // 시스템 코드 - 장비 상태 조회 | |
52 | + const equipmentStatesSelect = () => { | |
53 | + console.log('equipmentStatesSelect Function Run'); | |
54 | + | |
55 | + //fetch post | |
56 | + fetch("/common/systemCode/equipmentStatesSelect.json", { | |
57 | + method: "POST", | |
58 | + headers: { | |
59 | + 'Content-Type': 'application/json; charset=UTF-8' | |
60 | + }, | |
61 | + body: JSON.stringify({}) | |
62 | + }).then((response) => response.json()).then((data) => { | |
63 | + console.log('equipmentStatesSelect response : ', data); | |
64 | + setEquipmentStates(data); | |
65 | + }).catch((error) => { | |
66 | + console.log('equipmentStatesSelect error : ', error); | |
67 | + }); | |
68 | + } | |
69 | + | |
70 | + | |
71 | + const equipmentInit = { | |
72 | + 'equipment_serial_number': null, | |
73 | + 'equipment_name': null, | |
74 | + 'agency_name': null, | |
75 | + 'rental_detail_insert_user_name': null, | |
76 | + 'rental_detail_insert_user_id': null, | |
77 | + 'user_name': null, | |
78 | + 'user_id': null, | |
79 | + 'user_address': null, | |
80 | + 'equipment_state': null, | |
81 | + } | |
82 | + //문의 정보 | |
83 | + const [equipmentInquiry, setEquipmentInquiry] = React.useState({ | |
84 | + 'inquiry_idx': location.state['inquiry_idx'], | |
85 | + 'inquiry_type': null, | |
86 | + 'inquiry_title': null, | |
87 | + 'inquiry_content': null, | |
88 | + 'inquiry_state': null, | |
89 | + 'inquiry_insert_user_id': null, | |
90 | + 'inquiry_insert_datetime': null, | |
91 | + 'inquiry_answer_content': null, | |
92 | + 'inquiry_answer_user_id': null, | |
93 | + 'inquiry_update_datetime': null, | |
94 | + | |
95 | + 'equipment_serial_number': null, | |
96 | + //문의할 장비 정보 | |
97 | + equipment: {...equipmentInit} | |
98 | + }); | |
99 | + const equipmentInquiryRef = React.useRef({...equipmentInquiry}) | |
100 | + | |
101 | + //문의 상세 조회 | |
102 | + const equipmentInquirySelectOne = () => { | |
103 | + fetch("/equipment/equipmentInquirySelectOne.json", { | |
104 | + method: "POST", | |
105 | + headers: { | |
106 | + 'Content-Type': 'application/json; charset=UTF-8' | |
107 | + }, | |
108 | + body: JSON.stringify(equipmentInquiry), | |
109 | + }).then((response) => response.json()).then((data) => { | |
110 | + console.log("문의 상세 조회 결과 : ", data); | |
111 | + setEquipmentInquiry(data); | |
112 | + }).catch((error) => { | |
113 | + console.log('equipmentInquirySelectOne() /equipment/equipmentInquirySelectOne.json error : ', error); | |
114 | + }); | |
115 | + } | |
116 | + | |
117 | + | |
118 | + //문의 수정 페이지 이동 | |
119 | + const equipmentInquiryUpdatePage = () => { | |
120 | + navigate("/QandAUpdate", {state: { | |
121 | + 'inquiry_idx': location.state['inquiry_idx'], | |
122 | + }}) | |
123 | + } | |
124 | + | |
125 | + | |
126 | + | |
127 | + | |
128 | + //문의 답변 등록 | |
129 | + const equipmentInquiryAnswerUpdate = () => { | |
130 | + if (CommonUtil.isEmpty(equipmentInquiry['inquiry_answer_content'])) { | |
131 | + equipmentInquiryRef.current['inquiry_answer_content'].focus(); | |
132 | + alert("답변을 입력해주세요."); | |
133 | + | |
134 | + equipmentInquiry['inquiry_answer_content'] = "[접수완료] 문제를 조속히 처리하여 불편을 해결해드릴 수 있도록 하겠습니다. "; | |
135 | + setEquipmentInquiry({...equipmentInquiry}); | |
136 | + | |
137 | + return; | |
138 | + } | |
139 | + | |
140 | + if (confirm("해당 문의글의 답변을 등록하시겠습니까?") == false) { | |
141 | + return; | |
142 | + } | |
143 | + | |
144 | + fetch("/equipment/equipmentInquiryAnswerUpdate.json", { | |
145 | + method: "POST", | |
146 | + headers: { | |
147 | + 'Content-Type': 'application/json; charset=UTF-8' | |
148 | + }, | |
149 | + body: JSON.stringify(equipmentInquiry), | |
150 | + }).then((response) => response.json()).then((data) => { | |
151 | + console.log("문의 답변 등록 결과(건수) : ", data); | |
152 | + if (data > 0) { | |
153 | + alert("답변 등록완료"); | |
154 | + navigate('/QandASelect'); | |
155 | + } else { | |
156 | + alert("답변 등록에 실패하였습니다. 관리자에게 문의바랍니다."); | |
157 | + } | |
158 | + }).catch((error) => { | |
159 | + console.log('equipmentInquiryAnswerUpdate() /equipment/equipmentInquiryAnswerUpdate.json error : ', error); | |
160 | + }); | |
161 | + } | |
162 | + | |
163 | + //문의 삭제 | |
164 | + const equipmentInquiryDelete = () => { | |
165 | + if (confirm('해당 문의글을 삭제하시겠습니까?') == false) { | |
166 | + return; | |
167 | + } | |
168 | + | |
169 | + fetch("/equipment/equipmentInquiryDelete.json", { | |
170 | + method: "POST", | |
171 | + headers: { | |
172 | + 'Content-Type': 'application/json; charset=UTF-8' | |
173 | + }, | |
174 | + body: JSON.stringify(equipmentInquiry), | |
175 | + }).then((response) => response.json()).then((data) => { | |
176 | + console.log("문의 삭제 결과(건수) : ", data); | |
177 | + if (data > 0) { | |
178 | + alert("삭제완료"); | |
179 | + navigate('/QandASelect'); | |
180 | + } else { | |
181 | + alert("삭제에 실패하였습니다. 관리자에게 문의바랍니다."); | |
182 | + } | |
183 | + }).catch((error) => { | |
184 | + console.log('equipmentInquiryDelete() /equipment/equipmentInquiryDelete.json error : ', error); | |
185 | + }); | |
186 | + } | |
187 | + | |
188 | + | |
189 | + //장비 관리 페이지 이동 | |
190 | + const equipmentSelectPage = () => { | |
191 | + navigate('/EquipmentSelect', {state: { | |
192 | + searchType: 'equipment_serial_number', | |
193 | + searchText: equipmentInquiry.equipment['equipment_serial_number'], | |
194 | + tabIndex: 1, | |
195 | + | |
196 | + 'government_id': equipmentInquiry['insert_user_government_id'] | |
197 | + }}); | |
198 | + } | |
199 | + | |
200 | + React.useEffect(() => { | |
201 | + authoritiesSelect(); | |
202 | + equipmentStatesSelect(); | |
203 | + equipmentInquirySelectOne(); | |
204 | + }, []) | |
205 | + | |
206 | + return ( | |
207 | + <main> | |
208 | + | |
209 | + <div className="content-wrap row"> | |
210 | + <ContentTitle contentTitle={"문의글 작성"} className={"margin-bottom2"} /> | |
211 | + <SubTitle explanation={"문의 정보"} className={"margin-bottom2"}/> | |
212 | + <table className="margin-bottom2 qna-insert senior-detail"> | |
213 | + <tr> | |
214 | + <th>구분</th> | |
215 | + <td colSpan={3}> | |
216 | + {CommonUtil.isEmpty(equipmentInquiry['equipment_serial_number']) ? '일반문의' : '장비문의'} | |
217 | + </td> | |
218 | + </tr> | |
219 | + {equipmentInquiry['equipment_serial_number'] != null ? | |
220 | + <tr> | |
221 | + <th>장비문의 구분</th> | |
222 | + <td colSpan={3}> | |
223 | + {equipmentInquiry['inquiry_type']} | |
224 | + </td> | |
225 | + </tr> | |
226 | + : null} | |
227 | + <tr> | |
228 | + <th>문의제목</th> | |
229 | + <td colSpan={3}> | |
230 | + {equipmentInquiry['inquiry_title']} | |
231 | + </td> | |
232 | + </tr> | |
233 | + <tr> | |
234 | + <th>내용</th> | |
235 | + <td colSpan={3}> | |
236 | + {equipmentInquiry['inquiry_content']} | |
237 | + </td> | |
238 | + </tr> | |
239 | + {CommonUtil.isEmpty(state.loginUser) == false | |
240 | + && equipmentInquiry['insert_user_id'] != state.loginUser['user_id'] | |
241 | + ? <> | |
242 | + <tr> | |
243 | + <th>작성자</th> | |
244 | + <td>{equipmentInquiry['insert_user_name']}({equipmentInquiry['insert_user_id']})</td> | |
245 | + <th>구분</th> | |
246 | + <td>{authorities[equipmentInquiry['insert_user_authority']]}</td> | |
247 | + </tr> | |
248 | + <tr> | |
249 | + <th>관리기관</th> | |
250 | + <td>{equipmentInquiry['insert_user_government_name']}</td> | |
251 | + <th>시행기관</th> | |
252 | + <td>{equipmentInquiry['insert_user_agency_name']}</td> | |
253 | + </tr> | |
254 | + <tr> | |
255 | + <th>연락처</th> | |
256 | + <td colSpan={3}>{equipmentInquiry['insert_user_phonenumber']}</td> | |
257 | + </tr> | |
258 | + </>: null} | |
259 | + </table> | |
260 | + | |
261 | + {equipmentInquiry['equipment_serial_number'] != null | |
262 | + ?<> | |
263 | + <SubTitle explanation={'장비 정보'} className={"display-inline-block margin-bottom2"}/> | |
264 | + {CommonUtil.isEmpty(equipmentInquiry.equipment['equipment_serial_number']) == false ? | |
265 | + <> | |
266 | + <table className="margin-bottom2 qna-insert senior-detail"> | |
267 | + <tr> | |
268 | + <th>장비 시리얼넘버</th> | |
269 | + <td colSpan={3}> | |
270 | + {equipmentInquiry.equipment['equipment_serial_number']} | |
271 | + {CommonUtil.isEmpty(state.loginUser) == false && state.loginUser['authority'] == 'ROLE_ADMIN' | |
272 | + ? <button className="btn-small gray-btn margin-left2" onClick={() => equipmentSelectPage()}>관리페이지이동</button> | |
273 | + : null} | |
274 | + </td> | |
275 | + </tr> | |
276 | + <tr> | |
277 | + <th>모델명</th> | |
278 | + <td> | |
279 | + {equipmentInquiry.equipment['equipment_name']} | |
280 | + </td> | |
281 | + <th>장비상태</th> | |
282 | + <td> | |
283 | + {equipmentStates[equipmentInquiry.equipment['equipment_state']]} | |
284 | + </td> | |
285 | + </tr> | |
286 | + <tr> | |
287 | + <th>소속기관</th> | |
288 | + <td> | |
289 | + {equipmentInquiry.equipment['agency_id'] == null ? equipmentInquiry.equipment['government_name'] : equipmentInquiry.equipment['agency_name']} | |
290 | + </td> | |
291 | + <th>대여시행자</th> | |
292 | + <td> | |
293 | + {CommonUtil.isEmpty(equipmentInquiry.equipment['equipment_serial_number']) == false | |
294 | + && CommonUtil.isEmpty(equipmentInquiry.equipment['rental_detail_insert_user_id']) == false | |
295 | + ? <> | |
296 | + {equipmentInquiry.equipment['rental_detail_insert_user_name']} | |
297 | + ({equipmentInquiry.equipment['rental_detail_insert_user_id']}) | |
298 | + </> | |
299 | + : '미대여'} | |
300 | + </td> | |
301 | + </tr> | |
302 | + <tr> | |
303 | + <th>장비사용대상자</th> | |
304 | + <td> | |
305 | + {equipmentInquiry.equipment['user_id'] == null ? '미대여' : equipmentInquiry.equipment['user_name']} | |
306 | + </td> | |
307 | + <th>대상자 ID</th> | |
308 | + <td> | |
309 | + {equipmentInquiry.equipment['user_id'] == null ? '미대여' : equipmentInquiry.equipment['user_id']} | |
310 | + </td> | |
311 | + </tr> | |
312 | + <tr> | |
313 | + <th>대상자 주소</th> | |
314 | + <td colSpan={3}> | |
315 | + {equipmentInquiry.equipment['user_id'] == null ? '미대여' : equipmentInquiry.equipment['user_address']} | |
316 | + </td> | |
317 | + </tr> | |
318 | + </table> | |
319 | + </>: null} | |
320 | + </>: null} | |
321 | + | |
322 | + {CommonUtil.isEmpty(state.loginUser) == false | |
323 | + && state.loginUser['authority'] == 'ROLE_ADMIN' | |
324 | + ? <> | |
325 | + <SubTitle explanation={'문의 답변'} className={"display-inline-block margin-bottom2"}/> | |
326 | + <table className="margin-bottom2 qna-insert senior-detail"> | |
327 | + <tr> | |
328 | + <th>답변</th> | |
329 | + <td colSpan={3}> | |
330 | + <textarea className="medicine" cols="30" rows="2" | |
331 | + value={equipmentInquiry['inquiry_answer_content']} | |
332 | + onChange={(e) => {equipmentInquiry['inquiry_answer_content'] = e.target.value; setEquipmentInquiry({...equipmentInquiry});}} | |
333 | + ref={el => equipmentInquiryRef.current['inquiry_answer_content'] = el} | |
334 | + ></textarea> | |
335 | + </td> | |
336 | + </tr> | |
337 | + </table> | |
338 | + </> | |
339 | + : null} | |
340 | + | |
341 | + <div className="btn-wrap flex-center margin-top5"> | |
342 | + <button className="btn-large gray-btn" onClick={() => navigate(-1)}>이전</button> | |
343 | + | |
344 | + {CommonUtil.isEmpty(state.loginUser) == false | |
345 | + && equipmentInquiry['insert_user_id'] == state.loginUser['user_id'] | |
346 | + ? <button className="btn-large red-btn" onClick={() => equipmentInquiryUpdatePage()}>수정</button> | |
347 | + : null} | |
348 | + {CommonUtil.isEmpty(state.loginUser) == false | |
349 | + && state.loginUser['authority'] == 'ROLE_ADMIN' | |
350 | + ? <> | |
351 | + <button className="btn-large red-btn" onClick={() => equipmentInquiryAnswerUpdate()}>답변등록</button> | |
352 | + <button className="btn-large red-btn" onClick={() => equipmentInquiryDelete()}>삭제</button> | |
353 | + </> | |
354 | + : null} | |
355 | + </div> | |
356 | + | |
357 | + </div> | |
358 | + </main> | |
359 | + ); | |
360 | +} |
+++ client/views/pages/callcenter/QandAUpdate.jsx
... | ... | @@ -0,0 +1,500 @@ |
1 | +import React from "react"; | |
2 | +import { useNavigate, useLocation } from "react-router"; | |
3 | +import { useSelector } from "react-redux"; | |
4 | + | |
5 | +import Modal from "../../component/Modal.jsx"; | |
6 | +import ContentTitle from "../../component/ContentTitle.jsx"; | |
7 | +import SubTitle from "../../component/SubTitle.jsx"; | |
8 | +import Pagination from "../../component/Pagination.jsx"; | |
9 | + | |
10 | +import CommonUtil from "../../../resources/js/CommonUtil.js"; | |
11 | + | |
12 | +export default function QandAInsert() { | |
13 | + const navigate = useNavigate(); | |
14 | + const location = useLocation(); | |
15 | + | |
16 | + //전역 변수 저장 객체 | |
17 | + const state = useSelector((state) => {return state}); | |
18 | + const defaultGovernmentId = CommonUtil.isEmpty(state.loginUser) ? null : state.loginUser['government_id']; | |
19 | + const defaultAgencyId = CommonUtil.isEmpty(state.loginUser) ? null : state.loginUser['agency_id']; | |
20 | + let defaultSeniorId = null; | |
21 | + if (CommonUtil.isEmpty(state.loginUser) == false) { | |
22 | + if (state.loginUser['authority'] == 'ROLE_SENIOR') { | |
23 | + defaultSeniorId = state.loginUser['user_id']; | |
24 | + } else if (state.loginUser['authority'] == 'ROLE_GUARDIAN' && CommonUtil.isEmpty(state.seniorList) == false) { | |
25 | + defaultSeniorId = state.seniorList[state.currentSeniorIndex]['user_id']; | |
26 | + } | |
27 | + } else { | |
28 | + defaultSeniorId = null; | |
29 | + } | |
30 | + | |
31 | + // 시스템 코드 - 장비 상태 | |
32 | + const [equipmentStates, setEquipmentStates] = React.useState({}); | |
33 | + // 시스템 코드 - 장비 상태 조회 | |
34 | + const equipmentStatesSelect = () => { | |
35 | + console.log('equipmentStatesSelect Function Run'); | |
36 | + | |
37 | + //fetch post | |
38 | + fetch("/common/systemCode/equipmentStatesSelect.json", { | |
39 | + method: "POST", | |
40 | + headers: { | |
41 | + 'Content-Type': 'application/json; charset=UTF-8' | |
42 | + }, | |
43 | + body: JSON.stringify({}) | |
44 | + }).then((response) => response.json()).then((data) => { | |
45 | + console.log('equipmentStatesSelect response : ', data); | |
46 | + setEquipmentStates(data); | |
47 | + }).catch((error) => { | |
48 | + console.log('equipmentStatesSelect error : ', error); | |
49 | + }); | |
50 | + } | |
51 | + | |
52 | + | |
53 | + //입고 및 미대여 장비 검색 정보 | |
54 | + const [equipmentSearch, setEquipmentSearch] = React.useState({ | |
55 | + 'government_id': defaultGovernmentId, | |
56 | + 'agency_id': defaultAgencyId, | |
57 | + 'senior_id': defaultSeniorId, | |
58 | + 'currentPage': 1, | |
59 | + 'perPage': 10, | |
60 | + 'searchType': null, | |
61 | + 'searchText': null, | |
62 | + | |
63 | + 'equipment_state': null, | |
64 | + }); | |
65 | + //장비 정보 변경 | |
66 | + const equipmentSearchChange = (targetKey, value) => { | |
67 | + equipmentSearch[targetKey] = value; | |
68 | + setEquipmentSearch({...equipmentSearch}); | |
69 | + } | |
70 | + //장비 검색 | |
71 | + const equipmentSearching = () => { | |
72 | + equipmentSelectList(1); | |
73 | + } | |
74 | + const equipmentSearchingEnter = (key) => { | |
75 | + if (key == 'Enter') { | |
76 | + equipmentSearching(); | |
77 | + } else { | |
78 | + return; | |
79 | + } | |
80 | + } | |
81 | + //입고 및 미대여 목록 | |
82 | + const [equipment, setEquipment] = React.useState({equipmentList: [], equipmentListCount: 0}); | |
83 | + //입고 및 미대여 목록 조회 | |
84 | + const equipmentSelectList = (currentPage) => { | |
85 | + equipmentSearch.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage; | |
86 | + setEquipmentSearch({...equipmentSearch}); | |
87 | + | |
88 | + fetch("/equipment/equipmentSelectList.json", { | |
89 | + method: "POST", | |
90 | + headers: { | |
91 | + 'Content-Type': 'application/json; charset=UTF-8' | |
92 | + }, | |
93 | + body: JSON.stringify(equipmentSearch) | |
94 | + }).then((response) => response.json()).then((data) => { | |
95 | + console.log('equipmentSelectList response : ', data); | |
96 | + setEquipment(data); | |
97 | + if (CommonUtil.isEmpty(data.equipmentList) == false && equipmentInquiry['equipment_serial_number'] == '') { | |
98 | + equipmentInquirySelect(data.equipmentList[0]); | |
99 | + } | |
100 | + }).catch((error) => { | |
101 | + console.log('equipmentSelectList error : ', error); | |
102 | + }); | |
103 | + } | |
104 | + | |
105 | + //장비 모달 여부 | |
106 | + const [modalEquipmentIsOpen, setModalEquipmentIsOpen] = React.useState(false); | |
107 | + //장비 오픈 | |
108 | + const modalEquipmentOpen = () => { | |
109 | + setModalEquipmentIsOpen(true); | |
110 | + }; | |
111 | + //장비 닫기 | |
112 | + const modalEquipmentClose = () => { | |
113 | + setModalEquipmentIsOpen(false); | |
114 | + }; | |
115 | + | |
116 | + const equipmentInit = { | |
117 | + 'equipment_serial_number': null, | |
118 | + 'equipment_name': null, | |
119 | + 'agency_name': null, | |
120 | + 'rental_detail_insert_user_name': null, | |
121 | + 'rental_detail_insert_user_id': null, | |
122 | + 'user_name': null, | |
123 | + 'user_id': null, | |
124 | + 'user_address': null, | |
125 | + 'equipment_state': null, | |
126 | + } | |
127 | + //등록할 문의 정보 | |
128 | + const [equipmentInquiry, setEquipmentInquiry] = React.useState({ | |
129 | + 'inquiry_idx': location.state['inquiry_idx'], | |
130 | + 'inquiry_type': null, | |
131 | + 'inquiry_title': null, | |
132 | + 'inquiry_content': null, | |
133 | + 'inquiry_state': null, | |
134 | + 'inquiry_insert_user_id': null, | |
135 | + 'inquiry_insert_datetime': null, | |
136 | + 'inquiry_answer_content': null, | |
137 | + 'inquiry_answer_user_id': null, | |
138 | + 'inquiry_update_datetime': null, | |
139 | + | |
140 | + 'equipment_serial_number': null, | |
141 | + //문의할 장비 정보 | |
142 | + equipment: {...equipmentInit} | |
143 | + }); | |
144 | + const equipmentInquiryRef = React.useRef({...equipmentInquiry}); | |
145 | + | |
146 | + //문의 상세 조회 | |
147 | + const equipmentInquirySelectOne = () => { | |
148 | + fetch("/equipment/equipmentInquirySelectOne.json", { | |
149 | + method: "POST", | |
150 | + headers: { | |
151 | + 'Content-Type': 'application/json; charset=UTF-8' | |
152 | + }, | |
153 | + body: JSON.stringify(equipmentInquiry), | |
154 | + }).then((response) => response.json()).then((data) => { | |
155 | + console.log("문의 상세 조회 결과 : ", data); | |
156 | + setEquipmentInquiry(data); | |
157 | + }).catch((error) => { | |
158 | + console.log('equipmentInquirySelectOne() /equipment/equipmentInquirySelectOne.json error : ', error); | |
159 | + }); | |
160 | + } | |
161 | + | |
162 | + //문의할 장비 선택 | |
163 | + const equipmentInquirySelect = (equipment) => { | |
164 | + equipmentInquiry.equipment = equipment; | |
165 | + equipmentInquiry['equipment_serial_number'] = equipment['equipment_serial_number']; | |
166 | + setEquipmentInquiry({...equipmentInquiry}); | |
167 | + } | |
168 | + | |
169 | + //문의할 장비 선택 취소 | |
170 | + const equipmentInquirySelectCancel = () => { | |
171 | + equipmentInquiry['equipment_serial_number'] = ''; | |
172 | + equipmentInquiry.equipment = {...equipmentInit}; | |
173 | + | |
174 | + setEquipmentInquiry({...equipmentInquiry}); | |
175 | + } | |
176 | + | |
177 | + //등록할 문의 구분이 '장비문의'로 바꼈을 때만 작동 | |
178 | + React.useEffect(() => { | |
179 | + if (equipmentInquiry['equipment_serial_number'] == '') { | |
180 | + equipmentInquiry['inquiry_type'] = '기타'; | |
181 | + setEquipmentInquiry({...equipmentInquiry}); | |
182 | + } else if (equipmentInquiry['equipment_serial_number'] == null) { | |
183 | + equipmentInquiry.equipment = {...equipmentInit}; | |
184 | + equipmentInquiry['inquiry_type'] = null; | |
185 | + setEquipmentInquiry({...equipmentInquiry}); | |
186 | + } | |
187 | + }, [equipmentInquiry['equipment_serial_number']]); | |
188 | + | |
189 | + //등록할 문의 구분이 '장비문의 구분'이 바꼈을 때만 작동 | |
190 | + React.useEffect(() => { | |
191 | + if (equipmentInquiry['equipment_serial_number'] == '' | |
192 | + && (equipmentInquiry['inquiry_type'] == '교환' | |
193 | + || equipmentInquiry['inquiry_type'] == '수리')) { | |
194 | + equipmentSelectList(1); | |
195 | + } else if (CommonUtil.isEmpty(equipmentInquiry['equipment_serial_number']) == false | |
196 | + && equipmentInquiry['inquiry_type'] == '추가') { | |
197 | + equipmentInquirySelectCancel(); | |
198 | + } | |
199 | + }, [equipmentInquiry['inquiry_type']]); | |
200 | + | |
201 | + | |
202 | + //문의 등록 유효성 검사 | |
203 | + const equipmentInquiryValidation = () => { | |
204 | + const target = equipmentInquiry; | |
205 | + const targetRef = equipmentInquiryRef; | |
206 | + if (CommonUtil.isEmpty(target['inquiry_title']) == true) { | |
207 | + targetRef.current['inquiry_title'].focus(); | |
208 | + alert("문의제목을 입력해 주세요."); | |
209 | + return false; | |
210 | + } | |
211 | + if (CommonUtil.isEmpty(target['inquiry_content']) == true) { | |
212 | + targetRef.current['inquiry_content'].focus(); | |
213 | + alert("내용을 입력해 주세요."); | |
214 | + return false; | |
215 | + } | |
216 | + if ((equipmentInquiry['inquiry_type'] == '교환' || equipmentInquiry['inquiry_type'] == '수리') | |
217 | + && CommonUtil.isEmpty(target['equipment_serial_number'])) { | |
218 | + alert(`장비 ${equipmentInquiry['inquiry_type']}은(는) 장비 정보를 필수로 선택하셔야 됩니다.`); | |
219 | + return false; | |
220 | + } | |
221 | + | |
222 | + return true; | |
223 | + } | |
224 | + | |
225 | + //문의 수정 | |
226 | + const equipmentInquiryUpdate = () => { | |
227 | + if (equipmentInquiryValidation() == false) { | |
228 | + return; | |
229 | + } | |
230 | + | |
231 | + if (equipmentInquiry['equipment_serial_number'] == '') { | |
232 | + equipmentInquiry['equipment_serial_number'] = null; | |
233 | + } | |
234 | + | |
235 | + fetch("/equipment/equipmentInquiryUpdate.json", { | |
236 | + method: "POST", | |
237 | + headers: { | |
238 | + 'Content-Type': 'application/json; charset=UTF-8' | |
239 | + }, | |
240 | + body: JSON.stringify(equipmentInquiry), | |
241 | + }).then((response) => response.json()).then((data) => { | |
242 | + console.log("문의 수정 결과(건수) : ", data); | |
243 | + if (data > 0) { | |
244 | + alert("수정완료"); | |
245 | + navigate('/QandASelect'); | |
246 | + } else { | |
247 | + alert("수정에 실패하였습니다. 관리자에게 문의바랍니다."); | |
248 | + } | |
249 | + }).catch((error) => { | |
250 | + console.log('equipmentInquiryUpdate() /equipment/equipmentInquiryUpdate.json error : ', error); | |
251 | + }); | |
252 | + } | |
253 | + | |
254 | + //문의 삭제 | |
255 | + const equipmentInquiryDelete = () => { | |
256 | + if (confirm('해당 문의글을 삭제하시겠습니까?') == false) { | |
257 | + return; | |
258 | + } | |
259 | + | |
260 | + fetch("/equipment/equipmentInquiryDelete.json", { | |
261 | + method: "POST", | |
262 | + headers: { | |
263 | + 'Content-Type': 'application/json; charset=UTF-8' | |
264 | + }, | |
265 | + body: JSON.stringify(equipmentInquiry), | |
266 | + }).then((response) => response.json()).then((data) => { | |
267 | + console.log("문의 삭제 결과(건수) : ", data); | |
268 | + if (data > 0) { | |
269 | + alert("삭제완료"); | |
270 | + navigate('/QandASelect'); | |
271 | + } else { | |
272 | + alert("삭제에 실패하였습니다. 관리자에게 문의바랍니다."); | |
273 | + } | |
274 | + }).catch((error) => { | |
275 | + console.log('equipmentInquiryDelete() /equipment/equipmentInquiryDelete.json error : ', error); | |
276 | + }); | |
277 | + } | |
278 | + | |
279 | + | |
280 | + | |
281 | + React.useEffect(() => { | |
282 | + equipmentStatesSelect(); | |
283 | + equipmentInquirySelectOne(); | |
284 | + }, []) | |
285 | + | |
286 | + return ( | |
287 | + <main> | |
288 | + | |
289 | + <Modal open={modalEquipmentIsOpen} close={modalEquipmentClose} header="문의대상 장비 선택"> | |
290 | + <div className="board-wrap"> | |
291 | + <div> | |
292 | + | |
293 | + <div className="search-management flex-end margin-bottom2 margin-top gap"> | |
294 | + <select style={{maxWidth: '150px'}} | |
295 | + onChange={(e) => equipmentSearchChange('equipment_state', e.target.value)}> | |
296 | + <option value="">상태</option> | |
297 | + {Object.keys(equipmentStates).map((key, idx) => { return ( | |
298 | + <option key={key} value={key}> | |
299 | + {equipmentStates[key]} | |
300 | + </option> | |
301 | + )})} | |
302 | + </select> | |
303 | + <select style={{maxWidth: '150px'}} | |
304 | + onChange={(e) => equipmentSearchChange('searchType', e.target.value)}> | |
305 | + <option value="">전체</option> | |
306 | + <option value="equipment_name">모델명</option> | |
307 | + <option value="equipment_serial_number">시리얼넘버</option> | |
308 | + </select> | |
309 | + <input type="text" | |
310 | + value={equipmentSearch.searchText} | |
311 | + onChange={(e) => equipmentSearchChange('searchText', e.target.value)} | |
312 | + onKeyUp={(e) => equipmentSearchingEnter(e.key)} | |
313 | + /> | |
314 | + <button className={"btn-small gray-btn"} style={{maxWidth: '150px'}} onClick={equipmentSearching}>검색</button> | |
315 | + </div> | |
316 | + | |
317 | + <table class="caregiver-user protector-user"> | |
318 | + <thead> | |
319 | + <tr> | |
320 | + <th>No</th> | |
321 | + <th>장비사용대상자</th> | |
322 | + <th>모델명</th> | |
323 | + <th>시리얼넘버</th> | |
324 | + <th>장비상태</th> | |
325 | + <th>기관</th> | |
326 | + <th>선택</th> | |
327 | + </tr> | |
328 | + </thead> | |
329 | + <tbody> | |
330 | + {equipment.equipmentList.map((item, idx) => { return ( | |
331 | + <tr> | |
332 | + <td data-label="No">{equipment.equipmentListCount - idx - (equipmentSearch.currentPage - 1) * equipmentSearch.perPage}</td> | |
333 | + <td data-label="장비사용대상자"> | |
334 | + {item['user_id'] == null ? '미대여' : item['user_name']} | |
335 | + </td> | |
336 | + <td data-label="모델명">{item['equipment_name']}</td> | |
337 | + <td data-label="시리얼넘버">{item['equipment_serial_number']}</td> | |
338 | + <td data-label="장비상태">{equipmentStates[item['equipment_state']]}</td> | |
339 | + <td> | |
340 | + {item['agency_id'] == null ? item['government_name'] : item['agency_name']} | |
341 | + </td> | |
342 | + <td data-label="대여시행자"> | |
343 | + {equipmentInquiry.equipment['equipment_serial_number'] != item['equipment_serial_number'] | |
344 | + ? <button className={"btn-small gray-btn"} style={{maxWidth: '150px'}} | |
345 | + onClick={() => {equipmentInquirySelect(item); modalEquipmentClose();}}>선택</button> | |
346 | + : <button className={"btn-small red-btn"} style={{maxWidth: '150px'}} | |
347 | + onClick={() => {equipmentInquirySelectCancel(); modalEquipmentClose();}}>취소</button> | |
348 | + } | |
349 | + </td> | |
350 | + </tr> | |
351 | + )})} | |
352 | + {CommonUtil.isEmpty(equipment.equipmentList) ? | |
353 | + <tr> | |
354 | + <td colSpan={7}>조회된 데이터가 없습니다</td> | |
355 | + </tr> | |
356 | + : null} | |
357 | + </tbody> | |
358 | + </table> | |
359 | + <Pagination | |
360 | + currentPage={equipmentSearch.currentPage} | |
361 | + perPage={equipmentSearch.perPage} | |
362 | + totalCount={equipment.equipmentListCount} | |
363 | + maxRange={5} | |
364 | + click={equipmentSelectList} | |
365 | + /> | |
366 | + </div> | |
367 | + </div> | |
368 | + </Modal> | |
369 | + | |
370 | + <div className="content-wrap row"> | |
371 | + <ContentTitle contentTitle={"문의글 작성"} className={"margin-bottom2"} /> | |
372 | + <SubTitle explanation={"문의 정보"} className={"margin-bottom2"}/> | |
373 | + <table className="margin-bottom2 qna-insert senior-detail"> | |
374 | + <tr> | |
375 | + <th><span style={{color : "red"}}>*</span>구분</th> | |
376 | + <td colSpan={3}> | |
377 | + <div className="gender flex-start gap5"> | |
378 | + <div className="flex-start"> | |
379 | + <input type="radio" id="normal_question" name="question_type" value="일반문의" style={{width: '25px'}} | |
380 | + checked={equipmentInquiry['equipment_serial_number'] == null} | |
381 | + onChange={(e) => {equipmentInquiry['equipment_serial_number'] = null; setEquipmentInquiry({...equipmentInquiry});}}/> | |
382 | + <label for="normal_question">일반문의</label> | |
383 | + </div> | |
384 | + <div className="flex-start"> | |
385 | + <input type="radio" id="equipment_question" name="question_type" value="장비문의" style={{width: '25px'}} | |
386 | + checked={equipmentInquiry['equipment_serial_number'] != null} | |
387 | + onChange={(e) => {equipmentInquiry['equipment_serial_number'] = ''; setEquipmentInquiry({...equipmentInquiry});}}/> | |
388 | + <label for="equipment_question" >장비문의</label> | |
389 | + </div> | |
390 | + </div> | |
391 | + </td> | |
392 | + </tr> | |
393 | + {equipmentInquiry['equipment_serial_number'] != null ? | |
394 | + <tr> | |
395 | + <th><span style={{color : "red"}}>*</span>장비문의 구분</th> | |
396 | + <td colSpan={3}> | |
397 | + <select onChange={(e) => {equipmentInquiry['inquiry_type'] = e.target.value; setEquipmentInquiry({...equipmentInquiry});}}> | |
398 | + <option selected={equipmentInquiry['inquiry_type'] == '수리'}>수리</option> | |
399 | + <option selected={equipmentInquiry['inquiry_type'] == '교환'}>교환</option> | |
400 | + <option selected={equipmentInquiry['inquiry_type'] == '추가'}>추가</option> | |
401 | + <option selected={equipmentInquiry['inquiry_type'] == '기타'}>기타</option> | |
402 | + </select> | |
403 | + </td> | |
404 | + </tr> | |
405 | + : null} | |
406 | + <tr> | |
407 | + <th><span style={{color : "red"}}>*</span>문의제목</th> | |
408 | + <td colSpan={3}> | |
409 | + <input type="text" placeholder="문의글의 제목을 입력해주세요." | |
410 | + value={equipmentInquiry['inquiry_title']} | |
411 | + onChange={(e) => {equipmentInquiry['inquiry_title'] = e.target.value; setEquipmentInquiry({...equipmentInquiry});}} | |
412 | + ref={el => equipmentInquiryRef.current['inquiry_title'] = el} | |
413 | + /> | |
414 | + </td> | |
415 | + </tr> | |
416 | + <tr> | |
417 | + <th><span style={{color : "red"}}>*</span>내용</th> | |
418 | + <td colSpan={3}> | |
419 | + <textarea className="medicine" cols="30" rows="2" | |
420 | + value={equipmentInquiry['inquiry_content']} | |
421 | + onChange={(e) => {equipmentInquiry['inquiry_content'] = e.target.value; setEquipmentInquiry({...equipmentInquiry});}} | |
422 | + ref={el => equipmentInquiryRef.current['inquiry_content'] = el} | |
423 | + ></textarea> | |
424 | + </td> | |
425 | + </tr> | |
426 | + </table> | |
427 | + | |
428 | + {equipmentInquiry['equipment_serial_number'] != null | |
429 | + ?<> | |
430 | + <SubTitle explanation={equipmentInquiry['inquiry_type'] == '교환' || equipmentInquiry['inquiry_type'] == '수리' | |
431 | + ? <span>장비 정보 <span style={{color : "red"}}>(필수)</span></span> | |
432 | + : <span>장비 정보 (선택)</span> | |
433 | + } className={"display-inline-block margin-bottom2"}/> | |
434 | + <button className={"btn-small gray-btn"} style={{maxWidth: '150px'}} onClick={() => {equipmentSelectList(1); modalEquipmentOpen();}}>검색</button> | |
435 | + {CommonUtil.isEmpty(equipmentInquiry.equipment['equipment_serial_number']) == false ? | |
436 | + <> | |
437 | + <button className={"btn-small red-btn"} style={{maxWidth: '150px'}} onClick={equipmentInquirySelectCancel}>취소</button> | |
438 | + <table className="margin-bottom2 qna-insert senior-detail"> | |
439 | + <tr> | |
440 | + <th>장비 시리얼넘버</th> | |
441 | + <td colSpan={3}> | |
442 | + {equipmentInquiry.equipment['equipment_serial_number']} | |
443 | + </td> | |
444 | + </tr> | |
445 | + <tr> | |
446 | + <th>모델명</th> | |
447 | + <td> | |
448 | + {equipmentInquiry.equipment['equipment_name']} | |
449 | + </td> | |
450 | + <th>장비상태</th> | |
451 | + <td> | |
452 | + {equipmentStates[equipmentInquiry.equipment['equipment_state']]} | |
453 | + </td> | |
454 | + </tr> | |
455 | + <tr> | |
456 | + <th>소속기관</th> | |
457 | + <td> | |
458 | + {equipmentInquiry.equipment['agency_id'] == null ? equipmentInquiry.equipment['government_name'] : equipmentInquiry.equipment['agency_name']} | |
459 | + </td> | |
460 | + <th>대여시행자</th> | |
461 | + <td> | |
462 | + {CommonUtil.isEmpty(equipmentInquiry.equipment['equipment_serial_number']) == false | |
463 | + && CommonUtil.isEmpty(equipmentInquiry.equipment['rental_detail_insert_user_id']) == false | |
464 | + ? <> | |
465 | + {equipmentInquiry.equipment['rental_detail_insert_user_name']} | |
466 | + ({equipmentInquiry.equipment['rental_detail_insert_user_id']}) | |
467 | + </> | |
468 | + : '미대여'} | |
469 | + </td> | |
470 | + </tr> | |
471 | + <tr> | |
472 | + <th>장비사용대상자</th> | |
473 | + <td> | |
474 | + {equipmentInquiry.equipment['user_id'] == null ? '미대여' : equipmentInquiry.equipment['user_name']} | |
475 | + </td> | |
476 | + <th>대상자 ID</th> | |
477 | + <td> | |
478 | + {equipmentInquiry.equipment['user_id'] == null ? '미대여' : equipmentInquiry.equipment['user_id']} | |
479 | + </td> | |
480 | + </tr> | |
481 | + <tr> | |
482 | + <th>대상자 주소</th> | |
483 | + <td colSpan={3}> | |
484 | + {equipmentInquiry.equipment['user_id'] == null ? '미대여' : equipmentInquiry.equipment['user_address']} | |
485 | + </td> | |
486 | + </tr> | |
487 | + </table> | |
488 | + </>: null} | |
489 | + </>: null} | |
490 | + | |
491 | + <div className="btn-wrap flex-center margin-top5"> | |
492 | + <button className="btn-large gray-btn" onClick={() => navigate(-1)}>취소</button> | |
493 | + <button className="btn-large red-btn" onClick={() => equipmentInquiryUpdate()}>수정</button> | |
494 | + <button className="btn-large red-btn" onClick={() => equipmentInquiryDelete()}>삭제</button> | |
495 | + </div> | |
496 | + | |
497 | + </div> | |
498 | + </main> | |
499 | + ); | |
500 | +} |
--- client/views/pages/equipment/EquipmentSelect.jsx
+++ client/views/pages/equipment/EquipmentSelect.jsx
... | ... | @@ -1,5 +1,5 @@ |
1 | 1 |
import React from "react"; |
2 |
-import { useNavigate } from "react-router"; |
|
2 |
+import { useNavigate, useLocation } from "react-router"; |
|
3 | 3 |
import { useSelector } from "react-redux"; |
4 | 4 |
import { useStateWithCallbackLazy } from 'use-state-with-callback'; |
5 | 5 |
import SubTitle from "../../component/SubTitle.jsx"; |
... | ... | @@ -14,11 +14,14 @@ |
14 | 14 |
export default function EquipmentSelect() { |
15 | 15 |
|
16 | 16 |
const navigate = useNavigate(); |
17 |
+ const location = useLocation(); |
|
17 | 18 |
|
18 | 19 |
//전역 변수 저장 객체 |
19 | 20 |
const state = useSelector((state) => {return state}); |
20 |
- const defaultGovernmentId = CommonUtil.isEmpty(state.loginUser) ? null : state.loginUser['government_id']; |
|
21 |
+ const defaultGovernmentId = CommonUtil.isEmpty(location.state) || CommonUtil.isEmpty(location.state['government_id']) ? null : location.state['government_id']; |
|
21 | 22 |
|
23 |
+ console.log('location.state : ', location.state); |
|
24 |
+ console.log('defaultGovernmentId : ', defaultGovernmentId); |
|
22 | 25 |
|
23 | 26 |
//기관 계층 구조 목록 |
24 | 27 |
const [orgListOfHierarchy, setOrgListOfHierarchy] = React.useState([]); |
... | ... | @@ -29,7 +32,7 @@ |
29 | 32 |
headers: { |
30 | 33 |
'Content-Type': 'application/json; charset=UTF-8' |
31 | 34 |
}, |
32 |
- body: JSON.stringify({'government_id': defaultGovernmentId}), |
|
35 |
+ body: JSON.stringify({}), |
|
33 | 36 |
}).then((response) => response.json()).then((data) => { |
34 | 37 |
console.log("기관(관리, 시행) 계층 구조 목록 조회 : ", data); |
35 | 38 |
setOrgListOfHierarchy(data); |
... | ... | @@ -39,8 +42,8 @@ |
39 | 42 |
}; |
40 | 43 |
//검색 변수 (초기화값) |
41 | 44 |
const [org, setOrg] = React.useState({ |
42 |
- 'government_id': state.loginUser['government_id'], |
|
43 |
- 'agency_id': state.loginUser['agency_id'], |
|
45 |
+ 'government_id': defaultGovernmentId, |
|
46 |
+ 'agency_id': null, |
|
44 | 47 |
}); |
45 | 48 |
//올잇메디 선택 |
46 | 49 |
const adminChange = () => { |
... | ... | @@ -402,8 +405,8 @@ |
402 | 405 |
const [equipmentSearch, setEquipmentSearch] = React.useState({ |
403 | 406 |
'equipment_state': null, |
404 | 407 |
|
405 |
- 'searchType': null, |
|
406 |
- 'searchText': null, |
|
408 |
+ 'searchType': CommonUtil.isEmpty(location.state) || CommonUtil.isEmpty(location.state['searchType']) ? null : location.state['searchType'], |
|
409 |
+ 'searchText': CommonUtil.isEmpty(location.state) || CommonUtil.isEmpty(location.state['searchText']) ? null : location.state['searchText'] |
|
407 | 410 |
}); |
408 | 411 |
//장비 정보 변경 |
409 | 412 |
const equipmentSearchChange = (targetKey, value) => { |
... | ... | @@ -487,8 +490,18 @@ |
487 | 490 |
}); |
488 | 491 |
} |
489 | 492 |
|
493 |
+ |
|
494 |
+ //Mounted |
|
495 |
+ React.useEffect(() => { |
|
496 |
+ orgSelectListOfHierarchy(); |
|
497 |
+ equipmentStatesSelect(); |
|
498 |
+ equipmentSearching(); |
|
499 |
+ }, []); |
|
500 |
+ |
|
501 |
+ |
|
490 | 502 |
//현재 탭 Index |
491 |
- const [tabIndex, setTabIndex] = React.useState(0); |
|
503 |
+ const defaultTabIndex = CommonUtil.isEmpty(location.state) || CommonUtil.isEmpty(location.state['tabIndex']) ? 0 : location.state['tabIndex']; |
|
504 |
+ const [tabIndex, setTabIndex] = React.useState(defaultTabIndex); |
|
492 | 505 |
//탭 초기화 |
493 | 506 |
const tab = [{ |
494 | 507 |
title: `재고 장비 (${stockEquipment.equipmentListCount})`, |
... | ... | @@ -678,16 +691,6 @@ |
678 | 691 |
</div> |
679 | 692 |
) |
680 | 693 |
}]; |
681 |
- |
|
682 |
- |
|
683 |
- //Mounted |
|
684 |
- React.useEffect(() => { |
|
685 |
- orgSelectListOfHierarchy(); |
|
686 |
- equipmentStatesSelect(); |
|
687 |
- equipmentSearching(); |
|
688 |
- }, []); |
|
689 |
- |
|
690 |
- |
|
691 | 694 |
|
692 | 695 |
|
693 | 696 |
return ( |
... | ... | @@ -838,8 +841,8 @@ |
838 | 841 |
<select style={{maxWidth: '150px'}} |
839 | 842 |
onChange={(e) => equipmentSearchChange('searchType', e.target.value)}> |
840 | 843 |
<option value="">전체</option> |
841 |
- <option value="equipment_name">모델명</option> |
|
842 |
- <option value="equipment_serial_number">시리얼넘버</option> |
|
844 |
+ <option value="equipment_name" selected={equipmentSearch['searchType'] == 'equipment_name'}>모델명</option> |
|
845 |
+ <option value="equipment_serial_number" selected={equipmentSearch['searchType'] == 'equipment_serial_number'}>시리얼넘버</option> |
|
843 | 846 |
</select> |
844 | 847 |
<input type="text" |
845 | 848 |
value={equipmentSearch.searchText} |
--- client/views/pages/equipment/GovernmentEquipmentSelect.jsx
+++ client/views/pages/equipment/GovernmentEquipmentSelect.jsx
... | ... | @@ -199,7 +199,7 @@ |
199 | 199 |
<table class="caregiver-user protector-user"> |
200 | 200 |
<thead> |
201 | 201 |
<tr> |
202 |
- <th>No </th> |
|
202 |
+ <th>No</th> |
|
203 | 203 |
<th>모델명</th> |
204 | 204 |
<th>시리얼넘버</th> |
205 | 205 |
<th>입고일자</th> |
--- client/views/pages/main/Main_guardian.jsx
+++ client/views/pages/main/Main_guardian.jsx
... | ... | @@ -1,4 +1,7 @@ |
1 | 1 |
import React from "react"; |
2 |
+import { useNavigate, useLocation } from "react-router"; |
|
3 |
+import { useSelector } from "react-redux"; |
|
4 |
+ |
|
2 | 5 |
import Title from "../../component/Title.jsx"; |
3 | 6 |
import Table from "../../component/Table.jsx"; |
4 | 7 |
import Calendar from "../../component/Calendar.jsx"; |
... | ... | @@ -35,6 +38,13 @@ |
35 | 38 |
import percent_m_100 from '../../../resources/files/images/percent_m_100.png'; |
36 | 39 |
|
37 | 40 |
export default function Main_guardian() { |
41 |
+ const navigate = useNavigate(); |
|
42 |
+ const location = useLocation(); |
|
43 |
+ |
|
44 |
+ //전역 변수 저장 객체 |
|
45 |
+ const state = useSelector((state) => {return state}); |
|
46 |
+ //console.log('state.seniorList[state.currentSeniorIndex] : ', state.seniorList[state.currentSeniorIndex]); |
|
47 |
+ |
|
38 | 48 |
const tableHead1 = ["", "", "", "", "", ""]; |
39 | 49 |
const Key1 = ["morning", "morning2", "lunch", "lunch2", "dinner", "dinner2"]; |
40 | 50 |
const content1 = [ |
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?