Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions apis/AccessRequestApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const getHospitalList = async () => {
};

// 환자 번호 검증
// TODO: X-Hospital-Id 수정
export const verifyPatientCode = async (patientCode) => {
const response = await axios.post(
'/patients/code',
Expand All @@ -21,3 +22,13 @@ export const verifyPatientCode = async (patientCode) => {

return response.data;
};

// 병원의 출입증 발급 가능 날짜 조회
export const getAvailableDates = async (hospitalId) => {
const response = await axios.get('/hospitals/policies/available-dates', {
headers: {
'X-Hospital-Id': hospitalId,
},
});
return response.data.data.availableDates;
};
3 changes: 2 additions & 1 deletion app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export default {
favicon: './assets/images/logoIcon.png',
},
extra: {
BASE_URL: 'http://192.168.0.181:8081', // 본인 pc IPv4 주소로 수정하세용
BASE_URL: 'http://keywe.site', // EKS 사용시
//BASE_URL: 'http://192.168.0.181:8081', // 도커 사용시 - 본인 pc IPv4 주소로 수정하세용
},
},
};
32 changes: 19 additions & 13 deletions pages/AccessRequestRolePage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect } from 'react';
import { View, Text } from 'react-native';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import { styles } from './styles/AccessRequestRolePage.styles';
Expand All @@ -8,14 +9,30 @@ import NormalAlert from '../components/alerts/NormalAlert';
import PatientVerficationForm from '../components/accessRequest/PatientVerficationForm';
import GuardianVerificationForm from '../components/accessRequest/GuardianVerificationForm';
import { useNavigation } from '@react-navigation/native';
import { getAvailableDates } from '../apis/AccessRequestApi';

const AccessRequestRolePage = ({ route }) => {
const { hospitalName } = route.params;
const { hospitalId, hospitalName } = route.params;

const [role, setRole] = useState('patient');
const [isVerified, setIsVerified] = useState(false); // 검증 여부
const [verifiedData, setVerifiedData] = useState(null); // 자식 컴포넌트의 검증 정보
const [checkedDates, setCheckedDates] = useState([]);
const [availableDates, setAvailableDates] = useState([]); // 방문 가능 날짜 설정

// 방문 가능 날짜 불러오기
useEffect(() => {
const fetchAvailableDates = async () => {
try {
const dates = await getAvailableDates(hospitalId);
setAvailableDates(dates);
} catch (error) {
console.error('방문 가능 날짜 불러오기 실패:', error);
}
};

fetchAvailableDates();
}, [hospitalId]);

// Alert 관리 상태변수
const [showConfirmAlert, setShowConfirmAlert] = useState(false);
Expand Down Expand Up @@ -111,18 +128,7 @@ const AccessRequestRolePage = ({ route }) => {
{isVerified && (
<>
<Text style={styles.contentTitle}>방문 일시 선택</Text>
<NormalCheckbox
labels={[
'2025-08-02',
'2025-08-03',
'2025-08-04',
'2025-08-05',
'2025-08-06',
'2025-08-07',
'2025-08-08',
]}
onChangeHandler={handleDateCheckbox}
/>
<NormalCheckbox labels={availableDates} onChangeHandler={handleDateCheckbox} />
<NormalButton
title="방문증 신청"
onPressHandler={handleSubmitButton}
Expand Down