From dbe5e9117885017b50d682f8cc0d4dc456c6ba4f Mon Sep 17 00:00:00 2001 From: Brice Zele Date: Mon, 18 Apr 2022 19:03:09 +0100 Subject: [PATCH] Liste des exclusions --- redux/insurance/insurance.actions.js | 30 +++++++ redux/insurance/insurance.reducer.js | 31 ++++++++ redux/insurance/insurance.selector.js | 7 +- redux/insurance/insurance.type.js | 5 ++ redux/reducers/index.js | 2 + screens/nano-sante/SouscrireAssuranceUser.js | 4 +- .../wallet/agent/ModifierFeuilleSoinScreen.js | 78 ++++++++++++++++++- .../wallet/agent/SaisirFeuilleSoinScreen.js | 76 +++++++++++++++++- .../user/InsuranceSubscriptionScreen.js | 78 ++++++++++++++++++- utils/i18n/fr.json | 3 +- webservice/IlinkConstants.js | 1 + 11 files changed, 303 insertions(+), 12 deletions(-) diff --git a/redux/insurance/insurance.actions.js b/redux/insurance/insurance.actions.js index 2062d003..52420b01 100644 --- a/redux/insurance/insurance.actions.js +++ b/redux/insurance/insurance.actions.js @@ -12,6 +12,7 @@ import { checkInsuranceCoverageAmountUrl, consultationUrl, createConsultationUrl, + exclusionUrl, executionPrescriptionUrl, getAmountConsultationUrl, getDrugAndDevicesUrl, @@ -762,3 +763,32 @@ export const fetchCheckInsuranceCoverageAmount = (data) => { }); }; +/************************************************************/ +export const fetchGetExclusionPending = () => ({ + type: InsuranceActions.GET_EXCLUSION_PENDING, +}); + +export const fetchGetExclusionReset = () => ({ + type: InsuranceActions.GET_EXCLUSION_RESET, +}); + +export const fetchGetExclusionSuccess = (authkey: any) => ({ + type: InsuranceActions.GET_EXCLUSION_SUCCESS, + payload: authkey, +}); + +export const fetchGetExclusionError = (error: any) => ({ + type: InsuranceActions.GET_EXCLUSION_ERROR, + payload: error, +}); + +export const fetchGetExclusion = (network_id) => { + return ApiAction({ + url: `${exclusionUrl}/${network_id}`, + method: 'GET', + onLoading: fetchGetExclusionPending, + onSuccess: fetchGetExclusionSuccess, + onError: fetchGetExclusionError, + }); +}; + diff --git a/redux/insurance/insurance.reducer.js b/redux/insurance/insurance.reducer.js index 32b2211f..6ba4e8c0 100644 --- a/redux/insurance/insurance.reducer.js +++ b/redux/insurance/insurance.reducer.js @@ -768,3 +768,34 @@ export const checkInsuranceCoverageAmountReducer = (state = INITIAL_STATE, actio } }; + +export const getExclusionReducer = (state = INITIAL_STATE, action: InsuranceActions) => { + console.log("ACTION", action); + switch (action.type) { + case InsuranceActions.GET_EXCLUSION_PENDING: + return { + ...state, + loading: true + } + case InsuranceActions.GET_EXCLUSION_SUCCESS: + return { + loading: false, + result: action.payload.response, + error: null + } + case InsuranceActions.GET_EXCLUSION_ERROR: + return { + ...state, + loading: false, + result: null, + error: action.payload + } + + case InsuranceActions.GET_EXCLUSION_RESET: + return INITIAL_STATE; + + default: + return state + + } +}; diff --git a/redux/insurance/insurance.selector.js b/redux/insurance/insurance.selector.js index 33e3777c..f9c66f3e 100644 --- a/redux/insurance/insurance.selector.js +++ b/redux/insurance/insurance.selector.js @@ -6,7 +6,6 @@ * Date: 13/09/2021 */ import {createSelector} from "reselect"; -import {checkInsuranceCoverageAmountReducer, deleteBeneficiaryeducer, facturerSoinReducer} from "./insurance.reducer"; const selectInsuranceListReducer = (state) => state.insuranceList; const selectSubscribeInsuranceReducer = (state) => state.subscribeInsurance; @@ -32,6 +31,7 @@ const selectDemandeAutorisationSoinReducer = (state) => state.demandeAutorisatio const selectDeleteBeneficiaryeducerReducer = (state) => state.deleteBeneficiaryeducer; const selectFacturerSoinReducer = (state) => state.facturerSoinReducer; const selectCheckInsuranceCoverageAmountReducer = (state) => state.checkInsuranceCoverageAmountReducer; +const selectGetExclusionReducer = (state) => state.getExclusionReducer; export const selectInsuranceList = createSelector( [selectInsuranceListReducer], @@ -142,3 +142,8 @@ export const selectCheckInsuranceCoverageAmount = createSelector( [selectCheckInsuranceCoverageAmountReducer], (checkInsuranceCoverageAmount) => checkInsuranceCoverageAmount ); + +export const selectGetExclusion = createSelector( + [selectGetExclusionReducer], + (getExclusion) => getExclusion +); diff --git a/redux/insurance/insurance.type.js b/redux/insurance/insurance.type.js index 78df987f..22f9655c 100644 --- a/redux/insurance/insurance.type.js +++ b/redux/insurance/insurance.type.js @@ -130,5 +130,10 @@ const InsuranceActions = { CHECK_HEALTH_CARE_SHEET_SUCCESS: 'CHECK_HEALTH_CARE_SHEET_SUCCESS', CHECK_HEALTH_CARE_SHEET_ERROR: 'CHECK_HEALTH_CARE_SHEET_ERROR', CHECK_HEALTH_CARE_SHEET_RESET: 'CHECK_HEALTH_CARE_SHEET_RESET', + + GET_EXCLUSION_PENDING: 'GET_EXCLUSION_PENDING', + GET_EXCLUSION_SUCCESS: 'GET_EXCLUSION_SUCCESS', + GET_EXCLUSION_ERROR: 'GET_EXCLUSION_ERROR', + GET_EXCLUSION_RESET: 'GET_EXCLUSION_RESET', } export default InsuranceActions; diff --git a/redux/reducers/index.js b/redux/reducers/index.js index aea3d2bd..69e394bc 100755 --- a/redux/reducers/index.js +++ b/redux/reducers/index.js @@ -64,6 +64,7 @@ import { getAmountConsultationReducer, getConsultationReducer, getDrugAppareilReducer, + getExclusionReducer, getInsurancePrimeAmountReducer, getNetworkActReducer, getProviderClassReducer, @@ -192,6 +193,7 @@ const rootReducer = persistCombineReducers(persistConfig, { checkInsuranceCoverageAmountReducer: checkInsuranceCoverageAmountReducer, searchUserReducer: SearchUserReducer, getQRCodeDetailReducer: GetQRCodeDetailReducer, + getExclusionReducer: getExclusionReducer }); export default rootReducer; diff --git a/screens/nano-sante/SouscrireAssuranceUser.js b/screens/nano-sante/SouscrireAssuranceUser.js index 03fd73bf..018f104c 100755 --- a/screens/nano-sante/SouscrireAssuranceUser.js +++ b/screens/nano-sante/SouscrireAssuranceUser.js @@ -21,8 +21,6 @@ import {IlinkEmitter} from "../../utils/events"; import {connect} from "react-redux"; import {bindActionCreators} from "redux"; import {getBankListAction, getBankListReset} from "../../webservice/BankApi"; -import {store} from "../../redux/store"; -import {readUser} from "../../webservice/AuthApi"; import {getOperatorListAction, getOperatorListReset} from "../../webservice/WalletApi"; const route = require('../../route.json'); @@ -242,7 +240,7 @@ const mapDispatchToProps = dispatch => bindActionCreators({ getBankListAction, getBankListReset, getOperatorListAction, - getOperatorListReset + getOperatorListReset, }, dispatch); export default connect(mapStateToProps, mapDispatchToProps)(SouscrireAssuranceUser); diff --git a/screens/wallet/agent/ModifierFeuilleSoinScreen.js b/screens/wallet/agent/ModifierFeuilleSoinScreen.js index a3b2c7c7..91ace886 100644 --- a/screens/wallet/agent/ModifierFeuilleSoinScreen.js +++ b/screens/wallet/agent/ModifierFeuilleSoinScreen.js @@ -41,6 +41,7 @@ import { fetchGetConsultation, fetchGetConsultationReset, fetchGetDrugAppareil, + fetchGetExclusion, fetchGetNetworkActs, fetchGetNetworkActsReset, fetchGetProviderClass, @@ -63,6 +64,7 @@ import { selectGetAmountConsultation, selectGetConsultation, selectGetDrugAppareil, + selectGetExclusion, selectGetNetworkAct, selectGetProviderClass, selectGetUserByIdQRCode, @@ -91,6 +93,7 @@ import DateTimePicker from "@react-native-community/datetimepicker"; import {createStructuredSelector} from "reselect"; import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons"; import Fontisto from "react-native-vector-icons/Fontisto"; +import WebView from "react-native-webview"; let moment = require('moment-timezone'); @@ -273,6 +276,8 @@ const ModifierFeuilleSoinScreen = ({ fetchCheckInsuranceCoverageAmount, checkInsuranceCoverageAmount, getConsultation, + fetchGetExclusion, + getExclusion, getUserByNameOrNumber, getUserByIdQRCode, getProviderClass, @@ -337,6 +342,8 @@ const ModifierFeuilleSoinScreen = ({ const [modalModifyMedicament, setModalModifyMedicament] = useState(false); const [modalModifyExamen, setModalModifyExamen] = useState(false); const [modalAddMedicament, setModalAddMedicament] = useState(false); + const [modalVisible, setModalVisible] = useState(false); + const [prestations, setPrestations] = useState([]); @@ -409,7 +416,7 @@ const ModifierFeuilleSoinScreen = ({ dispatch(fetchModifyPrescriptionReset()); dispatch(fetchCheckInsuranceCoverageAmountReset()); - + fetchGetExclusion(wallet.id_network); fetchGetProviderClass(wallet.id_network); fetchGetNetworkActs(wallet.id_network, ''); @@ -683,6 +690,49 @@ const ModifierFeuilleSoinScreen = ({ setFieldValue('pregnancy_start_at', moment(currentDate).format('YYYY-MM-DD')); }; + const renderModalExclusion = () => ( + + { + setModalVisible(false); + }} + swipeDirection={['down']} + style={styles.bottomModal}> + + + + + + {I18n.t('EXCLUSION')} + + + + + + + + + + ); + + const renderDateDebutGrossessePicker = () => { return ( )} + {modalVisible && renderModalExclusion()} {modalPrestation && renderAddNewPrestation()} {modalListPrestation && renderPresatationList()} {modalModifyPrestation && renderModifyPrestation()} @@ -3194,6 +3245,25 @@ const ModifierFeuilleSoinScreen = ({ + {(getExclusion.result !== null) && ( { + setModalVisible(true) + }} + > + {I18n.t('EXCLUSION')} + )} ); }; @@ -3209,7 +3279,8 @@ const mapStateToProps = createStructuredSelector({ getConsultation: selectGetConsultation, getNetworkAct: selectGetNetworkAct, modifyPrescription: selectModifyPrescription, - checkInsuranceCoverageAmount: selectCheckInsuranceCoverageAmount + checkInsuranceCoverageAmount: selectCheckInsuranceCoverageAmount, + getExclusion: selectGetExclusion }); export default connect(mapStateToProps, { @@ -3224,7 +3295,8 @@ export default connect(mapStateToProps, { fetchGetConsultation, fetchExecutionPrescription, fetchModifyPrescription, - fetchCheckInsuranceCoverageAmount + fetchCheckInsuranceCoverageAmount, + fetchGetExclusion })( ModifierFeuilleSoinScreen, ); diff --git a/screens/wallet/agent/SaisirFeuilleSoinScreen.js b/screens/wallet/agent/SaisirFeuilleSoinScreen.js index 058dfa03..f2458c40 100644 --- a/screens/wallet/agent/SaisirFeuilleSoinScreen.js +++ b/screens/wallet/agent/SaisirFeuilleSoinScreen.js @@ -41,6 +41,7 @@ import { fetchGetAmountConsultationReset, fetchGetDrugAppareil, fetchGetDrugAppareilReset, + fetchGetExclusion, fetchGetNetworkActs, fetchGetNetworkActsReset, fetchGetProviderClass, @@ -63,6 +64,7 @@ import { selectCreateConsultation, selectGetAmountConsultation, selectGetDrugAppareil, + selectGetExclusion, selectGetNetworkAct, selectGetProviderClass, selectGetUserByIdQRCode, @@ -88,6 +90,7 @@ import * as Utils from "../../../utils/UtilsFunction"; import {store} from "../../../redux/store"; import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons"; import Fontisto from "react-native-vector-icons/Fontisto"; +import WebView from "react-native-webview"; let moment = require('moment-timezone'); @@ -264,6 +267,8 @@ const SaisirFeuilleSoinScreen = ({ fetchCreateConsultation, fetchGetAmountConsultation, fetchCheckInsuranceCoverageAmount, + fetchGetExclusion, + getExclusion, getUserByNameOrNumber, getUserByIdQRCode, getDrugAppareil, @@ -312,6 +317,8 @@ const SaisirFeuilleSoinScreen = ({ const [modalListAssure, setModalListAssure] = useState(false); const [modalListMedicament, setModalListMedicament] = useState(false); + const [modalVisible, setModalVisible] = useState(false); + const [networkAct, setNetworkAct] = useState(null); const [prestations, setPrestations] = useState([]); @@ -383,6 +390,7 @@ const SaisirFeuilleSoinScreen = ({ dispatch(fetchAddDrugReset()); dispatch(fetchCheckInsuranceCoverageAmountReset()); + fetchGetExclusion(wallet.id_network); fetchGetProviderClass(wallet.id_network); }, []); @@ -727,6 +735,48 @@ const SaisirFeuilleSoinScreen = ({ setFieldValue('accident_date', moment(currentDate).format('YYYY-MM-DD')); }; + const renderModalExclusion = () => ( + + { + setModalVisible(false); + }} + swipeDirection={['down']} + style={styles.bottomModal}> + + + + + + {I18n.t('EXCLUSION')} + + + + + + + + + + ); + const renderDateAccidentPicker = () => { return ( )} + {modalVisible && renderModalExclusion()} {modalPrestation && renderAddNewPrestation()} {modalMedicament && renderAddNewMedicament()} {modalExamen && renderAddNewExamen()} @@ -2248,6 +2299,25 @@ const SaisirFeuilleSoinScreen = ({ + {(getExclusion.result !== null) && ( { + setModalVisible(true) + }} + > + {I18n.t('EXCLUSION')} + )} ); }; @@ -2263,7 +2333,8 @@ const mapStateToProps = createStructuredSelector({ createConsultation: selectCreateConsultation, getNetworkAct: selectGetNetworkAct, getAmountConsultation: selectGetAmountConsultation, - checkInsuranceCoverageAmount: selectCheckInsuranceCoverageAmount + checkInsuranceCoverageAmount: selectCheckInsuranceCoverageAmount, + getExclusion: selectGetExclusion }); export default connect(mapStateToProps, { @@ -2277,7 +2348,8 @@ export default connect(mapStateToProps, { fetchGetNetworkActs, fetchCreateConsultation, fetchGetAmountConsultation, - fetchCheckInsuranceCoverageAmount + fetchCheckInsuranceCoverageAmount, + fetchGetExclusion })( SaisirFeuilleSoinScreen, ); diff --git a/screens/wallet/user/InsuranceSubscriptionScreen.js b/screens/wallet/user/InsuranceSubscriptionScreen.js index 6c61316d..1d5ac69a 100644 --- a/screens/wallet/user/InsuranceSubscriptionScreen.js +++ b/screens/wallet/user/InsuranceSubscriptionScreen.js @@ -36,6 +36,7 @@ import {responsiveWidth} from "react-native-responsive-dimensions"; import SwitchSelector from "react-native-switch-selector"; import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons"; import { + fetchGetExclusion, fetchGetInsurancePrimeAmount, fetchGetInsurancePrimeAmountReset, fetchGetListInsurance, @@ -52,6 +53,7 @@ import DateTimePicker from "@react-native-community/datetimepicker"; import * as Animatable from 'react-native-animatable'; import {createStructuredSelector} from "reselect"; import { + selectGetExclusion, selectInsuranceList, selectInsurancePrimeAmount, selectSubscribeInsurance, @@ -63,6 +65,8 @@ import {Typography} from "../../../config/typography"; import {Dropdown} from "react-native-material-dropdown"; import Icon from "react-native-vector-icons/FontAwesome5"; import isNil from "lodash/isNil"; +import {store} from "../../../redux/store"; +import WebView from "react-native-webview"; let moment = require('moment-timezone'); @@ -213,11 +217,14 @@ const InsuranceSubscriptionScreen = ({ fetchGetListInsurance, fetchGetInsurancePrimeAmount, fetchUploadInsurance, + fetchGetExclusion, + getExclusion, uploadInsuranceImages, navigation }) => { const [modalVisible, setModalVisible] = useState(false); + const [modalVisibleExclusion, setModalVisibleExclusion] = useState(false); const [isDropdownOpen, setIsDropdownOpen] = useState(false); const [user, setUser] = useState(null); const [insurance, setInsurance] = useState(null); @@ -243,6 +250,7 @@ const InsuranceSubscriptionScreen = ({ {label: I18n.t('MASCULIN'), value: "M"}, {label: I18n.t('FEMININ'), value: "F"}, ]); + const [wallet] = useState(store.getState().walletDetailReducer.result.response); const [dateNaissance, setDateNaissance] = useState('' + moment(new Date(((new Date()).getFullYear() - 5), 0, 1)).format('YYYY-MM-DD')); const [showDateNaissancePicker, setShowDateNaissancePicker] = useState(false); const [showModalDetail, setShowModalDetail] = useState(false); @@ -266,6 +274,8 @@ const InsuranceSubscriptionScreen = ({ dispatch(fetchUploadInsuranceReset()); dispatch(fetchGetInsurancePrimeAmountReset()); dispatch(fetchSubscribeInsuranceReset()); + + fetchGetExclusion(wallet.id_network); }, []); useEffect(() => { @@ -1009,6 +1019,48 @@ const InsuranceSubscriptionScreen = ({ ); + const renderModalExclusion = () => ( + + { + setModalVisible(false); + }} + swipeDirection={['down']} + style={styles.bottomModal}> + + + + + + {I18n.t('EXCLUSION')} + + + + + + + + + + ); + return ( (dropDownAlertRef = ref)}/> @@ -1290,6 +1342,7 @@ const InsuranceSubscriptionScreen = ({ + {modalVisibleExclusion && renderModalExclusion()} {modalVisible && renderAddNewIdentification()} {modalViewBeneficiariesVisible && renderModalViewBeneficiaries()} {showDateNaissancePicker && renderDateNaissancePicker()} @@ -1311,6 +1364,25 @@ const InsuranceSubscriptionScreen = ({ {beneficiaries.length} {I18n.t('AYANT_DROIT')} )} + {(getExclusion.result !== null) && ( { + setModalVisibleExclusion(true) + }} + > + {I18n.t('EXCLUSION')} + )} ); }; @@ -1319,14 +1391,16 @@ const mapStateToProps = createStructuredSelector({ insuranceList: selectInsuranceList, subscribeInsurance: selectSubscribeInsurance, uploadInsuranceImages: selectUploadInsuranceImages, - insurancePrimeAmount: selectInsurancePrimeAmount + insurancePrimeAmount: selectInsurancePrimeAmount, + getExclusion: selectGetExclusion }); export default connect(mapStateToProps, { fetchGetListInsurance, fetchSubscribeInsurance, fetchGetInsurancePrimeAmount, - fetchUploadInsurance + fetchUploadInsurance, + fetchGetExclusion })( InsuranceSubscriptionScreen, ); diff --git a/utils/i18n/fr.json b/utils/i18n/fr.json index 94e24ed0..97b079ec 100755 --- a/utils/i18n/fr.json +++ b/utils/i18n/fr.json @@ -738,5 +738,6 @@ "BY_QR_CODE": "Par QR Code", "SCAN": "Scanner", "BRING_YOUR_CAMERA_CLOSER_TO_SCAN_QR_CODE": "Approchez votre caméra du QR Code afin de le scanner", - "QUANTITY_CANNOT_BE_SUPERIOR": "La quantité ne doit pas être supérieure à" + "QUANTITY_CANNOT_BE_SUPERIOR": "La quantité ne doit pas être supérieure à", + "EXCLUSION": "Exclusion" } diff --git a/webservice/IlinkConstants.js b/webservice/IlinkConstants.js index 94c09fe5..a10f2e8e 100755 --- a/webservice/IlinkConstants.js +++ b/webservice/IlinkConstants.js @@ -89,6 +89,7 @@ export const getQRCodeDetail = testBaseUrl + '/walletService/qrcode/read'; export const facturerSoinUrl = testBaseUrl + '/nanoSanteService/generate-invoice'; export const invoiceUrl = testBaseUrl + '/nanoSanteService/invoices'; +export const exclusionUrl = testBaseUrl + '/nanoSanteService/exclusions'; export const getInsuranceListUrl = testBaseUrl + '/nanoSanteService/insurances'; export const checkInsuranceCoverageAmountUrl = testBaseUrl + '/nanoSanteService/health-care-sheets/check-insurance-coverage-amount'; export const getUserByIdQRCodeUrl = testBaseUrl + '/walletService/qrcode/read';