Validate soins ok

This commit is contained in:
Brice Zele 2021-12-07 06:25:01 +01:00
parent c90a4f3ad6
commit 4474f46d4a
16 changed files with 919 additions and 75 deletions

4
App.js
View File

@ -87,6 +87,8 @@ import InsuranceSubscriptionScreen from "./screens/wallet/user/InsuranceSubscrip
import AddBeneficiaryScreen from "./screens/wallet/user/AddBeneficiaryScreen";
import ActivateBuySubscriptionScreen from "./screens/wallet/user/ActivateBuySubscriptionScreen";
import SaisirFeuilleSoinScreen from "./screens/wallet/agent/SaisirFeuilleSoinScreen";
import ValidateConsultationScreen from "./screens/wallet/user/ValidateConsultationScreen";
import ValidateConsultationDetailScreen from "./screens/wallet/user/ValidateConsultationDetailScreen";
const instructions = Platform.select({
@ -136,6 +138,8 @@ const AppStack = createDrawerNavigator({
envoieWalletToBankUser: EnvoieWalletToBankUser,
addBeneficiaryScreen: AddBeneficiaryScreen,
insuranceSubscriptionScreen: InsuranceSubscriptionScreen,
validateConsultationScreen: ValidateConsultationScreen,
validateConsultationDetailScreen: ValidateConsultationDetailScreen,
activateBuySubscriptionScreen: ActivateBuySubscriptionScreen,
retraitWalletVersCashUser: RetraitWalletVersCashUser,
retraitCarteVersCashUser: RetraitCarteVersCashUser,

File diff suppressed because one or more lines are too long

View File

@ -662,5 +662,14 @@
"PRESTATION_SUCCESSFULLY_ADD": "Prestation ajouté avec succès",
"EXAMENS_SUCCESSFULLY_ADD": "Examens ajouté avec succès",
"PRESCRIPTIONS_SUCCESSFULLY_ADD": "Prescription ajouté avec succès",
"YOU_MUST_ADD_AT_LEAST_ONE_PRESTATION": "Vous devez ajouter au moins une prestation"
"YOU_MUST_ADD_AT_LEAST_ONE_PRESTATION": "Vous devez ajouter au moins une prestation",
"NO_DRUG_MATCH_YOU_SEARCH": "Aucun médicament ne correspond à votre rechercher, voulez-vous en ajouter ?",
"COMPRESSED": "Comprimé",
"SYRUP": "Sirop",
"SOLUTION": "Solution",
"SUPPOSITORY": "Suppositoire",
"DEVICE": "Appareillage",
"AJOUTER_NOUVEAU_MEDICAMENT": "Ajouter un nouveau médicament",
"SOUS_ORDONNANCE": "Sous ordonnance ?",
"PLEASE_SELECT_CONDITON_PRISE_CHARGE_FIRST": "Veuillez d'abord sélectionner la conditon de prise en charge"
}

View File

@ -1,74 +1,79 @@
import React from "react";
import { TouchableOpacity, StyleSheet, ActivityIndicator } from "react-native";
import { Color } from '../../config/Color';
import {ActivityIndicator, StyleSheet, TouchableOpacity} from "react-native";
import {Color} from '../../config/Color';
import PropTypes from "prop-types";
import CustomText from "../CustomText";
import styles from "./styles";
export default function CustomButton(props) {
const {
style,
styleCustomText,
icon,
outline,
full,
round,
loading,
children,
...rest
} = props;
const {
style,
styleCustomText,
icon,
outline,
onPress,
full,
round,
loading,
children,
...rest
} = props;
return (
<TouchableOpacity
{...rest}
style={StyleSheet.flatten([
[styles.default, { backgroundColor: Color.primaryColor }],
outline && [
styles.outline,
{ backgroundColor: Color.cardBackgroundColor, borderColor: Color.primaryColor }
],
full && styles.full,
round && styles.round,
style
])}
activeOpacity={0.9}
>
{icon ? icon : null}
<CustomText
style={StyleSheet.flatten([
styles.textDefault,
outline && { color: Color.primaryColor },
styleCustomText
])}
numberOfLines={1}
>
{children || "CustomButton"}
</CustomText>
{loading ? (
<ActivityIndicator
size="small"
color={outline ? Color.primaryColor : Color.whiteColor}
style={{ paddingLeft: 5 }}
/>
) : null}
</TouchableOpacity>
);
return (
<TouchableOpacity
{...rest}
style={StyleSheet.flatten([
[styles.default, {backgroundColor: Color.primaryColor}],
outline && [
styles.outline,
{backgroundColor: Color.cardBackgroundColor, borderColor: Color.primaryColor}
],
full && styles.full,
round && styles.round,
style
])}
activeOpacity={0.9}
onPress={onPress}
>
{icon ? icon : null}
<CustomText
style={StyleSheet.flatten([
styles.textDefault,
outline && {color: Color.primaryColor},
styleCustomText
])}
numberOfLines={1}
>
{children || "CustomButton"}
</CustomText>
{loading ? (
<ActivityIndicator
size="small"
color={outline ? Color.primaryColor : Color.whiteColor}
style={{paddingLeft: 5}}
/>
) : null}
</TouchableOpacity>
);
}
CustomButton.propTypes = {
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
icon: PropTypes.node,
outline: PropTypes.bool,
full: PropTypes.bool,
round: PropTypes.bool,
loading: PropTypes.bool
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
icon: PropTypes.node,
outline: PropTypes.bool,
full: PropTypes.bool,
onPress: PropTypes.func,
round: PropTypes.bool,
loading: PropTypes.bool
};
CustomButton.defaultProps = {
style: {},
icon: null,
outline: false,
full: false,
round: false,
loading: false
style: {},
icon: null,
outline: false,
full: false,
onPress: () => {
},
round: false,
loading: false
};

View File

@ -7,6 +7,7 @@
*/
import InsuranceActions from './insurance.type';
import {
consultationUrl,
createConsultationUrl,
getAmountConsultationUrl,
getDrugAndDevicesUrl,
@ -463,3 +464,62 @@ export const fetchGetAmountConsultation = (data) => {
onError: fetchGetAmountConsultationError,
});
};
/************************************************************/
export const fetchGetConsultationPending = () => ({
type: InsuranceActions.GET_USER_CONSULTATION_PENDING,
});
export const fetchGetConsultationReset = () => ({
type: InsuranceActions.GET_USER_CONSULTATION_RESET,
});
export const fetchGetConsultationSuccess = (authkey: any) => ({
type: InsuranceActions.GET_USER_CONSULTATION_SUCCESS,
payload: authkey,
});
export const fetchGetConsultationError = (error: any) => ({
type: InsuranceActions.GET_USER_CONSULTATION_ERROR,
payload: error,
});
export const fetchGetConsultation = (user_id) => {
return ApiAction({
url: `${consultationUrl}?user_id=${user_id}`,
method: 'GET',
onLoading: fetchGetConsultationPending,
onSuccess: fetchGetConsultationSuccess,
onError: fetchGetConsultationError,
});
};
/************************************************************/
export const fetchAcceptRejectConsultationPending = () => ({
type: InsuranceActions.ACCEPT_REJECT_CONSULTATION_PENDING,
});
export const fetchAcceptRejectConsultationReset = () => ({
type: InsuranceActions.ACCEPT_REJECT_CONSULTATION_RESET,
});
export const fetchAcceptRejectConsultationSuccess = (authkey: any) => ({
type: InsuranceActions.ACCEPT_REJECT_CONSULTATION_SUCCESS,
payload: authkey,
});
export const fetchAcceptRejectConsultationError = (error: any) => ({
type: InsuranceActions.ACCEPT_REJECT_CONSULTATION_ERROR,
payload: error,
});
export const fetchAcceptRejectConsultation = (data) => {
return ApiAction({
url: `${consultationUrl}`,
method: 'PUT',
data,
onLoading: fetchAcceptRejectConsultationPending,
onSuccess: fetchAcceptRejectConsultationSuccess,
onError: fetchAcceptRejectConsultationError,
});
};

View File

@ -467,3 +467,63 @@ export const getAmountConsultationReducer = (state = INITIAL_STATE, action: Insu
}
};
export const getConsultationReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
switch (action.type) {
case InsuranceActions.GET_USER_CONSULTATION_PENDING:
return {
...state,
loading: true
}
case InsuranceActions.GET_USER_CONSULTATION_SUCCESS:
return {
loading: false,
result: action.payload,
error: null
}
case InsuranceActions.GET_USER_CONSULTATION_ERROR:
return {
...state,
loading: false,
result: null,
error: action.payload
}
case InsuranceActions.GET_USER_CONSULTATION_RESET:
return INITIAL_STATE;
default:
return state
}
};
export const acceptOrRejectConsultationReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
switch (action.type) {
case InsuranceActions.ACCEPT_REJECT_CONSULTATION_PENDING:
return {
...state,
loading: true
}
case InsuranceActions.ACCEPT_REJECT_CONSULTATION_SUCCESS:
return {
loading: false,
result: action.payload,
error: null
}
case InsuranceActions.ACCEPT_REJECT_CONSULTATION_ERROR:
return {
...state,
loading: false,
result: null,
error: action.payload
}
case InsuranceActions.ACCEPT_REJECT_CONSULTATION_RESET:
return INITIAL_STATE;
default:
return state
}
};

