From 1ce94928b6dbd492c6dd1dd02d6f28bdc037c8f7 Mon Sep 17 00:00:00 2001 From: Don Wilfried Date: Wed, 18 Jun 2025 13:03:01 +0100 Subject: [PATCH] Update application branding and localization; refactor user input validation and logging - Changed app name from "iLink City" to "SIM_ba Mobile" in French localization files. - Updated various UI text to reflect new branding in French localization. - Added validation for Cameroon phone numbers in CreateUserStep2. - Enhanced logging for debugging purposes across multiple components. - Refactored user input handling to trim whitespace for phone numbers. - Updated geocoding URL to use test base URL for development. - Adjusted constants for API endpoints to reflect new test environment. --- android/app/build.gradle | 3 +- .../app/src/main/res/raw/utils_i18n_fr.json | 18 +- android/app/src/main/res/values/strings.xml | 3 +- app/screens/home/Home.js | 18 +- app/screens/login/CreateUserStep.js | 413 +++++++++++++----- app/screens/login/createUserStep2.js | 28 +- app/screens/splashscreen/SplashScreen.js | 7 +- app/utils/i18n/en.json | 5 +- app/utils/i18n/fr.json | 41 +- app/webservice/AuthApi.js | 2 + app/webservice/IlinkConstants.js | 32 +- app/webservice/MapService.js | 6 +- app/webservice/persistences/StorageService.js | 1 + 13 files changed, 402 insertions(+), 175 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 4078f38..646f89e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -132,7 +132,8 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { - applicationId "com.test_city.douala3" + // applicationId "com.test_city.douala3" + applicationId "com.test_city.douala3test" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion missingDimensionStrategy 'react-native-camera', 'general' diff --git a/android/app/src/main/res/raw/utils_i18n_fr.json b/android/app/src/main/res/raw/utils_i18n_fr.json index 31e8722..225d327 100644 --- a/android/app/src/main/res/raw/utils_i18n_fr.json +++ b/android/app/src/main/res/raw/utils_i18n_fr.json @@ -1,5 +1,5 @@ { - "WELCOME": "Bienvenue sur iLink City !", + "WELCOME": "Bienvenue sur SIM_ba Mobile !", "WAITING_LONG": "Veuillez patienter un instant", "HELP": "Aide", "SIMPLE_USER": "Utilisateur simple", @@ -386,7 +386,7 @@ "OK": "OK", "SIMPLE": "Simple", "BLOCKED": "Bloqué", - "APP_FULLNAME": "Ilink City", + "APP_FULLNAME": "SIM_ba Mobile", "GUIDE_TITLE": "Bienvenue dans le Guide de", "GUIDE_USER_SIMPLE": "Guide pour un utilisateur", "GUIDE_AGENT": "Guide pour un agent", @@ -544,8 +544,8 @@ "MEMBERSHIP_REQUEST": "Demandes d'adhésion", "HISTORY_TYPE_REQUEST": "Requêtes", "TREAT": "Traité", - "EXIT_TITLE": "Fermer iLink City !", - "EXIT_DESC": "Voulez-vous vraiment fermer iLink City ?", + "EXIT_TITLE": "Fermer SIM_ba Mobile !", + "EXIT_DESC": "Voulez-vous vraiment fermer SIM_ba Mobile ?", "NO_TREAT": "Non traité", "EXIT": "Fermer", "PERIOD": "Période", @@ -558,7 +558,7 @@ "ACCOUNT_ACTIVATE_TEXT": "Votre compte a été activé avec succès !", "HISTORY_END": "Fin", "DONT_VALIDATE_ACCOUNT": "Compte non validé", - "CONNEXION_SUCCESSFULL_TEXT": "Connexion réussie. Bienvenue dans iLink City ! ", + "CONNEXION_SUCCESSFULL_TEXT": "Connexion réussie. Bienvenue dans SIM_ba Mobile ! ", "UNVALIDATE_ACCOUNT_TEXT": "Votre hyperviseur n'a pas encore validé votre compte", "TEXT_NEED_POSITION": "Veuillez mettre à jour votre position !", "TITLE_NEED_POSITION": "Votre position doit être mise à jour", @@ -571,12 +571,12 @@ "TITLE_PROBLE_COME": "Un problème a été rencontré", "TITLE_SUPPRESS_CONFIRM": "Confirmation de suppression", "TEXT_SUPPRESS_CONFIRM": "Voulez vous vraiment supprimer cet utilisateur ?", - "TEXT_ERROR_START_APPLICATION": "Une erreur est survenue au démarrage de iLink City. Veuillez relancer iLink City", - "TEXT_UNABLE_TO_GET_YOUR_POSITION": "Impossible de recupérez votre position. Veuillez verifier que votre GPS est activé et relancez iLink City", + "TEXT_ERROR_START_APPLICATION": "Une erreur est survenue au démarrage de SIM_ba Mobile. Veuillez relancer SIM_ba Mobile", + "TEXT_UNABLE_TO_GET_YOUR_POSITION": "Impossible de recupérez votre position. Veuillez verifier que votre GPS est activé et relancez SIM_ba Mobile", "RESTART": "RECOMMENCER", "TEXT_UNABLE_TO_GET_COUNTRY_INFO": "Impossible de recupérer les informations de votre pays. Verifiez votre connexion internet ! cliquez sur \"Ok\" pour reessayer", "TITLE_UNABLE_TO_AUTORISE": "Echec de l'autorisation", - "MISSING_AUTORISATION_LOCATION": "iLink City n'est pas autorisé à acceder à votre position. Veuillez autoriser iLink City à accéder à votre localisation et relancez iLink City", + "MISSING_AUTORISATION_LOCATION": "SIM_ba Mobile n'est pas autorisé à acceder à votre position. Veuillez autoriser SIM_ba Mobile à accéder à votre localisation et relancez SIM_ba Mobile", "TEXT_FORGOTTEN_PASSWORD": "Saisissez votre identifiant,nous vous enverrons un nouveau mot de passe\n", "TEXT_NETWORK_UNABLE": "Réseau non disponible, voulez vous réessayer ?", "LOADING_TEXT_MARKERS": "Suite des points ", @@ -585,7 +585,7 @@ "LAUNCH_POINT_WITH_FILTER": "Voulez-vous relancer la recherche dans un rayon de ", "LOADING_TEXT_MARKERS_2": "autour", "UNABLE_GET_INFORMATION": "Problème de récuperation des Informations", - "UNABLE_GET_INFORMATION_TEXT": "Vérifiez que votre GPS est activé et mis en mode haute precision et relancez iLink City", + "UNABLE_GET_INFORMATION_TEXT": "Vérifiez que votre GPS est activé et mis en mode haute precision et relancez SIM_ba Mobile", "TITLE_HELP_SOON": "Aide non disponible !", "YOUR_NETWORK": "Sélectionner votre réseau", "YOUR_NETWORK_SELECTED": "Classe de la taxe", diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index d52c84d..e95fb8e 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ - SIM_ba mobile CAD3 + Test SIM_ba mobile CAD3 + diff --git a/app/screens/home/Home.js b/app/screens/home/Home.js index 54de5b8..5b950f8 100644 --- a/app/screens/home/Home.js +++ b/app/screens/home/Home.js @@ -521,8 +521,9 @@ class Home extends BaseScreen { } createUsagerAccounts = (usagers) => { + console.log("createGeolocatedAccounts===>>",JSON.stringify(usagers)); createGeolocatedAccounts(usagers).then((result) => { - console.log("result", result); + console.log("resultcreateGeolocatedAccounts===>>", result); this.setState({displaySynchronizeLoader: false}); if (!_.isNil(result)) { @@ -556,6 +557,7 @@ class Home extends BaseScreen { } createActifsAccounts = (actifs) => { + console.log("createActifsAccounts===>>",actifs) saveActifsSociety(actifs).then((result) => { console.log("result", result); this.setState({displaySynchronizeLoader: false}); @@ -634,6 +636,7 @@ class Home extends BaseScreen { usagersToSend.push(usagersToSave[index].data); if (usagersToSend.length === (usagersToSave.filter((usager) => !usager.isSaved)).length) { + console.log("Isco2===>>", usagersToSend); this.createUsagerAccounts(usagersToSend); } console.warn("USAGERS FORMATE", usagersToSave); @@ -663,6 +666,7 @@ class Home extends BaseScreen { usagersToSend.push(usagersToSave[index].data); if (usagersToSend.length === (usagersToSave.filter((usager) => !usager.isSaved)).length) { + console.log("Isco3===>>", usagersToSend); this.createUsagerAccounts(usagersToSend); } console.warn("USAGERS FORMATE", usagersToSave); @@ -673,9 +677,10 @@ class Home extends BaseScreen { } else usagersToSend.push(usagersToSave[index].data); - if (usagersToSend.length === (usagersToSave.filter((usager) => !usager.isSaved)).length) { - this.createUsagerAccounts(usagersToSend); - } + // if (usagersToSend.length === (usagersToSave.filter((usager) => !usager.isSaved)).length) { + // console.log("Isco4===>>", usagersToSend); + // this.createUsagerAccounts(usagersToSend); + // } } @@ -686,6 +691,7 @@ class Home extends BaseScreen { console.log("Usagers to save length", (usagersToSave.filter((usager) => !usager.isSaved)).length); if (usagersToSend.length === (usagersToSave.filter((usager) => !usager.isSaved)).length) { + console.log("Isco5===>>", usagersToSend); this.createUsagerAccounts(usagersToSend); } } @@ -720,6 +726,8 @@ class Home extends BaseScreen { actif.data.taxes.map((taxe, indexTaxe) => { console.log("Usagers to send length", actifsToSend.length); console.log("Usagers To save", actifsToSave.filter((usager) => !usager.isSaved).length); + console.log("taxe.has_image_capture", taxe.has_image_capture); + console.log("taxe.has_image_capture", taxe.has_image_capture === "1"); if (taxe.has_image_capture === "1") { this.createFormData(taxe.image); this.uploadImage().then((response) => { @@ -738,6 +746,8 @@ class Home extends BaseScreen { }); } else { actifsToSend.push(actif.data); + console.log("actifsToSend.push===>>",actif.data) + console.log("actifsToSend.length === (actifsToSave.filter((usager) => !usager.isSaved)).length",actifsToSend.length === (actifsToSave.filter((usager) => !usager.isSaved)).length) if (actifsToSend.length === (actifsToSave.filter((usager) => !usager.isSaved)).length) this.createActifsAccounts(actifsToSend); } diff --git a/app/screens/login/CreateUserStep.js b/app/screens/login/CreateUserStep.js index b66c800..f30a68f 100644 --- a/app/screens/login/CreateUserStep.js +++ b/app/screens/login/CreateUserStep.js @@ -122,6 +122,7 @@ class CreateUserStep extends Component { tax_units_count: [], units_per_tax_unit_count: [], number_of_days: [], + building_value: [], latlng: [], id_company_type: null, identification_number: null, @@ -165,16 +166,17 @@ class CreateUserStep extends Component { accountType:"", cni_number:"", birth_date:new Date(), - birth_place:"", - birth_country:"", - nationality_country:"", - father_lastname:"", - father_firstname:"", - mother_lastname:"", - mother_firstname:"", - signboard:"", + birth_place:null, + birth_country:null, + nationality_country:null, + father_lastname:null, + father_firstname:null, + mother_lastname:null, + mother_firstname:null, + signboard:null, entreprise_creation_date: new Date(), // initialisation avec la date actuelle showDatePicker: false, + built:[false], }; @@ -828,6 +830,18 @@ class CreateUserStep extends Component { renderTaxesDropdown = (index) => { const isTaxesEmpty = !this.state.result.taxes || this.state.result.taxes.length === 0; + // ─── CALCUL DE LA VALEUR MERCURIALE ─────────────────────────────── + // Trouve l’objet quartier correspondant au nom sélectionné + const selectedNeighbourhood = this.state.result.neighborhoods.find( + n => n.name === this.state.neighborhood + ); + // Choisit built ou unbuilt selon le dropdown, ou null si introuvable + const mercurialValue = selectedNeighbourhood + ? (this.state.built[index] + ? selectedNeighbourhood.mercur_built_value + : selectedNeighbourhood.mercur_unbuilt_value) + : null; + // return ( <> @@ -914,6 +928,8 @@ class CreateUserStep extends Component { } + {console.log("this.state.taxes_selected[index]==>",this.state.taxes_selected[index])} + {console.log("this.state.taxes_selected[index]==>",!isNil(this.state.taxes_selected[index]))} { !isNil(this.state.taxes_selected[index]) ? this.state.taxes_selected[index].measurement_unit !== "forfait" && @@ -1024,6 +1040,87 @@ class CreateUserStep extends Component { : null } + { + /* Champs spécifiques à la taxe foncière (“taxe sur la propriété”) */ + !isNil(this.state.taxes_selected[index]) && + this.state.taxes_selected[index].name?.toLowerCase() === 'taxe sur la propriété' && ( + <> + {/* Sélection Immeuble bâti → built */} + + + { + const built = [...this.state.built]; + // quand Non → false, Oui → true + built[index] = (value === 'Oui'); + this.setState({ built }); + }} + /> + + + {mercurialValue != null && ( + + {`${I18n.t('MERCURIAL_VALUE')}: ${mercurialValue}`} + + )} + {/* Saisir la valeur mercuriale → units_per_tax_unit_count */} + {/* + { + const units_per_tax_unit_count = [...this.state.units_per_tax_unit_count]; + units_per_tax_unit_count[index] = value; + this.setState({ units_per_tax_unit_count }); + }} + /> + */} + + {/* Saisir la valeur de la construction → building_value */} + {this.state.built[index] && ( + + { + const building_value = [...this.state.building_value]; + building_value[index] = value; + this.setState({ building_value }); + }} + /> + + )} + + + + ) + } ) } @@ -1623,6 +1720,18 @@ handleTaxSlection = (selectedTax) => { /> )} + { this.neightborhoodAnim = comp }}> + {console.log("ICI===>>",this.state.result)} + {console.log("ICI===>>",this.state.result.neighborhoods)} + { + const id = parseInt(selectedItem.id, 10); + this.setState({ neighborhood: selectedItem.name }); + }} + /> + {required_taxes_only_single_tax ? ( @@ -1873,18 +1982,7 @@ handleTaxSlection = (selectedTax) => { this.setState({neighborhood: text}) }}/> */} - { this.neightborhoodAnim = comp }}> - {console.log("ICI===>>",this.state.result)} - {console.log("ICI===>>",this.state.result.neighborhoods)} - { - const id = parseInt(selectedItem.id, 10); - this.setState({ neighborhood: selectedItem.name }); - }} - /> - + {/* { checkUserGeolocated() { let {myPosition, textaddress, place, indicatif, user, network, phone, phoneTransaction} = this.state; this.setState({isLoading: true}); - + console.log("isActif===>>", this.state.isActif); if (this.state.isActif) { let taxes_to_send = []; console.log("Taxes to send", this.state.taxes_selected); @@ -2250,6 +2348,7 @@ handleTaxSlection = (selectedTax) => { district: this.state.taxes_selected[i].district }); } + } } @@ -2377,7 +2476,9 @@ handleTaxSlection = (selectedTax) => { id_network_tax: this.state.taxes_selected[i].id, number_of_days: isNil(this.state.number_of_days[i]) ? null : this.state.number_of_days[i], tax_units_count: isNil(this.state.tax_units_count[i]) ? null : this.state.tax_units_count[i], - units_per_tax_unit_count: isNil(this.state.units_per_tax_unit_count[i]) ? null : this.state.units_per_tax_unit_count[i] + units_per_tax_unit_count: isNil(this.state.units_per_tax_unit_count[i]) ? null : this.state.units_per_tax_unit_count[i], + building_value: isNil(this.state.building_value[i]) ? null : this.state.building_value[i], + built: isNil(this.state.built[i]) ? null : this.state.built[i], }); } else { taxes_to_send.push({ @@ -2386,7 +2487,9 @@ handleTaxSlection = (selectedTax) => { name: this.state.taxes_selected[i].name, number_of_days: isNil(this.state.number_of_days[i]) ? null : this.state.number_of_days[i], tax_units_count: isNil(this.state.tax_units_count[i]) ? null : this.state.tax_units_count[i], - units_per_tax_unit_count: isNil(this.state.units_per_tax_unit_count[i]) ? null : this.state.units_per_tax_unit_count[i] + units_per_tax_unit_count: isNil(this.state.units_per_tax_unit_count[i]) ? null : this.state.units_per_tax_unit_count[i], + building_value: isNil(this.state.building_value[i]) ? null : this.state.building_value[i], + built: isNil(this.state.built[i]) ? null : this.state.built[i], }); } } @@ -2467,98 +2570,198 @@ handleTaxSlection = (selectedTax) => { let idsNetworksGroup1 = ["15", "16", "21", "17"]; let idsNetworksGroup3 = ["14"]; + const isPP = this.state.accountType === "PP"; + const isPM = this.state.accountType === "PM"; if (this.isOffline) { console.log("STATE", this.state); - if (((this.state.data.network.id !== "15") && (this.checkOrAlert(this.state.taxes_selected[0], `${I18n.t("THE_FIELD")} ${I18n.t("TAXE")} ${I18n.t("IS_REQUIRED")}`, true))) || ((this.state.data.network.id === "15") && !(this.checkOrAlert(this.state.taxes_selected[0], `${I18n.t("TAXE")} ${I18n.t("IS_REQUIRED")}`, true)))) { - if (this.checkOrAlert(this.state.companies_types_selected, `${I18n.t("THE_FIELD")} ${I18n.t("SOCIETY_TYPE")} ${I18n.t("IS_REQUIRED")}`, true)) { - if ((this.state.data.network.id !== "14") && (this.checkOrAlert(this.state.activity_type, `${I18n.t("THE_FIELD")} ${I18n.t("TYPE_ACTIVITE")} ${I18n.t("IS_REQUIRED")}`, false))) { - if ((this.state.data.network.id !== "14") && (this.checkOrAlert(this.state.municipality, `${I18n.t("THE_FIELD")} ${I18n.t("MUNICIPALITY")} ${I18n.t("IS_REQUIRED")}`, false))) { - if ((this.checkOrAlert(this.state.responsable_name, `${I18n.t("THE_FIELD")} ${I18n.t("NOM_RESPONSABLE")} ${I18n.t("IS_REQUIRED")}`, false))) { - if ((this.checkOrAlert(this.state.district, `${I18n.t("THE_FIELD")} ${I18n.t("DISTRICT")} ${I18n.t("IS_REQUIRED")}`, false))) { - if ((this.checkOrAlert(this.state.neighborhood, `${I18n.t("THE_FIELD")} ${I18n.t("NEIGHTBORHOOD")} ${I18n.t("IS_REQUIRED")}`, false))) { - if (this.checkIfAllImagesIsOk(data)) { - if (!this.state.addNewTaxeOdtp) { - if (this.state.data.network.id === "18") { - Alert.alert("", I18n.t("DO_YOU_WANT_TO_ADD_ANOTHER_TAXES"), [{ - text: I18n.t('YES'), - onPress: () => { - getData(supervisorCode).then(codeSupervisor => { - if (_.isNil(codeSupervisor)) { - Alert.alert( - I18n.t("ERROR_LABEL"), - I18n.t('DATA_NOT_SYNCHRONISED_WITH_SERVER') - , - [ - { - text: I18n.t("NO"), - onPress: () => { - BackHandler.exitApp(); - } - }, - { - text: I18n.t("YES"), - onPress: () => { - this.setState({displayLoader: true}); - } + if ( + ((this.state.data.network.id !== "15") && + this.checkOrAlert( + this.state.taxes_selected[0], + `${I18n.t("THE_FIELD")} ${I18n.t("TAXE")} ${I18n.t("IS_REQUIRED")}`, + true + )) || + ((this.state.data.network.id === "15") && + !this.checkOrAlert( + this.state.taxes_selected[0], + `${I18n.t("TAXE")} ${I18n.t("IS_REQUIRED")}`, + true + )) + ) { + if (this.checkOrAlert( + this.state.companies_types_selected, + `${I18n.t("THE_FIELD")} ${I18n.t("SOCIETY_TYPE")} ${I18n.t("IS_REQUIRED")}`, + true + )) { + if ( + (this.state.data.network.id !== "14") && + this.checkOrAlert( + this.state.activity_type, + `${I18n.t("THE_FIELD")} ${I18n.t("TYPE_ACTIVITE")} ${I18n.t("IS_REQUIRED")}`, + false + )) { + if ( + (this.state.data.network.id !== "14") && + this.checkOrAlert( + this.state.municipality, + `${I18n.t("THE_FIELD")} ${I18n.t("MUNICIPALITY")} ${I18n.t("IS_REQUIRED")}`, + false + )) { + if (this.checkOrAlert( + this.state.responsable_name, + `${I18n.t("THE_FIELD")} ${I18n.t("NOM_RESPONSABLE")} ${I18n.t("IS_REQUIRED")}`, + false + )) { + if (this.checkOrAlert( + this.state.district, + `${I18n.t("THE_FIELD")} ${I18n.t("DISTRICT")} ${I18n.t("IS_REQUIRED")}`, + false + )) { + if (this.checkOrAlert( + this.state.neighborhood, + `${I18n.t("THE_FIELD")} ${I18n.t("NEIGHTBORHOOD")} ${I18n.t("IS_REQUIRED")}`, + false + )) { + + /* ---------- NOUVEAUX CHAMPS OBLIGATOIRES ---------- */ + const isPP = this.state.accountType === "PP"; + const isPM = this.state.accountType === "PM"; + console.log("isPP isPM", this.state.accountType, isPP, isPM); + + if ( + (isPP && // Personne Physique + this.checkOrAlert( + this.state.birth_date, + `${I18n.t("THE_FIELD")} ${I18n.t("BIRTH_DATE")} ${I18n.t("IS_REQUIRED")}`, + false + ) && + this.checkOrAlert( + this.state.birth_place, + `${I18n.t("THE_FIELD")} ${I18n.t("BIRTH_PLACE")} ${I18n.t("IS_REQUIRED")}`, + false + ) && + this.checkOrAlert( + this.state.birth_country, + `${I18n.t("THE_FIELD")} ${I18n.t("BIRTH_COUNTRY")} ${I18n.t("IS_REQUIRED")}`, + false + ) && + this.checkOrAlert( + this.state.nationality_country, + `${I18n.t("THE_FIELD")} ${I18n.t("NATIONALITY_FORM")} ${I18n.t("IS_REQUIRED")}`, + false + ) && + this.checkOrAlert( + this.state.mother_lastname, + `${I18n.t("THE_FIELD")} ${I18n.t("MOTHER_LASTNAME")} ${I18n.t("IS_REQUIRED")}`, + false + ) && + this.checkOrAlert( + this.state.father_lastname, + `${I18n.t("THE_FIELD")} ${I18n.t("FATHER_LASTNAME")} ${I18n.t("IS_REQUIRED")}`, + false + ) + ) || + (isPM && // Personne Morale + this.checkOrAlert( + this.state.signboard, + `${I18n.t("THE_FIELD")} ${I18n.t("SIGNBOARD")} ${I18n.t("IS_REQUIRED")}`, + false + ) + ) + ) { + /* ---------- VALIDATIONS OK, ON CONTINUE ---------- */ + + if (this.checkIfAllImagesIsOk(data)) { + if (!this.state.addNewTaxeOdtp) { + if (this.state.data.network.id === "18") { + Alert.alert( + "", + I18n.t("DO_YOU_WANT_TO_ADD_ANOTHER_TAXES"), + [ + { + text: I18n.t("YES"), + onPress: () => { + getData(supervisorCode).then(codeSupervisor => { + if (_.isNil(codeSupervisor)) { + Alert.alert( + I18n.t("ERROR_LABEL"), + I18n.t("DATA_NOT_SYNCHRONISED_WITH_SERVER"), + [ + { + text: I18n.t("NO"), + onPress: () => BackHandler.exitApp() + }, + { + text: I18n.t("YES"), + onPress: () => this.setState({displayLoader: true}) + } + ], + {cancelable: false} + ); + } else { + const codeSupervisorsData = JSON.parse(codeSupervisor); + let dataTaxesPublicite = {}; + Object.entries(codeSupervisorsData).forEach(entry => { + if (entry[1].network.id === "19") { + dataTaxesPublicite = entry[1]; + } + }); + this.setState({dataTaxesPublicite}); } + }); - ], - {cancelable: false} - ); - } else { - - let codeSupervisorsData = JSON.parse(codeSupervisor); - let codeSupervisors = Object.keys(codeSupervisorsData); - let dataSupervisors = Object.entries(codeSupervisorsData); - let dataTaxesPublicite = {}; - dataSupervisors.map((codeSupervisor, index) => { - if (codeSupervisor[1].network.id === "19") - dataTaxesPublicite = codeSupervisor[1]; - }); - this.setState({dataTaxesPublicite}); + this.setState({ + addNewTaxeOdtp: true, + displayAddTaxeFromOtherNetwork: true, + isLoading: false + }); + this._scrollView.scrollTo(0); + } + }, + { + text: I18n.t("NO"), + onPress: () => this.submitUsagerOffline(data) } - }); - - this.setState({ - addNewTaxeOdtp: true, - displayAddTaxeFromOtherNetwork: true, - isLoading: false - }); - this._scrollView.scrollTo(0); - } - }, { - text: I18n.t('NO'), - onPress: () => { - this.submitUsagerOffline(data); - } - }]); - } else - this.submitUsagerOffline(data); - } else { - if ((this.checkOrAlert(this.state.publicites_taxes, `${I18n.t("THE_FIELD")} ${I18n.t("TAXES_SUR_LA_PUBLICITE")} ${I18n.t("IS_REQUIRED")}`, true))) { - this.submitUsagerOffline(data); - } else this.setState({isLoading: false}) - } - } else { - Alert.alert(I18n.t("ERROR_LABEL"), I18n.t("TAXES_REQUIRED_IMAGE"), [{ - text: "Ok", - onPress: () => { - //this._scrollView.scrollTo(0); - this.setState({isLoading: false}); + ] + ); + } else { + this.submitUsagerOffline(data); + } + } else { + if (this.checkOrAlert( + this.state.publicites_taxes, + `${I18n.t("THE_FIELD")} ${I18n.t("TAXES_SUR_LA_PUBLICITE")} ${I18n.t("IS_REQUIRED")}`, + true + )) { + this.submitUsagerOffline(data); + } else { + this.setState({isLoading: false}); + } } - }]); + } else { + Alert.alert( + I18n.t("ERROR_LABEL"), + I18n.t("TAXES_REQUIRED_IMAGE"), + [{ + text: "Ok", + onPress: () => this.setState({isLoading: false}) + }] + ); + } + + } else { + this.setState({isLoading: false}); // PP / PM manquant } - - } else this.setState({isLoading: false}) - } else this.setState({isLoading: false}) - } else this.setState({isLoading: false}); - } else this.setState({isLoading: false}); - } else this.setState({isLoading: false}); - } else this.setState({isLoading: false}); - } else this.setState({isLoading: false}); + } else this.setState({isLoading: false}); // neighborhood + } else this.setState({isLoading: false}); // district + } else this.setState({isLoading: false}); // responsable_name + } else this.setState({isLoading: false}); // municipality + } else this.setState({isLoading: false}); // activity_type + } else this.setState({isLoading: false}); // companies_types_selected + } else this.setState({isLoading: false}); // taxes_selected[0] } else { console.log("here===>>",JSON.stringify(data, null, 2)); diff --git a/app/screens/login/createUserStep2.js b/app/screens/login/createUserStep2.js index fb941b1..aaaed7a 100644 --- a/app/screens/login/createUserStep2.js +++ b/app/screens/login/createUserStep2.js @@ -160,6 +160,17 @@ export default class CreateUserStep2 extends Component { console.log("props", this.props); } + // Fonction de validation pour les numéros de téléphone camerounais + validateCameroonPhoneNumber = (phoneNumber) => { + if (!phoneNumber) { + return false; // Si le numéro est vide, retourne false + } + console.log("Phone number===>>", phoneNumber); + const trimmedPhoneNumber = phoneNumber.trim(); + const phoneRegex = /^\d{9}$/; + return phoneRegex.test(trimmedPhoneNumber); + } + createFormData = (photo) => { this.dataToSendTemp.append("image", { name: photo.path.split('/').pop(), @@ -789,8 +800,7 @@ export default class CreateUserStep2 extends Component { }} iconSize={20} onChangeText={(text) => { - let phonenumber = text - this.setState({phone: phonenumber, contact: text}) + this.setState({phone: text.trim(), contact: text.trim()}) }} style={{ @@ -811,8 +821,7 @@ export default class CreateUserStep2 extends Component { }} iconSize={20} onChangeText={(text) => { - let phonenumber = text - this.setState({phoneTransaction: phonenumber, contactTransaction: text}) + this.setState({phoneTransaction: text.trim(), contactTransaction: text.trim()}) }} style={{ @@ -1212,7 +1221,16 @@ export default class CreateUserStep2 extends Component { checkUserGeolocated() { let {myPosition, textaddress, place, indicatif, user, network, phone, phoneTransaction} = this.state; - this.setState({isLoading: true}) + this.setState({isLoading: true}); + // Validation des numéros de téléphone + const isPhoneValid = this.validateCameroonPhoneNumber(phone); + const isPhoneTransactionValid = this.validateCameroonPhoneNumber(phoneTransaction); + + if (!isPhoneValid || !isPhoneTransactionValid) { + Alert.alert("Erreur", "Les numéros de téléphone doivent être des numéros camerounais valides de 9 chiffres (ex: 656391882)."); + this.setState({isLoading: false}); + return; + } if (user !== undefined) { if (this.checkOrShake(phone, this.numanim)) { if (this.checkOrShake(network, this.networkanim)) { diff --git a/app/screens/splashscreen/SplashScreen.js b/app/screens/splashscreen/SplashScreen.js index 2e68b1c..18c554a 100644 --- a/app/screens/splashscreen/SplashScreen.js +++ b/app/screens/splashscreen/SplashScreen.js @@ -132,6 +132,8 @@ export default class SplashScreen extends Component { } componentDidMount() { + console.log("ComponentDidMount===>>") + this.retreiveSupervisorInfosCode(); try { this.requestCameraPermission() } catch (e) { @@ -197,15 +199,16 @@ export default class SplashScreen extends Component { } retreiveSupervisorInfosCode() { + console.log("RETRIEVE SUPERVISOR INFOS CODE"); getSupervisorInfoCode().then((result) => { - console.warn("SUPERVISOR INFOS CODE", JSON.stringify(result)); + console.warn("SUPERVISOR INFOS CODE_", JSON.stringify(result)); storeData(supervisorCode, JSON.stringify(result)).then(() => { getData(supervisorCode).then(resultGet => { console.log("DATA FROM ASYNC STORAGE", resultGet); }); }); }).catch(error => { - console.log(error); + console.log("errorGetSupervisorInfoCode", error); }) } diff --git a/app/utils/i18n/en.json b/app/utils/i18n/en.json index 7995808..33e3e85 100644 --- a/app/utils/i18n/en.json +++ b/app/utils/i18n/en.json @@ -756,5 +756,8 @@ "SIGNBOARD": "Acronym *", "CREATION_DATE": "Creation Date", "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" } diff --git a/app/utils/i18n/fr.json b/app/utils/i18n/fr.json index e66edb2..3acc5e1 100644 --- a/app/utils/i18n/fr.json +++ b/app/utils/i18n/fr.json @@ -1,5 +1,5 @@ { - "WELCOME": "Bienvenue sur iLink City !", + "WELCOME": "Bienvenue sur SIM_ba Mobile !", "WAITING_LONG": "Veuillez patienter un instant", "HELP": "Aide", "SIMPLE_USER": "Utilisateur simple", @@ -384,7 +384,7 @@ "OK": "OK", "SIMPLE": "Simple", "BLOCKED": "Bloqué", - "APP_FULLNAME": "Ilink City", + "APP_FULLNAME": "SIM_ba Mobile", "GUIDE_TITLE": "Bienvenue dans le Guide de", "GUIDE_USER_SIMPLE": "Guide pour un utilisateur", "GUIDE_AGENT": "Guide pour un agent", @@ -546,8 +546,8 @@ "MEMBERSHIP_REQUEST": "Demandes d'adhésion", "HISTORY_TYPE_REQUEST": "Requêtes", "TREAT": "Traité", - "EXIT_TITLE": "Fermer iLink City !", - "EXIT_DESC": "Voulez-vous vraiment fermer iLink City ?", + "EXIT_TITLE": "Fermer SIM_ba Mobile !", + "EXIT_DESC": "Voulez-vous vraiment fermer SIM_ba Mobile ?", "NO_TREAT": "Non traité", "EXIT": "Fermer", "PERIOD": "Période", @@ -560,7 +560,7 @@ "ACCOUNT_ACTIVATE_TEXT": "Votre compte a été activé avec succès !", "HISTORY_END": "Fin", "DONT_VALIDATE_ACCOUNT": "Compte non validé", - "CONNEXION_SUCCESSFULL_TEXT": "Connexion réussie. Bienvenue dans iLink City ! ", + "CONNEXION_SUCCESSFULL_TEXT": "Connexion réussie. Bienvenue dans SIM_ba Mobile ! ", "UNVALIDATE_ACCOUNT_TEXT": "Votre hyperviseur n'a pas encore validé votre compte", "TEXT_NEED_POSITION": "Veuillez mettre à jour votre position !", "TITLE_NEED_POSITION": "Votre position doit être mise à jour", @@ -573,12 +573,12 @@ "TITLE_PROBLE_COME": "Un problème a été rencontré", "TITLE_SUPPRESS_CONFIRM": "Confirmation de suppression", "TEXT_SUPPRESS_CONFIRM": "Voulez vous vraiment supprimer cet utilisateur ?", - "TEXT_ERROR_START_APPLICATION": "Une erreur est survenue au démarrage de iLink City. Veuillez relancer iLink City", - "TEXT_UNABLE_TO_GET_YOUR_POSITION": "Impossible de recupérez votre position. Veuillez verifier que votre GPS est activé et relancez iLink City", + "TEXT_ERROR_START_APPLICATION": "Une erreur est survenue au démarrage de SIM_ba Mobile. Veuillez relancer SIM_ba Mobile", + "TEXT_UNABLE_TO_GET_YOUR_POSITION": "Impossible de recupérez votre position. Veuillez verifier que votre GPS est activé et relancez SIM_ba Mobile", "RESTART": "RECOMMENCER", "TEXT_UNABLE_TO_GET_COUNTRY_INFO": "Impossible de recupérer les informations de votre pays. Verifiez votre connexion internet ! cliquez sur \"Ok\" pour reessayer", "TITLE_UNABLE_TO_AUTORISE": "Echec de l'autorisation", - "MISSING_AUTORISATION_LOCATION": "iLink City n'est pas autorisé à acceder à votre position. Veuillez autoriser iLink City à accéder à votre localisation et relancez iLink City", + "MISSING_AUTORISATION_LOCATION": "SIM_ba Mobile n'est pas autorisé à acceder à votre position. Veuillez autoriser SIM_ba Mobile à accéder à votre localisation et relancez SIM_ba Mobile", "TEXT_FORGOTTEN_PASSWORD": "Saisissez votre identifiant,nous vous enverrons un nouveau mot de passe\n", "TEXT_NETWORK_UNABLE": "Réseau non disponible, voulez vous réessayer ?", "LOADING_TEXT_MARKERS": "Suite des points ", @@ -587,7 +587,7 @@ "LAUNCH_POINT_WITH_FILTER": "Voulez-vous relancer la recherche dans un rayon de ", "LOADING_TEXT_MARKERS_2": "autour", "UNABLE_GET_INFORMATION": "Problème de récuperation des Informations", - "UNABLE_GET_INFORMATION_TEXT": "Vérifiez que votre GPS est activé et mis en mode haute precision et relancez iLink City", + "UNABLE_GET_INFORMATION_TEXT": "Vérifiez que votre GPS est activé et mis en mode haute precision et relancez SIM_ba Mobile", "TITLE_HELP_SOON": "Aide non disponible !", "YOUR_NETWORK": "Sélectionner votre réseau", "YOUR_NETWORK_SELECTED": "Classe de la taxe", @@ -662,7 +662,7 @@ "CREATE_ACTIF": "Créer un actif", "IMPOSSIBLE_TO_CONNECT_INTERNET": "Vérifier votre connexion internet. Voulez-vous réessayer ?", "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 ?", "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", @@ -672,13 +672,13 @@ "HOW_WOULD_YOU_WANT_TO_TAKE_IMAGE": "Comment voulez-vous prendre l'image?", "FROM_GALLERY": "Depuis la galerie", "FROM_CAMERA": "Depuis la caméra", - "USAGER_SAVED_SUCCESSFULLY": "Usager enregistré avec succès sur votre mobile", + "USAGER_SAVED_SUCCESSFULLY": "contribuable enregistré avec succès sur votre mobile", "ACTIF_SAVED_SUCCESSFULLY": "Actif enregistré avec succès sur votre mobile", - "SAUVEGARDER_OF_USAGER": "Création des comptes usagers: ", - "SAUVEGARDER_OF_USAGER_LOADING_SAVE": "Création des comptes usagers sauvegardés... ", + "SAUVEGARDER_OF_USAGER": "Création des contribuables: ", + "SAUVEGARDER_OF_USAGER_LOADING_SAVE": "Création des contribuables sauvegardés... ", "SAUVEGARDER_OF_ACTIF_LOADING_SAVE": "Création des actifs sauvegardés... ", "LIMITE_ACTIF_LOCAL_ATTEINTE": "Vous avez enregistré de nombreux actifs, veuillez les synchroniser avant de réessayer", - "LIMITE_USAGER_LOCAL_ATTEINTE": "Vous avez enregistré de nombreux usagers, veuillez les synchroniser avant de réessayer", + "LIMITE_USAGER_LOCAL_ATTEINTE": "Vous avez enregistré de nombreux contribuables, veuillez les synchroniser avant de réessayer", "DO_YOU_WANT_TO_ADD_ANOTHER_TAXES": "Voulez-vous rajouter une taxe sur la publicité ?", "TAXES_SUR_LA_PUBLICITE": "Taxes sur la publicité", "TAXE_REQUIRED_IMAGE": "L'image est requise pour la taxe", @@ -712,10 +712,10 @@ "AMOUNT_ORDRE_RECETTE": "Montant de l'ordre de recette", "AMOUNT_TAX_NOTICE": "Montant de la déclaration", "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 ?", - "USAGER_NAME": "Nom de l'usager", - "NO_USAGER_CORRESPONDING_TO_SEARCH": "Aucun usager ne correspond à votre recherche", - "USAGER_SEARCH": "Recherche d'un usager", + "WOULD_YOU_WANT_SEARCH_BY_NAME": "Voulez-vous rechercher le contribuable par son nom ?", + "USAGER_NAME": "Nom du contribuable", + "NO_USAGER_CORRESPONDING_TO_SEARCH": "Aucun contribuable ne correspond à votre recherche", + "USAGER_SEARCH": "Recherche d'un contribuable", "BY_NAME": "Par nom", "BY_QR_CODE": "Par QR Code", "SCAN": "Scanner", @@ -756,5 +756,8 @@ "SIGNBOARD": "Sigle *", "CREATION_DATE": "Date de création", "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" } diff --git a/app/webservice/AuthApi.js b/app/webservice/AuthApi.js index 7b2cb59..69d0d48 100644 --- a/app/webservice/AuthApi.js +++ b/app/webservice/AuthApi.js @@ -103,7 +103,9 @@ async function queryData(data, url) { body: JSON.stringify(data), }); let responseJson = null; + console.log("response1===>>",data,response) let responseText = await response.text() + console.log("response2===>>",data,responseText) try { console.warn("SERVER RESPONSE SUCCESS", responseText); responseJson = JSON.parse(responseText) diff --git a/app/webservice/IlinkConstants.js b/app/webservice/IlinkConstants.js index 0efea41..6527b10 100644 --- a/app/webservice/IlinkConstants.js +++ b/app/webservice/IlinkConstants.js @@ -1,36 +1,16 @@ export const isDebugMode = false -//base url test -//export const baseUrl = "https://ilink-app.com/mobilebackendbeta" -//base url production -//export const baseUrl = "https://ilink-app.com/mobilebackend"; -//export const baseUrl = "https://test.ilink-app.com/mobilebackendtest"; -//export const baseUrl = "http://test.ilink-app.com:8080/mobilebackendtest"; -//const baseUrl = "https://ilink-app.com/mobilebackendtest2"; -/*export const baseUrl = "http://city.ilink-app.com:8080/mobilebackend"; -export const testBaseUrl = "https://city.ilink-app.com:8081";*/ +// PROD URL +// export const baseUrl = "https://city-douala3.ilink-app.com:8080/mobilebackend"; +// export const testBaseUrl= "https://city-douala3.ilink-app.com:8081"; -export const baseUrl = "https://city-douala3.ilink-app.com:8080/mobilebackend"; -export const testBaseUrl= "https://city-douala3.ilink-app.com:8081"; - -//CUD -// export const baseUrl = "https://test-cud.ilink-app.com:9080/mobilebackend"; -// export const testBaseUrl = "https://test-cud.ilink-app.com:9081"; - - -// les derniers api modifiers commune X -// export const baseUrl = "http://test-city.ilink-app.com:8080/mobilebackend"; -// export const testBaseUrl = "https://test-city.ilink-app.com:8081"; +// TEST URL +export const baseUrl = "https://test-city-douala3.ilink-app.com:9080/mobilebackend"; +export const testBaseUrl= "https://test-city-douala3.ilink-app.com:9081"; -/* export const baseUrl = "https://preprod.ilink-app.com:8080/mobilebackend"; -export const testBaseUrl = "https://preprod.ilink-app.com"; */ - -//base url agent test -//const baseUrl = "https://ilink-app.com/mobilebackendtest"; - export const adhesionUrl = baseUrl + '/interacted/LoginAction.php'; export const memberActionUrl = baseUrl + '/interacted/MembersAction.php'; export const networkActionUrl = baseUrl + '/interacted/NetworkAction.php'; diff --git a/app/webservice/MapService.js b/app/webservice/MapService.js index 0b4066a..b3a50d5 100644 --- a/app/webservice/MapService.js +++ b/app/webservice/MapService.js @@ -3,9 +3,11 @@ import React, {Component} from 'react'; var db = require('./persistences/db.js'); import I18n from 'react-native-i18n' import {readUser} from './AuthApi' -import {isDebugMode, MARKER_URL, mobileAppVersion, opencageDataApiUrl} from "./IlinkConstants"; +import {isDebugMode, MARKER_URL, mobileAppVersion, opencageDataApiUrl, testBaseUrl} from "./IlinkConstants"; -let GEOCODDING_URL = "https://city-douala3.ilink-app.com:8081/geocode"; +// let GEOCODDING_URL = "https://city-douala3.ilink-app.com:8081/geocode"; +let GEOCODDING_URL = testBaseUrl + "/geocode" +console.log("GEOCODDING_URL===>>",GEOCODDING_URL) let API_KEY = "AIzaSyAme0ZMQjUynvo6AeSVlMRzUPdcOSuPbZE" export const getLocalMarkers = () => { return db.markers.get_all() diff --git a/app/webservice/persistences/StorageService.js b/app/webservice/persistences/StorageService.js index 7c1bb00..c7bad5f 100644 --- a/app/webservice/persistences/StorageService.js +++ b/app/webservice/persistences/StorageService.js @@ -1,6 +1,7 @@ import {AsyncStorage} from "react-native"; export const storeData = async (key, value) => { + console.log("Store data ===>>") return new Promise(async (resolve, reject) => { try { const val = await AsyncStorage.setItem(key, value);