Showing
5 changed files
with
101 additions
and
3 deletions
... | @@ -100,13 +100,13 @@ exports.doctorRegister = async ctx => { | ... | @@ -100,13 +100,13 @@ exports.doctorRegister = async ctx => { |
100 | } | 100 | } |
101 | 101 | ||
102 | const existDoctorInfo = await DoctorInfo.findByDoctorId(userId); | 102 | const existDoctorInfo = await DoctorInfo.findByDoctorId(userId); |
103 | - if(existDoctorInfo.useYn === 'W') { | 103 | + if(existDoctorInfo && existDoctorInfo.useYn === 'W') { |
104 | ctx.status = 401; | 104 | ctx.status = 401; |
105 | ctx.body = { | 105 | ctx.body = { |
106 | error : '가입 승인 대기중인 회원입니다.', | 106 | error : '가입 승인 대기중인 회원입니다.', |
107 | }; | 107 | }; |
108 | return; | 108 | return; |
109 | - } else if(existDoctorInfo.useYn === 'N') { | 109 | + } else if(existDoctorInfo && existDoctorInfo.useYn === 'N') { |
110 | ctx.status = 401; | 110 | ctx.status = 401; |
111 | ctx.body = { | 111 | ctx.body = { |
112 | error : '가입이 거절된 회원입니다.', | 112 | error : '가입이 거절된 회원입니다.', | ... | ... |
... | @@ -30,4 +30,11 @@ export default { | ... | @@ -30,4 +30,11 @@ export default { |
30 | }, | 30 | }, |
31 | }); | 31 | }); |
32 | }, | 32 | }, |
33 | + validateDoctorLicense : (token : RecoilState<any>, Data : any) => { | ||
34 | + return client.post('/manage/doctor/validate', Data, { | ||
35 | + headers : { | ||
36 | + Authorization : token, | ||
37 | + }, | ||
38 | + }); | ||
39 | + }, | ||
33 | }; | 40 | }; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -21,11 +21,13 @@ const ManagerMenuContainer = (props : ManagerMenuProps) => { | ... | @@ -21,11 +21,13 @@ const ManagerMenuContainer = (props : ManagerMenuProps) => { |
21 | 21 | ||
22 | const [doctorDetail, setDoctorDetail] = useState<any>({}); | 22 | const [doctorDetail, setDoctorDetail] = useState<any>({}); |
23 | const [modalUp, setModalUp] = useState<boolean>(false); | 23 | const [modalUp, setModalUp] = useState<boolean>(false); |
24 | + const [validate, setValidate] = useState<string>('W'); | ||
24 | 25 | ||
25 | 26 | ||
26 | 27 | ||
27 | const fetchData = async() => { | 28 | const fetchData = async() => { |
28 | setModalUp(false); | 29 | setModalUp(false); |
30 | + setValidate('W'); | ||
29 | 31 | ||
30 | try { | 32 | try { |
31 | await managerApi.getDoctorRegReqList(token) | 33 | await managerApi.getDoctorRegReqList(token) |
... | @@ -43,6 +45,8 @@ const ManagerMenuContainer = (props : ManagerMenuProps) => { | ... | @@ -43,6 +45,8 @@ const ManagerMenuContainer = (props : ManagerMenuProps) => { |
43 | 45 | ||
44 | 46 | ||
45 | const onViewDetailReq = async (doctorId : string) => { | 47 | const onViewDetailReq = async (doctorId : string) => { |
48 | + setValidate('W'); | ||
49 | + | ||
46 | try { | 50 | try { |
47 | await managerApi.getDoctorRegReqDetail(token, doctorId) | 51 | await managerApi.getDoctorRegReqDetail(token, doctorId) |
48 | .then((res : any) => { | 52 | .then((res : any) => { |
... | @@ -58,6 +62,14 @@ const ManagerMenuContainer = (props : ManagerMenuProps) => { | ... | @@ -58,6 +62,14 @@ const ManagerMenuContainer = (props : ManagerMenuProps) => { |
58 | 62 | ||
59 | //회원 가입 수락 | 63 | //회원 가입 수락 |
60 | const onAcceptRequest = () => { | 64 | const onAcceptRequest = () => { |
65 | + if(validate === 'W') { | ||
66 | + Alert.onError('먼저 의사의 자격번호가 유효한지 검증해주세요.', () => null); | ||
67 | + return; | ||
68 | + } else if(validate === 'N') { | ||
69 | + Alert.onError('유효한 자격 번호가 아닙니다.', () => null); | ||
70 | + return; | ||
71 | + } | ||
72 | + | ||
61 | const onAccept = async() => { | 73 | const onAccept = async() => { |
62 | try { | 74 | try { |
63 | await managerApi.acceptDoctorRegReq(token, doctorDetail) | 75 | await managerApi.acceptDoctorRegReq(token, doctorDetail) |
... | @@ -92,6 +104,28 @@ const ManagerMenuContainer = (props : ManagerMenuProps) => { | ... | @@ -92,6 +104,28 @@ const ManagerMenuContainer = (props : ManagerMenuProps) => { |
92 | Alert.onCheck('회원 가입 요청을 취소하시겠습니까?', onReject, () => null); | 104 | Alert.onCheck('회원 가입 요청을 취소하시겠습니까?', onReject, () => null); |
93 | }; | 105 | }; |
94 | 106 | ||
107 | + const onValidate = async () => { | ||
108 | + try { | ||
109 | + await managerApi.validateDoctorLicense(token, { | ||
110 | + doctorLicense : doctorDetail.info.doctorLicense, | ||
111 | + }).then(res => { | ||
112 | + if(res.statusText === 'OK') { | ||
113 | + setValidate(res.data.result ? 'Y' : 'N'); | ||
114 | + } | ||
115 | + }).catch(err => { | ||
116 | + Alert.onError(err.response.data, () => { | ||
117 | + setModalUp(false); | ||
118 | + setValidate('W'); | ||
119 | + }); | ||
120 | + }) | ||
121 | + } catch(e) { | ||
122 | + Alert.onError(e.response.data, () => { | ||
123 | + setModalUp(false); | ||
124 | + setValidate('W'); | ||
125 | + }); | ||
126 | + } | ||
127 | + }; | ||
128 | + | ||
95 | useEffect(() => { | 129 | useEffect(() => { |
96 | fetchData(); | 130 | fetchData(); |
97 | }, []); | 131 | }, []); |
... | @@ -104,6 +138,8 @@ const ManagerMenuContainer = (props : ManagerMenuProps) => { | ... | @@ -104,6 +138,8 @@ const ManagerMenuContainer = (props : ManagerMenuProps) => { |
104 | modalUp = {modalUp} | 138 | modalUp = {modalUp} |
105 | setModalUp = {setModalUp} | 139 | setModalUp = {setModalUp} |
106 | onViewDetailReq = {onViewDetailReq} | 140 | onViewDetailReq = {onViewDetailReq} |
141 | + validate = {validate} | ||
142 | + onValidate = {onValidate} | ||
107 | 143 | ||
108 | onAcceptRequest = {onAcceptRequest} | 144 | onAcceptRequest = {onAcceptRequest} |
109 | onRejectRequest = {onRejectRequest} | 145 | onRejectRequest = {onRejectRequest} | ... | ... |
... | @@ -13,6 +13,8 @@ interface ManagerMenuProps { | ... | @@ -13,6 +13,8 @@ interface ManagerMenuProps { |
13 | modalUp : boolean; | 13 | modalUp : boolean; |
14 | setModalUp : any; | 14 | setModalUp : any; |
15 | onViewDetailReq : (arg0 : string) => void; | 15 | onViewDetailReq : (arg0 : string) => void; |
16 | + validate : string; | ||
17 | + onValidate : () => void; | ||
16 | 18 | ||
17 | onAcceptRequest : () => void; | 19 | onAcceptRequest : () => void; |
18 | onRejectRequest : () => void; | 20 | onRejectRequest : () => void; |
... | @@ -42,7 +44,23 @@ const ManagerMenuPresenter = (props : ManagerMenuProps) => { | ... | @@ -42,7 +44,23 @@ const ManagerMenuPresenter = (props : ManagerMenuProps) => { |
42 | <styled.ModalBodyLeftAndRight> | 44 | <styled.ModalBodyLeftAndRight> |
43 | <styled.ModalInfoWrapper> | 45 | <styled.ModalInfoWrapper> |
44 | <styled.ModalInfoExplain>의사 자격 번호</styled.ModalInfoExplain> | 46 | <styled.ModalInfoExplain>의사 자격 번호</styled.ModalInfoExplain> |
45 | - <styled.ModalInfo>{props.doctorDetail.info.doctorLicense}</styled.ModalInfo> | 47 | + <styled.ModalInfo> |
48 | + {props.doctorDetail.info.doctorLicense} | ||
49 | + <styled.ValidateButton | ||
50 | + onClick = {props.onValidate} | ||
51 | + disabled = {props.validate !== 'W'} | ||
52 | + validate = {props.validate} | ||
53 | + > | ||
54 | + { | ||
55 | + props.validate === 'Y' ? | ||
56 | + '검증 완료' : | ||
57 | + props.validate === 'W' ? | ||
58 | + '검증' : | ||
59 | + props.validate === 'N' ? | ||
60 | + '검증 실패' : null | ||
61 | + } | ||
62 | + </styled.ValidateButton> | ||
63 | + </styled.ModalInfo> | ||
46 | </styled.ModalInfoWrapper> | 64 | </styled.ModalInfoWrapper> |
47 | <styled.ModalInfoWrapper> | 65 | <styled.ModalInfoWrapper> |
48 | <styled.ModalInfoExplain>이름</styled.ModalInfoExplain> | 66 | <styled.ModalInfoExplain>이름</styled.ModalInfoExplain> | ... | ... |
... | @@ -194,6 +194,43 @@ export const ModalInfo = styled.div ` | ... | @@ -194,6 +194,43 @@ export const ModalInfo = styled.div ` |
194 | margin : 5px 0 20px 0; | 194 | margin : 5px 0 20px 0; |
195 | font-size : 20px; | 195 | font-size : 20px; |
196 | font-weight : 700; | 196 | font-weight : 700; |
197 | + | ||
198 | + display : flex; | ||
199 | + flex-direction : row; | ||
200 | + align-items : center; | ||
201 | +`; | ||
202 | + | ||
203 | +export const ValidateButton = styled.button<{validate : string}> ` | ||
204 | + margin : 0 0 0 15px; | ||
205 | + padding : 2px 5px; | ||
206 | + | ||
207 | + border-radius : 3px; | ||
208 | + | ||
209 | + border : ${props => props.validate === 'W' ? '1px solid #343434' | ||
210 | + : props.validate === 'Y' ? '1px solid #337DFF' | ||
211 | + : props.validate === 'N' ? '1px solid #dedede' : 'transparent' | ||
212 | + }; | ||
213 | + background-color : ${props => props.validate === 'W' ? 'transparent' | ||
214 | + : props.validate === 'Y' ? '#377DFF' | ||
215 | + : props.validate === 'N' ? '#f2f2f2' : 'transparent' | ||
216 | + }; | ||
217 | + color : ${props => props.validate === 'W' ? '#343434' | ||
218 | + : props.validate === 'Y' ? '#fff' | ||
219 | + : props.validate === 'N' ? '#a0a0a0' : 'transparent' | ||
220 | + }; | ||
221 | + | ||
222 | + | ||
223 | + transition : .25s all; | ||
224 | + | ||
225 | + :not(:disabled) { | ||
226 | + cursor : pointer; | ||
227 | + &:hover { | ||
228 | + background-color : #343434; | ||
229 | + color : #fff; | ||
230 | + border : 1px solid #343434; | ||
231 | + } | ||
232 | + } | ||
233 | + | ||
197 | `; | 234 | `; |
198 | 235 | ||
199 | export const ModalButtonWrapper = styled.div ` | 236 | export const ModalButtonWrapper = styled.div ` | ... | ... |
-
Please register or login to post a comment