View File

@ -22,6 +22,8 @@ const selectGetProviderClassReducer = (state) => state.getProviderClassReducer;
const selectGetNetworkActReducer = (state) => state.getNetworkActReducer;
const selectCreateConsultationReducer = (state) => state.createConsultationReducer;
const selectGetAmountConsultationReducer = (state) => state.getAmountConsultationReducer;
const selectGetConsultationReducer = (state) => state.getConsultationReducer;
const selectAcceptRefuseConsultationReducer = (state) => state.acceptOrRejectConsultationReducer;
export const selectInsuranceList = createSelector(
[selectInsuranceListReducer],
@ -90,3 +92,11 @@ export const selectGetAmountConsultation = createSelector(
[selectGetAmountConsultationReducer],
(getAmountConsultationReducer) => getAmountConsultationReducer
);
export const selectGetConsultation = createSelector(
[selectGetConsultationReducer],
(selectGetConsultation) => selectGetConsultation
);
export const selectAcceptRefuseConsultation = createSelector(
[selectAcceptRefuseConsultationReducer],
(acceptRejectConsultation) => acceptRejectConsultation
);

View File

@ -80,5 +80,15 @@ const InsuranceActions = {
GET_AMOUNT_CONSULTATION_SUCCESS: 'GET_AMOUNT_CONSULTATION_SUCCESS',
GET_AMOUNT_CONSULTATION_ERROR: 'GET_AMOUNT_CONSULTATION_ERROR',
GET_AMOUNT_CONSULTATION_RESET: 'GET_AMOUNT_CONSULTATION_RESET',
GET_USER_CONSULTATION_PENDING: 'GET_USER_CONSULTATION_PENDING',
GET_USER_CONSULTATION_SUCCESS: 'GET_USER_CONSULTATION_SUCCESS',
GET_USER_CONSULTATION_ERROR: 'GET_USER_CONSULTATION_ERROR',
GET_USER_CONSULTATION_RESET: 'GET_USER_CONSULTATION_RESET',
ACCEPT_REJECT_CONSULTATION_PENDING: 'ACCEPT_REJECT_CONSULTATION_PENDING',
ACCEPT_REJECT_CONSULTATION_SUCCESS: 'ACCEPT_REJECT_CONSULTATION_SUCCESS',
ACCEPT_REJECT_CONSULTATION_ERROR: 'ACCEPT_REJECT_CONSULTATION_ERROR',
ACCEPT_REJECT_CONSULTATION_RESET: 'ACCEPT_REJECT_CONSULTATION_RESET',
}
export default InsuranceActions;

View File

@ -51,10 +51,11 @@ import PayBillReducer from "./PayBillReducer";
import GetIlinkBankReducer from "./GetIlinkBankReducer";
import ReattachAccountReducer from "./ReattachAccountReducer";
import {
acceptOrRejectConsultationReducer,
activatePaySubscriptionReducer,
addBeneficiaryToSubscriptionReducer,
addDrugReducer,
createConsultationReducer, getAmountConsultationReducer,
createConsultationReducer, getAmountConsultationReducer, getConsultationReducer,
getDrugAppareilReducer,
getInsurancePrimeAmountReducer,
getNetworkActReducer,
@ -166,7 +167,9 @@ const rootReducer = persistCombineReducers(persistConfig, {
getProviderClassReducer: getProviderClassReducer,
getNetworkActReducer: getNetworkActReducer,
createConsultationReducer: createConsultationReducer,
getAmountConsultationReducer: getAmountConsultationReducer
getAmountConsultationReducer: getAmountConsultationReducer,
getConsultationReducer: getConsultationReducer,
acceptOrRejectConsultationReducer: acceptOrRejectConsultationReducer
});
export default rootReducer;

View File

@ -272,7 +272,7 @@ export default class OptionsMenu extends Component {
|| item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe'
|| item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent'
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser' || item === 'insuranceSubscriptionScreen'
|| item === 'addBeneficiaryScreen' || item === 'activateBuySubscriptionScreen' || item === 'saisirFeuilleSoinScreen') {
|| item === 'addBeneficiaryScreen' || item === 'activateBuySubscriptionScreen' || item === 'saisirFeuilleSoinScreen' || item === 'validateConsultationScreen' || item === 'validateConsultationDetailScreen') {
return null
} else {
const color = this.state.currentId === item.id ? theme.accent : "grey"

View File

@ -1773,6 +1773,7 @@ const SaisirFeuilleSoinScreen = ({
]}
onPress={e => {
dispatch(fetchGetAmountConsultationReset());
setIsVisiteDomicile(false);
if(careConditon === null) {
dropDownAlertRef.alertWithType(
'warn',

View File

@ -0,0 +1,260 @@
/**
* Project iLinkWorld
* File ValidateConsultationDetailScreen
* Path screens/wallet/user
* Created by BRICE ZELE
* Date: 01/12/2021
*/
import React, {useEffect, useState} from "react";
import {BaseStyle} from "../../../config/BaseStyle";
import {Alert, SafeAreaView, ScrollView, StyleSheet, View} from "react-native";
import I18n from 'react-native-i18n';
import {Color as BaseColor} from "../../../config/Color";
import Text from '../../../components/Text';
import {createStructuredSelector} from "reselect";
import {
selectAcceptRefuseConsultation,
selectActivatePaySubscription,
selectGetConsultation,
selectSubscriptionList
} from "../../../redux/insurance/insurance.selector";
import {connect, useDispatch} from "react-redux";
import {
fetchAcceptRejectConsultation,
fetchAcceptRejectConsultationReset,
fetchActivePaySubscription,
fetchGetConsultation
} from "../../../redux/insurance/insurance.actions";
import * as Utils from "../../../utils/UtilsFunction";
import {uppercaseFirstLetter} from "../../../utils/UtilsFunction";
import moment from "moment-timezone";
import CustomButton from "../../../components/CustomButton";
import {readUser} from "../../../webservice/AuthApi";
import DropdownAlert from "react-native-dropdownalert";
const ValidateConsultationDetailScreen = ({navigation, fetchAcceptRejectConsultation, acceptRefuseConsultation}) => {
const dispatch = useDispatch();
const [consultation, setConsultation] = useState(navigation.getParam('item'));
const [user, setUser] = useState(null);
let dropDownAlertRef: any = null;
useEffect(() => {
readUser().then((user) => {
setUser(user);
});
dispatch(fetchAcceptRejectConsultationReset());
}, []);
useEffect(() => {
if (acceptRefuseConsultation.result !== null) {
Alert.alert(
I18n.t("SUCCESS"),
acceptRefuseConsultation.result.response,
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchAcceptRejectConsultationReset());
navigation.goBack();
}
}
],
{cancelable: false}
);
}
if (acceptRefuseConsultation.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(acceptRefuseConsultation),
);
dispatch(fetchAcceptRejectConsultationReset());
}
}, [acceptRefuseConsultation]);
console.log("Consultation", consultation);
return (
<SafeAreaView style={BaseStyle.safeAreaView} forceInset={{top: 'always'}}>
<DropdownAlert ref={ref => (dropDownAlertRef = ref)}/>
<ScrollView>
<View style={styles.contain}>
<View style={[styles.contentRow]}>
<View
style={styles.colCenter}>
<Text body1 light>
{I18n.t('PATIENT')}
</Text>
<Text body2>
{`${consultation.patient_lastname} ${consultation.patient_firstname}`}
</Text>
<Text body2>{consultation.patient_situation.toLowerCase()}</Text>
</View>
<View
style={styles.colCenter}>
<Text body1 light>
{I18n.t('PRATICIEN')}
</Text>
<Text body2>
{`${consultation.practitioner_lastname} ${consultation.practitioner_firstname}`}
</Text>
<Text
body2>{uppercaseFirstLetter(consultation.practitioner_provider_class.toLowerCase())}</Text>
</View>
</View>
<View style={styles.line}/>
<View style={{flexDirection: 'row'}}>
<View style={{flex: 1}}>
<Text caption1 light>
{I18n.t('STATE')}
</Text>
<Text headline style={{marginTop: 5}}>
{uppercaseFirstLetter(consultation.state.toLowerCase())}
</Text>
</View>
<View style={{flex: 1}}>
<Text caption1 light>
Type
</Text>
<Text headline style={{marginTop: 5}}>
{uppercaseFirstLetter(consultation.type.toLowerCase())}
</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 25}}>
<View style={{flex: 1}}>
<Text caption1 light>
{I18n.t('CONDITION_PRISE_CHARGE')}
</Text>
<Text headline style={{marginTop: 5}}>
{uppercaseFirstLetter(consultation.care_condition.toLowerCase())}
</Text>
</View>
<View style={{flex: 1}}>
<Text caption1 light>
{I18n.t('INSTITUTE_NAME')}
</Text>
<Text headline style={{marginTop: 5}}>
{uppercaseFirstLetter(consultation.institution_name.toLowerCase())}
</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 25}}>
<View style={{flex: 1}}>
<Text caption1 light>
Date
</Text>
<Text headline style={{marginTop: 5}}>
{moment(consultation.created_at).format('YYYY-MM-DD')}
</Text>
</View>
</View>
<View style={styles.line}/>
<View style={{flexDirection: 'row', marginTop: 25}}>
<View style={{flex: 1}}>
<Text caption1 light>
{I18n.t('EXAMEN')}
</Text>
<Text headline style={{marginTop: 5}}>
{consultation.exams.length}
</Text>
</View>
<View style={{flex: 1}}>
<Text caption1 light>
{I18n.t('MEDICAMENT')}
</Text>
<Text headline style={{marginTop: 5}}>
{consultation.prescriptions.length}
</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 25}}>
<View style={{flex: 1}}>
<Text caption1 light>
{I18n.t('PRESTATION')}
</Text>
<Text headline style={{marginTop: 5}}>
{consultation.performances.length}
</Text>
</View>
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between', marginTop: 25}}>
<CustomButton onPress={() => {
fetchAcceptRejectConsultation({
health_care_sheet_id: consultation.id,
user_id: user.id,
action: "ACCEPT"
});
}}>
{I18n.t("ACCEPT")}
</CustomButton>
<CustomButton onPress={() => {
fetchAcceptRejectConsultation({
health_care_sheet_id: consultation.id,
user_id: user.id,
action: "REJECT"
});
}}>
{I18n.t("REJECT")}
</CustomButton>
</View>
</View>
</ScrollView>
</SafeAreaView>
);
}
const mapStateToProps = createStructuredSelector({
subscriptionList: selectSubscriptionList,
activatePaySubscription: selectActivatePaySubscription,
getConsultation: selectGetConsultation,
acceptRefuseConsultation: selectAcceptRefuseConsultation
});
export default connect(mapStateToProps, {
fetchActivePaySubscription,
fetchGetConsultation,
fetchAcceptRejectConsultation
})(
ValidateConsultationDetailScreen,
);
const styles = StyleSheet.create({
contain: {
padding: 20,
width: "100%"
},
classContent: {
flexDirection: "row",
justifyContent: "flex-end",
marginBottom: 15
},
line: {
width: "100%",
height: 1,
borderWidth: 0.5,
borderColor: BaseColor.dividerColor,
borderStyle: "dashed",
marginVertical: 20
},
code: {
width: "100%",
padding: 20,
alignItems: "center",
justifyContent: "center"
},
contentRow: {flexDirection: "row"},
centerView: {
alignItems: "center",
justifyContent: "center",
marginHorizontal: 10
},
colCenter: {flex: 1, alignItems: "flex-start"}
});

