demande autorisation soin ok
This commit is contained in:
parent
e47386f1c3
commit
894d031e78
2
App.js
2
App.js
|
@ -93,6 +93,7 @@ import ExecuterPrescriptionScreen from "./screens/wallet/agent/ExecuterPrescript
|
||||||
import ModifierFeuilleSoinScreen from "./screens/wallet/agent/ModifierFeuilleSoinScreen";
|
import ModifierFeuilleSoinScreen from "./screens/wallet/agent/ModifierFeuilleSoinScreen";
|
||||||
import ModifierExecutionPrescriptionScreen from "./screens/wallet/agent/ModifierExecutionPrescriptionScreen";
|
import ModifierExecutionPrescriptionScreen from "./screens/wallet/agent/ModifierExecutionPrescriptionScreen";
|
||||||
import HistoriqueNanoSanteUserScreen from "./screens/wallet/user/HistoriqueNanoSanteUserScreen";
|
import HistoriqueNanoSanteUserScreen from "./screens/wallet/user/HistoriqueNanoSanteUserScreen";
|
||||||
|
import DemandeAutorisationSoinScreen from "./screens/wallet/user/DemandeAutorisationSoinScreen";
|
||||||
|
|
||||||
|
|
||||||
const instructions = Platform.select({
|
const instructions = Platform.select({
|
||||||
|
@ -143,6 +144,7 @@ const AppStack = createDrawerNavigator({
|
||||||
addBeneficiaryScreen: AddBeneficiaryScreen,
|
addBeneficiaryScreen: AddBeneficiaryScreen,
|
||||||
insuranceSubscriptionScreen: InsuranceSubscriptionScreen,
|
insuranceSubscriptionScreen: InsuranceSubscriptionScreen,
|
||||||
validateConsultationScreen: ValidateConsultationScreen,
|
validateConsultationScreen: ValidateConsultationScreen,
|
||||||
|
demandeAutorisationSoinScreen: DemandeAutorisationSoinScreen,
|
||||||
validateConsultationDetailScreen: ValidateConsultationDetailScreen,
|
validateConsultationDetailScreen: ValidateConsultationDetailScreen,
|
||||||
activateBuySubscriptionScreen: ActivateBuySubscriptionScreen,
|
activateBuySubscriptionScreen: ActivateBuySubscriptionScreen,
|
||||||
historiqueNanoSanteUserScreen: HistoriqueNanoSanteUserScreen,
|
historiqueNanoSanteUserScreen: HistoriqueNanoSanteUserScreen,
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
/**
|
||||||
|
* Project iLinkWorld
|
||||||
|
* File SpinnerOverlayComponent
|
||||||
|
* Path components
|
||||||
|
* Created by BRICE ZELE
|
||||||
|
* Date: 01/02/2022
|
||||||
|
*/
|
||||||
|
import React, {ReactNode} from 'react';
|
||||||
|
import {ActivityIndicator, Modal, View} from 'react-native';
|
||||||
|
import Text from './Text';
|
||||||
|
import I18n from "react-native-i18n";
|
||||||
|
|
||||||
|
interface SpinnerOverlayProps {
|
||||||
|
show: boolean;
|
||||||
|
color?: string;
|
||||||
|
backgroundColor?: string;
|
||||||
|
dimLights?: number;
|
||||||
|
children: ReactNode;
|
||||||
|
loadingMessage?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SpinnerOverlay = ({
|
||||||
|
show = false,
|
||||||
|
color = '',
|
||||||
|
backgroundColor = '',
|
||||||
|
dimLights = 0.6,
|
||||||
|
loadingMessage = '',
|
||||||
|
children = null
|
||||||
|
}: SpinnerOverlayProps) => {
|
||||||
|
return (
|
||||||
|
<Modal transparent animationType="none" visible={show}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
backgroundColor: `rgba(0,0,0,${dimLights})`,
|
||||||
|
}}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
padding: 13,
|
||||||
|
backgroundColor: `transparent`,
|
||||||
|
borderRadius: 13,
|
||||||
|
}}>
|
||||||
|
{children !== null ?
|
||||||
|
React.Children.map(children, child =>
|
||||||
|
React.cloneElement(child, {}),
|
||||||
|
)
|
||||||
|
:
|
||||||
|
<ActivityIndicator
|
||||||
|
animating={show}
|
||||||
|
color="white"
|
||||||
|
size="large"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
<Text style={{color: 'white'}}>
|
||||||
|
{loadingMessage === ''
|
||||||
|
? I18n.t('LOADING_DOTS')
|
||||||
|
: loadingMessage}
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SpinnerOverlay;
|
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
import InsuranceActions from './insurance.type';
|
import InsuranceActions from './insurance.type';
|
||||||
import {
|
import {
|
||||||
|
autorisationCareRequestUrl,
|
||||||
consultationUrl,
|
consultationUrl,
|
||||||
createConsultationUrl,
|
createConsultationUrl,
|
||||||
executionPrescriptionUrl,
|
executionPrescriptionUrl,
|
||||||
|
@ -41,9 +42,9 @@ export const fetchGetListInsuranceError = (error: any) => ({
|
||||||
payload: error,
|
payload: error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetListInsurance = (idCountry) => {
|
export const fetchGetListInsurance = (idCountry, otherParam = '') => {
|
||||||
return ApiAction({
|
return ApiAction({
|
||||||
url: `${getInsuranceListUrl}/networks?country_id=${idCountry}`,
|
url: `${getInsuranceListUrl}/networks?country_id=${idCountry}${otherParam}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
onLoading: fetchGetListInsurancePending,
|
onLoading: fetchGetListInsurancePending,
|
||||||
onSuccess: fetchGetListInsuranceSuccess,
|
onSuccess: fetchGetListInsuranceSuccess,
|
||||||
|
@ -396,9 +397,9 @@ export const fetchGetNetworkActsError = (error: any) => ({
|
||||||
payload: error,
|
payload: error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNetworkActs = (network_id, code = '') => {
|
export const fetchGetNetworkActs = (network_id, code = '', otherParam = '') => {
|
||||||
return ApiAction({
|
return ApiAction({
|
||||||
url: `${getNetworkActsUrl}?network_id=${network_id}&code=${code}`,
|
url: `${getNetworkActsUrl}?network_id=${network_id}&code=${code}${otherParam}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
onLoading: fetchGetNetworkActsPending,
|
onLoading: fetchGetNetworkActsPending,
|
||||||
onSuccess: fetchGetNetworkActsSuccess,
|
onSuccess: fetchGetNetworkActsSuccess,
|
||||||
|
@ -596,3 +597,33 @@ export const fetchModifyPrescription = (id, data) => {
|
||||||
onError: fetchModifyPrescriptionError,
|
onError: fetchModifyPrescriptionError,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/************************************************************/
|
||||||
|
export const fetchDemaneAutorisationSoinPending = () => ({
|
||||||
|
type: InsuranceActions.DEMAND_AUTORISATION_PENDING,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchDemaneAutorisationSoinReset = () => ({
|
||||||
|
type: InsuranceActions.DEMAND_AUTORISATION_RESET,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchDemaneAutorisationSoinSuccess = (authkey: any) => ({
|
||||||
|
type: InsuranceActions.DEMAND_AUTORISATION_SUCCESS,
|
||||||
|
payload: authkey,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchDemaneAutorisationSoinError = (error: any) => ({
|
||||||
|
type: InsuranceActions.DEMAND_AUTORISATION_ERROR,
|
||||||
|
payload: error,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchDemaneAutorisationSoin = (data) => {
|
||||||
|
return ApiAction({
|
||||||
|
url: `${autorisationCareRequestUrl}`,
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
onLoading: fetchDemaneAutorisationSoinPending,
|
||||||
|
onSuccess: fetchDemaneAutorisationSoinSuccess,
|
||||||
|
onError: fetchDemaneAutorisationSoinError,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
|
@ -587,3 +587,33 @@ export const modifyPrescriptionReducer = (state = INITIAL_STATE, action: Insuran
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const demandeAutorisationSoinReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case InsuranceActions.DEMAND_AUTORISATION_PENDING:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
|
case InsuranceActions.DEMAND_AUTORISATION_SUCCESS:
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
result: action.payload,
|
||||||
|
error: null
|
||||||
|
}
|
||||||
|
case InsuranceActions.DEMAND_AUTORISATION_ERROR:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: action.payload
|
||||||
|
}
|
||||||
|
|
||||||
|
case InsuranceActions.DEMAND_AUTORISATION_RESET:
|
||||||
|
return INITIAL_STATE;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return state
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -26,6 +26,7 @@ const selectGetConsultationReducer = (state) => state.getConsultationReducer;
|
||||||
const selectAcceptRefuseConsultationReducer = (state) => state.acceptOrRejectConsultationReducer;
|
const selectAcceptRefuseConsultationReducer = (state) => state.acceptOrRejectConsultationReducer;
|
||||||
const selectExecutionPrescriptionReducerReducer = (state) => state.executionPrescriptionReducer;
|
const selectExecutionPrescriptionReducerReducer = (state) => state.executionPrescriptionReducer;
|
||||||
const selectModifyPrescriptionReducer = (state) => state.modifyPrescriptionReducer;
|
const selectModifyPrescriptionReducer = (state) => state.modifyPrescriptionReducer;
|
||||||
|
const selectDemandeAutorisationSoinReducer = (state) => state.demandeAutorisationSoinReducer;
|
||||||
|
|
||||||
export const selectInsuranceList = createSelector(
|
export const selectInsuranceList = createSelector(
|
||||||
[selectInsuranceListReducer],
|
[selectInsuranceListReducer],
|
||||||
|
@ -111,3 +112,8 @@ export const selectModifyPrescription = createSelector(
|
||||||
[selectModifyPrescriptionReducer],
|
[selectModifyPrescriptionReducer],
|
||||||
(modifyPrescriptionReducer) => modifyPrescriptionReducer
|
(modifyPrescriptionReducer) => modifyPrescriptionReducer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectDemandeAutorisationSoin = createSelector(
|
||||||
|
[selectDemandeAutorisationSoinReducer],
|
||||||
|
(demandeAutorisationSoin) => demandeAutorisationSoin
|
||||||
|
);
|
||||||
|
|
|
@ -100,5 +100,10 @@ const InsuranceActions = {
|
||||||
MODIFY_PRESCRIPTION_SUCCESS: 'MODIFY_PRESCRIPTION_SUCCESS',
|
MODIFY_PRESCRIPTION_SUCCESS: 'MODIFY_PRESCRIPTION_SUCCESS',
|
||||||
MODIFY_PRESCRIPTION_ERROR: 'MODIFY_PRESCRIPTION_ERROR',
|
MODIFY_PRESCRIPTION_ERROR: 'MODIFY_PRESCRIPTION_ERROR',
|
||||||
MODIFY_PRESCRIPTION_RESET: 'MODIFY_PRESCRIPTION_RESET',
|
MODIFY_PRESCRIPTION_RESET: 'MODIFY_PRESCRIPTION_RESET',
|
||||||
|
|
||||||
|
DEMAND_AUTORISATION_PENDING: 'DEMAND_AUTORISATION_PENDING',
|
||||||
|
DEMAND_AUTORISATION_SUCCESS: 'DEMAND_AUTORISATION_SUCCESS',
|
||||||
|
DEMAND_AUTORISATION_ERROR: 'DEMAND_AUTORISATION_ERROR',
|
||||||
|
DEMAND_AUTORISATION_RESET: 'DEMAND_AUTORISATION_RESET',
|
||||||
}
|
}
|
||||||
export default InsuranceActions;
|
export default InsuranceActions;
|
||||||
|
|
|
@ -55,7 +55,11 @@ import {
|
||||||
activatePaySubscriptionReducer,
|
activatePaySubscriptionReducer,
|
||||||
addBeneficiaryToSubscriptionReducer,
|
addBeneficiaryToSubscriptionReducer,
|
||||||
addDrugReducer,
|
addDrugReducer,
|
||||||
createConsultationReducer, executionPrescriptionReducer, getAmountConsultationReducer, getConsultationReducer,
|
createConsultationReducer,
|
||||||
|
demandeAutorisationSoinReducer,
|
||||||
|
executionPrescriptionReducer,
|
||||||
|
getAmountConsultationReducer,
|
||||||
|
getConsultationReducer,
|
||||||
getDrugAppareilReducer,
|
getDrugAppareilReducer,
|
||||||
getInsurancePrimeAmountReducer,
|
getInsurancePrimeAmountReducer,
|
||||||
getNetworkActReducer,
|
getNetworkActReducer,
|
||||||
|
@ -63,7 +67,8 @@ import {
|
||||||
getSubscriptionListReducer,
|
getSubscriptionListReducer,
|
||||||
getUserByIdQRCodeReducer,
|
getUserByIdQRCodeReducer,
|
||||||
getUserByNameOrNumberReducer,
|
getUserByNameOrNumberReducer,
|
||||||
insuranceListReducer, modifyPrescriptionReducer,
|
insuranceListReducer,
|
||||||
|
modifyPrescriptionReducer,
|
||||||
subscribeInsuranceReducer,
|
subscribeInsuranceReducer,
|
||||||
uploadInsuranceImagesReducer
|
uploadInsuranceImagesReducer
|
||||||
} from "../insurance/insurance.reducer";
|
} from "../insurance/insurance.reducer";
|
||||||
|
@ -171,7 +176,8 @@ const rootReducer = persistCombineReducers(persistConfig, {
|
||||||
getConsultationReducer: getConsultationReducer,
|
getConsultationReducer: getConsultationReducer,
|
||||||
acceptOrRejectConsultationReducer: acceptOrRejectConsultationReducer,
|
acceptOrRejectConsultationReducer: acceptOrRejectConsultationReducer,
|
||||||
executionPrescriptionReducer: executionPrescriptionReducer,
|
executionPrescriptionReducer: executionPrescriptionReducer,
|
||||||
modifyPrescriptionReducer: modifyPrescriptionReducer
|
modifyPrescriptionReducer: modifyPrescriptionReducer,
|
||||||
|
demandeAutorisationSoinReducer: demandeAutorisationSoinReducer
|
||||||
});
|
});
|
||||||
|
|
||||||
export default rootReducer;
|
export default rootReducer;
|
||||||
|
|
|
@ -273,7 +273,8 @@ export default class OptionsMenu extends Component {
|
||||||
|| item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent'
|
|| item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent'
|
||||||
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser' || item === 'insuranceSubscriptionScreen'
|
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser' || item === 'insuranceSubscriptionScreen'
|
||||||
|| item === 'addBeneficiaryScreen' || item === 'activateBuySubscriptionScreen' || item === 'saisirFeuilleSoinScreen' || item === 'validateConsultationScreen' || item === 'validateConsultationDetailScreen'
|
|| item === 'addBeneficiaryScreen' || item === 'activateBuySubscriptionScreen' || item === 'saisirFeuilleSoinScreen' || item === 'validateConsultationScreen' || item === 'validateConsultationDetailScreen'
|
||||||
|| item === 'executerPrescriptionScreen' || item === 'modifierFeuilleSoinScreen' || item === 'modifierExecutionPrescriptionScreen' || item === 'historiqueNanoSanteUserScreen') {
|
|| item === 'executerPrescriptionScreen' || item === 'modifierFeuilleSoinScreen' || item === 'modifierExecutionPrescriptionScreen' || item === 'historiqueNanoSanteUserScreen'
|
||||||
|
|| item === 'demandeAutorisationSoinScreen') {
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
const color = this.state.currentId === item.id ? theme.accent : "grey"
|
const color = this.state.currentId === item.id ? theme.accent : "grey"
|
||||||
|
|
|
@ -0,0 +1,406 @@
|
||||||
|
/**
|
||||||
|
* Project iLinkWorld
|
||||||
|
* File DemandeAutorisationSoinScreen
|
||||||
|
* Path screens/wallet/user
|
||||||
|
* Created by BRICE ZELE
|
||||||
|
* Date: 01/02/2022
|
||||||
|
*/
|
||||||
|
import React, {useEffect, useState} from 'react';
|
||||||
|
import {
|
||||||
|
ActivityIndicator,
|
||||||
|
Alert,
|
||||||
|
Dimensions,
|
||||||
|
KeyboardAvoidingView,
|
||||||
|
Platform,
|
||||||
|
ProgressBarAndroid,
|
||||||
|
ScrollView,
|
||||||
|
StyleSheet,
|
||||||
|
TouchableOpacity,
|
||||||
|
View,
|
||||||
|
} from 'react-native';
|
||||||
|
import {connect, useDispatch} from 'react-redux';
|
||||||
|
import {Color} from "../../../config/Color";
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import {ScreenComponent} from "../../../components/ScreenComponent";
|
||||||
|
import {
|
||||||
|
fetchAcceptRejectConsultation,
|
||||||
|
fetchAcceptRejectConsultationReset,
|
||||||
|
fetchActivePaySubscription, fetchDemaneAutorisationSoin, fetchDemaneAutorisationSoinReset,
|
||||||
|
fetchGetConsultation,
|
||||||
|
fetchGetConsultationReset,
|
||||||
|
fetchGetListInsurance,
|
||||||
|
fetchGetListInsuranceReset,
|
||||||
|
fetchGetNetworkActs
|
||||||
|
} from "../../../redux/insurance/insurance.actions";
|
||||||
|
import DropdownAlert from "react-native-dropdownalert";
|
||||||
|
import {createStructuredSelector} from "reselect";
|
||||||
|
import {
|
||||||
|
selectAcceptRefuseConsultation,
|
||||||
|
selectActivatePaySubscription, selectDemandeAutorisationSoin,
|
||||||
|
selectGetConsultation, selectGetNetworkAct,
|
||||||
|
selectInsuranceList,
|
||||||
|
selectSubscriptionList
|
||||||
|
} from "../../../redux/insurance/insurance.selector";
|
||||||
|
import {readUser} from "../../../webservice/AuthApi";
|
||||||
|
import Text from '../../../components/Text';
|
||||||
|
import * as Utils from "../../../utils/UtilsFunction";
|
||||||
|
import {uppercaseFirstLetter} from "../../../utils/UtilsFunction";
|
||||||
|
import Dialog from "react-native-dialog";
|
||||||
|
import {Typography} from "../../../config/typography";
|
||||||
|
import {store} from "../../../redux/store";
|
||||||
|
import {Formik} from "formik";
|
||||||
|
import * as Animatable from "react-native-animatable";
|
||||||
|
import {responsiveWidth} from "react-native-responsive-dimensions";
|
||||||
|
import {Dropdown} from "react-native-material-dropdown";
|
||||||
|
import PasswordInput from "../../../components/PasswordInput";
|
||||||
|
import FontAwesome from "react-native-vector-icons/FontAwesome";
|
||||||
|
import Button from "../../../components/Button";
|
||||||
|
import * as Yup from "yup";
|
||||||
|
import SpinnerOverlay from "../../../components/SpinnerOverlayComponent";
|
||||||
|
|
||||||
|
|
||||||
|
let moment = require('moment-timezone');
|
||||||
|
|
||||||
|
const {width, height} = Dimensions.get('window');
|
||||||
|
|
||||||
|
const DemandeAutorisationSoinScreen = ({
|
||||||
|
navigation,
|
||||||
|
fetchGetNetworkActs,
|
||||||
|
fetchAcceptRejectConsultation,
|
||||||
|
fetchGetListInsurance,
|
||||||
|
fetchDemaneAutorisationSoin,
|
||||||
|
getConsultation,
|
||||||
|
insuranceList,
|
||||||
|
getNetworkAct,
|
||||||
|
demandeAutorisationSoin
|
||||||
|
}) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const [user, setUser] = useState(null);
|
||||||
|
const [displayModalHistory, setDisplayModalHistory] = useState(false);
|
||||||
|
const [historyItemDetail, setHistoryItemDetail] = useState({});
|
||||||
|
const [wallet] = useState(store.getState().walletDetailReducer.result.response);
|
||||||
|
const [insurances, setInsurances] = useState([]);
|
||||||
|
const [insurance, setInsurance] = useState(null);
|
||||||
|
|
||||||
|
let insurancesRef = null;
|
||||||
|
let codeActeRef = null;
|
||||||
|
|
||||||
|
let dropDownAlertRef: any = null;
|
||||||
|
|
||||||
|
const RegisterSchema = Yup.object().shape({
|
||||||
|
password: Yup.string()
|
||||||
|
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
dispatch(fetchGetConsultationReset());
|
||||||
|
dispatch(fetchGetListInsuranceReset());
|
||||||
|
dispatch(fetchAcceptRejectConsultationReset());
|
||||||
|
readUser().then((user) => {
|
||||||
|
setUser(user);
|
||||||
|
console.log("User", user);
|
||||||
|
fetchGetListInsurance(user.country_id, `&user_id=${user.id}`);
|
||||||
|
//fetchGetConsultation(user.id, 'ACCEPTED', '');
|
||||||
|
});
|
||||||
|
//fetchGetNetworkActs(wallet.idNetwork, '', '&authorization_type=PRIOR');
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (getConsultation.error) {
|
||||||
|
dropDownAlertRef.alertWithType(
|
||||||
|
'error',
|
||||||
|
I18n.t('ERROR_LABEL'),
|
||||||
|
Utils.getErrorMsg(getConsultation),
|
||||||
|
);
|
||||||
|
dispatch(fetchGetConsultationReset());
|
||||||
|
}
|
||||||
|
}, [getConsultation]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (insuranceList.result !== null) {
|
||||||
|
let insuranceListTemp = [];
|
||||||
|
insuranceList.result.response.map((insuranceItem, index) => {
|
||||||
|
insuranceListTemp.push(insuranceItem);
|
||||||
|
});
|
||||||
|
setInsurances(insuranceListTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insuranceList.error) {
|
||||||
|
dropDownAlertRef.alertWithType(
|
||||||
|
'error',
|
||||||
|
I18n.t('ERROR_LABEL'),
|
||||||
|
Utils.getErrorMsg(insuranceList),
|
||||||
|
);
|
||||||
|
dispatch(fetchGetListInsuranceReset());
|
||||||
|
}
|
||||||
|
}, [insuranceList]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (demandeAutorisationSoin.result !== null) {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("SUCCESS"),
|
||||||
|
demandeAutorisationSoin.result.response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
dispatch(fetchDemaneAutorisationSoinReset());
|
||||||
|
navigation.goBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{cancelable: false}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (demandeAutorisationSoin.error) {
|
||||||
|
dropDownAlertRef.alertWithType(
|
||||||
|
'error',
|
||||||
|
I18n.t('ERROR_LABEL'),
|
||||||
|
Utils.getErrorMsg(demandeAutorisationSoin),
|
||||||
|
);
|
||||||
|
dispatch(fetchDemaneAutorisationSoinReset());
|
||||||
|
}
|
||||||
|
}, [demandeAutorisationSoin]);
|
||||||
|
|
||||||
|
const renderLoader = () => (
|
||||||
|
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
|
||||||
|
{Platform.OS === 'android'
|
||||||
|
?
|
||||||
|
(
|
||||||
|
<>
|
||||||
|
<ProgressBarAndroid/>
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
|
||||||
|
</>
|
||||||
|
) :
|
||||||
|
<>
|
||||||
|
<ActivityIndicator size="large" color={'#ccc'}/>
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<ScreenComponent>
|
||||||
|
<DropdownAlert ref={ref => (dropDownAlertRef = ref)}/>
|
||||||
|
<SpinnerOverlay show={getNetworkAct.loading} />
|
||||||
|
<KeyboardAvoidingView
|
||||||
|
behavior={Platform.OS === 'android' ? 'height' : 'padding'}
|
||||||
|
style={{flex: 1}}>
|
||||||
|
|
||||||
|
<ScrollView style={{flex: 1}}>
|
||||||
|
<Formik validationSchema={RegisterSchema}
|
||||||
|
initialValues={{
|
||||||
|
password: '',
|
||||||
|
code_acte: ''
|
||||||
|
}}
|
||||||
|
onSubmit={(values) => {
|
||||||
|
if (user !== null) {
|
||||||
|
if (insurance === null) {
|
||||||
|
insurancesRef.shake(800);
|
||||||
|
} else if (values.code_acte === '')
|
||||||
|
codeActeRef.shake(200)
|
||||||
|
else {
|
||||||
|
|
||||||
|
fetchDemaneAutorisationSoin({
|
||||||
|
act_id: values.code_acte,
|
||||||
|
user_id: user.id,
|
||||||
|
password: values.password
|
||||||
|
});
|
||||||
|
console.log(user);
|
||||||
|
console.log("insurance", insurance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
|
||||||
|
{({
|
||||||
|
values,
|
||||||
|
errors,
|
||||||
|
touched,
|
||||||
|
handleChange,
|
||||||
|
handleBlur,
|
||||||
|
setFieldValue,
|
||||||
|
setFieldTouched,
|
||||||
|
handleSubmit,
|
||||||
|
isSubmitting,
|
||||||
|
}) => (<>
|
||||||
|
{
|
||||||
|
insuranceList.loading
|
||||||
|
? renderLoader()
|
||||||
|
: insuranceList.result ?
|
||||||
|
<View style={styles.contain}>
|
||||||
|
<Animatable.View ref={(comp) => {
|
||||||
|
insurancesRef = comp
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('SELECT_INSURANCE')}
|
||||||
|
data={insurances}
|
||||||
|
useNativeDriver={true}
|
||||||
|
onChangeText={(value, index, data) => {
|
||||||
|
console.log("Value", value);
|
||||||
|
setInsurance(value);
|
||||||
|
dispatch(fetchGetConsultationReset());
|
||||||
|
fetchGetNetworkActs(value.id, '', '&authorization_type=PRIOR')
|
||||||
|
}}
|
||||||
|
valueExtractor={(value) => {
|
||||||
|
return value
|
||||||
|
}}
|
||||||
|
labelExtractor={(value) => {
|
||||||
|
return value.name
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => {
|
||||||
|
codeActeRef = comp
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
marginTop: 10,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('CODE_ACTE')}
|
||||||
|
data={getNetworkAct.result !== null ? getNetworkAct.result?.response : []}
|
||||||
|
useNativeDriver={true}
|
||||||
|
onChangeText={(value, index, data) => {
|
||||||
|
setFieldTouched('code_acte');
|
||||||
|
setFieldValue('code_acte', value.id);
|
||||||
|
}}
|
||||||
|
valueExtractor={(value) => {
|
||||||
|
return value
|
||||||
|
}}
|
||||||
|
labelExtractor={(value) => {
|
||||||
|
return value.name
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<PasswordInput
|
||||||
|
style={{marginTop: 10}}
|
||||||
|
onChangeText={handleChange('password')}
|
||||||
|
placeholder={I18n.t('PASSWORD')}
|
||||||
|
secureTextEntry
|
||||||
|
icon={<FontAwesome name="lock" size={20}/>}
|
||||||
|
value={values.password}
|
||||||
|
onBlur={handleBlur('password')}
|
||||||
|
success={touched.password && !errors.password}
|
||||||
|
touched={touched.password}
|
||||||
|
error={errors.password}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style={{marginTop: 20}}
|
||||||
|
full
|
||||||
|
loading={demandeAutorisationSoin.loading}
|
||||||
|
onPress={handleSubmit}>
|
||||||
|
{I18n.t('SUBMIT_LABEL')}
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
: null}
|
||||||
|
</>)}
|
||||||
|
</Formik>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
</KeyboardAvoidingView>
|
||||||
|
|
||||||
|
{/* {getConsultation.loading
|
||||||
|
? renderLoader()
|
||||||
|
: getConsultation.result !== null ?
|
||||||
|
(
|
||||||
|
<FlatList
|
||||||
|
style={{flex: 1}}
|
||||||
|
ListEmptyComponent={() => {
|
||||||
|
return (
|
||||||
|
<Text>{I18n.t('NO_CONSULTATION_DEMAND')}</Text>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
data={[]}
|
||||||
|
keyExtractor={(item, index) => item.id}
|
||||||
|
renderItem={({item, index}) => (
|
||||||
|
renderItem(item)
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
: null}*/}
|
||||||
|
</ScreenComponent>
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
subscriptionList: selectSubscriptionList,
|
||||||
|
insuranceList: selectInsuranceList,
|
||||||
|
activatePaySubscription: selectActivatePaySubscription,
|
||||||
|
getConsultation: selectGetConsultation,
|
||||||
|
getNetworkAct: selectGetNetworkAct,
|
||||||
|
demandeAutorisationSoin: selectDemandeAutorisationSoin
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, {
|
||||||
|
fetchActivePaySubscription,
|
||||||
|
fetchGetNetworkActs,
|
||||||
|
fetchAcceptRejectConsultation,
|
||||||
|
fetchGetListInsurance,
|
||||||
|
fetchDemaneAutorisationSoin
|
||||||
|
})(
|
||||||
|
DemandeAutorisationSoinScreen,
|
||||||
|
);
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
textInput: {
|
||||||
|
height: 46,
|
||||||
|
backgroundColor: Color.fieldColor,
|
||||||
|
borderRadius: 5,
|
||||||
|
marginTop: 10,
|
||||||
|
padding: 10,
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
|
lineRow: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
paddingBottom: 20,
|
||||||
|
},
|
||||||
|
contain: {
|
||||||
|
marginTop: 20,
|
||||||
|
paddingBottom: 20,
|
||||||
|
paddingLeft: 10,
|
||||||
|
paddingRight: 10,
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
padding: 10,
|
||||||
|
marginBottom: 10,
|
||||||
|
borderRadius: 8
|
||||||
|
},
|
||||||
|
contentTop: {
|
||||||
|
flexDirection: "row",
|
||||||
|
paddingBottom: 10,
|
||||||
|
borderBottomWidth: 1
|
||||||
|
},
|
||||||
|
|
||||||
|
contentBottom: {
|
||||||
|
flexDirection: "row",
|
||||||
|
marginTop: 10,
|
||||||
|
justifyContent: "space-between"
|
||||||
|
},
|
||||||
|
bottomLeft: {flexDirection: "row", alignItems: "center"},
|
||||||
|
image: {width: 32, height: 32, marginRight: 10, borderRadius: 16},
|
||||||
|
blockView: {
|
||||||
|
paddingVertical: 10,
|
||||||
|
borderBottomWidth: 0.5,
|
||||||
|
},
|
||||||
|
});
|
|
@ -524,7 +524,7 @@ export const optionNanoSanteUserScreen = {
|
||||||
{
|
{
|
||||||
icon: 'account-multiple',
|
icon: 'account-multiple',
|
||||||
title: 'DEMAND_AUTORIZATION_HEALTH',
|
title: 'DEMAND_AUTORIZATION_HEALTH',
|
||||||
screen: ''
|
screen: 'demandeAutorisationSoinScreen'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'HISTORIC_HEALTH',
|
title: 'HISTORIC_HEALTH',
|
||||||
|
|
|
@ -93,6 +93,7 @@ export const executionPrescriptionUrl = testBaseUrl + '/nanoSanteService/health-
|
||||||
export const consultationUrl = testBaseUrl + '/nanoSanteService/health-care-sheets';
|
export const consultationUrl = testBaseUrl + '/nanoSanteService/health-care-sheets';
|
||||||
export const getAmountConsultationUrl = testBaseUrl + '/nanoSanteService/health-care-sheets/performances-amount';
|
export const getAmountConsultationUrl = testBaseUrl + '/nanoSanteService/health-care-sheets/performances-amount';
|
||||||
export const getInsurancePrimeAmountUrl = testBaseUrl + '/nanoSanteService/insurances/subscriptions/bonus-amount';
|
export const getInsurancePrimeAmountUrl = testBaseUrl + '/nanoSanteService/insurances/subscriptions/bonus-amount';
|
||||||
|
export const autorisationCareRequestUrl = testBaseUrl + '/nanoSanteService/authorizations-care-requests';
|
||||||
export const uploadInsuranceImagetUrl = 'https://test.ilink-app.com:8086/insurances/subscriptions/upload-images';
|
export const uploadInsuranceImagetUrl = 'https://test.ilink-app.com:8086/insurances/subscriptions/upload-images';
|
||||||
|
|
||||||
export const authKeyUrl = testBaseUrl + '/oauth/token';
|
export const authKeyUrl = testBaseUrl + '/oauth/token';
|
||||||
|
|
Loading…
Reference in New Issue