Delete ayant droit

This commit is contained in:
Brice Zele 2022-02-04 10:54:28 +01:00
parent 894d031e78
commit 524c4f8860
13 changed files with 837 additions and 31 deletions

2
App.js
View File

@ -94,6 +94,7 @@ import ModifierFeuilleSoinScreen from "./screens/wallet/agent/ModifierFeuilleSoi
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"; import DemandeAutorisationSoinScreen from "./screens/wallet/user/DemandeAutorisationSoinScreen";
import DeleteBeneficiaryScreen from "./screens/wallet/user/DeleteBeneficiaryScreen";
const instructions = Platform.select({ const instructions = Platform.select({
@ -148,6 +149,7 @@ const AppStack = createDrawerNavigator({
validateConsultationDetailScreen: ValidateConsultationDetailScreen, validateConsultationDetailScreen: ValidateConsultationDetailScreen,
activateBuySubscriptionScreen: ActivateBuySubscriptionScreen, activateBuySubscriptionScreen: ActivateBuySubscriptionScreen,
historiqueNanoSanteUserScreen: HistoriqueNanoSanteUserScreen, historiqueNanoSanteUserScreen: HistoriqueNanoSanteUserScreen,
deleteBeneficiaryScreen: DeleteBeneficiaryScreen,
retraitWalletVersCashUser: RetraitWalletVersCashUser, retraitWalletVersCashUser: RetraitWalletVersCashUser,
retraitCarteVersCashUser: RetraitCarteVersCashUser, retraitCarteVersCashUser: RetraitCarteVersCashUser,
retraitCarteVersWalletUser: RetraitCarteVersWalletUser, retraitCarteVersWalletUser: RetraitCarteVersWalletUser,

File diff suppressed because one or more lines are too long

View File

@ -700,5 +700,7 @@
"SOINS": "Soins", "SOINS": "Soins",
"NETWORK": "Réseau", "NETWORK": "Réseau",
"TOTAL_BONUS_AMOUNT": "Total de la prime", "TOTAL_BONUS_AMOUNT": "Total de la prime",
"BONUS_AMOUNT": "Montant de la prime de base" "BONUS_AMOUNT": "Montant de la prime de base",
"MONTANT_ASSURANCE": "Montant de l'assurance",
"MONTANT_ASSURE": "Montant de l'assuré"
} }

View File

@ -619,7 +619,7 @@ export const fetchDemaneAutorisationSoinError = (error: any) => ({
export const fetchDemaneAutorisationSoin = (data) => { export const fetchDemaneAutorisationSoin = (data) => {
return ApiAction({ return ApiAction({
url: `${autorisationCareRequestUrl}`, url: `${autorisationCareRequestUrl}${otherParam}`,
method: 'POST', method: 'POST',
data, data,
onLoading: fetchDemaneAutorisationSoinPending, onLoading: fetchDemaneAutorisationSoinPending,
@ -627,3 +627,44 @@ export const fetchDemaneAutorisationSoin = (data) => {
onError: fetchDemaneAutorisationSoinError, onError: fetchDemaneAutorisationSoinError,
}); });
}; };
export const fetchGetDemandeAutorisationSoin = (param = '') => {
return ApiAction({
url: `${autorisationCareRequestUrl}${param}`,
method: 'GET',
onLoading: fetchGetConsultationPending,
onSuccess: fetchGetConsultationSuccess,
onError: fetchGetConsultationError
});
};
/************************************************************/
export const fetchDeleteBeneficiaryPending = () => ({
type: InsuranceActions.DELETE_BENEFICIARY_PENDING,
});
export const fetchDeleteBeneficiaryReset = () => ({
type: InsuranceActions.DELETE_BENEFICIARY_RESET,
});
export const fetchDeleteBeneficiarySuccess = (authkey: any) => ({
type: InsuranceActions.DELETE_BENEFICIARY_SUCCESS,
payload: authkey,
});
export const fetchDeleteBeneficiaryError = (error: any) => ({
type: InsuranceActions.DELETE_BENEFICIARY_ERROR,
payload: error,
});
export const fetchDeleteBeneficiary = (id, data) => {
return ApiAction({
url: `${getInsuranceListUrl}/${id}/delete-beneficiaries`,
method: 'PUT',
data,
onLoading: fetchDeleteBeneficiaryPending,
onSuccess: fetchDeleteBeneficiarySuccess,
onError: fetchDeleteBeneficiaryError,
});
};

View File

@ -617,3 +617,33 @@ export const demandeAutorisationSoinReducer = (state = INITIAL_STATE, action: In
} }
}; };
export const deleteBeneficiaryeducer = (state = INITIAL_STATE, action: InsuranceActions) => {
switch (action.type) {
case InsuranceActions.DELETE_BENEFICIARY_PENDING:
return {
...state,
loading: true
}
case InsuranceActions.DELETE_BENEFICIARY_SUCCESS:
return {
loading: false,
result: action.payload,
error: null
}
case InsuranceActions.DELETE_BENEFICIARY_ERROR:
return {
...state,
loading: false,
result: null,
error: action.payload
}
case InsuranceActions.DELETE_BENEFICIARY_RESET:
return INITIAL_STATE;
default:
return state
}
};

View File

@ -6,6 +6,7 @@
* Date: 13/09/2021 * Date: 13/09/2021
*/ */
import {createSelector} from "reselect"; import {createSelector} from "reselect";
import {deleteBeneficiaryeducer} from "./insurance.reducer";
const selectInsuranceListReducer = (state) => state.insuranceList; const selectInsuranceListReducer = (state) => state.insuranceList;
const selectSubscribeInsuranceReducer = (state) => state.subscribeInsurance; const selectSubscribeInsuranceReducer = (state) => state.subscribeInsurance;
@ -27,6 +28,7 @@ const selectAcceptRefuseConsultationReducer = (state) => state.acceptOrRejectCon
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; const selectDemandeAutorisationSoinReducer = (state) => state.demandeAutorisationSoinReducer;
const selectDeleteBeneficiaryeducerReducer = (state) => state.deleteBeneficiaryeducer;
export const selectInsuranceList = createSelector( export const selectInsuranceList = createSelector(
[selectInsuranceListReducer], [selectInsuranceListReducer],
@ -117,3 +119,8 @@ export const selectDemandeAutorisationSoin = createSelector(
[selectDemandeAutorisationSoinReducer], [selectDemandeAutorisationSoinReducer],
(demandeAutorisationSoin) => demandeAutorisationSoin (demandeAutorisationSoin) => demandeAutorisationSoin
); );
export const selectDeleteBeneficiary = createSelector(
[selectDeleteBeneficiaryeducerReducer],
(deleteBeneficiary) => deleteBeneficiary
);

View File

@ -105,5 +105,10 @@ const InsuranceActions = {
DEMAND_AUTORISATION_SUCCESS: 'DEMAND_AUTORISATION_SUCCESS', DEMAND_AUTORISATION_SUCCESS: 'DEMAND_AUTORISATION_SUCCESS',
DEMAND_AUTORISATION_ERROR: 'DEMAND_AUTORISATION_ERROR', DEMAND_AUTORISATION_ERROR: 'DEMAND_AUTORISATION_ERROR',
DEMAND_AUTORISATION_RESET: 'DEMAND_AUTORISATION_RESET', DEMAND_AUTORISATION_RESET: 'DEMAND_AUTORISATION_RESET',
DELETE_BENEFICIARY_PENDING: 'DELETE_BENEFICIARY_PENDING',
DELETE_BENEFICIARY_SUCCESS: 'DELETE_BENEFICIARY_SUCCESS',
DELETE_BENEFICIARY_ERROR: 'DELETE_BENEFICIARY_ERROR',
DELETE_BENEFICIARY_RESET: 'DELETE_BENEFICIARY_RESET',
} }
export default InsuranceActions; export default InsuranceActions;

View File

@ -55,7 +55,7 @@ import {
activatePaySubscriptionReducer, activatePaySubscriptionReducer,
addBeneficiaryToSubscriptionReducer, addBeneficiaryToSubscriptionReducer,
addDrugReducer, addDrugReducer,
createConsultationReducer, createConsultationReducer, deleteBeneficiaryeducer,
demandeAutorisationSoinReducer, demandeAutorisationSoinReducer,
executionPrescriptionReducer, executionPrescriptionReducer,
getAmountConsultationReducer, getAmountConsultationReducer,
@ -177,7 +177,8 @@ const rootReducer = persistCombineReducers(persistConfig, {
acceptOrRejectConsultationReducer: acceptOrRejectConsultationReducer, acceptOrRejectConsultationReducer: acceptOrRejectConsultationReducer,
executionPrescriptionReducer: executionPrescriptionReducer, executionPrescriptionReducer: executionPrescriptionReducer,
modifyPrescriptionReducer: modifyPrescriptionReducer, modifyPrescriptionReducer: modifyPrescriptionReducer,
demandeAutorisationSoinReducer: demandeAutorisationSoinReducer demandeAutorisationSoinReducer: demandeAutorisationSoinReducer,
deleteBeneficiaryeducer: deleteBeneficiaryeducer
}); });
export default rootReducer; export default rootReducer;

View File

@ -274,7 +274,7 @@ export default class OptionsMenu extends Component {
|| 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') { || item === 'demandeAutorisationSoinScreen' || item === 'deleteBeneficiaryScreen') {
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"

View File

@ -0,0 +1,530 @@
import React, {useEffect, useState} from 'react';
import {
Alert,
Dimensions,
FlatList,
Image,
Keyboard,
KeyboardAvoidingView,
Platform,
ScrollView,
StyleSheet,
TouchableOpacity,
View,
} from 'react-native';
import {connect, useDispatch} from 'react-redux';
import Modal from 'react-native-modal';
import {Formik} from 'formik';
import * as Yup from 'yup';
import * as Utils from '../../../utils/UtilsFunction';
import {Color} from "../../../config/Color";
import I18n from 'react-native-i18n';
import {ScreenComponent} from "../../../components/ScreenComponent";
import TextInput from '../../../components/TextInput';
import Text from '../../../components/Text';
import PasswordInput from '../../../components/PasswordInput';
import Button from "../../../components/Button";
import FontAwesome from "react-native-vector-icons/FontAwesome";
import {responsiveWidth} from "react-native-responsive-dimensions";
import SwitchSelector from "react-native-switch-selector";
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
import {
fetchAddBeneficiaryToSubscription,
fetchAddBeneficiaryToSubscriptionReset, fetchDeleteBeneficiary, fetchDeleteBeneficiaryReset,
fetchGetInsurancePrimeAmount,
fetchGetListInsurance,
fetchGetListInsuranceReset,
fetchGetSubscriptionList,
fetchGetSubscriptionListReset,
fetchSubscribeInsurance,
fetchSubscribeInsuranceReset,
fetchUploadInsurance,
fetchUploadInsuranceReset
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
import {readUser} from "../../../webservice/AuthApi";
import ImagePicker from "react-native-image-crop-picker";
import DateTimePicker from "@react-native-community/datetimepicker";
import * as Animatable from 'react-native-animatable';
import {createStructuredSelector} from "reselect";
import {
selectAddBeneficiaryToSubscription, selectDeleteBeneficiary,
selectInsuranceList,
selectInsurancePrimeAmount,
selectSubscribeInsurance,
selectSubscriptionList,
selectUploadInsuranceImages
} from "../../../redux/insurance/insurance.selector";
import {Dropdown} from "react-native-material-dropdown";
import Icon from "react-native-vector-icons/FontAwesome5";
import {displayToast} from "../../../utils/UtilsFunction";
let moment = require('moment-timezone');
const {width, height} = Dimensions.get('window');
const CIRCLE_SIZE = width * 0.5;
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: {
alignItems: 'center',
marginTop: 40,
paddingBottom: 20,
paddingLeft: 20,
paddingRight: 20,
flex: 1,
},
circle: {
width: CIRCLE_SIZE,
height: CIRCLE_SIZE,
borderRadius: CIRCLE_SIZE / 2,
position: 'absolute',
top: '15%',
},
circleContainer: {
alignItems: 'flex-end',
right: -(CIRCLE_SIZE / 3),
top: -(CIRCLE_SIZE / 1.5),
},
lineSeparator: {
borderWidth: 1,
width: '40%',
height: 1,
alignSelf: 'center',
},
line: {
width: 1,
height: 14,
backgroundColor: Color.grayColor,
marginLeft: 10,
},
contentModeView: {
width: 30,
height: '100%',
alignItems: 'flex-end',
justifyContent: 'center',
},
contentFilter: {
flexDirection: 'row',
alignItems: 'center',
marginLeft: 10,
},
bottomModal: {
justifyContent: 'flex-end',
margin: 0,
},
contentFilterBottom: {
width: "100%",
borderTopLeftRadius: 8,
borderTopRightRadius: 8,
paddingHorizontal: 20
},
contentSwipeDown: {
paddingTop: 10,
alignItems: 'center',
},
lineSwipeDown: {
width: 30,
height: 2.5,
backgroundColor: Color.dividerColor,
},
contentActionModalBottom: {
flexDirection: 'row',
paddingVertical: 15,
justifyContent: 'space-between',
borderBottomWidth: 1,
},
containModal: {
paddingVertical: 10,
paddingHorizontal: 20,
flexDirection: 'row',
justifyContent: 'space-between',
},
floatingButtonAdd: {
backgroundColor: Color.accentColor,
position: "absolute",
width: 25,
bottom: 0,
zIndex: 1000,
right: 20,
top: 35,
height: 25,
borderRadius: 12.5,
alignItems: 'center',
justifyContent: 'center',
},
contentSwitch: {
width: responsiveWidth(40),
},
switch: {},
choosePhotoBtn: {
marginTop: 10,
marginBottom: 10,
width: "auto",
height: "auto",
padding: 5,
alignItems: 'center',
borderColor: Color.borderColor,
marginRight: 10,
elevation: 2,
},
checkbox: {
alignSelf: "center",
color: "white"
},
itemAmountPerMonth: {
paddingLeft: 10,
marginTop: 10,
flexDirection: 'row',
},
dot: {
width: 12,
height: 12,
borderRadius: 6
},
blockView: {
paddingVertical: 10,
borderBottomWidth: 0.5,
},
});
const DeleteBeneficiaryScreen = ({
fetchAddBeneficiaryToSubscription,
addBeneficiaryToSubscription,
fetchGetSubscriptionList,
fetchDeleteBeneficiary,
subscriptionList,
deleteBeneficiary,
navigation
}) => {
const [user, setUser] = useState(null);
const [insurance, setInsurance] = useState(null);
const [password, setPassword] = useState(null);
const dispatch = useDispatch();
const [modalViewBeneficiariesVisible, setModalViewBeneficiariesVisible] = useState(false);
const [subscription, setSubscription] = useState(null);
const [subscriptions, setSubscriptions] = useState([]);
const [beneficiaries, setBeneficiaries] = useState([]);
const [beneficiariesToDelete, setBeneficiariesToDelete] = useState([]);
let subscriptionRef = null;
useEffect(() => {
readUser().then((user) => {
console.log("user", user);
setUser(user)
});
dispatch(fetchAddBeneficiaryToSubscriptionReset());
dispatch(fetchGetSubscriptionListReset());
}, []);
useEffect(() => {
if (user !== null)
fetchGetSubscriptionList(user.id, 'EDITABLE', false);
}, [user]);
let dropDownAlertRef: any = null;
useEffect(() => {
if (subscriptionList.result !== null) {
let subscriptionListTemp = [];
subscriptionList.result.response.map((insuranceItem, index) => {
subscriptionListTemp.push(insuranceItem);
});
setSubscriptions(subscriptionListTemp);
}
if (subscriptionList.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(subscriptionList),
);
dispatch(fetchGetListInsuranceReset());
}
}, [subscriptionList]);
useEffect(() => {
if (deleteBeneficiary.result !== null) {
Alert.alert(
I18n.t("SUCCESS"),
deleteBeneficiary.result.response,
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchDeleteBeneficiaryReset());
navigation.goBack();
}
}
],
{cancelable: false}
)
}
if (deleteBeneficiary.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(deleteBeneficiary),
);
dispatch(fetchDeleteBeneficiaryReset());
}
}, [deleteBeneficiary]);
const RegisterSchema = Yup.object().shape({
password: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
});
const renderModalViewBeneficiaries = () => {
return (
<Modal
isVisible={modalViewBeneficiariesVisible}
onSwipeComplete={() => setModalViewBeneficiariesVisible(false)}
swipeDirection={['down']}
style={styles.bottomModal}>
<View
style={[styles.contentFilterBottom, {backgroundColor: Color.cardBackgroundColor}]}>
<View style={styles.contentSwipeDown}>
<View style={styles.lineSwipeDown}/>
</View>
<View
style={[
styles.contentActionModalBottom,
{borderBottomColor: Color.borderColor},
]}/>
<View style={[{marginBottom: 40}]}>
<FlatList
data={beneficiaries}
extraData={beneficiaries}
keyExtractor={(item, index) => index}
renderItem={({item, index}) => {
console.log("Item", item);
return (
<View style={styles.lineRow}>
<View style={{alignItems: 'flex-start'}}>
<Text body1>{I18n.t('NOM_ASSURE')}</Text>
<Text caption1 grayColor>
{`${item.firstname} ${item.lastname}`}
</Text>
</View>
<View style={{alignItems: 'flex-start'}}>
<Text body1>{I18n.t('AFFILIATION')}</Text>
<Text caption1 grayColor>
{item.affiliation === 'CHILD' ? I18n.t('ENFANT') : I18n.t('CONJOINT')}
</Text>
</View>
<View style={styles.iconRight}>
<TouchableOpacity
onPress={() => {
Alert.alert(
I18n.t("TITLE_SUPPRESS_CONFIRM"),
I18n.t("TEXT_SUPPRESS_CONFIRM_BENEFICIARY"),
[
{
text: I18n.t("OK"), onPress: () => {
setBeneficiariesToDelete([...beneficiariesToDelete, item.id]);
setBeneficiaries(beneficiaries.filter(beneficiary => beneficiary.id !== item.id));
}
},
{
text: I18n.t("CANCEL_LABEL"), onPress: () => {
}
}
],
{cancelable: false}
)
}}>
<Icon
name="minus-circle"
size={24}
color={Color.grayColor}
/>
</TouchableOpacity>
</View>
</View>
);
}}/>
</View>
<Button
style={{marginTop: 20, marginBottom: 20}}
full
onPress={() => {
displayToast(I18n.t('ENTER_PASSWORD_TO_VALID_MODIFICATION'));
setModalViewBeneficiariesVisible(false)
}}>
{I18n.t('OK')}
</Button>
</View>
</Modal>
);
};
return (
<ScreenComponent>
<DropdownAlert ref={ref => (dropDownAlertRef = ref)}/>
<KeyboardAvoidingView
behavior={Platform.OS === 'android' ? 'height' : 'padding'}
style={{flex: 1}}>
<ScrollView style={{flex: 1}}>
<Formik validationSchema={RegisterSchema}
initialValues={{
password: '',
}}
onSubmit={(values) => {
if (user !== null) {
if (subscription === null) {
subscriptionRef.shake(800);
} else {
console.log(user);
console.log("insurance", insurance);
setPassword(values.password);
fetchDeleteBeneficiary(subscription.id, {
password: values.password,
beneficiaries_ids: beneficiariesToDelete
});
}
}
}}>
{({
values,
errors,
touched,
handleChange,
handleBlur,
handleSubmit,
isSubmitting,
}) => (
<View style={styles.contain}>
<Animatable.View ref={(comp) => {
subscriptionRef = comp
}}
style={{
width: responsiveWidth(90),
height: 60,
alignSelf: 'center',
borderRadius: 10,
paddingLeft: 20,
paddingRight: 20,
backgroundColor: 'white'
}}>
<Dropdown
label={I18n.t('SELECT_SUBSCRIPTION')}
data={subscriptions}
useNativeDriver={true}
onChangeText={(value, index, data) => {
console.log("Value", value);
setBeneficiaries(value.beneficiaries);
setSubscription(
{
id: value.id,
insured_id: value.insured_id,
subscription: value.subscription,
beneficiaries: value.beneficiaries
}
);
setModalViewBeneficiariesVisible(true);
}}
valueExtractor={(value) => {
return value
}}
labelExtractor={(value) => {
return `${value.network.name} | ${I18n.t('ETAT')}: ${value.state} | ${I18n.t('AMOUNT_LABEL')}: ${value.total_bonus_amount}`
}}
/>
</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={deleteBeneficiary.loading}
onPress={handleSubmit}>
{I18n.t('SUBMIT_LABEL')}
</Button>
</View>
)}
</Formik>
</ScrollView>
</KeyboardAvoidingView>
{modalViewBeneficiariesVisible && renderModalViewBeneficiaries()}
{(subscription !== null) && (<TouchableOpacity
style={{
alignItems: 'center',
flexDirection: 'row',
width: 60,
position: 'absolute',
bottom: 10,
right: 10,
height: 60,
padding: 3,
backgroundColor: Color.primaryColor,
borderRadius: 100,
}}
onPress={() => setModalViewBeneficiariesVisible(true)}
>
<Text whiteColor title2>{beneficiaries.length}</Text>
<Text whiteColor caption2>{I18n.t('AYANT_DROIT')}</Text>
</TouchableOpacity>)}
</ScreenComponent>
);
};
const mapStateToProps = createStructuredSelector({
insuranceList: selectInsuranceList,
subscribeInsurance: selectSubscribeInsurance,
uploadInsuranceImages: selectUploadInsuranceImages,
insurancePrimeAmount: selectInsurancePrimeAmount,
addBeneficiaryToSubscription: selectAddBeneficiaryToSubscription,
subscriptionList: selectSubscriptionList,
deleteBeneficiary: selectDeleteBeneficiary
});
export default connect(mapStateToProps, {
fetchGetListInsurance,
fetchSubscribeInsurance,
fetchGetInsurancePrimeAmount,
fetchUploadInsurance,
fetchAddBeneficiaryToSubscription,
fetchGetSubscriptionList,
fetchDeleteBeneficiary
})(
DeleteBeneficiaryScreen,
);