View File

@ -0,0 +1,411 @@
/**
* Project iLinkWorld
* File AcceptOrRejectConsultationScreen
* Path screens/wallet/user
* Created by BRICE ZELE
* Date: 01/12/2021
*/
import React, {useEffect, useState} from 'react';
import {
ActivityIndicator,
Alert,
Dimensions,
FlatList,
Platform,
ProgressBarAndroid,
ScrollView,
StyleSheet,
TouchableOpacity,
View,
} from 'react-native';
import {connect, useDispatch} from 'react-redux';
import {Color} from "../../../config/Color";
import I18n from 'react-native-i18n';
import {ScreenComponent} from "../../../components/ScreenComponent";
import {
fetchAcceptRejectConsultation,
fetchAcceptRejectConsultationReset,
fetchActivePaySubscription,
fetchGetConsultation,
fetchGetConsultationReset
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
import {createStructuredSelector} from "reselect";
import {
selectAcceptRefuseConsultation,
selectActivatePaySubscription,
selectGetConsultation,
selectSubscriptionList
} from "../../../redux/insurance/insurance.selector";
import {readUser} from "../../../webservice/AuthApi";
import Text from '../../../components/Text';
import * as Utils from "../../../utils/UtilsFunction";
import {uppercaseFirstLetter} from "../../../utils/UtilsFunction";
import Dialog from "react-native-dialog";
import {Typography} from "../../../config/typography";
let moment = require('moment-timezone');
const {width, height} = Dimensions.get('window');
const ValidateConsultationScreen = ({
navigation,
fetchGetConsultation,
fetchAcceptRejectConsultation,
getConsultation,
acceptRefuseConsultation
}) => {
const dispatch = useDispatch();
const [user, setUser] = useState(null);
const [displayModalHistory, setDisplayModalHistory] = useState(false);
const [historyItemDetail, setHistoryItemDetail] = useState({});
let dropDownAlertRef: any = null;
useEffect(() => {
readUser().then((user) => {
setUser(user);
console.log("User", user);
fetchGetConsultation(user.id);
});
dispatch(fetchGetConsultationReset());
dispatch(fetchAcceptRejectConsultationReset());
}, []);
useEffect(() => {
if (getConsultation.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(getConsultation),
);
dispatch(fetchGetConsultationReset());
}
}, [getConsultation]);
useEffect(() => {
if (acceptRefuseConsultation.result !== null) {
Alert.alert(
I18n.t("SUCCESS"),
acceptRefuseConsultation.result.response,
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchAcceptRejectConsultationReset());
fetchGetConsultation(user.id);
setDisplayModalHistory(false);
}
}
],
{cancelable: false}
);
}
if (acceptRefuseConsultation.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(acceptRefuseConsultation),
);
dispatch(fetchAcceptRejectConsultationReset());
setDisplayModalHistory(false);
}
}, [acceptRefuseConsultation]);
const renderLoader = () => (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
{Platform.OS === 'android'
?
(
<>
<ProgressBarAndroid/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
) :
<>
<ActivityIndicator size="large" color={'#ccc'}/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
}
</View>
);
const renderModalHistoryDetail = () => (
<Dialog.Container useNativeDriver={true} visible={displayModalHistory}>
<Dialog.Title>{I18n.t('DETAIL')}</Dialog.Title>
<ScrollView persistentScrollbar={true}>
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('PATIENT')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{`${historyItemDetail.patient_lastname} ${historyItemDetail.patient_firstname}`}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>Situation</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{historyItemDetail.patient_situation.toLowerCase()}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('PRATICIEN')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{`${historyItemDetail.practitioner_lastname} ${historyItemDetail.practitioner_firstname}`}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('CLASSE_PRESTATAIRE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{uppercaseFirstLetter(historyItemDetail.practitioner_provider_class.toLowerCase())}</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]}>Type</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{uppercaseFirstLetter(historyItemDetail.type.toLowerCase())}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('CONDITION_PRISE_CHARGE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{uppercaseFirstLetter(historyItemDetail.care_condition.toLowerCase())}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('INSTITUTE_NAME')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{uppercaseFirstLetter(historyItemDetail.institution_name.toLowerCase())}</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]}>{moment(historyItemDetail.created_at).format('YYYY-MM-DD')}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('EXAMEN')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
{historyItemDetail.exams.map(exam => (
<Text
style={[Typography.caption1, Color.grayColor]}>{`${exam.description} \n ${exam.act.name} \n`}</Text>
))}
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('MEDICAMENT')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
{historyItemDetail.prescriptions.map(prescription => (
<Text
style={[Typography.caption1, Color.grayColor]}>{`${prescription.drug_or_device.name} \n ${prescription.dosage} \n`}</Text>
))}
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('PRESTATION')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
{historyItemDetail.performances.map(performance => (
<Text
style={[Typography.caption1, Color.grayColor]}>{`${performance.act.name} \n ${performance.amount} \n`}</Text>
))}
</View>
</View>
</View>
</ScrollView>
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
setDisplayModalHistory(false);
}}/>
<Dialog.Button bold={true} label={I18n.t('REJECT')} onPress={() => {
fetchAcceptRejectConsultation({
health_care_sheet_id: historyItemDetail.id,
user_id: user.id,
action: "REJECT"
});
}}/>
<Dialog.Button bold={true} label={I18n.t('ACCEPT')} onPress={() => {
fetchAcceptRejectConsultation({
health_care_sheet_id: historyItemDetail.id,
user_id: user.id,
action: "ACCEPT"
});
}}/>
</Dialog.Container>
)
const renderItem = (item) => (
<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('PATIENT')}: ${item.patient_lastname} ${item.patient_firstname}`}</Text>
<Text footnote light numberOfLines={1}>
{`${I18n.t('SITUATION')}: ${item.patient_situation.toLowerCase()}`}
</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
caption1>{`${I18n.t('PRATICIEN')}: ${item.practitioner_lastname} ${item.practitioner_firstname}`}</Text>
<Text footnote light numberOfLines={1}>
{`${I18n.t('SITUATION')}: ${item.practitioner_provider_class}`}
</Text>
</View>
</View>
<View style={styles.contentBottom}>
<View style={styles.bottomLeft}>
<View style={{marginHorizontal: 5}}>
<Text caption1 semibold accentColor>
{`Type: ${item.type.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>
)
return (
<ScreenComponent>
<DropdownAlert ref={ref => (dropDownAlertRef = ref)}/>
<View style={styles.contain}>
{getConsultation.loading
? renderLoader()
: getConsultation.result !== null ?
(
<FlatList
style={{flex: 1}}
data={getConsultation.result.response}
keyExtractor={(item, index) => item.id}
renderItem={({item, index}) => (
renderItem(item)
)}
/>
)
: null}
{displayModalHistory && renderModalHistoryDetail()}
</View>
</ScreenComponent>
)
};
const mapStateToProps = createStructuredSelector({
subscriptionList: selectSubscriptionList,
activatePaySubscription: selectActivatePaySubscription,
getConsultation: selectGetConsultation,
acceptRefuseConsultation: selectAcceptRefuseConsultation
});
export default connect(mapStateToProps, {
fetchActivePaySubscription,
fetchGetConsultation,
fetchAcceptRejectConsultation,
})(
ValidateConsultationScreen,
);
const styles = StyleSheet.create({
textInput: {
height: 46,
backgroundColor: Color.fieldColor,
borderRadius: 5,
marginTop: 10,
padding: 10,
width: '100%',
},
lineRow: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingBottom: 20,
},
contain: {
marginTop: 20,
paddingBottom: 20,
paddingLeft: 10,
paddingRight: 10,
flex: 1,
},
content: {
padding: 10,
marginBottom: 10,
borderRadius: 8
},
contentTop: {
flexDirection: "row",
paddingBottom: 10,
borderBottomWidth: 1
},
contentBottom: {
flexDirection: "row",
marginTop: 10,
justifyContent: "space-between"
},
bottomLeft: {flexDirection: "row", alignItems: "center"},
image: {width: 32, height: 32, marginRight: 10, borderRadius: 16},
blockView: {
paddingVertical: 10,
borderBottomWidth: 0.5,
},
});

