correction bugs ok

This commit is contained in:
Brice Zele 2022-02-09 18:43:48 +01:00
parent 4193ce4965
commit e9f8c6bbcc
20 changed files with 1015 additions and 135 deletions

2
App.js
View File

@ -96,6 +96,7 @@ import HistoriqueNanoSanteUserScreen from "./screens/wallet/user/HistoriqueNanoS
import DemandeAutorisationSoinScreen from "./screens/wallet/user/DemandeAutorisationSoinScreen";
import DeleteBeneficiaryScreen from "./screens/wallet/user/DeleteBeneficiaryScreen";
import StopSubscriptionScreen from "./screens/wallet/user/StopSubscriptionScreen";
import RenewAssuranceScreen from "./screens/wallet/user/RenewAssuranceScreen";
const instructions = Platform.select({
@ -150,6 +151,7 @@ const AppStack = createDrawerNavigator({
validateConsultationDetailScreen: ValidateConsultationDetailScreen,
activateBuySubscriptionScreen: ActivateBuySubscriptionScreen,
stopSubscriptionScreen: StopSubscriptionScreen,
renewAssuranceScreen: RenewAssuranceScreen,
historiqueNanoSanteUserScreen: HistoriqueNanoSanteUserScreen,
deleteBeneficiaryScreen: DeleteBeneficiaryScreen,
retraitWalletVersCashUser: RetraitWalletVersCashUser,

File diff suppressed because one or more lines are too long

View File

@ -572,7 +572,7 @@
"MANAGE_ASSURANCE": "Gérer son assurance",
"MANAGE_HEALTH": "Gérer ses soins",
"DEMAND_AUTORIZATION_HEALTH": "Demande autorisation soin",
"HISTORIC_HEALTH": "Historique souscriptions et soins",
"HISTORIC_HEALTH": "Historique",
"VALID_HEALTH": "Valider un soin ",
"ACTIVATE_INSSURANCE": "Activer son assurance",
"AMOUNT_PER_DURATION": "Montant par durée",

View File

@ -242,6 +242,17 @@ export const fetchStopSubscription = (id, data) => {
});
};
export const fetchRenewSubscription = (id, data) => {
return ApiAction({
url: `${getInsuranceListUrl}/${id}/renew`,
data,
method: 'PUT',
onLoading: fetchStopSubscriptionPending,
onSuccess: fetchStopSubscriptionSuccess,
onError: fetchStopSubscriptionError,
});
};
/************************************************************/
export const fetchAddBeneficiaryToSubscriptionPending = () => ({
type: InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_PENDING,
@ -529,7 +540,7 @@ export const fetchGetConsultationError = (error: any) => ({
export const fetchGetConsultation = (user_id, state = 'UNTREATED', typeParam = 'CONSULTATION', otherParam = '') => {
console.log("user_id", user_id);
return ApiAction({
url: `${consultationUrl}?user_id=${user_id}&state=${state}${otherParam}`,
url: `${consultationUrl}?user_id=${user_id}&state=${state}&type=${typeParam}${otherParam}`,
method: 'GET',
onLoading: fetchGetConsultationPending,
onSuccess: fetchGetConsultationSuccess,

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 === 'addBeneficiaryScreen' || item === 'activateBuySubscriptionScreen' || item === 'saisirFeuilleSoinScreen' || item === 'validateConsultationScreen' || item === 'validateConsultationDetailScreen'
|| item === 'executerPrescriptionScreen' || item === 'modifierFeuilleSoinScreen' || item === 'modifierExecutionPrescriptionScreen' || item === 'historiqueNanoSanteUserScreen'
|| item === 'demandeAutorisationSoinScreen' || item === 'deleteBeneficiaryScreen' || item === 'StopSubscriptionScreen' || item === 'stopSubscriptionScreen') {
|| item === 'demandeAutorisationSoinScreen' || item === 'deleteBeneficiaryScreen' || item === 'StopSubscriptionScreen' || item === 'stopSubscriptionScreen' || item === 'renewAssuranceScreen') {
return null
} else {
const color = this.state.currentId === item.id ? theme.accent : "grey"

View File

@ -28,6 +28,7 @@ import {ScreenComponent} from "../../../components/ScreenComponent";
import Button from "../../../components/Button";
import {responsiveWidth} from "react-native-responsive-dimensions";
import {
fetchAcceptRejectConsultationReset,
fetchActivePaySubscription,
fetchCreateConsultation,
fetchCreateConsultationReset,
@ -357,12 +358,24 @@ const ExecuterPrescriptionScreen = ({
}
if (getUserByNameOrNumber.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getUserByNameOrNumber),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetUserByNameOrNumberReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getUserByNameOrNumber),
);
dispatch(fetchGetUserByNameOrNumberReset());
dispatch(fetchGetUserByNameOrNumberReset());*/
}
}, [getUserByNameOrNumber]);
@ -372,12 +385,24 @@ const ExecuterPrescriptionScreen = ({
setModalConsultation(true);
if (getConsultation.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getConsultation),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetConsultationReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getConsultation),
);
dispatch(fetchGetConsultationReset());
dispatch(fetchGetConsultationReset());*/
}
}, [getConsultation]);
@ -400,12 +425,24 @@ const ExecuterPrescriptionScreen = ({
}
if (executionPrescription.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(executionPrescription),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchExecutionPrescriptionReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(executionPrescription),
);
dispatch(fetchExecutionPrescriptionReset());
dispatch(fetchExecutionPrescriptionReset());*/
}
}, [executionPrescription]);
@ -680,7 +717,7 @@ const ExecuterPrescriptionScreen = ({
}
}}>
<Text body2 semibold>
{`${item.user.firstname} ${item.user.lastname}`}
{`${item.user.firstname !== null ? item.user.firstname : ''} ${item.user.lastname !== null ? item.user.lastname : ''}`}
</Text>
</TouchableOpacity>
{item.beneficiaries.map((beneficiary) => (
@ -704,7 +741,7 @@ const ExecuterPrescriptionScreen = ({
<View style={{width: 10}}/>
<View style={{paddingHorizontal: 10, alignItems: 'flex-start'}}>
<Text subhead semibold>
{`${beneficiary.firstname} ${beneficiary.lastname} (${I18n.t('AYANT_DROITS')})`}
{`${beneficiary.firstname !== null ? beneficiary.firstname : ''} ${beneficiary.lastname !== null ? beneficiary.lastname : ''} (${I18n.t('AYANT_DROITS')})`}
</Text>
</View>
</TouchableOpacity>
@ -1048,8 +1085,8 @@ const ExecuterPrescriptionScreen = ({
switch (currentStep) {
case 0:
console.log("values", values);
if (values.numero_assure !== '') {
dispatch(fetchGetUserByNameOrNumberReset());
if (values.numero_assure !== '' && getUserByNameOrNumber.result === null) {
if (isNumeroAssureSearch)
fetchGetUserByNameOrNumber(wallet.id_network, `&insured_id=${values.numero_assure}`);
else if (isPhoneAssureSearch)

View File

@ -362,12 +362,24 @@ const ModifierExecutionPrescriptionScreen = ({
}
if (getUserByNameOrNumber.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getUserByNameOrNumber),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetUserByNameOrNumberReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getUserByNameOrNumber),
);
dispatch(fetchGetUserByNameOrNumberReset());
dispatch(fetchGetUserByNameOrNumberReset());*/
}
}, [getUserByNameOrNumber]);
@ -377,12 +389,24 @@ const ModifierExecutionPrescriptionScreen = ({
setModalConsultation(true);
if (getConsultation.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getConsultation),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetConsultationReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getConsultation),
);
dispatch(fetchGetConsultationReset());
dispatch(fetchGetConsultationReset());*/
}
}, [getConsultation]);
@ -405,12 +429,24 @@ const ModifierExecutionPrescriptionScreen = ({
}
if (modifyPrescription.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(modifyPrescription),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchModifyPrescriptionReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(modifyPrescription),
);
dispatch(fetchModifyPrescriptionReset());
dispatch(fetchModifyPrescriptionReset());*/
}
}, [modifyPrescription]);
@ -685,7 +721,7 @@ const ModifierExecutionPrescriptionScreen = ({
}
}}>
<Text body2 semibold>
{`${item.user.firstname} ${item.user.lastname}`}
{`${item.user.firstname !== null ? item.user.firstname : ''} ${item.user.lastname !== null ? item.user.lastname : ''}`}
</Text>
</TouchableOpacity>
{item.beneficiaries.map((beneficiary) => (
@ -709,7 +745,7 @@ const ModifierExecutionPrescriptionScreen = ({
<View style={{width: 10}}/>
<View style={{paddingHorizontal: 10, alignItems: 'flex-start'}}>
<Text subhead semibold>
{`${beneficiary.firstname} ${beneficiary.lastname} (${I18n.t('AYANT_DROITS')})`}
{`${beneficiary.firstname !== null ? beneficiary.firstname : ''} ${beneficiary.lastname !== null ? beneficiary.lastname : ''} (${I18n.t('AYANT_DROITS')})`}
</Text>
</View>
</TouchableOpacity>
@ -1054,7 +1090,7 @@ const ModifierExecutionPrescriptionScreen = ({
switch (currentStep) {
case 0:
console.log("values", values);
if (values.numero_assure !== '') {
if (values.numero_assure !== '' && getUserByNameOrNumber.result === null) {
dispatch(fetchGetUserByNameOrNumberReset());
if (isNumeroAssureSearch)
fetchGetUserByNameOrNumber(wallet.id_network, `&insured_id=${values.numero_assure}`);

View File

@ -428,12 +428,24 @@ const ModifierFeuilleSoinScreen = ({
}
if (getUserByNameOrNumber.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getUserByNameOrNumber),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetUserByNameOrNumberReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getUserByNameOrNumber),
);
dispatch(fetchGetUserByNameOrNumberReset());
dispatch(fetchGetUserByNameOrNumberReset());*/
}
}, [getUserByNameOrNumber]);
@ -443,12 +455,24 @@ const ModifierFeuilleSoinScreen = ({
setModalConsultation(true);
if (getConsultation.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getConsultation),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetConsultationReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getConsultation),
);
dispatch(fetchGetConsultationReset());
dispatch(fetchGetConsultationReset());*/
}
}, [getConsultation]);
@ -471,12 +495,24 @@ const ModifierFeuilleSoinScreen = ({
}
if (modifyPrescription.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(modifyPrescription),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchModifyPrescriptionReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(modifyPrescription),
);
dispatch(fetchModifyPrescriptionReset());
dispatch(fetchModifyPrescriptionReset());*/
}
}, [modifyPrescription]);
@ -1971,7 +2007,7 @@ const ModifierFeuilleSoinScreen = ({
}
}}>
<Text body2 semibold>
{`${item.user.firstname} ${item.user.lastname}`}
{`${item.user.firstname !== null ? item.user.firstname : ''} ${item.user.lastname !== null ? item.user.lastname : ''}`}
</Text>
</TouchableOpacity>
{item.beneficiaries.map((beneficiary) => (
@ -1994,7 +2030,7 @@ const ModifierFeuilleSoinScreen = ({
<View style={{width: 10}}/>
<View style={{paddingHorizontal: 10, alignItems: 'flex-start'}}>
<Text subhead semibold>
{`${beneficiary.firstname} ${beneficiary.lastname} (${I18n.t('AYANT_DROITS')})`}
{`${beneficiary.firstname !== null ? beneficiary.firstname : ''} ${beneficiary.lastname !== null ? beneficiary.lastname : ''} (${I18n.t('AYANT_DROITS')})`}
</Text>
</View>
</TouchableOpacity>
@ -2383,7 +2419,7 @@ const ModifierFeuilleSoinScreen = ({
switch (currentStep) {
case 0:
console.log("values", values);
if (values.numero_assure !== '') {
if (values.numero_assure !== '' && getUserByNameOrNumber.result === null) {
dispatch(fetchGetUserByNameOrNumberReset());
if (isNumeroAssureSearch)
fetchGetUserByNameOrNumber(wallet.id_network, `&insured_id=${values.numero_assure}`);

View File

@ -48,7 +48,7 @@ import {
fetchGetUserByIdQRCode,
fetchGetUserByIdQRCodeReset,
fetchGetUserByNameOrNumber,
fetchGetUserByNameOrNumberReset
fetchGetUserByNameOrNumberReset, fetchModifyPrescriptionReset
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
import {readUser} from "../../../webservice/AuthApi";
@ -403,12 +403,24 @@ const SaisirFeuilleSoinScreen = ({
}
if (getUserByNameOrNumber.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getUserByNameOrNumber),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetUserByNameOrNumberReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getUserByNameOrNumber),
);
dispatch(fetchGetUserByNameOrNumberReset());
dispatch(fetchGetUserByNameOrNumberReset());*/
}
}, [getUserByNameOrNumber]);
@ -436,12 +448,24 @@ const SaisirFeuilleSoinScreen = ({
}
if (getDrugAppareil.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getDrugAppareil),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetDrugAppareilReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getDrugAppareil),
);
dispatch(fetchGetDrugAppareilReset());
dispatch(fetchGetDrugAppareilReset());*/
}
}, [getDrugAppareil]);
@ -452,12 +476,24 @@ const SaisirFeuilleSoinScreen = ({
}
if (addDrug.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(addDrug),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchAddDrugReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(addDrug),
);
dispatch(fetchAddDrugReset());
dispatch(fetchAddDrugReset());*/
}
}, [addDrug]);
@ -480,12 +516,24 @@ const SaisirFeuilleSoinScreen = ({
}
if (createConsultation.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(createConsultation),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchCreateConsultationReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(createConsultation),
);
dispatch(fetchCreateConsultationReset());
dispatch(fetchCreateConsultationReset());*/
}
}, [createConsultation]);
@ -1246,13 +1294,13 @@ const SaisirFeuilleSoinScreen = ({
'firstname_patient',
item.user.firstname,
);
fetchGetNetworkActs(wallet.id_network, '', `&user_id=${item.id}`);
fetchGetNetworkActs(wallet.id_network, '', `&user_id=${item.user.id}`);
dispatch(fetchGetUserByNameOrNumberReset());
wizard.current.next();
}
}}>
<Text body2 semibold>
{`${item.user.firstname} ${item.user.lastname}`}
{`${item.user.firstname !== null ? item.user.firstname : ''} ${item.user.lastname !== null ? item.user.lastname : ''}`}
</Text>
</TouchableOpacity>
{item.beneficiaries.map((beneficiary) => (
@ -1270,14 +1318,14 @@ const SaisirFeuilleSoinScreen = ({
'firstname_patient',
beneficiary.firstname,
);
fetchGetNetworkActs(wallet.id_network, '', `&user_id=${item.id}&beneficiary_id=${beneficiary.id}`);
fetchGetNetworkActs(wallet.id_network, '', `&user_id=${item.user.id}&beneficiary_id=${beneficiary.id}`);
dispatch(fetchGetUserByNameOrNumberReset());
wizard.current.next();
}}>
<View style={{width: 10}}/>
<View style={{paddingHorizontal: 10, alignItems: 'flex-start'}}>
<Text subhead semibold>
{`${beneficiary.firstname} ${beneficiary.lastname} (${I18n.t('AYANT_DROITS')})`}
{`${beneficiary.firstname !== null ? beneficiary.firstname : ''} ${beneficiary.lastname !== null ? beneficiary.lastname : ''} (${I18n.t('AYANT_DROITS')})`}
</Text>
</View>
</TouchableOpacity>
@ -1387,11 +1435,22 @@ const SaisirFeuilleSoinScreen = ({
onSubmit: values => {
if (prestations.length === 0) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
I18n.t('YOU_MUST_ADD_AT_LEAST_ONE_PRESTATION'),
[
{
text: I18n.t("OK"), onPress: () => {
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
I18n.t('YOU_MUST_ADD_AT_LEAST_ONE_PRESTATION'),
);
);*/
} else {
fetchCreateConsultation({
insured_id: assure.insured_id,
@ -1418,8 +1477,8 @@ const SaisirFeuilleSoinScreen = ({
switch (currentStep) {
case 0:
console.log("values", values);
if (values.numero_assure !== '') {
dispatch(fetchGetUserByNameOrNumberReset());
if (values.numero_assure !== '' && getUserByNameOrNumber.result === null) {
if (isNumeroAssureSearch)
fetchGetUserByNameOrNumber(wallet.id_network, `&insured_id=${values.numero_assure}`);
else if (isPhoneAssureSearch)

View File

@ -20,7 +20,7 @@ import FontAwesome from "react-native-vector-icons/FontAwesome";
import {responsiveWidth} from "react-native-responsive-dimensions";
import {
fetchActivePaySubscription,
fetchActivePaySubscriptionReset,
fetchActivePaySubscriptionReset, fetchCreateConsultationReset,
fetchGetSubscriptionList,
fetchGetSubscriptionListReset
} from "../../../redux/insurance/insurance.actions";
@ -216,12 +216,24 @@ const ActivateBuySubscriptionScreen = ({
}
if (subscriptionList.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(subscriptionList),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetSubscriptionListReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(subscriptionList),
);
dispatch(fetchGetSubscriptionListReset());
dispatch(fetchGetSubscriptionListReset());*/
}
}, [subscriptionList]);
@ -244,12 +256,24 @@ const ActivateBuySubscriptionScreen = ({
}
if (activatePaySubscription.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(activatePaySubscription),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchActivePaySubscriptionReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(activatePaySubscription),
);
dispatch(fetchActivePaySubscriptionReset());
dispatch(fetchActivePaySubscriptionReset());*/
}
}, [activatePaySubscription]);

View File

@ -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 {
fetchActivePaySubscriptionReset,
fetchAddBeneficiaryToSubscription,
fetchAddBeneficiaryToSubscriptionReset,
fetchGetInsurancePrimeAmount,
@ -303,12 +304,24 @@ const AddBeneficiaryScreen = ({
}
if (subscriptionList.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(subscriptionList),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetListInsuranceReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(subscriptionList),
);
dispatch(fetchGetListInsuranceReset());
dispatch(fetchGetListInsuranceReset());*/
}
}, [subscriptionList]);
@ -331,12 +344,24 @@ const AddBeneficiaryScreen = ({
}
if (addBeneficiaryToSubscription.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(addBeneficiaryToSubscription),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchSubscribeInsuranceReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(addBeneficiaryToSubscription),
);
dispatch(fetchSubscribeInsuranceReset());
dispatch(fetchSubscribeInsuranceReset());*/
}
}, [addBeneficiaryToSubscription]);
@ -347,11 +372,22 @@ const AddBeneficiaryScreen = ({
if (subscription !== null) {
if (beneficiaries.length === parseInt(subscription.max_number_of_beneficiaries)) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
I18n.t('NUMBER_MAX_BENEFICIARY'),
[
{
text: I18n.t("OK"), onPress: () => {
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
I18n.t('NUMBER_MAX_BENEFICIARY'),
);
);*/
} else {
console.log("affiliation", affiliation);
let beneficiariesTemp = beneficiaries;
@ -381,12 +417,24 @@ const AddBeneficiaryScreen = ({
}
if (uploadInsuranceImages.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(uploadInsuranceImages),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchUploadInsuranceReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(uploadInsuranceImages),
);
dispatch(fetchUploadInsuranceReset());
dispatch(fetchUploadInsuranceReset());*/
}
}, [uploadInsuranceImages]);
@ -959,7 +1007,7 @@ const AddBeneficiaryScreen = ({
onPress={() => {
if (subscription === null) {
dropDownAlertRef.alertWithType(
'error',
'warn',
I18n.t('ERROR_LABEL'),
I18n.t('PLEASE_SELECT_INSURANCE_BEFORE'),
);

View File

@ -250,12 +250,24 @@ const DeleteBeneficiaryScreen = ({
}
if (subscriptionList.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(subscriptionList),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetListInsuranceReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(subscriptionList),
);
dispatch(fetchGetListInsuranceReset());
dispatch(fetchGetListInsuranceReset());*/
}
}, [subscriptionList]);
@ -278,12 +290,24 @@ const DeleteBeneficiaryScreen = ({
}
if (deleteBeneficiary.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(deleteBeneficiary),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchDeleteBeneficiaryReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(deleteBeneficiary),
);
dispatch(fetchDeleteBeneficiaryReset());
dispatch(fetchDeleteBeneficiaryReset());*/
}
}, [deleteBeneficiary]);

View File

@ -25,11 +25,15 @@ import {ScreenComponent} from "../../../components/ScreenComponent";
import {
fetchAcceptRejectConsultation,
fetchAcceptRejectConsultationReset,
fetchActivePaySubscription, fetchDemaneAutorisationSoin, fetchDemaneAutorisationSoinReset,
fetchActivePaySubscription,
fetchDeleteBeneficiaryReset,
fetchDemaneAutorisationSoin,
fetchDemaneAutorisationSoinReset,
fetchGetConsultation,
fetchGetConsultationReset,
fetchGetListInsurance,
fetchGetListInsuranceReset, fetchGetListInsuranceWithBeneficiaries,
fetchGetListInsuranceReset,
fetchGetListInsuranceWithBeneficiaries,
fetchGetNetworkActs
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
@ -111,12 +115,24 @@ const DemandeAutorisationSoinScreen = ({
useEffect(() => {
if (getConsultation.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getConsultation),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetConsultationReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getConsultation),
);
dispatch(fetchGetConsultationReset());
dispatch(fetchGetConsultationReset());*/
}
}, [getConsultation]);
@ -132,12 +148,24 @@ const DemandeAutorisationSoinScreen = ({
}
if (insuranceList.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(insuranceList),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetListInsuranceReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(insuranceList),
);
dispatch(fetchGetListInsuranceReset());
dispatch(fetchGetListInsuranceReset());*/
}
}, [insuranceList]);
@ -160,12 +188,24 @@ const DemandeAutorisationSoinScreen = ({
}
if (demandeAutorisationSoin.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(demandeAutorisationSoin),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchDemaneAutorisationSoinReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(demandeAutorisationSoin),
);
dispatch(fetchDemaneAutorisationSoinReset());
dispatch(fetchDemaneAutorisationSoinReset());*/
}
}, [demandeAutorisationSoin]);

View File

@ -7,7 +7,7 @@
*/
import React, {useEffect, useState} from 'react';
import {
ActivityIndicator,
ActivityIndicator, Alert,
Dimensions,
FlatList,
Platform,
@ -25,7 +25,7 @@ import {ScreenComponent} from "../../../components/ScreenComponent";
import {
fetchAcceptRejectConsultation,
fetchAcceptRejectConsultationReset,
fetchActivePaySubscription,
fetchActivePaySubscription, fetchDemaneAutorisationSoinReset,
fetchGetConsultation,
fetchGetConsultationReset, fetchGetDemandeAutorisationSoin,
fetchGetSubscription
@ -106,12 +106,24 @@ const HistoriqueNanoSanteUserScreen = ({
}
if (getConsultation.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getConsultation),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetConsultationReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getConsultation),
);
dispatch(fetchGetConsultationReset());
dispatch(fetchGetConsultationReset());*/
}
//forceUpdate();
}, [getConsultation]);

View File

@ -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 {
fetchGetConsultationReset,
fetchGetInsurancePrimeAmount,
fetchGetInsurancePrimeAmountReset,
fetchGetListInsurance,
@ -291,12 +292,24 @@ const InsuranceSubscriptionScreen = ({
}
if (insuranceList.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(insuranceList),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetListInsuranceReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(insuranceList),
);
dispatch(fetchGetListInsuranceReset());
dispatch(fetchGetListInsuranceReset());*/
}
}, [insuranceList]);
@ -319,12 +332,24 @@ const InsuranceSubscriptionScreen = ({
}
if (subscribeInsurance.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(subscribeInsurance),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchSubscribeInsuranceReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(subscribeInsurance),
);
dispatch(fetchSubscribeInsuranceReset());
dispatch(fetchSubscribeInsuranceReset());*/
}
}, [subscribeInsurance]);
@ -333,12 +358,24 @@ const InsuranceSubscriptionScreen = ({
setShowModalDetail(true);
if (insurancePrimeAmount.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(insurancePrimeAmount),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetInsurancePrimeAmountReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(insurancePrimeAmount),
);
dispatch(fetchGetInsurancePrimeAmountReset());
dispatch(fetchGetInsurancePrimeAmountReset());*/
}
}, [insurancePrimeAmount]);
@ -352,11 +389,22 @@ const InsuranceSubscriptionScreen = ({
if (insurance !== null) {
if (beneficiaries.length === parseInt(insurance.max_number_of_beneficiaries)) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
I18n.t("NUMBER_MAX_BENEFICIARY"),
[
{
text: I18n.t("OK"), onPress: () => {
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
I18n.t('NUMBER_MAX_BENEFICIARY'),
);
);*/
} else {
console.log("affiliation", affiliation);
let beneficiariesTemp = beneficiaries;
@ -385,12 +433,24 @@ const InsuranceSubscriptionScreen = ({
}
if (uploadInsuranceImages.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(uploadInsuranceImages),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchUploadInsuranceReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(uploadInsuranceImages),
);
dispatch(fetchUploadInsuranceReset());
dispatch(fetchUploadInsuranceReset());*/
}
}, [uploadInsuranceImages]);
@ -1170,11 +1230,23 @@ const InsuranceSubscriptionScreen = ({
<TouchableOpacity
onPress={() => {
if (insurance === null) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
I18n.t("PLEASE_SELECT_INSURANCE_BEFORE"),
Utils.getErrorMsg(uploadInsuranceImages),
[
{
text: I18n.t("OK"), onPress: () => {
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
I18n.t('PLEASE_SELECT_INSURANCE_BEFORE'),
);
);*/
} else {
setModalVisible(true);
setShowDateNaissancePicker(false);

View File

@ -0,0 +1,410 @@
import React, {useEffect, useState} from 'react';
import {Alert, Dimensions, KeyboardAvoidingView, Platform, ScrollView, StyleSheet, View,} from 'react-native';
import {connect, useDispatch} from 'react-redux';
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 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 {
fetchStopSubscription,
fetchStopSubscriptionReset,
fetchGetSubscriptionList,
fetchGetSubscriptionListReset,
fetchGetListInsuranceReset,
fetchGetListInsuranceWithBeneficiaries,
fetchRenewSubscription, fetchUploadInsuranceReset
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
import {readUser} from "../../../webservice/AuthApi";
import * as Animatable from 'react-native-animatable';
import {createStructuredSelector} from "reselect";
import {
selectInsuranceList,
selectStopSubscription,
selectSubscriptionList
} from "../../../redux/insurance/insurance.selector";
import {Dropdown} from "react-native-material-dropdown";
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 RenewAssuranceScreen = ({
stopSubscription,
fetchGetSubscriptionList,
fetchGetListInsuranceWithBeneficiaries,
insuranceList,
fetchRenewSubscription,
navigation
}) => {
const [user, setUser] = useState(null);
const [password, setPassword] = useState(null);
const [subscriptions, setSubscriptions] = useState([]);
const [subscription, setSubscription] = useState(null);
const dispatch = useDispatch();
let dropDownAlertRef: any = null;
let subscriptionRef = null;
let amountPerMonthRef = null;
useEffect(() => {
readUser().then((user) => {
setUser(user)
});
dispatch(fetchGetListInsuranceReset());
dispatch(fetchGetSubscriptionListReset());
dispatch(fetchStopSubscriptionReset());
}, []);
useEffect(() => {
if (user !== null) {
console.log("user", user.id);
fetchGetListInsuranceWithBeneficiaries(`?user_id=${user.id}&type=STOPPED`);
//fetchGetSubscriptionList(user.id, 'ACCEPTED', true);
}
}, [user]);
useEffect(() => {
if (insuranceList.result !== null) {
let insuranceListTemp = [];
insuranceList.result.response.map((subscriptionItem, index) => {
insuranceListTemp.push(subscriptionItem);
});
setSubscriptions(insuranceListTemp);
}
if (insuranceList.error) {
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(insuranceList),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetSubscriptionListReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(insuranceList),
);
dispatch(fetchGetSubscriptionListReset());*/
}
}, [insuranceList]);
useEffect(() => {
if (stopSubscription.result !== null) {
Alert.alert(
I18n.t("SUCCESS"),
stopSubscription.result.response,
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchStopSubscriptionReset());
navigation.goBack();
}
}
],
{cancelable: false}
)
}
if (stopSubscription.error) {
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(stopSubscription),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchStopSubscriptionReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(stopSubscription),
);
dispatch(fetchStopSubscriptionReset());*/
}
}, [stopSubscription]);
const RegisterSchema = Yup.object().shape({
password: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
});
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("subscription", subscription);
fetchRenewSubscription(subscription.id, {password: values.password});
}
}
}}>
{({
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_INSURANCE')}
data={subscriptions}
useNativeDriver={true}
onChangeText={(value, index, data) => {
console.log("Value", value);
setSubscription(
{
id: value.id,
insurance_subscription_id: value.insurance_subscription_id,
network_id: value.network_id,
user_id: value.user_id,
number_of_months: value.number_of_months,
bonus_amount: value.bonus_amount,
number_of_beneficiaries: value.number_of_beneficiaries,
total_bonus_amount: value.total_bonus_amount,
state: value.state,
created_at: value.created_at,
updated_at: value.updated_at,
start_at: value.start_at,
end_at: value.end_at,
reason: value.reason,
network: value.network,
beneficiaries: value.beneficiaries
}
);
}}
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={stopSubscription.loading}
onPress={handleSubmit}>
{I18n.t('SUBMIT_LABEL')}
</Button>
</View>
)}
</Formik>
</ScrollView>
</KeyboardAvoidingView>
</ScreenComponent>
);
};
const mapStateToProps = createStructuredSelector({
insuranceList: selectInsuranceList,
stopSubscription: selectStopSubscription
});
export default connect(mapStateToProps, {
fetchRenewSubscription,
fetchGetListInsuranceWithBeneficiaries,
fetchGetSubscriptionList,
})(
RenewAssuranceScreen,
);

