feat: Enhance user search functionality with improved payload handling and logging
This commit is contained in:
parent
6ab275100e
commit
cbe0067fdd
|
@ -2424,109 +2424,131 @@ class Home extends BaseScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSearchUser() {
|
renderSearchUser() {
|
||||||
return (
|
return (
|
||||||
<MaterialDialog
|
<MaterialDialog
|
||||||
title={I18n.t("SEARCH")}
|
title={I18n.t("SEARCH")}
|
||||||
visible={this.state.dialogSearchUser}
|
visible={this.state.dialogSearchUser}
|
||||||
onCancel={() => this.setState({dialogSearchUser: false})}
|
onCancel={() => this.setState({ dialogSearchUser: false })}
|
||||||
onOk={result => {
|
onOk={() => {
|
||||||
if(this.state.isPhoneAssureSearch) {
|
console.log(
|
||||||
this.props.searchUserAction({
|
"On ok search user===>>",
|
||||||
dial_code: this.state.indicatif,
|
this.state.userName,
|
||||||
phone: this.state.userName,
|
this.state.indicatif,
|
||||||
|
this.state.isPhoneAssureSearch,
|
||||||
|
this.state.isNumeroAssureSearch
|
||||||
|
);
|
||||||
|
// Prépare le payload
|
||||||
|
const payload = { dial_code: this.state.indicatif };
|
||||||
|
if (this.state.isPhoneAssureSearch) {
|
||||||
|
payload.phone = this.state.userName;
|
||||||
|
} else if (this.state.isNumeroAssureSearch) {
|
||||||
|
payload.identification_number = this.state.userName;
|
||||||
|
} else {
|
||||||
|
payload.name = this.state.userName;
|
||||||
|
}
|
||||||
|
// Lance l'action
|
||||||
|
this.props.searchUserAction(payload, true);
|
||||||
|
this.setState({ dialogSearchUser: false });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View>
|
||||||
|
<TextInput
|
||||||
|
style={{
|
||||||
|
marginTop: 10, height: 46, borderRadius: 5, borderWidth: 1, borderColor: "#ccc"
|
||||||
|
}}
|
||||||
|
placeholder={
|
||||||
|
this.state.isPhoneAssureSearch
|
||||||
|
? I18n.t("PHONE")
|
||||||
|
: this.state.isNumeroAssureSearch
|
||||||
|
? I18n.t("IMMATRICULATION_DGI") // nouveau libellé à ajouter dans vos traductions
|
||||||
|
: I18n.t("NAME")
|
||||||
|
}
|
||||||
|
value={this.state.userName}
|
||||||
|
keyboardType={this.state.isPhoneAssureSearch ? "numeric" : "default"}
|
||||||
|
onChangeText={userName => this.setState({ userName })}
|
||||||
|
icon={
|
||||||
|
<FontAwesome
|
||||||
|
style={{ zIndex: 10 }}
|
||||||
|
name={
|
||||||
|
this.state.isPhoneAssureSearch
|
||||||
|
? "phone"
|
||||||
|
: this.state.isNumeroAssureSearch
|
||||||
|
? "id-card" // icône FontAwesome5 pour le NIU
|
||||||
|
: "user"
|
||||||
|
}
|
||||||
|
size={20}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
}, true);
|
<View
|
||||||
} else {
|
style={{
|
||||||
this.props.searchUserAction({
|
flexDirection: "row",
|
||||||
dial_code: this.state.indicatif,
|
position: "absolute",
|
||||||
name: this.state.userName,
|
top: 22,
|
||||||
}, true);
|
right: 20,
|
||||||
}
|
}}
|
||||||
|
|
||||||
this.setState({dialogSearchUser: false});
|
|
||||||
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<View>
|
{/* Mode téléphone */}
|
||||||
<TextInput
|
<FontAwesomeIcon
|
||||||
style={{marginTop: 10, height: 46, borderRadius: 5, borderWidth: 1, borderColor: "#ccc"}}
|
name="phone"
|
||||||
placeholder={this.state.isPhoneAssureSearch ? I18n.t('PHONE') : I18n.t('NAME')}
|
size={20}
|
||||||
value={this.state.userName}
|
color={this.state.isPhoneAssureSearch ? Color.primaryColor : "#888"}
|
||||||
keyboardType={this.state.isPhoneAssureSearch ? 'numeric' : 'default'}
|
onPress={() =>
|
||||||
onChangeText={(userName) => {
|
this.setState({
|
||||||
this.setState({userName});
|
isPhoneAssureSearch: true,
|
||||||
}}
|
isNumeroAssureSearch: false
|
||||||
icon={
|
})
|
||||||
<FontAwesome
|
}
|
||||||
style={{zIndex: 10}}
|
style={{ marginHorizontal: 5 }}
|
||||||
name={this.state.isPhoneAssureSearch ? 'phone' : 'user'}
|
/>
|
||||||
size={20}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<View style={{
|
{/* Mode nom */}
|
||||||
flexDirection: 'row',
|
<FontAwesomeIcon
|
||||||
position: 'absolute',
|
name="user"
|
||||||
top: 22,
|
size={20}
|
||||||
right: 50,
|
color={
|
||||||
justifyContent: 'space-between',
|
!this.state.isPhoneAssureSearch && !this.state.isNumeroAssureSearch
|
||||||
width: 50
|
? Color.primaryColor
|
||||||
}}>
|
: "#888"
|
||||||
<FontAwesomeIcon
|
}
|
||||||
style={{paddingRight: 5}}
|
onPress={() =>
|
||||||
name='phone'
|
this.setState({
|
||||||
size={20}
|
isPhoneAssureSearch: false,
|
||||||
color={Color.primaryColor}
|
isNumeroAssureSearch: false
|
||||||
onPress={() => {
|
})
|
||||||
this.setState({
|
}
|
||||||
isNumeroAssureSearch: false,
|
style={{ marginHorizontal: 5 }}
|
||||||
isPhoneAssureSearch: true
|
/>
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<FontAwesomeIcon
|
|
||||||
style={{paddingRight: 5}}
|
|
||||||
name='user'
|
|
||||||
size={20}
|
|
||||||
color={Color.primaryColor}
|
|
||||||
onPress={() => {
|
|
||||||
this.setState({
|
|
||||||
isNumeroAssureSearch: false,
|
|
||||||
isPhoneAssureSearch: false
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<FontAwesomeIcon
|
|
||||||
style={{paddingRight: 5}}
|
|
||||||
name="qrcode"
|
|
||||||
size={20}
|
|
||||||
color={Color.primaryColor}
|
|
||||||
onPress={() => {
|
|
||||||
this.setState({
|
|
||||||
showQRCodeScanner: true
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
{/* <Fumi iconClass={FontAwesomeIcon}
|
{/* Mode NIU */}
|
||||||
label={I18n.t('NAME')}
|
<FontAwesomeIcon
|
||||||
iconColor={'#f95a25'}
|
name="id-card"
|
||||||
iconSize={20}
|
size={20}
|
||||||
iconName={"user"}
|
color={this.state.isNumeroAssureSearch ? Color.primaryColor : "#888"}
|
||||||
value={this.state.userName}
|
onPress={() =>
|
||||||
onChangeText={(userName) => {
|
this.setState({
|
||||||
this.setState({userName});
|
isPhoneAssureSearch: false,
|
||||||
}}
|
isNumeroAssureSearch: true
|
||||||
style={styles.input}
|
})
|
||||||
>
|
}
|
||||||
</Fumi>*/}
|
style={{ marginHorizontal: 5 }}
|
||||||
|
/>
|
||||||
|
|
||||||
</MaterialDialog>)
|
{/* Scanner QR */}
|
||||||
|
<FontAwesomeIcon
|
||||||
|
name="qrcode"
|
||||||
|
size={20}
|
||||||
|
color={Color.primaryColor}
|
||||||
|
onPress={() => this.setState({ showQRCodeScanner: true })}
|
||||||
|
style={{ marginHorizontal: 5 }}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</MaterialDialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
renderDialogResultSearchUser() {
|
renderDialogResultSearchUser() {
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ class NumeroQuitance extends Component {
|
||||||
static navigationOptions = () => {
|
static navigationOptions = () => {
|
||||||
return {
|
return {
|
||||||
drawerLabel: () => null,
|
drawerLabel: () => null,
|
||||||
headerTitle: I18n.t('QUITANCE'),
|
headerTitle: I18n.t('PAYMENT'),
|
||||||
headerTintColor: 'white',
|
headerTintColor: 'white',
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
backgroundColor: Color.primaryColor,
|
backgroundColor: Color.primaryColor,
|
||||||
|
|
|
@ -74,8 +74,8 @@ class NumeroQuitanceDetail extends Component {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
drawerLabel: () => null,
|
drawerLabel: () => null,
|
||||||
title: navigation.getParam("isModify", false) ? I18n.t('QUITANCE')
|
title: navigation.getParam("isModify", false) ? I18n.t('PAYMENT')
|
||||||
: I18n.t('QUITANCE'),
|
: I18n.t('PAYMENT'),
|
||||||
headerTintColor: 'white',
|
headerTintColor: 'white',
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
backgroundColor: Color.primaryColor,
|
backgroundColor: Color.primaryColor,
|
||||||
|
@ -119,15 +119,16 @@ class NumeroQuitanceDetail extends Component {
|
||||||
added_revenue_orders_items: [],
|
added_revenue_orders_items: [],
|
||||||
displayAddOrdreRecette: false,
|
displayAddOrdreRecette: false,
|
||||||
ordreRecetteId: this.props.navigation.getParam("isModify", false) ? this.props.navigation.getParam("item", "-").id_receipt : "",
|
ordreRecetteId: this.props.navigation.getParam("isModify", false) ? this.props.navigation.getParam("item", "-").id_receipt : "",
|
||||||
|
// Suppression de ces 2 moyens de paiement Wallet et Cash pour laissser uniquement Tresor pay qui lui vient plutot de l'API
|
||||||
paymentMethods: [
|
paymentMethods: [
|
||||||
{
|
// {
|
||||||
title: I18n.t('WALLET'),
|
// title: I18n.t('WALLET'),
|
||||||
value: 'wallet'
|
// value: 'wallet'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
title: I18n.t('CASH'),
|
// title: I18n.t('CASH'),
|
||||||
value: 'cash'
|
// value: 'cash'
|
||||||
},
|
// },
|
||||||
],
|
],
|
||||||
paymentMethod: 'wallet',
|
paymentMethod: 'wallet',
|
||||||
paymentUrl: '',
|
paymentUrl: '',
|
||||||
|
@ -285,15 +286,16 @@ class NumeroQuitanceDetail extends Component {
|
||||||
if (nextProps.paymentMethod !== null) {
|
if (nextProps.paymentMethod !== null) {
|
||||||
if (nextProps.paymentMethod.result !== null) {
|
if (nextProps.paymentMethod.result !== null) {
|
||||||
console.log("nextProps.paymentMethod", nextProps.paymentMethod);
|
console.log("nextProps.paymentMethod", nextProps.paymentMethod);
|
||||||
|
// Suppression de ces 2 moyens de paiement Wallet et Cash pour laissser uniquement Tresor pay qui lui vient plutot de l'API
|
||||||
const paymentsMethods = [
|
const paymentsMethods = [
|
||||||
{
|
// {
|
||||||
title: I18n.t('WALLET'),
|
// title: I18n.t('WALLET'),
|
||||||
value: 'wallet'
|
// value: 'wallet'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
title: I18n.t('CASH'),
|
// title: I18n.t('CASH'),
|
||||||
value: 'cash'
|
// value: 'cash'
|
||||||
},
|
// },
|
||||||
]
|
]
|
||||||
this.setState({
|
this.setState({
|
||||||
paymentMethods: [...paymentsMethods, ...nextProps.paymentMethod.result.response.methods]
|
paymentMethods: [...paymentsMethods, ...nextProps.paymentMethod.result.response.methods]
|
||||||
|
|
|
@ -491,7 +491,7 @@ export const optionOrdreRecetteScreen = {
|
||||||
|
|
||||||
export const optionNumeroQuitanceScreen = {
|
export const optionNumeroQuitanceScreen = {
|
||||||
type: 'QUITANCE',
|
type: 'QUITANCE',
|
||||||
title: 'QUITANCE',
|
title: 'NUMERO_QUITANCE',
|
||||||
subTitle: 'CHOOSE_OPTION',
|
subTitle: 'CHOOSE_OPTION',
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -757,5 +757,8 @@
|
||||||
"CREATION_DATE": "Creation Date",
|
"CREATION_DATE": "Creation Date",
|
||||||
"TECHNICAL_APPROVAL": "Technical Approval",
|
"TECHNICAL_APPROVAL": "Technical Approval",
|
||||||
"TRADE_LICENSE": "Business License",
|
"TRADE_LICENSE": "Business License",
|
||||||
|
"MERCURIAL_VALUE": "Mercurial Value ",
|
||||||
|
"CONSTRUCTION_VALUE": "Enter the Construction Value",
|
||||||
|
"BUILDING_CONSTRUCTED": "Building Constructed",
|
||||||
"PAY": "Pay"
|
"PAY": "Pay"
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
"SUCCESS": "Succès",
|
"SUCCESS": "Succès",
|
||||||
"ETAT": "Etat",
|
"ETAT": "Etat",
|
||||||
"MY_ACCOUNT": "Mon compte",
|
"MY_ACCOUNT": "Mon compte",
|
||||||
"WALLET": "Wallet",
|
"WALLET": "Portefeuille",
|
||||||
"DEPOSIT": "Dépôt",
|
"DEPOSIT": "Dépôt",
|
||||||
"EN_ATTENTE_DE_VALIDATION": "En attente de validation",
|
"EN_ATTENTE_DE_VALIDATION": "En attente de validation",
|
||||||
"REMBOURSE": "Remboursé",
|
"REMBOURSE": "Remboursé",
|
||||||
|
@ -601,9 +601,9 @@
|
||||||
"ORDRE_RECETTE": "Ordre recette",
|
"ORDRE_RECETTE": "Ordre recette",
|
||||||
"NO_ORDRE_RECETTE": "Aucun ordre de recette",
|
"NO_ORDRE_RECETTE": "Aucun ordre de recette",
|
||||||
"MODIFICATION_ORDRE_RECETTE": "Modifier ordre recette",
|
"MODIFICATION_ORDRE_RECETTE": "Modifier ordre recette",
|
||||||
"SAISIE_NUMERO_QUITANCE": "Saisir numéro quittance",
|
"SAISIE_NUMERO_QUITANCE": "Effectuer un paiement",
|
||||||
"MODIFICATION_NUMERO_QUITANCE": "Modifier numéro quittance",
|
"MODIFICATION_NUMERO_QUITANCE": "Modifier numéro quittance",
|
||||||
"SAISIR_QUITANCE": "Saisir paiement ou quittance",
|
"SAISIR_QUITANCE": "Gestion paiement ou quittance",
|
||||||
"CODE_AGENT": "Code agent ",
|
"CODE_AGENT": "Code agent ",
|
||||||
"AVIS_IMPOSITION": "Déclaration",
|
"AVIS_IMPOSITION": "Déclaration",
|
||||||
"AGENT_INFORMATION": "Informations sur l'agent",
|
"AGENT_INFORMATION": "Informations sur l'agent",
|
||||||
|
@ -615,8 +615,8 @@
|
||||||
"TAXES_SUR_LA_PROPRETE": "Impôt général synthétique *",
|
"TAXES_SUR_LA_PROPRETE": "Impôt général synthétique *",
|
||||||
"SAVE": "Enregistrer",
|
"SAVE": "Enregistrer",
|
||||||
"TEXT_SUPPRESS_CONFIRM_TAXE": "Voulez vous vraiment supprimer cette taxe?",
|
"TEXT_SUPPRESS_CONFIRM_TAXE": "Voulez vous vraiment supprimer cette taxe?",
|
||||||
"NUMERO_QUITANCE": "Numéro quittance",
|
"NUMERO_QUITANCE": "Gestion quittance",
|
||||||
"QUITANCE": "Quitance",
|
"QUITANCE": "Quittance",
|
||||||
"ORDRE_DE_RECETTE": "Ordre de recette",
|
"ORDRE_DE_RECETTE": "Ordre de recette",
|
||||||
"MODIFY_ORDRE_DE_RECETTE": "Modifier ordre de recette",
|
"MODIFY_ORDRE_DE_RECETTE": "Modifier ordre de recette",
|
||||||
"ORDRE_DE_RECETTE_NUMBER": "Numéro d'ordre de recette",
|
"ORDRE_DE_RECETTE_NUMBER": "Numéro d'ordre de recette",
|
||||||
|
@ -651,8 +651,8 @@
|
||||||
"ORDRE_RECETTE_RECEIPT": "Recette et quittance",
|
"ORDRE_RECETTE_RECEIPT": "Recette et quittance",
|
||||||
"HISTORY_OF": "Historique des",
|
"HISTORY_OF": "Historique des",
|
||||||
"AVIS_IMPOSITIONS": "déclarations",
|
"AVIS_IMPOSITIONS": "déclarations",
|
||||||
"ORDRE_RECETTES_RECEIPTS": "recettes et quitances",
|
"ORDRE_RECETTES_RECEIPTS": "recettes et quittances",
|
||||||
"QUITANCES": "quitances",
|
"QUITANCES": "quittances",
|
||||||
"PRINCIPAL_AMOUNT": "Montant principal",
|
"PRINCIPAL_AMOUNT": "Montant principal",
|
||||||
"DATE_AVIS_IMPOSITION": "Date avis imposition",
|
"DATE_AVIS_IMPOSITION": "Date avis imposition",
|
||||||
"TEXT_NETWORK_UNABLE_CHOOSE_ANOTHER": "Ce réseau n'est pas actif, veuillez choisir un autre",
|
"TEXT_NETWORK_UNABLE_CHOOSE_ANOTHER": "Ce réseau n'est pas actif, veuillez choisir un autre",
|
||||||
|
@ -662,7 +662,7 @@
|
||||||
"CREATE_ACTIF": "Créer un actif",
|
"CREATE_ACTIF": "Créer un actif",
|
||||||
"IMPOSSIBLE_TO_CONNECT_INTERNET": "Vérifier votre connexion internet. Voulez-vous réessayer ?",
|
"IMPOSSIBLE_TO_CONNECT_INTERNET": "Vérifier votre connexion internet. Voulez-vous réessayer ?",
|
||||||
"REGISTER_OPTIONS": "Options d'enregistrement",
|
"REGISTER_OPTIONS": "Options d'enregistrement",
|
||||||
"WOULD_YOU_WANT_TO_REGISTER_OFFLINE": "Voulez-vous enregistrer un usager en ligne ?",
|
"WOULD_YOU_WANT_TO_REGISTER_OFFLINE": "Voulez-vous enregistrer un contribuable en ligne ?",
|
||||||
"DATA_NOT_SYNCHRONISED_WITH_SERVER": "Les données nécessaires au mode offline n'ont pas été sauvegarder. Voulez-vous vous connecter et réessayez ?",
|
"DATA_NOT_SYNCHRONISED_WITH_SERVER": "Les données nécessaires au mode offline n'ont pas été sauvegarder. Voulez-vous vous connecter et réessayez ?",
|
||||||
"CODE_AGENT_NOT_EXIST": "Ce code agent n'existe pas",
|
"CODE_AGENT_NOT_EXIST": "Ce code agent n'existe pas",
|
||||||
"FOR_THIS_KING_OF_USER_PLEASE_CONNECT": "Pour enregistrer ce type d'agent, veuillez vous connecter",
|
"FOR_THIS_KING_OF_USER_PLEASE_CONNECT": "Pour enregistrer ce type d'agent, veuillez vous connecter",
|
||||||
|
@ -712,10 +712,10 @@
|
||||||
"AMOUNT_ORDRE_RECETTE": "Montant de l'ordre de recette",
|
"AMOUNT_ORDRE_RECETTE": "Montant de l'ordre de recette",
|
||||||
"AMOUNT_TAX_NOTICE": "Montant de la déclaration",
|
"AMOUNT_TAX_NOTICE": "Montant de la déclaration",
|
||||||
"YOU_CANT_DELETE_LAST_TAX_NOTICE": "Une quittance doit contenir au moins un ordre de recette",
|
"YOU_CANT_DELETE_LAST_TAX_NOTICE": "Une quittance doit contenir au moins un ordre de recette",
|
||||||
"WOULD_YOU_WANT_SEARCH_BY_NAME": "Voulez-vous rechercher l'usager par son nom ?",
|
"WOULD_YOU_WANT_SEARCH_BY_NAME": "Voulez-vous rechercher le contribuable par son nom ?",
|
||||||
"USAGER_NAME": "Nom de l'usager",
|
"USAGER_NAME": "Nom du contribuable",
|
||||||
"NO_USAGER_CORRESPONDING_TO_SEARCH": "Aucun usager ne correspond à votre recherche",
|
"NO_USAGER_CORRESPONDING_TO_SEARCH": "Aucun contribuable ne correspond à votre recherche",
|
||||||
"USAGER_SEARCH": "Recherche d'un usager",
|
"USAGER_SEARCH": "Recherche d'un contribuable",
|
||||||
"BY_NAME": "Par nom",
|
"BY_NAME": "Par nom",
|
||||||
"BY_QR_CODE": "Par QR Code",
|
"BY_QR_CODE": "Par QR Code",
|
||||||
"SCAN": "Scanner",
|
"SCAN": "Scanner",
|
||||||
|
@ -757,5 +757,8 @@
|
||||||
"CREATION_DATE": "Date de création",
|
"CREATION_DATE": "Date de création",
|
||||||
"TECHNICAL_APPROVAL": "Agrément technique",
|
"TECHNICAL_APPROVAL": "Agrément technique",
|
||||||
"TRADE_LICENSE": "Patente",
|
"TRADE_LICENSE": "Patente",
|
||||||
|
"MERCURIAL_VALUE": "Valeur mercuriale ",
|
||||||
|
"CONSTRUCTION_VALUE": "Saisir la valeur de la construction",
|
||||||
|
"BUILDING_CONSTRUCTED": "Immeuble bâti",
|
||||||
"PAY": "Payer"
|
"PAY": "Payer"
|
||||||
}
|
}
|
||||||
|
|
|
@ -604,6 +604,8 @@ export const savePenalityReset = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const searchUserAction = (data, searchFromMap = false) => {
|
export const searchUserAction = (data, searchFromMap = false) => {
|
||||||
|
console.log("searchUserAction===>>", data, searchFromMap);
|
||||||
|
console.log("searchUserActionUrl===>>", searchFromMap ? searchUserHomeUrl : `${searchUserUrl}?name=${data}`);
|
||||||
|
|
||||||
const auth = store.getState().authKeyReducer;
|
const auth = store.getState().authKeyReducer;
|
||||||
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
Loading…
Reference in New Issue