View File

@ -33,6 +33,10 @@ export const isNormalInteger = (str) => {
return true;
}
export const uppercaseFirstLetter = (str) => {
return str.charAt(0).toUpperCase() + str.slice(1)
}
export const getErrorMsg = (error: any) =>
error.error?.hasOwnProperty('message')
? Array.isArray(error.error?.message)
@ -529,7 +533,7 @@ export const optionNanoSanteUserScreen = {
},
{
title: 'VALID_HEALTH',
screen: '',
screen: 'validateConsultationScreen',
icon: 'cash'
},
]

View File

@ -573,7 +573,7 @@
"MANAGE_HEALTH": "Gérer ses soins",
"DEMAND_AUTORIZATION_HEALTH": "Demande autorisation soin",
"HISTORIC_HEALTH": "Consulter historique de ses soins",
"VALID_HEALTH": "Valider une feuille de soin ",
"VALID_HEALTH": "Valider un soin ",
"ACTIVATE_INSSURANCE": "Activer son assurance",
"AMOUNT_PER_DURATION": "Montant par durée",
"AMOUNT_PRIME": "Montant de la prime",
@ -671,5 +671,11 @@
"DEVICE": "Appareillage",
"AJOUTER_NOUVEAU_MEDICAMENT": "Ajouter un nouveau médicament",
"SOUS_ORDONNANCE": "Sous ordonnance ?",
"PLEASE_SELECT_CONDITON_PRISE_CHARGE_FIRST": "Veuillez d'abord sélectionner la conditon de prise en charge"
"PLEASE_SELECT_CONDITON_PRISE_CHARGE_FIRST": "Veuillez d'abord sélectionner la conditon de prise en charge",
"CONSULTATION": "Consultation",
"STATE": "Etat",
"INSTITUTE_NAME": "Nom de l'institut",
"ACCEPT": "Accepter",
"REJECT": "Rejeter",
"DETAIL": "Détail",
}

View File

@ -89,6 +89,7 @@ export const subscribeInsuranceUrl = testBaseUrl + '/nanoSanteService/insurances
export const getProviderClassUrl = testBaseUrl + '/nanoSanteService/provider-classes';
export const getNetworkActsUrl = testBaseUrl + '/nanoSanteService/acts';
export const createConsultationUrl = testBaseUrl + '/nanoSanteService/health-care-sheets/consultation';
export const consultationUrl = testBaseUrl + '/nanoSanteService/health-care-sheets';
export const getAmountConsultationUrl = testBaseUrl + '/nanoSanteService/health-care-sheets/performances-amount';
export const getInsurancePrimeAmountUrl = testBaseUrl + '/nanoSanteService/insurances/subscriptions/bonus-amount';
export const uploadInsuranceImagetUrl = 'https://test.ilink-app.com:8086/insurances/subscriptions/upload-images';