View File

@ -15,13 +15,17 @@ import {
fetchStopSubscription,
fetchStopSubscriptionReset,
fetchGetSubscriptionList,
fetchGetSubscriptionListReset
fetchGetSubscriptionListReset, fetchGetListInsuranceReset, fetchGetListInsuranceWithBeneficiaries
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
import {readUser} from "../../../webservice/AuthApi";
import * as Animatable from 'react-native-animatable';
import {createStructuredSelector} from "reselect";
import {selectStopSubscription, selectSubscriptionList} from "../../../redux/insurance/insurance.selector";
import {
selectInsuranceList,
selectStopSubscription,
selectSubscriptionList
} from "../../../redux/insurance/insurance.selector";
import {Dropdown} from "react-native-material-dropdown";
@ -169,7 +173,8 @@ const styles = StyleSheet.create({
const StopSubscriptionScreen = ({
stopSubscription,
fetchGetSubscriptionList,
subscriptionList,
fetchGetListInsuranceWithBeneficiaries,
insuranceList,
fetchStopSubscription,
navigation
}) => {
@ -188,6 +193,7 @@ const StopSubscriptionScreen = ({
readUser().then((user) => {
setUser(user)
});
dispatch(fetchGetListInsuranceReset());
dispatch(fetchGetSubscriptionListReset());
dispatch(fetchStopSubscriptionReset());
}, []);
@ -195,28 +201,41 @@ const StopSubscriptionScreen = ({
useEffect(() => {
if (user !== null) {
console.log("user", user.id);
fetchGetSubscriptionList(user.id, 'ACCEPTED', true);
fetchGetListInsuranceWithBeneficiaries(`?user_id=${user.id}&type=EDITABLE`);
//fetchGetSubscriptionList(user.id, 'ACCEPTED', true);
}
}, [user]);
useEffect(() => {
if (subscriptionList.result !== null) {
let subscriptionListTemp = [];
subscriptionList.result.response.map((subscriptionItem, index) => {
subscriptionListTemp.push(subscriptionItem);
if (insuranceList.result !== null) {
let insuranceListTemp = [];
insuranceList.result.response.map((subscriptionItem, index) => {
insuranceListTemp.push(subscriptionItem);
});
setSubscriptions(subscriptionListTemp);
setSubscriptions(insuranceListTemp);
}
if (subscriptionList.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(subscriptionList),
);
if (insuranceList.error) {
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(insuranceList),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetSubscriptionListReset());
}
}, [subscriptionList]);
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(insuranceList),
);
dispatch(fetchGetSubscriptionListReset());*/
}
}, [insuranceList]);
useEffect(() => {
if (stopSubscription.result !== null) {
@ -237,12 +256,24 @@ const StopSubscriptionScreen = ({
}
if (stopSubscription.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(stopSubscription),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchStopSubscriptionReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(stopSubscription),
);
dispatch(fetchStopSubscriptionReset());
dispatch(fetchStopSubscriptionReset());*/
}
}, [stopSubscription]);
@ -363,12 +394,13 @@ const StopSubscriptionScreen = ({
};
const mapStateToProps = createStructuredSelector({
subscriptionList: selectSubscriptionList,
insuranceList: selectInsuranceList,
stopSubscription: selectStopSubscription
});
export default connect(mapStateToProps, {
fetchStopSubscription,
fetchGetListInsuranceWithBeneficiaries,
fetchGetSubscriptionList,
})(
StopSubscriptionScreen,

View File

@ -23,7 +23,7 @@ import {
fetchAcceptRejectConsultation,
fetchAcceptRejectConsultationReset,
fetchActivePaySubscription,
fetchGetConsultation
fetchGetConsultation, fetchStopSubscriptionReset
} from "../../../redux/insurance/insurance.actions";
import * as Utils from "../../../utils/UtilsFunction";
import {uppercaseFirstLetter} from "../../../utils/UtilsFunction";
@ -65,12 +65,24 @@ const ValidateConsultationDetailScreen = ({navigation, fetchAcceptRejectConsulta
}
if (acceptRefuseConsultation.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(acceptRefuseConsultation),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchAcceptRejectConsultationReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(acceptRefuseConsultation),
);
dispatch(fetchAcceptRejectConsultationReset());
dispatch(fetchAcceptRejectConsultationReset());*/
}
}, [acceptRefuseConsultation]);

View File

@ -75,12 +75,24 @@ const ValidateConsultationScreen = ({
useEffect(() => {
if (getConsultation.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(getConsultation),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchGetConsultationReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getConsultation),
);
dispatch(fetchGetConsultationReset());
dispatch(fetchGetConsultationReset());*/
}
}, [getConsultation]);
@ -106,12 +118,24 @@ const ValidateConsultationScreen = ({
}
if (acceptRefuseConsultation.error) {
dropDownAlertRef.alertWithType(
Alert.alert(
I18n.t("ERROR_LABLE"),
Utils.getErrorMsg(acceptRefuseConsultation),
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchAcceptRejectConsultationReset());
}
}
],
{ cancelable: false }
);
/* dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(acceptRefuseConsultation),
);
dispatch(fetchAcceptRejectConsultationReset());
dispatch(fetchAcceptRejectConsultationReset());*/
setDisplayModalHistory(false);
if (user !== null)
fetchGetConsultation(user.id, 'UNTREATED');

View File

@ -503,7 +503,7 @@ export const optionNanoSanteUserScreen = {
},
{
title: 'RENEW_INSSURANCE',
screen: '',
screen: 'renewAssuranceScreen',
icon: "cash-refund"
},
{