View File

@ -27,14 +27,14 @@ import {
fetchAcceptRejectConsultationReset, fetchAcceptRejectConsultationReset,
fetchActivePaySubscription, fetchActivePaySubscription,
fetchGetConsultation, fetchGetConsultation,
fetchGetConsultationReset, fetchGetConsultationReset, fetchGetDemandeAutorisationSoin,
fetchGetSubscription fetchGetSubscription
} from "../../../redux/insurance/insurance.actions"; } from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert"; import DropdownAlert from "react-native-dropdownalert";
import {createStructuredSelector} from "reselect"; import {createStructuredSelector} from "reselect";
import { import {
selectAcceptRefuseConsultation, selectAcceptRefuseConsultation,
selectActivatePaySubscription, selectActivatePaySubscription, selectDemandeAutorisationSoin,
selectGetConsultation, selectGetConsultation,
selectSubscriptionList selectSubscriptionList
} from "../../../redux/insurance/insurance.selector"; } from "../../../redux/insurance/insurance.selector";
@ -57,9 +57,10 @@ const HistoriqueNanoSanteUserScreen = ({
navigation, navigation,
fetchGetConsultation, fetchGetConsultation,
fetchGetSubscription, fetchGetSubscription,
fetchGetDemandeAutorisationSoin,
fetchAcceptRejectConsultation, fetchAcceptRejectConsultation,
getConsultation, acceptRefuseConsultation,
acceptRefuseConsultation getConsultation
}) => { }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const [user, setUser] = useState(null); const [user, setUser] = useState(null);
@ -71,29 +72,36 @@ const HistoriqueNanoSanteUserScreen = ({
let dropDownAlertRef: any = null; let dropDownAlertRef: any = null;
function useForceUpdate() {
const [value, setValue] = useState(0); // integer state
return () => setValue(value => value + 1); // update the state to force render
}
const forceUpdate = useForceUpdate();
useEffect(() => { useEffect(() => {
dispatch(fetchGetConsultationReset()); dispatch(fetchGetConsultationReset());
dispatch(fetchAcceptRejectConsultationReset()); dispatch(fetchAcceptRejectConsultationReset());
readUser().then((user) => { readUser().then((user) => {
setUser(user); setUser(user);
console.log("User", user); console.log("User", user);
fetchGetConsultation(user.id, 'UNTREATED', '', '&pagination=true&page=1'); fetchGetConsultation(user.id, 'ALL', '', '&pagination=true&page=1');
}); });
}, []); }, []);
useEffect(() => { useEffect(() => {
if (getConsultation.result !== null) { if (getConsultation.result !== null) {
console.log("Page", page);
if (page < getConsultation.result.response.last_page) if (page < getConsultation.result.response.last_page)
setHistoryResult(historyResult.concat(getConsultation.result.response.data)); setHistoryResult(historyResult.concat(getConsultation.result.response.data));
if (page === getConsultation.result.response.last_page) { if (page === getConsultation.result.response.last_page) {
console.log("Page", page === getConsultation.result.response.last_page);
setPage(page + 1); setPage(page + 1);
console.log("historyResult.concat", historyResult.concat(getConsultation.result.response.data));
setHistoryResult(historyResult.concat(getConsultation.result.response.data)); setHistoryResult(historyResult.concat(getConsultation.result.response.data));
} }
} }
if (getConsultation.error) { if (getConsultation.error) {
@ -104,6 +112,7 @@ const HistoriqueNanoSanteUserScreen = ({
); );
dispatch(fetchGetConsultationReset()); dispatch(fetchGetConsultationReset());
} }
//forceUpdate();
}, [getConsultation]); }, [getConsultation]);
useEffect(() => { useEffect(() => {
@ -272,7 +281,113 @@ const HistoriqueNanoSanteUserScreen = ({
</View> </View>
</ScrollView> </ScrollView>
: : historyItemDetail.hasOwnProperty('act_name') ?
<ScrollView persistentScrollbar={true}>
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>ID</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{historyItemDetail.request_id}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>Date</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{historyItemDetail.created_at}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('STATE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{uppercaseFirstLetter(historyItemDetail.state.toLowerCase())}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('USER')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{`${historyItemDetail.user_firstname} ${historyItemDetail.user_lastname}`}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('EMAIL')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{`${historyItemDetail.user_email}`}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('PHONE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{`${historyItemDetail.user_phone}`}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('AGENT_VALIDEUR')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{`${historyItemDetail.validating_agent_firstname} ${historyItemDetail.validating_agent_lastname}`}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('EMAIL')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{historyItemDetail.validating_agent_email}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('EMAIL')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{historyItemDetail.validating_agent_phone}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('NETWORK')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{historyItemDetail.network.name}</Text>
</View>
</View>
</View>
</ScrollView>
:
<ScrollView persistentScrollbar={true}> <ScrollView persistentScrollbar={true}>
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}> <View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{flexDirection: 'row', marginTop: 10}}> <View style={{flexDirection: 'row', marginTop: 10}}>
@ -481,6 +596,46 @@ const HistoriqueNanoSanteUserScreen = ({
</View> </View>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
: item.hasOwnProperty('act_name') ?
<TouchableOpacity
style={[styles.content, {backgroundColor: Color.cardBackgroundColor}]}
onPress={() => {
setDisplayModalHistory(true);
setHistoryItemDetail(item);
/*navigation.navigate('validateConsultationDetailScreen', {
item
});*/
}}>
<View style={[styles.contentTop, {borderColor: Color.borderColor}]}>
<View style={{flex: 1, alignItems: 'flex-start'}}>
<Text caption1>{`${I18n.t('ACTE')}: ${item.act_name}`}</Text>
<Text footnote light numberOfLines={1}>
{`${I18n.t('USER')}: ${item.user_firstname} ${item.user_lastname}`}
</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
caption1>{`${I18n.t('NETWORK')}: ${item.network.name}`}</Text>
<Text footnote light numberOfLines={1}>
{`${I18n.t('AGENT_VALIDEUR')}: ${item.validating_agent_firstname} ${item.validating_agent_lastname}`}
</Text>
</View>
</View>
<View style={styles.contentBottom}>
<View style={styles.bottomLeft}>
<View style={{marginHorizontal: 5}}>
<Text caption1 semibold accentColor>
{`${I18n.t('STATE')}: ${item.state.toLowerCase()}`}
</Text>
</View>
</View>
<View style={{flexDirection: 'row', alignItems: 'flex-end'}}>
<Text caption1 semibold primaryColor>
{`Date: ${moment(item.created_at).format('YYYY-MM-DD')}`}
</Text>
</View>
</View>
</TouchableOpacity>
: :
<TouchableOpacity <TouchableOpacity
style={[styles.content, {backgroundColor: Color.cardBackgroundColor}]} style={[styles.content, {backgroundColor: Color.cardBackgroundColor}]}
@ -550,7 +705,32 @@ const HistoriqueNanoSanteUserScreen = ({
fetchGetConsultation(user.id, 'ALL', '', '&pagination=true&page=1'); fetchGetConsultation(user.id, 'ALL', '', '&pagination=true&page=1');
}}> }}>
{I18n.t('SOINS')} {` ${I18n.t('SOINS')}`}
</Tag>
<Tag primary
icon={<FontAwesome5 name='file' size={20} color={Color.whiteColor}
style={{marginLeft: 15}}/>}
style={{
paddingRight: 10,
width: 120,
borderTopRightRadius: 0,
borderBottomRightRadius: 0,
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0,
borderRightWidth: 1,
borderRightColor: Color.whiteColor,
borderLeftWidth: 1,
borderLeftColor: Color.whiteColor
}}
onPress={() => {
dispatch(fetchGetConsultationReset());
setPage(1);
setLoadMore(false);
setHistoryResult([]);
fetchGetDemandeAutorisationSoin('?pagination=true&page=1&user_id=' + user.id);
}}>
{` ${I18n.t('DEMANDES')}`}
</Tag> </Tag>
<Tag icon={<MaterialCommunityIcons name='medical-bag' size={20} color={Color.whiteColor} <Tag icon={<MaterialCommunityIcons name='medical-bag' size={20} color={Color.whiteColor}
style={{marginLeft: -15}}/>} style={{marginLeft: -15}}/>}
@ -563,7 +743,7 @@ const HistoriqueNanoSanteUserScreen = ({
setHistoryResult([]); setHistoryResult([]);
fetchGetSubscription(user.id, 'ALL', '&pagination=true&page=1'); fetchGetSubscription(user.id, 'ALL', '&pagination=true&page=1');
}}> }}>
{I18n.t('SOUSCRIPTION')} {` ${I18n.t('SOUSCRIPTION')}`}
</Tag> </Tag>
</View> </View>
@ -613,7 +793,8 @@ export default connect(mapStateToProps, {
fetchActivePaySubscription, fetchActivePaySubscription,
fetchGetConsultation, fetchGetConsultation,
fetchAcceptRejectConsultation, fetchAcceptRejectConsultation,
fetchGetSubscription fetchGetSubscription,
fetchGetDemandeAutorisationSoin
})( })(
HistoriqueNanoSanteUserScreen, HistoriqueNanoSanteUserScreen,

View File

@ -507,7 +507,7 @@ export const optionNanoSanteUserScreen = {
icon: "cash-refund" icon: "cash-refund"
}, },
{ {
screen: '', screen: 'deleteBeneficiaryScreen',
icon: 'cash-register', icon: 'cash-register',
title: 'DELETE_SUBSCRIBE', title: 'DELETE_SUBSCRIBE',
}, },

View File

@ -702,5 +702,10 @@
"TOTAL_BONUS_AMOUNT": "Total de la prime", "TOTAL_BONUS_AMOUNT": "Total de la prime",
"BONUS_AMOUNT": "Montant de la prime de base", "BONUS_AMOUNT": "Montant de la prime de base",
"MONTANT_ASSURANCE": "Montant de l'assurance", "MONTANT_ASSURANCE": "Montant de l'assurance",
"MONTANT_ASSURE": "Montant de l'assuré" "MONTANT_ASSURE": "Montant de l'assuré",
"DEMANDES": "Demandes",
"ACTE": "Acte",
"AGENT_VALIDEUR": "Agent valideur",
"TEXT_SUPPRESS_CONFIRM_BENEFICIARY": "Voulez vous vraiment supprimer cet ayant droit ?",
"ENTER_PASSWORD_TO_VALID_MODIFICATION": "Renseigner votre mot de passe et valider la suppression de l'ayant pour le supprimé définitivement"
} }