diff --git a/app/screens/home/Home.js b/app/screens/home/Home.js
index 5b950f8..e27d1f0 100644
--- a/app/screens/home/Home.js
+++ b/app/screens/home/Home.js
@@ -2433,109 +2433,130 @@ class Home extends BaseScreen {
)
}
- renderSearchUser() {
+ renderSearchUser() {
return (
this.setState({dialogSearchUser: false})}
- onOk={result => {
- if(this.state.isPhoneAssureSearch) {
- this.props.searchUserAction({
- dial_code: this.state.indicatif,
- phone: this.state.userName,
-
- }, true);
- } else {
- this.props.searchUserAction({
- dial_code: this.state.indicatif,
- name: this.state.userName,
- }, true);
- }
-
- this.setState({dialogSearchUser: false});
-
- }}
+ title={I18n.t("SEARCH")}
+ visible={this.state.dialogSearchUser}
+ onCancel={() => this.setState({ dialogSearchUser: false })}
+ onOk={() => {
+ console.log(
+ "On ok search user===>>",
+ 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 });
+ }}
>
-
- {
- this.setState({userName});
- }}
- icon={
-
- }
- />
+
+ this.setState({ userName })}
+ icon={
+
+ }
+ />
-
- {
- this.setState({
- isNumeroAssureSearch: false,
- isPhoneAssureSearch: true
- });
- }}
- />
- {
- this.setState({
- isNumeroAssureSearch: false,
- isPhoneAssureSearch: false
- });
- }}
- />
- {
- this.setState({
- showQRCodeScanner: true
- });
- }}
- />
-
-
-
- {/* {
- this.setState({userName});
- }}
- style={styles.input}
+
- */}
+ {/* Mode téléphone */}
+
+ this.setState({
+ isPhoneAssureSearch: true,
+ isNumeroAssureSearch: false
+ })
+ }
+ style={{ marginHorizontal: 5 }}
+ />
- )
+ {/* Mode nom */}
+
+ this.setState({
+ isPhoneAssureSearch: false,
+ isNumeroAssureSearch: false
+ })
+ }
+ style={{ marginHorizontal: 5 }}
+ />
+ {/* Mode NIU */}
+
+ this.setState({
+ isPhoneAssureSearch: false,
+ isNumeroAssureSearch: true
+ })
+ }
+ style={{ marginHorizontal: 5 }}
+ />
+
+ {/* Scanner QR */}
+ this.setState({ showQRCodeScanner: true })}
+ style={{ marginHorizontal: 5 }}
+ />
+
+
+
+ );
}
renderDialogResultSearchUser() {
diff --git a/app/screens/login/CreateUserStep.js b/app/screens/login/CreateUserStep.js
index f30a68f..59454e6 100644
--- a/app/screens/login/CreateUserStep.js
+++ b/app/screens/login/CreateUserStep.js
@@ -1,631 +1,710 @@
import CheckBox from '@react-native-community/checkbox';
+import DateTimePicker from '@react-native-community/datetimepicker';
import Button from 'apsl-react-native-button';
-import axios from "axios";
-import _ from "lodash";
+import axios from 'axios';
+import _ from 'lodash';
import isNil from 'lodash/isNil';
-import DateTimePicker from "@react-native-community/datetimepicker"
-import React, { Component } from 'react';
+import {Component} from 'react';
import {
- Alert,
- BackHandler,
- FlatList,
- Image,
- PermissionsAndroid,
- Platform,
- ProgressBarAndroid,
- ScrollView,
- StyleSheet,
- Text,
- TouchableOpacity,
- View
+ Alert,
+ BackHandler,
+ FlatList,
+ Image,
+ PermissionsAndroid,
+ Platform,
+ ProgressBarAndroid,
+ ScrollView,
+ StyleSheet,
+ Text,
+ TouchableOpacity,
+ View,
} from 'react-native';
import * as Animatable from 'react-native-animatable';
-import Dialog from "react-native-dialog";
+import Dialog from 'react-native-dialog';
import Geolocation from 'react-native-geolocation-service';
import I18n from 'react-native-i18n';
import ImagePicker from 'react-native-image-crop-picker';
-import MapView, { Marker } from 'react-native-maps';
-import { MaterialDialog } from "react-native-material-dialog";
-import { Dropdown } from 'react-native-material-dropdown-v2';
-import OneSignal from "react-native-onesignal";
-import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
-import { ProgressDialog } from "react-native-simple-dialogs";
-import { Fumi } from 'react-native-textinput-effects';
-import { material } from 'react-native-typography';
+import MapView, {Marker} from 'react-native-maps';
+import {MaterialDialog} from 'react-native-material-dialog';
+import {Dropdown} from 'react-native-material-dropdown-v2';
+import OneSignal from 'react-native-onesignal';
+import {
+ responsiveHeight,
+ responsiveWidth,
+} from 'react-native-responsive-dimensions';
+import {ProgressDialog} from 'react-native-simple-dialogs';
+import {Fumi} from 'react-native-textinput-effects';
+import {material} from 'react-native-typography';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
-import { connect } from "react-redux";
-import { bindActionCreators } from "redux";
-import { Color } from "../../config/Color";
-import { FontWeight, Typography } from "../../config/typography";
-import { actifToSave, supervisorCode, uploadImage, usagerToSave } from "../../webservice/IlinkConstants";
-import { getData, storeData } from "../../webservice/persistences/StorageService";
-import { saveActifSocietyAction, saveActifSocietyReset } from "../../webservice/regisseur/WalletRegisseurApi";
-import { createGeolocatedAccount } from './../../webservice/AuthApi';
-import { getPositionInformation } from './../../webservice/MapService';
+import {connect} from 'react-redux';
+import {bindActionCreators} from 'redux';
+import {Color} from '../../config/Color';
+import {FontWeight, Typography} from '../../config/typography';
+import {
+ actifToSave,
+ supervisorCode,
+ uploadImage,
+ usagerToSave,
+} from '../../webservice/IlinkConstants';
+import {getData, storeData} from '../../webservice/persistences/StorageService';
+import {
+ saveActifSocietyAction,
+ saveActifSocietyReset,
+} from '../../webservice/regisseur/WalletRegisseurApi';
+import {createGeolocatedAccount} from './../../webservice/AuthApi';
+import {getPositionInformation} from './../../webservice/MapService';
import FilteredList from './FilteredList ';
-const GEOLOCATION_OPTIONS = {enableHighAccuracy: true, timeout: 20000, maximumAge: 1000, useSignificantChanges: true};
+const GEOLOCATION_OPTIONS = {
+ enableHighAccuracy: true,
+ timeout: 20000,
+ maximumAge: 1000,
+ useSignificantChanges: true,
+};
let theme = require('./../../utils/theme.json');
let route = require('./../../route.json');
class CreateUserStep extends Component {
+ static navigatorStyle = {
+ drawUnderNavBar: true,
+ navBarHidden: true,
+ drawUnderStatusBar: false,
+ statusBarHidden: true,
+ statusBarTextColorScheme: 'light',
+ };
- static navigatorStyle = {
- drawUnderNavBar: true,
- navBarHidden: true,
- drawUnderStatusBar: false,
- statusBarHidden: true,
- statusBarTextColorScheme: 'light',
+ static options(passProps) {
+ return {
+ topBar: {
+ visible: false,
+ enabled: false,
+ drawBehind: true,
+ },
+ statusBar: {
+ drawBehind: true,
+ enabled: false,
+ },
+ };
+ }
+
+ constructor(props) {
+ super(props);
+ const {navigation} = this.props;
+ this.type = navigation.getParam('type', 0);
+ this.user = navigation.getParam('user', null);
+ this.data = navigation.getParam('data', null);
+ this.result = navigation.getParam('result', null);
+ this.isActif = navigation.getParam('isActif', false);
+ this.isOffline = navigation.getParam('isOffline', false);
+ console.log('Is OFFLINE', this.isOffline);
+ this.mapRef = new Array();
+ console.log('DATA', this.data);
+
+ console.log('PROPS', this.props);
+ this.state = {
+ password: null,
+ isDataSubmit: false,
+ enterPhone: null,
+ nameanim: null,
+ networksinglePickerVisible: false,
+ surnameanim: null,
+ passwordanim: null,
+ confirmpassanim: null,
+ network: this.result.network,
+ isLoging: false,
+ countries: [],
+ snackVisible: false,
+ snackText: '',
+ disableNetwork: false,
+ networks: [],
+ modalVisible: true,
+ select_network: I18n.t('SELECT_NETWORK'),
+ user: this.user,
+ result: this.result,
+ data: this.data,
+ // town: this.data !== null ? this.data.town : null,
+ town:
+ this.data !== null && this.data.town
+ ? this.data.town
+ : {
+ name: '',
+ id: '2',
+ indicatif: '',
+ districts: [],
+ },
+ isActif: this.isActif,
+ id_network_tax: null,
+ tax_units_count: [],
+ units_per_tax_unit_count: [],
+ number_of_days: [],
+ building_value: [],
+ latlng: [],
+ id_company_type: null,
+ identification_number: null,
+ remainingCharacters: 14,
+ trade_registry: null,
+ tabTaxe: [0],
+ taxes_selected: [],
+ companies_types_selected_value: null,
+ responsable_name: null,
+ technical_approval: null,
+ municipality: 'Douala',
+ neighborhood: null,
+ district: 'Douala 3eme',
+ id_patente: null,
+ TVA: false,
+ IRPP: false,
+ licence: false,
+ activity_type: null,
+ year_tax_paid_N: false,
+ year_tax_paid_N_1: false,
+ year_tax_paid_N_2: false,
+ image: null,
+ displayImage: false,
+ loadingUpload: false,
+ required_taxes_selected: [],
+ required_taxes: [],
+ required_taxes_only_single_tax: [],
+ required_taxes_only_single_tax_selected: [],
+ isTaxesLoaded: false,
+ index: 0,
+ modalDialog: false,
+ player_id: null,
+ latitude: '',
+ longitude: '',
+ addNewTaxeOdtp: false,
+ displayAddTaxeFromOtherNetwork: false,
+ dataTaxesPublicite: {},
+ publicites_taxes: null,
+ messageRequiredImage: '',
+ selectedTax: null,
+ accountType: '',
+ cni_number: '',
+ birth_date: new Date(),
+ 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],
};
- static options(passProps) {
- return {
- topBar: {
- visible: false,
- enabled: false,
- drawBehind: true,
-
- },
- statusBar: {
- drawBehind: true,
- enabled: false,
- }
- }
- }
-
- constructor(props) {
- super(props);
- const {navigation} = this.props;
- this.type = navigation.getParam("type", 0);
- this.user = navigation.getParam('user', null);
- this.data = navigation.getParam('data', null);
- this.result = navigation.getParam('result', null);
- this.isActif = navigation.getParam('isActif', false);
- this.isOffline = navigation.getParam('isOffline', false);
- console.log("Is OFFLINE", this.isOffline);
- this.mapRef = new Array();
- console.log("DATA", this.data);
-
- console.log("PROPS", this.props);
- this.state = {
- password: null,
- isDataSubmit: false,
- enterPhone: null,
- nameanim: null,
- networksinglePickerVisible: false,
- surnameanim: null,
- passwordanim: null,
- confirmpassanim: null,
- network: this.result.network,
- isLoging: false,
- countries: [],
- snackVisible: false,
- snackText: '',
- disableNetwork: false,
- networks: [],
- modalVisible: true,
- select_network: I18n.t("SELECT_NETWORK"),
- user: this.user,
- result: this.result,
- data: this.data,
- // town: this.data !== null ? this.data.town : null,
- town: this.data !== null && this.data.town ? this.data.town : {
- name: "",
- id: "2",
- indicatif: "",
- districts: []
- },
- isActif: this.isActif,
- id_network_tax: null,
- tax_units_count: [],
- units_per_tax_unit_count: [],
- number_of_days: [],
- building_value: [],
- latlng: [],
- id_company_type: null,
- identification_number: null,
- remainingCharacters: 14,
- trade_registry: null,
- tabTaxe: [0],
- taxes_selected: [],
- companies_types_selected_value: null,
- responsable_name: null,
- technical_approval: null,
- municipality: "Douala",
- neighborhood: null,
- district: "Douala 3eme",
- id_patente: null,
- TVA: false,
- IRPP: false,
- licence: false,
- activity_type: null,
- year_tax_paid_N: false,
- year_tax_paid_N_1: false,
- year_tax_paid_N_2: false,
- image: null,
- displayImage: false,
- loadingUpload: false,
- required_taxes_selected: [],
- required_taxes: [],
- required_taxes_only_single_tax: [],
- required_taxes_only_single_tax_selected: [],
- isTaxesLoaded: false,
- index: 0,
- modalDialog: false,
- player_id: null,
- latitude: "",
- longitude: "",
- addNewTaxeOdtp: false,
- displayAddTaxeFromOtherNetwork: false,
- dataTaxesPublicite: {},
- publicites_taxes: null,
- messageRequiredImage: "",
- selectedTax: null,
- accountType:"",
- cni_number:"",
- birth_date:new Date(),
- 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],
-
- };
-
- this.dataToSendTemp = new FormData();
- // console.log("PROPS", this.props);
- // console.log("STATE", this.state);
- this.props.saveActifSocietyReset();
- OneSignal.addEventListener('ids', this.onIds);
- }
- // Méthode appelée lors de la sélection d'une date
+ this.dataToSendTemp = new FormData();
+ // console.log("PROPS", this.props);
+ // console.log("STATE", this.state);
+ this.props.saveActifSocietyReset();
+ OneSignal.addEventListener('ids', this.onIds);
+ }
+ // Méthode appelée lors de la sélection d'une date
onChangeDate = (event, selectedDate) => {
// Sur Android, si l'utilisateur annule, event.type sera "dismissed"
if (Platform.OS === 'android' && event.type === 'dismissed') {
- this.setState({ showDatePicker: false });
+ this.setState({showDatePicker: false});
return;
}
const currentDate = selectedDate || this.state.entreprise_creation_date;
- this.setState({
+ this.setState({
entreprise_creation_date: currentDate,
- showDatePicker: Platform.OS === 'ios' // en iOS, le picker reste affiché
+ showDatePicker: Platform.OS === 'ios', // en iOS, le picker reste affiché
});
};
onChangeDate2 = (event, selectedDate) => {
// Sur Android, si l'utilisateur annule, event.type sera "dismissed"
if (Platform.OS === 'android' && event.type === 'dismissed') {
- this.setState({ showDatePicker: false });
+ this.setState({showDatePicker: false});
return;
}
const currentDate = selectedDate || this.state.birth_date;
- this.setState({
+ this.setState({
birth_date: currentDate,
- showDatePicker: Platform.OS === 'ios' // en iOS, le picker reste affiché
+ showDatePicker: Platform.OS === 'ios', // en iOS, le picker reste affiché
});
};
// Afficher le date picker
showDatePicker = () => {
- this.setState({ showDatePicker: true });
+ this.setState({showDatePicker: true});
+ };
+ createFormData = photo => {
+ this.dataToSendTemp.append('image', {
+ name: photo.path.split('/').pop(),
+ type: photo.mime,
+ uri:
+ Platform.OS === 'android'
+ ? photo.path
+ : photo.path.replace('file://', ''),
+ });
};
- createFormData = (photo) => {
- this.dataToSendTemp.append("image", {
- name: photo.path.split('/').pop(),
- type: photo.mime,
- uri:
- Platform.OS === "android" ? photo.path : photo.path.replace("file://", "")
- });
- };
-
- onIds = async (device) => {
- console.log('Device info: ', device);
- this.setState({player_id: device.userId}, () => {
- console.log("Player ID", this.state.player_id);
- });
-
- }
-
- componentDidMount() {
- this.mounted = true;
- const {type} = this.props;
- if (!this.state.isTaxesLoaded) {
- let taxesTemp = new Array();
- if (!_.isNil(this.result.required_taxes)) {
- this.result.required_taxes.map((taxes, index) => {
- if (this.state.companies_types_selected_value !== null) {
- if (this.state.companies_types_selected_value.name !== "END") {
- let tempTaxes = taxes;
- tempTaxes.id_network_tax = taxes.id;
- if (taxes.measurement_unit !== "forfait") {
- tempTaxes.tax_units_count = null;
- tempTaxes.units_per_tax_unit_count = null;
- }
- taxesTemp.push(tempTaxes);
- } else {
- if (taxes.id !== 70) {
- let tempTaxes = taxes;
- tempTaxes.id_network_tax = taxes.id;
- if (taxes.measurement_unit !== "forfait") {
- tempTaxes.tax_units_count = null;
- tempTaxes.units_per_tax_unit_count = null;
- }
- taxesTemp.push(tempTaxes);
- }
- }
- } else {
- let tempTaxes = taxes;
- tempTaxes.id_network_tax = taxes.id;
- if (taxes.measurement_unit !== "forfait") {
- tempTaxes.tax_units_count = null;
- tempTaxes.units_per_tax_unit_count = null;
- }
- taxesTemp.push(tempTaxes);
- }
- });
- this.setState({
- required_taxes: taxesTemp,
- isTaxesLoaded: true
- });
- }
- }
-
- if (Platform.OS === 'android') {
- this.requestCameraPermission(false);
- } else {
- this.watchLocation(false);
- }
-
- }
-
- componentWillUnmount() {
- OneSignal.removeEventListener('ids', this.onIds);
- }
-
- updateRequiredTaxes(value) {
- let taxesTemp = new Array();
+ onIds = async device => {
+ console.log('Device info: ', device);
+ this.setState({player_id: device.userId}, () => {
+ console.log('Player ID', this.state.player_id);
+ });
+ };
+ componentDidMount() {
+ this.mounted = true;
+ const {type} = this.props;
+ if (!this.state.isTaxesLoaded) {
+ let taxesTemp = new Array();
+ if (!_.isNil(this.result.required_taxes)) {
this.result.required_taxes.map((taxes, index) => {
- if (value.name !== "END") {
+ if (this.state.companies_types_selected_value !== null) {
+ if (this.state.companies_types_selected_value.name !== 'END') {
+ let tempTaxes = taxes;
+ tempTaxes.id_network_tax = taxes.id;
+ if (taxes.measurement_unit !== 'forfait') {
+ tempTaxes.tax_units_count = null;
+ tempTaxes.units_per_tax_unit_count = null;
+ }
+ taxesTemp.push(tempTaxes);
+ } else {
+ if (taxes.id !== 70) {
let tempTaxes = taxes;
tempTaxes.id_network_tax = taxes.id;
- if (taxes.measurement_unit !== "forfait") {
- tempTaxes.tax_units_count = null;
- tempTaxes.units_per_tax_unit_count = null;
+ if (taxes.measurement_unit !== 'forfait') {
+ tempTaxes.tax_units_count = null;
+ tempTaxes.units_per_tax_unit_count = null;
}
taxesTemp.push(tempTaxes);
- } else {
- if (taxes.id !== "70") {
- // console.log("ETABLISSEMENT", value);
- // console.log("TAXE", taxes);
- let tempTaxes = taxes;
- tempTaxes.id_network_tax = taxes.id;
- if (taxes.measurement_unit !== "forfait") {
- tempTaxes.tax_units_count = null;
- tempTaxes.units_per_tax_unit_count = null;
- }
- taxesTemp.push(tempTaxes);
- }
+ }
}
+ } else {
+ let tempTaxes = taxes;
+ tempTaxes.id_network_tax = taxes.id;
+ if (taxes.measurement_unit !== 'forfait') {
+ tempTaxes.tax_units_count = null;
+ tempTaxes.units_per_tax_unit_count = null;
+ }
+ taxesTemp.push(tempTaxes);
+ }
});
this.setState({
- required_taxes: taxesTemp
+ required_taxes: taxesTemp,
+ isTaxesLoaded: true,
});
+ }
}
- componentWillUnmount() {
- this.mounted = false;
+ if (Platform.OS === 'android') {
+ this.requestCameraPermission(false);
+ } else {
+ this.watchLocation(false);
}
+ }
- showErrorDialog() {
- this.setState({modalDialog: false})
- Alert.alert("Une erreur est survenue", "Impossible de récuperer des informations du pays verifier que votre gps est activé," +
- "et que vous êtes connecté à internet puis ressayer", [{
- text: "Recommencer", onPress: () => {
- this.watchLocation()
- }
- }, {
- text: "Annuler", onPress: () => {
- this.props.navigation.popToTop()
- }
- }])
- }
+ componentWillUnmount() {
+ OneSignal.removeEventListener('ids', this.onIds);
+ }
- renderLoader = () => {
- return (
-
- )
- }
+ updateRequiredTaxes(value) {
+ let taxesTemp = new Array();
- async requestCameraPermission(param) {
- try {
- const granted = await PermissionsAndroid.request(
- PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
- {
- 'title': 'Cool Photo App Camera Permission',
- 'message': 'Cool Photo App needs access to your camera ' +
- 'so you can take awesome pictures.'
- }
- )
- if (granted === PermissionsAndroid.RESULTS.GRANTED) {
- this.watchLocation(param);
- } else {
- this.setState({modalDialog: false})
- Alert.alert("Echec à l'autorisation",
- "L'application n'est pas autorisé à acceder à votre position veuillez verifier que votre GPS est activé et configurer en mode Haute Precision",
- [{
- text: "Ok", onPress: () => {
- this.props.navigation.popToTop()
- }
- }])
- }
- } catch (err) {
- this.setState({modalDialog: false})
- Alert.alert("Une erreur est Survenue",
- "Une erreur est survenu lors du demarrage de l'application veuillez relancer l'application",
- [{
- text: "Ok", onPress: () => {
- BackHandler.exitApp()
- }
- }])
+ this.result.required_taxes.map((taxes, index) => {
+ if (value.name !== 'END') {
+ let tempTaxes = taxes;
+ tempTaxes.id_network_tax = taxes.id;
+ if (taxes.measurement_unit !== 'forfait') {
+ tempTaxes.tax_units_count = null;
+ tempTaxes.units_per_tax_unit_count = null;
}
+ taxesTemp.push(tempTaxes);
+ } else {
+ if (taxes.id !== '70') {
+ // console.log("ETABLISSEMENT", value);
+ // console.log("TAXE", taxes);
+ let tempTaxes = taxes;
+ tempTaxes.id_network_tax = taxes.id;
+ if (taxes.measurement_unit !== 'forfait') {
+ tempTaxes.tax_units_count = null;
+ tempTaxes.units_per_tax_unit_count = null;
+ }
+ taxesTemp.push(tempTaxes);
+ }
+ }
+ });
+ this.setState({
+ required_taxes: taxesTemp,
+ });
+ }
+
+ componentWillUnmount() {
+ this.mounted = false;
+ }
+
+ showErrorDialog() {
+ this.setState({modalDialog: false});
+ Alert.alert(
+ 'Une erreur est survenue',
+ 'Impossible de récuperer des informations du pays verifier que votre gps est activé,' +
+ 'et que vous êtes connecté à internet puis ressayer',
+ [
+ {
+ text: 'Recommencer',
+ onPress: () => {
+ this.watchLocation();
+ },
+ },
+ {
+ text: 'Annuler',
+ onPress: () => {
+ this.props.navigation.popToTop();
+ },
+ },
+ ],
+ );
+ }
+
+ renderLoader = () => {
+ return (
+
+ );
+ };
+
+ async requestCameraPermission(param) {
+ try {
+ const granted = await PermissionsAndroid.request(
+ PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
+ {
+ title: 'Cool Photo App Camera Permission',
+ message:
+ 'Cool Photo App needs access to your camera ' +
+ 'so you can take awesome pictures.',
+ },
+ );
+ if (granted === PermissionsAndroid.RESULTS.GRANTED) {
+ this.watchLocation(param);
+ } else {
+ this.setState({modalDialog: false});
+ Alert.alert(
+ "Echec à l'autorisation",
+ "L'application n'est pas autorisé à acceder à votre position veuillez verifier que votre GPS est activé et configurer en mode Haute Precision",
+ [
+ {
+ text: 'Ok',
+ onPress: () => {
+ this.props.navigation.popToTop();
+ },
+ },
+ ],
+ );
+ }
+ } catch (err) {
+ this.setState({modalDialog: false});
+ Alert.alert(
+ 'Une erreur est Survenue',
+ "Une erreur est survenu lors du demarrage de l'application veuillez relancer l'application",
+ [
+ {
+ text: 'Ok',
+ onPress: () => {
+ BackHandler.exitApp();
+ },
+ },
+ ],
+ );
}
+ }
- async watchLocation(param) {
- if (this.isOffline) {
- Geolocation.getCurrentPosition((position) => {
- console.log("Abena1===>>",this.isOffline)
+ async watchLocation(param) {
+ if (this.isOffline) {
+ Geolocation.getCurrentPosition(
+ position => {
+ console.log('Abena1===>>', this.isOffline);
+ this.setState(
+ {
+ modalVisible: false,
+ latitude: position.coords.latitude,
+ longitude: position.coords.longitude,
+ },
+ () => {
+ //console.log("latitude", this.state.latitude);
+ },
+ );
+ if (this.result.child) {
+ this.setState({disableNetwork: true});
+ if (this.result.network) {
+ this.setState({
+ modalVisible: false,
+ networks: [this.result.network],
+ });
+ if (
+ this.result.child === 'geolocated' ||
+ this.result.child === 'super'
+ ) {
this.setState({
- modalVisible: false,
- latitude: position.coords.latitude,
- longitude: position.coords.longitude
- }, () => {
- //console.log("latitude", this.state.latitude);
+ network: this.result.network,
+ select_network: I18n.t('YOUR_NETWORK_SELECTED'),
});
- if (this.result.child) {
- this.setState({disableNetwork: true});
- if (this.result.network) {
- this.setState({
- modalVisible: false, networks: [this.result.network],
- });
- if (this.result.child === "geolocated" || this.result.child === "super") {
- this.setState({
- network: this.result.network,
- select_network: I18n.t("YOUR_NETWORK_SELECTED")
- });
- }
- } else {
- this.showErrorDialog();
- }
- }
-
- }, (e) => {
- Alert.alert(I18n.t('TITLE_PROBLE_COME'), "Impossible de recuperer les informations du code hiérarchique ou taxe", [{
- text: "Reesayer",
- onPress: () => this.watchLocation(param)
- }])
- console.warn("POSITION ERROR", e);
- this.setState({modalVisible: false})
- }, this.props.geolocationOptions);
- } else {
- Geolocation.getCurrentPosition((position) => {
- this.treatPosition(position, param)
- }, (e) => {
- this.showErrorDialog();
- }, this.props.geolocationOptions);
- /* if (!this.watchID) {
+ }
+ } else {
+ this.showErrorDialog();
+ }
+ }
+ },
+ e => {
+ Alert.alert(
+ I18n.t('TITLE_PROBLE_COME'),
+ 'Impossible de recuperer les informations du code hiérarchique ou taxe',
+ [
+ {
+ text: 'Reesayer',
+ onPress: () => this.watchLocation(param),
+ },
+ ],
+ );
+ console.warn('POSITION ERROR', e);
+ this.setState({modalVisible: false});
+ },
+ this.props.geolocationOptions,
+ );
+ } else {
+ Geolocation.getCurrentPosition(
+ position => {
+ this.treatPosition(position, param);
+ },
+ e => {
+ this.showErrorDialog();
+ },
+ this.props.geolocationOptions,
+ );
+ /* if (!this.watchID) {
Geolocation.watchPosition((position) => {
this.treatPosition(position, param)
}, (e) => {
this.showErrorDialog();
}, this.props.geolocationOptions)
}*/
- }
+ }
+ }
+ treatPosition(position, param) {
+ const myLastPosition = this.state.myPosition;
+ const myPosition = position.coords;
+ //console.log("Param transfer to location", param);
+
+ if (param) {
+ let taxes_selected = this.state.taxes_selected;
+ taxes_selected[this.state.index].latitude = position.coords.latitude;
+ taxes_selected[this.state.index].longitude = position.coords.longitude;
+
+ this.setState({taxes_selected}, () => {
+ console.warn('Taxes selected', taxes_selected);
+ });
}
- treatPosition(position, param) {
- const myLastPosition = this.state.myPosition;
- const myPosition = position.coords;
- //console.log("Param transfer to location", param);
-
- if (param) {
- let taxes_selected = this.state.taxes_selected;
- taxes_selected[this.state.index].latitude = position.coords.latitude;
- taxes_selected[this.state.index].longitude = position.coords.longitude;
-
- this.setState({taxes_selected}, () => {
- console.warn("Taxes selected", taxes_selected);
- });
- }
-
- if (!_.isEqual(myPosition, myLastPosition)) {
- getPositionInformation(myPosition).then((response) => {
- console.log("Abena3===>>",response.results)
- console.log("Abena3===>>",response.results.length)
- if (response.results !== undefined) {
- if (response.results.length > 0) {
- let most = response.results[0]
- let {address_components, formatted_address, place_id} = most
- this.setState({
- address: address_components,
- textadress: formatted_address,
- place: place_id,
- modalVisible: false
- })
- }
-
- }
- }).catch((e) => {
- this.showErrorDialog()
- });
- if (!_.isNil(position.coords)) {
- this.setState({myPosition});
- if (this.mapRef[this.state.index] !== undefined && this.mapRef[this.state.index] !== null) {
- this.mapRef[this.state.index].animateToCoordinate({
- latitude: position.coords.latitude,
- longitude: position.coords.longitude
- }, 1000);
- this.mapRef[this.state.index].animateToRegion({
- latitude: position.coords.latitude,
- longitude: position.coords.longitude,
- latitudeDelta: 0.03,
- longitudeDelta: 0.01,
- }, 1000)
- }
+ if (!_.isEqual(myPosition, myLastPosition)) {
+ getPositionInformation(myPosition)
+ .then(response => {
+ console.log('Abena3===>>', response.results);
+ console.log('Abena3===>>', response.results.length);
+ if (response.results !== undefined) {
+ if (response.results.length > 0) {
+ let most = response.results[0];
+ let {address_components, formatted_address, place_id} = most;
+ this.setState({
+ address: address_components,
+ textadress: formatted_address,
+ place: place_id,
+ modalVisible: false,
+ });
}
- }
-
- }
-
- prepareModal() {
- return (
-
- {I18n.t("LOADING_DESCRIPTION_COUNTRY")}
-
-
- )
- }
-
- uploadImage = () => {
- axios({
- url: `${uploadImage}`,
- method: 'POST',
- data: this.dataToSendTemp,
- headers: {
- 'X-Localization': I18n.currentLocale(),
- 'Content-Type': 'multipart/form-data'
- },
+ }
})
- .then(response => {
- //console.log(response);
- let taxes_selected = this.state.taxes_selected;
- taxes_selected[this.state.index].image = response.data.response.filename;
- this.setState({taxes_selected, loadingUpload: false});
- })
- .catch(error => {
- console.log(error);
- if (error.response)
- console.log(error.response);
- else if (error.request)
- console.log(error.request);
- else
- console.log(error.message);
+ .catch(e => {
+ this.showErrorDialog();
+ });
+ if (!_.isNil(position.coords)) {
+ this.setState({myPosition});
+ if (
+ this.mapRef[this.state.index] !== undefined &&
+ this.mapRef[this.state.index] !== null
+ ) {
+ this.mapRef[this.state.index].animateToCoordinate(
+ {
+ latitude: position.coords.latitude,
+ longitude: position.coords.longitude,
+ },
+ 1000,
+ );
+ this.mapRef[this.state.index].animateToRegion(
+ {
+ latitude: position.coords.latitude,
+ longitude: position.coords.longitude,
+ latitudeDelta: 0.03,
+ longitudeDelta: 0.01,
+ },
+ 1000,
+ );
+ }
+ }
+ }
+ }
- Alert.alert("", I18n.t('TITLE_ERROR_SURVENU'), [{
- text: "Ok",
- onPress: () => {
- }
- }]);
- this.setState({loadingUpload: false});
+ prepareModal() {
+ return (
+
+
+ {I18n.t('LOADING_DESCRIPTION_COUNTRY')}
+
+
+
+ );
+ }
+
+ uploadImage = () => {
+ axios({
+ url: `${uploadImage}`,
+ method: 'POST',
+ data: this.dataToSendTemp,
+ headers: {
+ 'X-Localization': I18n.currentLocale(),
+ 'Content-Type': 'multipart/form-data',
+ },
+ })
+ .then(response => {
+ //console.log(response);
+ let taxes_selected = this.state.taxes_selected;
+ taxes_selected[this.state.index].image =
+ response.data.response.filename;
+ this.setState({taxes_selected, loadingUpload: false});
+ })
+ .catch(error => {
+ console.log(error);
+ if (error.response) console.log(error.response);
+ else if (error.request) console.log(error.request);
+ else console.log(error.message);
+
+ Alert.alert('', I18n.t('TITLE_ERROR_SURVENU'), [
+ {
+ text: 'Ok',
+ onPress: () => {},
+ },
+ ]);
+ this.setState({loadingUpload: false});
+ });
+ };
+
+ renderCreateActifResponse = () => {
+ const {result, error} = this.props;
+
+ if (error !== null) {
+ if (typeof error.data !== 'undefined') {
+ Alert.alert(
+ I18n.t('UNABLE_TO_CREATE_ACCOUNT'),
+ error.data.error_msg,
+ [
+ {
+ text: I18n.t('OK'),
+ onPress: () => {
+ this.props.saveActifSocietyReset();
+ },
+ },
+ ],
+ {cancelable: false},
+ );
+ }
+ }
+
+ if (result !== null) {
+ if (result.response !== null) {
+ Alert.alert(
+ I18n.t('SUCCESS'),
+ result.success_msg,
+ [
+ {
+ text: I18n.t('OK'),
+ onPress: () => {
+ this.props.saveActifSocietyReset();
+ this.props.navigation.popToTop();
+ },
+ },
+ ],
+ {cancelable: false},
+ );
+ }
+ }
+ };
+
+ renderDialogImage = () => {
+ return (
+
+ {I18n.t('PREVISUALISATION')}
+
+
+
+
+
+
+
+
+
+ {
+ this.setState({
+ displayImage: false,
});
- };
-
- renderCreateActifResponse = () => {
-
- const {result, error} = this.props;
-
- if (error !== null) {
- if (typeof error.data !== 'undefined') {
- Alert.alert(
- I18n.t("UNABLE_TO_CREATE_ACCOUNT"),
- error.data.error_msg,
- [
- {
- text: I18n.t("OK"), onPress: () => {
- this.props.saveActifSocietyReset();
- }
- }
- ],
- {cancelable: false}
- )
+ if (this.isOffline) {
+ if (this.state.addNewTaxeOdtp) {
+ let taxes_selected = this.state.publicites_taxes;
+ if (!_.isNil(taxes_selected)) {
+ taxes_selected.image = this.state.image;
+ this.setState({
+ publicites_taxes: taxes_selected,
+ loadingUpload: false,
+ });
+ }
+ } else {
+ let taxes_selected = this.state.taxes_selected;
+ taxes_selected[this.state.index].image = this.state.image;
+ this.setState({taxes_selected, loadingUpload: false});
+ }
+ } else {
+ this.setState({loadingUpload: true});
+ this.uploadImage();
}
- }
+ }}
+ />
+
+ );
+ };
- if (result !== null) {
- if (result.response !== null) {
- Alert.alert(
- I18n.t("SUCCESS"),
- result.success_msg,
- [
- {
- text: I18n.t("OK"), onPress: () => {
- this.props.saveActifSocietyReset();
- this.props.navigation.popToTop();
- }
- }
-
- ],
- {cancelable: false}
- )
- }
- }
- }
-
- renderDialogImage = () => {
-
- return (
-
-
- {I18n.t('PREVISUALISATION')}
-
-
-
-
-
-
-
-
-
- {
- this.setState({
- displayImage: false,
- });
- if (this.isOffline) {
- if (this.state.addNewTaxeOdtp) {
- let taxes_selected = this.state.publicites_taxes;
- if (!_.isNil(taxes_selected)) {
- taxes_selected.image = this.state.image;
- this.setState({publicites_taxes: taxes_selected, loadingUpload: false});
- }
- } else {
- let taxes_selected = this.state.taxes_selected;
- taxes_selected[this.state.index].image = this.state.image;
- this.setState({taxes_selected, loadingUpload: false});
- }
- } else {
- this.setState({loadingUpload: true});
- this.uploadImage();
- }
-
- }}/>
-
- )
- }
-
- renderRequiredTaxesDropdown = (item, index) => {
- return (
- <>
- {/*
+ renderRequiredTaxesDropdown = (item, index) => {
+ return (
+ <>
+ {/*
*/}
- {
- item.measurement_unit !== "forfait" &&
- <>
-
- {
- let tax_units_count = this.state.required_taxes;
- if (value === "")
- tax_units_count[index].tax_units_count = null;
- else
- tax_units_count[index].tax_units_count = value;
- this.setState({required_taxes: tax_units_count});
- }}
- >
-
-
+ {item.measurement_unit !== 'forfait' && (
+ <>
+
+ {
+ let tax_units_count = this.state.required_taxes;
+ if (value === '')
+ tax_units_count[index].tax_units_count = null;
+ else tax_units_count[index].tax_units_count = value;
+ this.setState({required_taxes: tax_units_count});
+ }}>
+
- {
- item.labels.length === 2 &&
-
- {
- let units_per_tax_unit_count = this.state.required_taxes;
- units_per_tax_unit_count[index].units_per_tax_unit_count = value;
- this.setState({required_taxes: units_per_tax_unit_count});
- }}
- >
-
-
- }
- >
+ {item.labels.length === 2 && (
+
+ {
+ let units_per_tax_unit_count = this.state.required_taxes;
+ units_per_tax_unit_count[index].units_per_tax_unit_count =
+ value;
+ this.setState({required_taxes: units_per_tax_unit_count});
+ }}>
+
+ )}
+ >
+ )}
+ >
+ );
+ };
- }
- >
- )
- }
-
-
-
- renderPubliciteTaxesDropdown = () => {
- return (
- <>
+ renderPubliciteTaxesDropdown = () => {
+ return (
+ <>
+
+
+
+ {
+ return value;
+ }}
+ labelExtractor={value => {
+ return value.name;
+ }}
+ onChangeText={(value, i, data) => {
+ this.setState({publicites_taxes: value}, () => {
+ //console.log("Taxes", this.state.publicites_taxes);
+ });
+ }}
+ />
+
+
+
+ {!isNil(this.state.publicites_taxes)
+ ? this.state.publicites_taxes.measurement_unit !== 'forfait' && (
+ <>
-
-
-
- {
- return value
- }}
- labelExtractor={(value) => {
- return value.name
- }}
- onChangeText={(value, i, data) => {
- this.setState({publicites_taxes: value}, () => {
- //console.log("Taxes", this.state.publicites_taxes);
- });
- }}
- />
-
-
+ {
+ let tax_units_count = this.state.publicites_taxes;
+ if (value === '') tax_units_count.tax_units_count = null;
+ else tax_units_count.tax_units_count = value;
+ this.setState({publicites_taxes: tax_units_count});
+ }}>
- {
- !isNil(this.state.publicites_taxes) ?
- this.state.publicites_taxes.measurement_unit !== "forfait" &&
- <>
-
- {
- let tax_units_count = this.state.publicites_taxes;
- if (value === "")
- tax_units_count.tax_units_count = null;
- else
- tax_units_count.tax_units_count = value;
- this.setState({publicites_taxes: tax_units_count});
- }}
- >
-
-
- {
- this.state.publicites_taxes.labels.length === 2 &&
-
- {
- let units_per_tax_unit_count = this.state.publicites_taxes;
- units_per_tax_unit_count.units_per_tax_unit_count = value;
- this.setState({publicites_taxes: units_per_tax_unit_count});
- }}/>
-
- }
- > : null
- }
- {
- !isNil(this.state.publicites_taxes) ?
- this.state.publicites_taxes.has_image_capture === "1" &&
-
- {
- ImagePicker.openCamera({
- width: 400,
- height: 281,
- cropping: true,
- useFrontCamera: false
- }).then(image => {
- this.createFormData(image);
- this.setState({image, displayImage: true});
- })
- }}
- activeOpacity={0.9}>
-
-
-
-
-
-
-
-
-
- {I18n.t('IMAGE_TAKE')}
- : null
-
- }
- >
- )
- }
-
- 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 (
- <>
-
- {
- this.taxesAnim = comp
- }} key={index}>
-
-
- {isTaxesEmpty ? null : (
-
- {
- return value
- }}
- onChangeText={(value, i, data) => {
- let taxes_seleted = this.state.taxes_selected;
- if (index === 0) {
- taxes_seleted = new Array();
- taxes_seleted[index] = value;
- } else
- taxes_seleted[index] = value;
- this.setState({taxes_selected: taxes_seleted}, () => {
- // console.log("Taxes", this.state.taxes_selected);
- // console.log("Index", index);
- });
- }}
- labelExtractor={(value) => {
- return value.name
- }}
- />
-
- )}
-
- {
- this.state.network.has_many_taxes === "1" &&
-
- {
- let tabTaxe = this.state.tabTaxe;
- if (index === 0) {
- let lastElement = this.state.tabTaxe[this.state.tabTaxe.length - 1];
- tabTaxe.push(lastElement++);
- this.setState({tabTaxe});
- } else {
- tabTaxe = tabTaxe.filter((element, i) => index !== i);
- this.setState({tabTaxe});
- }
- }}
- activeOpacity={0.9}>
-
-
- 0 ? 'minus' : 'plus'} color={Color.whiteColor}
- size={20}/>
-
-
-
-
-
- }
+ {this.state.publicites_taxes.labels.length === 2 && (
+
+ {
+ let units_per_tax_unit_count =
+ this.state.publicites_taxes;
+ units_per_tax_unit_count.units_per_tax_unit_count =
+ value;
+ this.setState({
+ publicites_taxes: units_per_tax_unit_count,
+ });
+ }}
+ />
+
+ )}
+ >
+ )
+ : null}
+ {!isNil(this.state.publicites_taxes)
+ ? this.state.publicites_taxes.has_image_capture === '1' && (
+
+ {
+ ImagePicker.openCamera({
+ width: 400,
+ height: 281,
+ cropping: true,
+ useFrontCamera: false,
+ }).then(image => {
+ this.createFormData(image);
+ this.setState({image, displayImage: true});
+ });
+ }}
+ activeOpacity={0.9}>
+
+
+
+
+
+
+
+
+
+ {I18n.t('IMAGE_TAKE')}
+
+
+ )
+ : null}
+ >
+ );
+ };
+
+ 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 (
+ <>
+ {
+ this.taxesAnim = comp;
+ }}
+ key={index}>
+
+ {isTaxesEmpty ? null : (
+
+ {
+ return value;
+ }}
+ onChangeText={(value, i, data) => {
+ let taxes_seleted = this.state.taxes_selected;
+ if (index === 0) {
+ taxes_seleted = new Array();
+ taxes_seleted[index] = value;
+ } else taxes_seleted[index] = value;
+ this.setState({taxes_selected: taxes_seleted}, () => {
+ // console.log("Taxes", this.state.taxes_selected);
+ // console.log("Index", index);
+ });
+ }}
+ labelExtractor={value => {
+ return value.name;
+ }}
+ />
+
+ )}
+
+ {this.state.network.has_many_taxes === '1' && (
+
+ {
+ let tabTaxe = this.state.tabTaxe;
+ if (index === 0) {
+ let lastElement =
+ this.state.tabTaxe[this.state.tabTaxe.length - 1];
+ tabTaxe.push(lastElement++);
+ this.setState({tabTaxe});
+ } else {
+ tabTaxe = tabTaxe.filter((element, i) => index !== i);
+ this.setState({tabTaxe});
+ }
+ }}
+ activeOpacity={0.9}>
+
+
+ 0 ? 'minus' : 'plus'}
+ color={Color.whiteColor}
+ size={20}
+ />
+
+
+
+
+ )}
+
+
+ {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' && (
+ <>
+
+ {
+ let tax_units_count = this.state.tax_units_count;
+ if (index === 0) {
+ tax_units_count = [];
+ tax_units_count[0] = value;
+ } else tax_units_count[index] = value;
+ this.setState({tax_units_count: tax_units_count});
+ }}>
- {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" &&
- <>
-
- {
- let tax_units_count = this.state.tax_units_count;
- if (index === 0) {
- tax_units_count = [];
- tax_units_count[0] = value;
- } else
- tax_units_count[index] = value;
- this.setState({tax_units_count: tax_units_count});
- }}
- >
-
-
- {
- this.state.taxes_selected[index].labels.length === 2 &&
-
- {
- let units_per_tax_unit_count = this.state.units_per_tax_unit_count;
- if (index === 0) {
- units_per_tax_unit_count = [];
- units_per_tax_unit_count[0] = value;
- } else
- units_per_tax_unit_count[index] = value;
- this.setState({units_per_tax_unit_count: units_per_tax_unit_count});
- }}
- >
-
-
- }
- > :
- null
-
- }
- {
- !isNil(this.state.taxes_selected[index]) ?
- this.state.taxes_selected[index].has_image_capture === "1" &&
-
- {
- ImagePicker.openCamera({
- width: 400,
- height: 281,
- cropping: true,
- useFrontCamera: false
- }).then(image => {
- this.createFormData(image);
- this.setState({image, displayImage: true, index});
- })
- }}
- activeOpacity={0.9}>
-
-
-
-
-
-
-
-
-
- {I18n.t('IMAGE_TAKE')}
- : null
-
- }
- {
- !isNil(this.state.taxes_selected[index]) ?
- this.state.taxes_selected[index].billing_period === "jour" &&
- (
- {
- let {number_of_days} = this.state.number_of_days;
- if (index === 0) {
- number_of_days = [];
- number_of_days[0] = value;
- } else
- number_of_days[index] = value;
- this.setState({number_of_days});
- }}
- style={styles.input}
- >
-
- )
- : 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 */}
- {/*
+ {this.state.taxes_selected[index].labels.length === 2 && (
+
+ {
+ let units_per_tax_unit_count =
+ this.state.units_per_tax_unit_count;
+ if (index === 0) {
+ units_per_tax_unit_count = [];
+ units_per_tax_unit_count[0] = value;
+ } else units_per_tax_unit_count[index] = value;
+ this.setState({
+ units_per_tax_unit_count: units_per_tax_unit_count,
+ });
+ }}>
+
+ )}
+ >
+ )
+ : null}
+ {!isNil(this.state.taxes_selected[index])
+ ? this.state.taxes_selected[index].has_image_capture === '1' && (
+
+ {
+ ImagePicker.openCamera({
+ width: 400,
+ height: 281,
+ cropping: true,
+ useFrontCamera: false,
+ }).then(image => {
+ this.createFormData(image);
+ this.setState({image, displayImage: true, index});
+ });
+ }}
+ activeOpacity={0.9}>
+
+
+
+
+
+
+
+
+
+
+ {I18n.t('IMAGE_TAKE')}
+
+
+ )
+ : null}
+ {!isNil(this.state.taxes_selected[index])
+ ? this.state.taxes_selected[index].billing_period === 'jour' && (
+
+ {
+ let {number_of_days} = this.state.number_of_days;
+ if (index === 0) {
+ number_of_days = [];
+ number_of_days[0] = value;
+ } else number_of_days[index] = value;
+ this.setState({number_of_days});
+ }}
+ style={styles.input}>
+
+ )
+ : 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 */}
+ {/*
*/}
- {/* 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 });
- }}
- />
-
- )}
-
+ {/* 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});
+ }}
+ />
+
+ )}
+ >
+ )
+ }
+ >
+ );
+ };
- >
- )
- }
- >
- )
- }
+ renderTaxesEntreprisesDropdown = index => {
+ return (
+ <>
+ {
+ this.taxesAnim = comp;
+ }}
+ key={index}>
+
+
+ {
+ return value;
+ }}
+ onChangeText={(value, i, data) => {
+ //console.log("Value selected", value);
- renderTaxesEntreprisesDropdown = (index) => {
- return (
- <>
- {
- this.taxesAnim = comp
- }} key={index}>
-
+ let taxes_seleted = this.state.taxes_selected;
+ if (index === 0) {
+ taxes_seleted = new Array();
+ taxes_seleted[index] = value;
+ } else taxes_seleted[index] = value;
+ this.setState({taxes_selected: taxes_seleted}, () => {
+ // console.log("Taxes", this.state.taxes_selected);
+ // console.log("Index", index);
+ });
-
- {
- return value
- }}
- onChangeText={(value, i, data) => {
- //console.log("Value selected", value);
+ if (Platform.OS === 'android') {
+ this.requestCameraPermission(true);
+ } else {
+ this.watchLocation(true);
+ }
+ }}
+ labelExtractor={value => {
+ return value.name;
+ }}
+ />
+
- let taxes_seleted = this.state.taxes_selected;
- if (index === 0) {
- taxes_seleted = new Array();
- taxes_seleted[index] = value;
- } else
- taxes_seleted[index] = value;
- this.setState({taxes_selected: taxes_seleted}, () => {
- // console.log("Taxes", this.state.taxes_selected);
- // console.log("Index", index);
- });
-
- if (Platform.OS === 'android') {
- this.requestCameraPermission(true);
- } else {
- this.watchLocation(true);
- }
- }}
- labelExtractor={(value) => {
- return value.name
- }}
- />
-
-
-
- {
- let tabTaxe = this.state.tabTaxe;
- if (index === 0) {
- let lastElement = this.state.tabTaxe[this.state.tabTaxe.length - 1];
- tabTaxe.push(lastElement++);
- this.setState({tabTaxe});
- } else {
- tabTaxe = tabTaxe.filter((element, i) => index !== i);
- this.setState({tabTaxe});
- }
- }}
- activeOpacity={0.9}>
-
-
- 0 ? 'minus' : 'plus'} color={Color.whiteColor} size={20}/>
-
-
-
-
-
+
+ {
+ let tabTaxe = this.state.tabTaxe;
+ if (index === 0) {
+ let lastElement =
+ this.state.tabTaxe[this.state.tabTaxe.length - 1];
+ tabTaxe.push(lastElement++);
+ this.setState({tabTaxe});
+ } else {
+ tabTaxe = tabTaxe.filter((element, i) => index !== i);
+ this.setState({tabTaxe});
+ }
+ }}
+ activeOpacity={0.9}>
+
+
+ 0 ? 'minus' : 'plus'}
+ color={Color.whiteColor}
+ size={20}
+ />
+
+
+
+
+
+
+ {!isNil(this.state.taxes_selected[index])
+ ? this.state.taxes_selected[index].measurement_unit !== 'forfait' && (
+ <>
+
+ {
+ let tax_units_count = this.state.tax_units_count;
+ if (index === 0) {
+ tax_units_count = [];
+ tax_units_count[0] = value;
+ } else tax_units_count[index] = value;
+ this.setState({tax_units_count: tax_units_count});
+ }}>
- {
- !isNil(this.state.taxes_selected[index]) ?
- this.state.taxes_selected[index].measurement_unit !== "forfait" &&
- <>
-
- {
- let tax_units_count = this.state.tax_units_count;
- if (index === 0) {
- tax_units_count = [];
- tax_units_count[0] = value;
- } else
- tax_units_count[index] = value;
- this.setState({tax_units_count: tax_units_count});
- }}
- >
-
-
- {
- this.state.taxes_selected[index].labels.length === 2 &&
-
- {
- let units_per_tax_unit_count = this.state.units_per_tax_unit_count;
- if (index === 0) {
- units_per_tax_unit_count = [];
- units_per_tax_unit_count[0] = value;
- } else
- units_per_tax_unit_count[index] = value;
- this.setState({units_per_tax_unit_count: units_per_tax_unit_count});
- }}
- >
-
-
- }
- > :
- null
-
- }
-
-
- {!isNil(this.state.taxes_selected[index]) ?
- this.state.taxes_selected[index].has_image_capture === "1" &&
-
- {
- ImagePicker.openCamera({
- width: 400,
- height: 281,
- cropping: true,
- useFrontCamera: false
- }).then(image => {
- this.createFormData(image);
- this.setState({image, displayImage: true, index});
- })
- }}
- activeOpacity={0.9}>
-
-
-
-
-
-
-
-
-
- {I18n.t('IMAGE_TAKE')}
- : null
- }
+ {this.state.taxes_selected[index].labels.length === 2 && (
+
+ {
+ let units_per_tax_unit_count =
+ this.state.units_per_tax_unit_count;
+ if (index === 0) {
+ units_per_tax_unit_count = [];
+ units_per_tax_unit_count[0] = value;
+ } else units_per_tax_unit_count[index] = value;
+ this.setState({
+ units_per_tax_unit_count: units_per_tax_unit_count,
+ });
+ }}>
+
+ )}
+ >
+ )
+ : null}
+ {!isNil(this.state.taxes_selected[index])
+ ? this.state.taxes_selected[index].has_image_capture === '1' && (
+
+ {
+ ImagePicker.openCamera({
+ width: 400,
+ height: 281,
+ cropping: true,
+ useFrontCamera: false,
+ }).then(image => {
+ this.createFormData(image);
+ this.setState({image, displayImage: true, index});
+ });
+ }}
+ activeOpacity={0.9}>
+
+
+
+
+
+
+
+
+
+ {I18n.t('IMAGE_TAKE')}
+
+
+ )
+ : null}
+
+
+ {I18n.t('WAIT_LOADING_POSITION')}
+
+
+ {this.isOffline ? (
+
+
+
+
+
+
+
+
+ ) : (
+ <>
+ {
+ this.mapanim = comp;
+ }}>
+ {
+ this.mapRef[this.state.index] = ref;
+ }}
+ style={styles.map}>
+ {this.state.myPosition !== undefined ? (
+ {I18n.t('WAIT_LOADING_POSITION')}
-
- {this.isOffline ?
-
-
-
-
-
-
-
-
- :
-
- <>
- {
- this.mapanim = comp
- }}
- >
- {
- this.mapRef[this.state.index] = ref
- }}
- style={styles.map}
- >
- {this.state.myPosition !== undefined ?
- :
- null}
-
-
- {/*
+ />
+ ) : null}
+
+
+ {/*
{this.state.textadress !== undefined ? this.state.textadress : I18n.t('TAKE_MY_POSITION')}
*/}
- >
- }
- {
- this.districtAnim = comp
- }}>
-
- {
- return value
- }}
- labelExtractor={(value) => {
- return value.name
- }}
- onChangeText={(value, index, data) => {
- let taxes_selected = this.state.taxes_selected;
- taxes_selected[this.state.index].district = value.name;
- this.setState({taxes_selected});
- }}
- />
-
-
+ >
+ )}
+ {
+ this.districtAnim = comp;
+ }}>
+
+ {
+ return value;
+ }}
+ labelExtractor={value => {
+ return value.name;
+ }}
+ onChangeText={(value, index, data) => {
+ let taxes_selected = this.state.taxes_selected;
+ taxes_selected[this.state.index].district = value.name;
+ this.setState({taxes_selected});
+ }}
+ />
+
+
- {
- this.neightborhoodAnim = comp
- }}>
- {
- let taxes_selected = this.state.taxes_selected;
- taxes_selected[this.state.index].neighborhood = text;
- this.setState({taxes_selected});
- }}/>
-
- >
- )
- }
-handleTaxSlection = (selectedTax) => {
- this.setState({selectedTax})
-}
+ {
+ this.neightborhoodAnim = comp;
+ }}>
+ {
+ let taxes_selected = this.state.taxes_selected;
+ taxes_selected[this.state.index].neighborhood = text;
+ this.setState({taxes_selected});
+ }}
+ />
+
+ >
+ );
+ };
+ handleTaxSlection = selectedTax => {
+ this.setState({selectedTax});
+ };
- renderUserGeoAccount() {
- let year = new Date();
- const {required_taxes_only_single_tax, selectedTax,accountType} = this.state
- return (
-
- {this.state.displayImage && this.renderDialogImage()}
- {this.state.loadingUpload && this.renderLoader()}
-
- this.props.navigation.pop()}
- />
- {I18n.t('LAST_STEP')}
+ renderUserGeoAccount() {
+ let year = new Date();
+ const {required_taxes_only_single_tax, selectedTax, accountType} =
+ this.state;
+ return (
+
+ {this.state.displayImage && this.renderDialogImage()}
+ {this.state.loadingUpload && this.renderLoader()}
+
+ this.props.navigation.pop()}
+ />
+ {I18n.t('LAST_STEP')}
+
+ (this._scrollView = component)}
+ style={styles.container}>
+ {/* Sélection du type de compte */}
-
- this._scrollView = component} style={styles.container}>
- {/* Sélection du type de compte */}
-
-
-
-
- <>
- {I18n.t('INFORMATION_FICHE_CIRCUIT')}
- {/*
+
+ {I18n.t('INFORMATION_FICHE_CIRCUIT')}
+
+ {/* {
/>
*/}
-
-
-
-
- {
- this.societyTypeAnim = comp
- }}>
-
- {console.log("this.state.result.companies_types===>>",this.state.result.companies_types)}
- {
- return value
- }}
- labelExtractor={(value) => {
- return value.description
- }}
- onChangeText={(value, index, data) => {
- this.setState({companies_types_selected: value.id});
- this.updateRequiredTaxes(value);
- console.log("value12===>>",value)
- if (value.name ==="PPH"){ this.setState({accountType:"PP"})}else{this.setState({accountType:"PM"})}
-
- }}
- />
-
-
- { accountType === "PP" && (
- <>
- {/* Champ NUMERO CNI (obligatoire) */}
- this.setState({ cni_number: text })}
- />
- {/* Champ DATE DE NAISSANCE (obligatoire) */}
- {/* {
+ this.societyTypeAnim = comp;
+ }}>
+
+ {console.log(
+ 'this.state.result.companies_types===>>',
+ this.state.result.companies_types,
+ )}
+ {
+ return value;
+ }}
+ labelExtractor={value => {
+ return value.description;
+ }}
+ onChangeText={(value, index, data) => {
+ this.setState({companies_types_selected: value.id});
+ this.updateRequiredTaxes(value);
+ console.log('value12===>>', value);
+ if (value.name === 'PPH') {
+ this.setState({accountType: 'PP'});
+ } else {
+ this.setState({accountType: 'PM'});
+ }
+ }}
+ />
+
+
+ {accountType === 'PP' && (
+ <>
+ {/* Champ NUMERO CNI (obligatoire) */}
+ this.setState({cni_number: text})}
+ />
+ {/* Champ DATE DE NAISSANCE (obligatoire) */}
+ {/* {
value={this.state.birth_date}
onChangeText={(text) => this.setState({ birth_date: text })}
/> */}
-
-
-
- {I18n.t('BIRTH_DATE')}
-
-
-
-
- {this.state.birth_date.toLocaleDateString()}
-
-
-
-
- {this.state.showDatePicker &&(
-
- )}
- {/* Champ LIEU DE NAISSANCE (obligatoire) */}
- this.setState({ birth_place: text })}
- />
- {/* Champ PAYS NAISSANCE (obligatoire) */}
- this.setState({ birth_country: text })}
- />
- {/* Champ PAYS NATIONALITE (obligatoire) */}
- this.setState({ nationality_country: text })}
- />
- {/* Champs pour les informations parentales */}
- this.setState({ mother_lastname: text })}
- />
- this.setState({ mother_firstname: text })}
- />
- this.setState({ father_lastname: text })}
- />
- this.setState({ father_firstname: text })}
- />
- {/* Masquer les champs TECHNICAL AGREMENT et PATENTE */}
- >
- )}
+
+
+
+ {I18n.t('BIRTH_DATE')}
+
+
+
+
+ {this.state.birth_date.toLocaleDateString()}
+
+
+
+
+ {this.state.showDatePicker && (
+
+ )}
+ {/* Champ LIEU DE NAISSANCE (obligatoire) */}
+ this.setState({birth_place: text})}
+ />
+ {/* Champ PAYS NAISSANCE (obligatoire) */}
+ this.setState({birth_country: text})}
+ />
+ {/* Champ PAYS NATIONALITE (obligatoire) */}
+
+ this.setState({nationality_country: text})
+ }
+ />
+ {/* Champs pour les informations parentales */}
+ this.setState({mother_lastname: text})}
+ />
+ this.setState({mother_firstname: text})}
+ />
+ this.setState({father_lastname: text})}
+ />
+ this.setState({father_firstname: text})}
+ />
+ {/* Masquer les champs TECHNICAL AGREMENT et PATENTE */}
+ >
+ )}
- { accountType === "PM" && (
- <>
- {/* Champ SIGLE (commun aux deux types mais ici on le traite dans le PM) */}
- this.setState({ signboard: text })}
- />
- {/* Champ DATE CREATION (obligatoire) */}
- {/*
+ {/* Champ SIGLE (commun aux deux types mais ici on le traite dans le PM) */}
+ this.setState({signboard: text})}
+ />
+ {/* Champ DATE CREATION (obligatoire) */}
+ {/* {
value={this.state.entreprise_creation_date}
onChangeText={(text) => this.setState({ entreprise_creation_date: text })}
/> */}
-
-
-
- {I18n.t('CREATION_DATE')}
-
-
-
-
- {this.state.entreprise_creation_date.toLocaleDateString()}
-
-
-
-
- {this.state.showDatePicker &&(
-
- )}
- {/* Ici, on peut conserver TECHNICAL AGREMENT et PATENTE pour PM */}
- this.setState({ technical_approval: text })}
- />
- this.setState({ id_patente: text })}
- />
- >
- )}
- { this.neightborhoodAnim = comp }}>
- {console.log("ICI===>>",this.state.result)}
- {console.log("ICI===>>",this.state.result.neighborhoods)}
-
+
+
+ {I18n.t('CREATION_DATE')}
+
+
+
+
+ {this.state.entreprise_creation_date.toLocaleDateString()}
+
+
+
+
+ {this.state.showDatePicker && (
+
+ )}
+ {/* Ici, on peut conserver TECHNICAL AGREMENT et PATENTE pour PM */}
+
+ this.setState({technical_approval: text})
+ }
+ />
+ this.setState({id_patente: 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 });
+ onItemSelect={selectedItem => {
+ const id = parseInt(selectedItem.id, 10);
+ this.setState({neighborhood: selectedItem.name});
}}
- />
-
+ />
+
- {required_taxes_only_single_tax ? (
-
- {
- this.ProprierteTypeAnim = comp
- }} >
- {/* {
+ this.ProprierteTypeAnim = comp;
+ }}>
+ {/* {
/>
*/}
-
+
+ ) : (
+ this.state.required_taxes.map((element, index) =>
+ this.renderRequiredTaxesDropdown(element, index),
+ )
+ )}
- ) : (
+ {this.renderTaxesDropdown(0)}
+ {this.state.tabTaxe.map(
+ (element, index) => index > 0 && this.renderTaxesDropdown(index),
+ )}
- this.state.required_taxes.map((element, index) => (
- this.renderRequiredTaxesDropdown(element, index)
- ))
- )}
+ {this.state.displayAddTaxeFromOtherNetwork &&
+ !_.isEmpty(this.state.dataTaxesPublicite)
+ ? this.renderPubliciteTaxesDropdown()
+ : null}
- {this.renderTaxesDropdown(0)}
- {
- this.state.tabTaxe.map((element, index) => (
- index > 0 &&
- this.renderTaxesDropdown(index)
- ))
- }
+ {
+ this.activityTypeAnim = comp;
+ }}>
+ {
+ this.setState({activity_type: selectedItem.name});
+ }}
+ />
+
- {
- this.state.displayAddTaxeFromOtherNetwork &&
- !_.isEmpty(this.state.dataTaxesPublicite) ?
- this.renderPubliciteTaxesDropdown() : null
-
- }
-
-
-
-
-
- {
- this.activityTypeAnim = comp
- }}>
-
- {
- this.setState({activity_type: selectedItem.name});
- }}
- />
-
-
-
- {/* {
+ {/* {
this.activityTypeAnim = comp
}}>
{
*/}
-
- {
- // Update the identification_number state
- this.setState({
- identification_number: text,
- remainingCharacters: 14 - text.length // Update the remaining characters
- });
- }}/>
-
- {this.state.remainingCharacters} caractères restants
-
-
+
+ {
+ // Update the identification_number state
+ this.setState({
+ identification_number: text,
+ remainingCharacters: 14 - text.length, // Update the remaining characters
+ });
+ }}
+ />
+
+ {this.state.remainingCharacters} caractères restants
+
+
-
- {
- this.setState({trade_registry: text})
- }}/>
-
+
+ {
+ this.setState({trade_registry: text});
+ }}
+ />
+
-
- {
- this.setState({technical_approval: text})
- }}/>
-
+
+ {
+ this.setState({technical_approval: text});
+ }}
+ />
+
- {
- this.nomResponsableAnim = comp
- }}>
- {
- this.setState({responsable_name: text})
- }}
- />
-
+ {
+ this.nomResponsableAnim = comp;
+ }}>
+ {
+ this.setState({responsable_name: text});
+ }}
+ />
+
- {
- this.municipalityAnim = comp
- }}>
-
- {
- return value
- }}
- labelExtractor={(value) => {
- return value.name
- }}
- onChangeText={(value, index, data) => {
- this.setState({municipality: value.name});
- }}
- />
-
-
+ {
+ this.municipalityAnim = comp;
+ }}>
+
+ {
+ return value;
+ }}
+ labelExtractor={value => {
+ return value.name;
+ }}
+ onChangeText={(value, index, data) => {
+ this.setState({municipality: value.name});
+ }}
+ />
+
+
- {I18n.t('OTHERS_INFORMATIONS')}
+ {I18n.t('OTHERS_INFORMATIONS')}
- {
- this.districtAnim = comp
- }}>
-
- {
- return value
- }}
- labelExtractor={(value) => {
- return value.name
- }}
- onChangeText={(value, index, data) => {
- this.setState({district: value.name});
- }}
- />
-
-
+ {
+ this.districtAnim = comp;
+ }}>
+
+ {
+ return value;
+ }}
+ labelExtractor={value => {
+ return value.name;
+ }}
+ onChangeText={(value, index, data) => {
+ this.setState({district: value.name});
+ }}
+ />
+
+
- {/* {
+ {/* {
this.neightborhoodAnim = comp
}}>
{
this.setState({neighborhood: text})
}}/>
*/}
-
- {/*
+ {/*
{
}}/>
*/}
+
+
+ this.setState({TVA: value})}
+ style={styles.checkbox}
+ />
+ {I18n.t('TVA')}
+
-
-
-
- this.setState({TVA: value})}
- style={styles.checkbox}/>
- {I18n.t('TVA')}
-
-
-
- this.setState({IRPP: value})}
- value={this.state.IRPP}
- style={styles.checkbox}/>
- {I18n.t('IRPP')}
-
-
- this.setState({licence: value})}
- value={this.state.licence}
- style={styles.checkbox}/>
- Licence
- {console.log("licence===>>",this.state.licence)}
- {console.log("licence===>>",typeof this.state.licence)}
-
- {/*
+ this.setState({IRPP: value})}
+ value={this.state.IRPP}
+ style={styles.checkbox}
+ />
+ {I18n.t('IRPP')}
+
+
+ this.setState({licence: value})}
+ value={this.state.licence}
+ style={styles.checkbox}
+ />
+ Licence
+ {console.log('licence===>>', this.state.licence)}
+ {console.log('licence===>>', typeof this.state.licence)}
+
+ {/*
this.setState({year_tax_paid_N: value})}
@@ -2042,11 +2240,9 @@ handleTaxSlection = (selectedTax) => {
{I18n.t('ANNEE_TAXE')} {Number(year.getFullYear() - 1)}
*/}
+
-
-
-
- {/* {
*/}
- {/* {
style={styles.label}>{I18n.t('ANNEE_TAXE')} {Number(year.getFullYear() - 3)}
*/}
- >
+ >
-
-
-
- ({value: row, label: row}))}
- visible={this.state.networksinglePickerVisible}
- selectedItem={this.state.singlePickerSelectedItem}
- onCancel={() => this.setState({networksinglePickerVisible: false})}
- onOk={result => {
- this.setState({networksinglePickerVisible: false});
- this.setState({singlePickerSelectedItem: result.selectedItem});
- }}
- >
- this.renderRow(item)}/>
-
-
- )
-
- }
-
- renderActifAccount() {
- return (
-
- {this.prepareModal()}
- {this.state.displayImage && this.renderDialogImage()}
- {this.state.loadingUpload && this.renderLoader()}
- {this.state.isDataSubmit && this.renderCreateActifResponse()}
-
- this.props.navigation.pop()}
- />
- {I18n.t('LAST_STEP')}
-
-
-
-
- <>
-
- {I18n.t('INFORMATION_FICHE_CIRCUIT')}
-
- this.nomSocieteAnim = comp}>
-
- {
- return value
- }}
- labelExtractor={(value) => {
- return value.name
- }}
- onChangeText={(value, index, data) => {
- this.setState({companies_types_selected: value.id});
- //this.updateRequiredTaxes(value);
- //console.log("Company", value);
- }}
- />
-
-
-
- {this.renderTaxesEntreprisesDropdown(0)}
- {
- this.state.tabTaxe.map((element, index) => (
- index > 0 &&
- this.renderTaxesEntreprisesDropdown(index)
- ))
- }
-
- >
-
-
-
-
- ({value: row, label: row}))}
- visible={this.state.networksinglePickerVisible}
- selectedItem={this.state.singlePickerSelectedItem}
- onCancel={() => this.setState({networksinglePickerVisible: false})}
- onOk={result => {
- this.setState({networksinglePickerVisible: false});
- this.setState({singlePickerSelectedItem: result.selectedItem});
- }}
- >
- this.renderRow(item)}/>
-
-
-
- )
- }
-
- onRowPress(rowID) {
- this.setState({network: rowID})
- }
-
- renderRow = (row) => (
- this.onRowPress(row)}>
-
-
-
-
- {row.name}
-
-
+
+
+ ({value: row, label: row}))}
+ visible={this.state.networksinglePickerVisible}
+ selectedItem={this.state.singlePickerSelectedItem}
+ onCancel={() => this.setState({networksinglePickerVisible: false})}
+ onOk={result => {
+ this.setState({networksinglePickerVisible: false});
+ this.setState({singlePickerSelectedItem: result.selectedItem});
+ }}>
+ this.renderRow(item)}
+ />
+
+
);
+ }
- checkIfAllImagesIsOk(data) {
- let message = "";
- let isOk = true
- data['taxes'].map((taxe) => {
- // console.log("Taxes map", taxe);
- if (taxe.has_image_capture === "1") {
- if (_.isNil(taxe.image)) {
- isOk = false;
- message += `${I18n.t("TAXE_REQUIRED_IMAGE")} ${taxe.name}`
- }
+ renderActifAccount() {
+ return (
+
+ {this.prepareModal()}
+ {this.state.displayImage && this.renderDialogImage()}
+ {this.state.loadingUpload && this.renderLoader()}
+ {this.state.isDataSubmit && this.renderCreateActifResponse()}
+
+ this.props.navigation.pop()}
+ />
+ {I18n.t('LAST_STEP')}
+
+
+ <>
+
+ {I18n.t('INFORMATION_FICHE_CIRCUIT')}
+
+
+ (this.nomSocieteAnim = comp)}>
+
+ {
+ return value;
+ }}
+ labelExtractor={value => {
+ return value.name;
+ }}
+ onChangeText={(value, index, data) => {
+ this.setState({companies_types_selected: value.id});
+ //this.updateRequiredTaxes(value);
+ //console.log("Company", value);
+ }}
+ />
+
+
+
+ {this.renderTaxesEntreprisesDropdown(0)}
+ {this.state.tabTaxe.map(
+ (element, index) =>
+ index > 0 && this.renderTaxesEntreprisesDropdown(index),
+ )}
+ >
+
+
+
+ ({value: row, label: row}))}
+ visible={this.state.networksinglePickerVisible}
+ selectedItem={this.state.singlePickerSelectedItem}
+ onCancel={() => this.setState({networksinglePickerVisible: false})}
+ onOk={result => {
+ this.setState({networksinglePickerVisible: false});
+ this.setState({singlePickerSelectedItem: result.selectedItem});
+ }}>
+ this.renderRow(item)}
+ />
+
+
+ );
+ }
+
+ onRowPress(rowID) {
+ this.setState({network: rowID});
+ }
+
+ renderRow = row => (
+ this.onRowPress(row)}>
+
+
+
+
+ {row.name}
+
+
+ );
+
+ checkIfAllImagesIsOk(data) {
+ let message = '';
+ let isOk = true;
+ data['taxes'].map(taxe => {
+ // console.log("Taxes map", taxe);
+ if (taxe.has_image_capture === '1') {
+ if (_.isNil(taxe.image)) {
+ isOk = false;
+ message += `${I18n.t('TAXE_REQUIRED_IMAGE')} ${taxe.name}`;
+ }
+ }
+ });
+ if (data.hasOwnProperty('secondary_taxes')) {
+ data['secondary_taxes'].map(taxe => {
+ console.log('Secondary Taxes map', taxe);
+ if (_.isNil(taxe.image)) {
+ isOk = false;
+ message += `${I18n.t('TAXE_REQUIRED_IMAGE')} ${taxe.name}`;
+ }
+ });
+ }
+ console.log('Message erreur image', message);
+ this.setState({messageRequiredImage: message});
+
+ return isOk;
+ }
+
+ checkIfAllImagesIsOkForActif(data) {
+ let message = '';
+ let isOk = true;
+ data.map(taxe => {
+ console.log('Taxes map', taxe);
+ if (taxe.has_image_capture === '1') {
+ if (_.isNil(taxe.image)) {
+ isOk = false;
+ message += `${I18n.t('TAXE_REQUIRED_IMAGE')} ${taxe.name}`;
+ }
+ }
+ });
+ this.setState({messageRequiredImage: message});
+
+ return isOk;
+ }
+
+ submitUsagerOffline(data) {
+ getData(usagerToSave).then(resultGet => {
+ let usagerArray = new Array();
+ console.log('DATA FROM ASYNC STORAGE', resultGet);
+
+ if (_.isNil(resultGet)) {
+ usagerArray.push({
+ data,
+ isSaved: false,
});
- if (data.hasOwnProperty("secondary_taxes")) {
- data['secondary_taxes'].map((taxe) => {
- console.log("Secondary Taxes map", taxe);
- if (_.isNil(taxe.image)) {
- isOk = false;
- message += `${I18n.t("TAXE_REQUIRED_IMAGE")} ${taxe.name}`
+ } else {
+ usagerArray = JSON.parse(resultGet);
+ if (usagerArray.length <= 10) {
+ usagerArray.push({
+ data,
+ isSaved: false,
+ });
+ }
+ }
+
+ if (usagerArray.length === 10) {
+ Alert.alert('', I18n.t('LIMITE_USAGER_LOCAL_ATTEINTE'), [
+ {
+ text: 'Ok',
+ onPress: () => {
+ this.props.navigation.popToTop();
+ },
+ },
+ ]);
+ } else {
+ storeData(usagerToSave, JSON.stringify(usagerArray)).then(() => {
+ Alert.alert('', I18n.t('USAGER_SAVED_SUCCESSFULLY'), [
+ {
+ text: 'Ok',
+ onPress: () => {
+ this.setState({isLoading: false});
+ this.props.navigation.popToTop();
+ },
+ },
+ ]);
+ });
+ }
+ });
+ }
+
+ // getTownValue(key, defaultValue = "") {
+ // return this.state.town && this.state.town[key] ? this.state.town[key] : defaultValue;
+ // }
+ 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);
+ for (let i = 0; i < this.state.tabTaxe.length; i++) {
+ if (this.state.taxes_selected[i] !== undefined) {
+ if (this.state.taxes_selected[i].has_image_capture === '1') {
+ taxes_to_send.push({
+ has_image_capture: '1',
+ latitude: this.isOffline
+ ? this.state.latitude
+ : this.state.taxes_selected[i].latitude,
+ longitude: this.isOffline
+ ? this.state.longitude
+ : this.state.taxes_selected[i].longitude,
+ image: this.state.taxes_selected[i].image,
+ name: this.state.taxes_selected[i].name,
+ id_network_tax: this.state.taxes_selected[i].id,
+ 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],
+ number_of_days: isNil(this.state.number_of_days[i])
+ ? null
+ : this.state.number_of_days[i],
+ neighborhood: this.state.taxes_selected[i].neighborhood,
+ district: this.state.taxes_selected[i].district,
+ });
+ } else {
+ taxes_to_send.push({
+ has_image_capture: '0',
+ latitude: this.isOffline
+ ? this.state.latitude
+ : this.state.taxes_selected[i].latitude,
+ longitude: this.isOffline
+ ? this.state.longitude
+ : this.state.taxes_selected[i].longitude,
+ id_network_tax: this.state.taxes_selected[i].id,
+ name: this.state.taxes_selected[i].name,
+ 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],
+ number_of_days: isNil(this.state.number_of_days[i])
+ ? null
+ : this.state.number_of_days[i],
+ neighborhood: this.state.taxes_selected[i].neighborhood,
+ district: this.state.taxes_selected[i].district,
+ });
+ }
+ }
+ }
+
+ if (this.isOffline) {
+ if (this.checkOrShake(this.state.taxes_selected[0], this.taxesAnim)) {
+ if (
+ this.checkOrAlert(
+ this.checkIfArrayValueIsNull(
+ this.state.taxes_selected,
+ 'district',
+ ),
+ `${I18n.t('THE_FIELD')} ${I18n.t('DISTRICT')} ${I18n.t(
+ 'IS_REQUIRED',
+ )}`,
+ false,
+ )
+ ) {
+ if (
+ this.checkOrShake(
+ this.state.companies_types_selected,
+ this.nomSocieteAnim,
+ false,
+ )
+ ) {
+ if (
+ this.checkOrAlert(
+ this.checkIfArrayValueIsNull(
+ this.state.taxes_selected,
+ 'neighborhood',
+ ),
+ `${I18n.t('THE_FIELD')} ${I18n.t('NEIGHTBORHOOD')} ${I18n.t(
+ 'IS_REQUIRED',
+ )}`,
+ false,
+ )
+ ) {
+ getData(actifToSave).then(resultGet => {
+ let actifArray = new Array();
+ console.log('DATA FROM ASYNC STORAGE', resultGet);
+ if (_.isNil(resultGet)) {
+ actifArray.push({
+ data: {
+ id_network_super: this.state.result.id_network_super,
+ id_company: this.state.companies_types_selected,
+ district: this.state.district,
+ neighborhood: this.state.neighborhood,
+ taxes: taxes_to_send,
+ },
+ isSaved: false,
+ });
+ } else {
+ actifArray = JSON.parse(resultGet);
+ if (actifArray.length <= 10) {
+ actifArray.push({
+ data: {
+ id_network_super: this.state.result.id_network_super,
+ id_company: this.state.companies_types_selected,
+ district: this.state.district,
+ neighborhood: this.state.neighborhood,
+ taxes: taxes_to_send,
+ },
+ isSaved: false,
+ });
+ }
+ }
+
+ if (actifArray.length === 10) {
+ Alert.alert('', I18n.t('LIMITE_ACTIF_LOCAL_ATTEINTE'), [
+ {
+ text: 'Ok',
+ onPress: () => {
+ this.props.navigation.popToTop();
+ },
+ },
+ ]);
+ } else {
+ if (
+ this.checkIfAllImagesIsOkForActif(
+ this.state.taxes_selected,
+ )
+ ) {
+ storeData(actifToSave, JSON.stringify(actifArray)).then(
+ () => {
+ Alert.alert('', I18n.t('ACTIF_SAVED_SUCCESSFULLY'), [
+ {
+ text: 'Ok',
+ onPress: () => {
+ this.props.navigation.popToTop();
+ },
+ },
+ ]);
+ },
+ );
+ } else {
+ Alert.alert(
+ I18n.t('ERROR_LABEL'),
+ this.state.messageRequiredImage,
+ [
+ {
+ text: 'Ok',
+ onPress: () => {
+ 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.props.saveActifSocietyAction({
+ id_network_super: this.state.result.id_network_super,
+ id_company: this.state.companies_types_selected,
+ district: this.state.district,
+ neighborhood: this.state.neighborhood,
+ taxes: taxes_to_send,
+ });
+ }
+ } else {
+ if (user !== undefined) {
+ const addIndicatif = phone => {
+ const indicatif = '+237';
+ return phone.startsWith(indicatif) ? phone : indicatif + phone;
+ };
+
+ var data = {};
+ data.tag = 'member';
+ data.type = 'create_geolocated_user';
+ data['phone'] = addIndicatif(
+ this.state.data.phone.replace('undefined', ''),
+ );
+ data['phone_transaction'] = addIndicatif(
+ this.state.data.phone_transaction.replace('undefined', ''),
+ );
+ data['network'] = this.state.data.network;
+ data['id_network_tax'] = this.state.data.network.id;
+ data['town'] = this.isOffline ? null : this.state.town;
+ if (this.state.town && typeof this.state.town === 'object') {
+ data['town'] = {
+ name: this.state.municipality || '',
+ id: this.state.town.id || '',
+ indicatif: '+237' || '',
+ districts: Array.isArray(this.state.result.districts)
+ ? this.state.result.districts
+ : [],
+ };
+ } else {
+ data['town'] = null;
+ }
+ // Utilisation :
+ // data['town'] = {
+ // name: this.getTownValue('name'),
+ // id: this.getTownValue('id'),
+ // indicatif: this.getTownValue('indicatif'),
+ // districts: this.getTownValue('districts', [])
+ // };
+
+ let taxes_to_send = [];
+ for (let i = 0; i < this.state.tabTaxe.length; i++) {
+ if (this.state.taxes_selected[i] !== undefined) {
+ if (this.state.taxes_selected[i].has_image_capture === '1') {
+ taxes_to_send.push({
+ has_image_capture: '1',
+ image: this.state.taxes_selected[i].image,
+ name: this.state.taxes_selected[i].name,
+ 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],
+ 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({
+ has_image_capture: '0',
+ id_network_tax: this.state.taxes_selected[i].id,
+ 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],
+ 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],
+ });
+ }
+ }
+ }
+
+ if (this.state.publicites_taxes !== null) {
+ let publicites_taxes = new Array();
+ publicites_taxes.push({
+ ...this.state.publicites_taxes,
+ id_network_tax: this.state.publicites_taxes.id,
+ });
+ data['secondary_taxes'] = publicites_taxes;
+ }
+
+ data['taxes'] = taxes_to_send;
+ data['required_taxes'] = this.state.required_taxes.filter(
+ (element, i) => element.id_network_tax === this.state.selectedTax?.id,
+ );
+ //data['required_taxes'] = this.state.required_taxes;
+ data['id_company_type'] = this.state.companies_types_selected;
+ data['identification_number'] = this.state.identification_number;
+ data['trade_registry'] = this.state.trade_registry;
+ data['responsable_name'] = this.state.responsable_name;
+ data['technical_approval'] = this.state.technical_approval;
+ data['municipality'] = this.state.municipality;
+ data['municipality'] = this.state.municipality;
+ data['neighborhood'] = this.state.neighborhood;
+ data['district'] = this.state.district;
+ data['id_patente'] = this.state.id_patente;
+ data['TVA'] = this.state.TVA;
+ data['IRPP'] = this.state.IRPP;
+ data['licence'] = this.state.licence;
+ data['activity_type'] = this.state.activity_type;
+ data['year_tax_paid_N_1'] = this.state.year_tax_paid_N;
+ data['year_tax_paid_N_2'] = this.state.year_tax_paid_N_1;
+ data['year_tax_paid_N_3'] = this.state.year_tax_paid_N_2;
+ data['latitude'] = this.state.data.latitude;
+ data['longitude'] = this.state.data.longitude;
+ data['player_id'] = this.state.player_id;
+ data['accountType'] = this.state.accountType;
+
+ data['cni_number'] = this.state.cni_number;
+ data['birth_date'] = this.state.birth_date;
+ data['birth_place'] = this.state.birth_place;
+ data['birth_country'] = this.state.birth_country;
+ data['nationality_country'] = this.state.nationality_country;
+ data['father_lastname'] = this.state.father_lastname;
+ data['father_firstname'] = this.state.father_firstname;
+ data['mother_lastname'] = this.state.mother_lastname;
+ data['mother_firstname'] = this.state.mother_firstname;
+
+ data['signboard'] = this.state.signboard;
+ data['entreprise_creation_date'] = this.state.entreprise_creation_date;
+ for (let i in user) {
+ data[i] = user[i];
+ }
+ data['category'] = user.category;
+
+ data['active'] = '0';
+ // Ajout de la logique conditionnelle pour vider les champs en fonction du type de compte.
+ if (this.state.accountType === 'PP') {
+ // Pour une personne physique, on s'assure que les champs spécifiques à une personne morale soient à null.
+ data['signboard'] = null;
+ data['entreprise_creation_date'] = null;
+ data['technical_approval'] = null;
+ data['id_patente'] = null;
+ } else if (this.state.accountType === 'PM') {
+ // Pour une personne morale, on met à null les champs spécifiques à une personne physique.
+ data['cni_number'] = null;
+ data['birth_date'] = null;
+ data['birth_place'] = null;
+ data['birth_country'] = null;
+ data['nationality_country'] = null;
+ data['father_lastname'] = null;
+ data['father_firstname'] = null;
+ data['mother_lastname'] = null;
+ data['mother_firstname'] = null;
+ }
+ console.log('DATA TO SEND CONVERT', data);
+
+ 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,
+ )
+ ) {
+ /* ---------- 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,
+ });
+ }
+ },
+ );
+
+ 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.setState({isLoading: false}),
+ },
+ ],
+ );
+ }
+ } else {
+ this.setState({isLoading: false}); // PP / PM manquant
+ }
+ } 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));
+ createGeolocatedAccount(data)
+ .then(result => {
+ console.log('here2===>>', result);
+ if (result.success !== undefined && result.success === 1) {
+ const message =
+ result.category === 'super'
+ ? I18n.t('HYPERVISOR_MUST_VALIDATE_SUPERVISOR')
+ : I18n.t('ACCOUNT_SUCCESSFULL_CREATED');
+ Alert.alert('', message, [
+ {
+ text: 'Ok',
+ onPress: () => {
+ this.props.navigation.popToTop();
+ },
+ },
+ ]);
+ setTimeout(() => {
+ this.setState({isLoading: false});
+ }, 1000);
+ this.props.navigator.push({
+ screen: route.login,
+ });
+ this.setState({isLoading: false});
+ } else {
+ if (result.error !== undefined) {
+ switch (result.error) {
+ case -3:
+ Alert.alert('', I18n.t('UNABLE_TO_CREATE_ACCOUNT'), [
+ {
+ text: 'Ok',
+ onPress: () => {},
+ },
+ ]);
+ break;
+ default:
+ if (result.error_msg)
+ Alert.alert('', result.error_msg, [
+ {
+ text: 'Ok',
+ onPress: () => {},
+ },
+ ]);
+ else if (result.sql_error)
+ Alert.alert(
+ I18n.t('UNABLE_TO_CREATE_ACCOUNT'),
+ result.sql_error,
+ [
+ {
+ text: 'Ok',
+ onPress: () => {},
+ },
+ ],
+ );
+ }
+ this.setState({isLoading: false});
}
+ }
+ })
+ .catch(error => {
+ this.setState({isLoading: false});
});
}
- console.log("Message erreur image", message);
- this.setState({messageRequiredImage: message});
+ } else {
+ this.setState({isLoading: false});
+ }
+ }
+ }
- return isOk;
+ checkOrShake(champ, view, scroll = false) {
+ let res = !_.isNil(champ);
+ console.log(
+ 'CheckOrShake field condition',
+ res,
+ 'Animatable view',
+ view,
+ 'scrollTo',
+ scroll,
+ );
+ if (!res) {
+ if (view !== undefined) view.shake(800);
}
- checkIfAllImagesIsOkForActif(data) {
- let message = "";
- let isOk = true
- data.map((taxe) => {
- console.log("Taxes map", taxe);
- if (taxe.has_image_capture === "1") {
- if (_.isNil(taxe.image)) {
- isOk = false;
- message += `${I18n.t("TAXE_REQUIRED_IMAGE")} ${taxe.name}`
- }
- }
+ if (scroll) this._scrollView.scrollTo(0);
+ return res;
+ }
- });
- this.setState({messageRequiredImage: message});
-
- return isOk;
+ checkOrAlert(champ, message, scroll = false) {
+ let res = !_.isNil(champ);
+ if (!res) {
+ Alert.alert(I18n.t('ERROR_LABEL'), message, [
+ {
+ text: 'Ok',
+ onPress: () => {
+ this.setState({isLoading: false});
+ },
+ },
+ ]);
}
- submitUsagerOffline(data) {
- getData(usagerToSave).then(resultGet => {
- let usagerArray = new Array();
- console.log("DATA FROM ASYNC STORAGE", resultGet);
+ if (scroll) this._scrollView.scrollTo(0);
+ return res;
+ }
- if (_.isNil(resultGet)) {
- usagerArray.push({
- data,
- isSaved: false
- });
- } else {
- usagerArray = JSON.parse(resultGet);
- if (usagerArray.length <= 10) {
- usagerArray.push({
- data,
- isSaved: false
- });
- }
- }
+ checkIfArrayValueIsNull(tab, key) {
+ let size = 0;
+ tab.map(value => {
+ if (!_.isNil(value[key])) size++;
+ });
+ if (size === tab.length) return ' ';
+ else return null;
+ }
- if (usagerArray.length === 10) {
- Alert.alert("", I18n.t("LIMITE_USAGER_LOCAL_ATTEINTE"), [{
- text: "Ok",
- onPress: () => {
- this.props.navigation.popToTop()
- }
- }]);
- } else {
- storeData(usagerToSave, JSON.stringify(usagerArray)).then(() => {
- Alert.alert("", I18n.t("USAGER_SAVED_SUCCESSFULLY"), [{
- text: "Ok",
- onPress: () => {
- this.setState({isLoading: false});
- this.props.navigation.popToTop()
- }
- }])
- });
- }
- });
- }
-
- // getTownValue(key, defaultValue = "") {
- // return this.state.town && this.state.town[key] ? this.state.town[key] : defaultValue;
- // }
- 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);
- for (let i = 0; i < this.state.tabTaxe.length; i++) {
- if (this.state.taxes_selected[i] !== undefined) {
- if (this.state.taxes_selected[i].has_image_capture === "1") {
- taxes_to_send.push({
- has_image_capture: "1",
- latitude: this.isOffline ? this.state.latitude : this.state.taxes_selected[i].latitude,
- longitude: this.isOffline ? this.state.longitude : this.state.taxes_selected[i].longitude,
- image: this.state.taxes_selected[i].image,
- name: this.state.taxes_selected[i].name,
- id_network_tax: this.state.taxes_selected[i].id,
- 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],
- number_of_days: isNil(this.state.number_of_days[i]) ? null : this.state.number_of_days[i],
- neighborhood: this.state.taxes_selected[i].neighborhood,
- district: this.state.taxes_selected[i].district
- });
- } else {
- taxes_to_send.push({
- has_image_capture: "0",
- latitude: this.isOffline ? this.state.latitude : this.state.taxes_selected[i].latitude,
- longitude: this.isOffline ? this.state.longitude : this.state.taxes_selected[i].longitude,
- id_network_tax: this.state.taxes_selected[i].id,
- name: this.state.taxes_selected[i].name,
- 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],
- number_of_days: isNil(this.state.number_of_days[i]) ? null : this.state.number_of_days[i],
- neighborhood: this.state.taxes_selected[i].neighborhood,
- district: this.state.taxes_selected[i].district
- });
- }
-
- }
- }
-
- if (this.isOffline) {
- if (this.checkOrShake(this.state.taxes_selected[0], this.taxesAnim)) {
- if ((this.checkOrAlert(this.checkIfArrayValueIsNull(this.state.taxes_selected, 'district'), `${I18n.t("THE_FIELD")} ${I18n.t("DISTRICT")} ${I18n.t("IS_REQUIRED")}`, false))) {
- if (this.checkOrShake(this.state.companies_types_selected, this.nomSocieteAnim, false)) {
- if ((this.checkOrAlert(this.checkIfArrayValueIsNull(this.state.taxes_selected, 'neighborhood'), `${I18n.t("THE_FIELD")} ${I18n.t("NEIGHTBORHOOD")} ${I18n.t("IS_REQUIRED")}`, false))) {
- getData(actifToSave).then(resultGet => {
- let actifArray = new Array();
- console.log("DATA FROM ASYNC STORAGE", resultGet);
- if (_.isNil(resultGet)) {
- actifArray.push({
- data: {
- id_network_super: this.state.result.id_network_super,
- id_company: this.state.companies_types_selected,
- district: this.state.district,
- neighborhood: this.state.neighborhood,
- taxes: taxes_to_send
- },
- isSaved: false
- });
- } else {
- actifArray = JSON.parse(resultGet);
- if (actifArray.length <= 10) {
- actifArray.push({
- data: {
- id_network_super: this.state.result.id_network_super,
- id_company: this.state.companies_types_selected,
- district: this.state.district,
- neighborhood: this.state.neighborhood,
- taxes: taxes_to_send
- },
- isSaved: false
- });
- }
- }
-
- if (actifArray.length === 10) {
- Alert.alert("", I18n.t("LIMITE_ACTIF_LOCAL_ATTEINTE"), [{
- text: "Ok",
- onPress: () => {
- this.props.navigation.popToTop();
- }
- }]);
- } else {
-
- if (this.checkIfAllImagesIsOkForActif(this.state.taxes_selected)) {
- storeData(actifToSave, JSON.stringify(actifArray)).then(() => {
- Alert.alert("", I18n.t("ACTIF_SAVED_SUCCESSFULLY"), [{
- text: "Ok",
- onPress: () => {
- this.props.navigation.popToTop()
- }
- }])
- });
- } else {
- Alert.alert(I18n.t("ERROR_LABEL"), this.state.messageRequiredImage, [{
- text: "Ok",
- onPress: () => {
- 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.props.saveActifSocietyAction({
- id_network_super: this.state.result.id_network_super,
- id_company: this.state.companies_types_selected,
- district: this.state.district,
- neighborhood: this.state.neighborhood,
- taxes: taxes_to_send
- });
- }
- } else {
-
- if (user !== undefined) {
-
- const addIndicatif = (phone) => {
- const indicatif = "+237";
- return phone.startsWith(indicatif) ? phone : indicatif + phone;
- };
-
- var data = {};
- data.tag = "member";
- data.type = "create_geolocated_user";
- data['phone'] = addIndicatif(this.state.data.phone.replace("undefined", ""));
- data['phone_transaction'] = addIndicatif(this.state.data.phone_transaction.replace("undefined", ""));
- data['network'] = this.state.data.network;
- data['id_network_tax'] = this.state.data.network.id;
- data['town'] = this.isOffline ? null : this.state.town;
- if (this.state.town && typeof this.state.town === 'object') {
- data['town'] = {
- name: this.state.municipality || "",
- id: this.state.town.id || "",
- indicatif: "+237" || "",
- districts: Array.isArray(this.state.result.districts) ? this.state.result.districts : []
- };
- } else {
- data['town'] = null;
- }
- // Utilisation :
- // data['town'] = {
- // name: this.getTownValue('name'),
- // id: this.getTownValue('id'),
- // indicatif: this.getTownValue('indicatif'),
- // districts: this.getTownValue('districts', [])
- // };
-
- let taxes_to_send = [];
- for (let i = 0; i < this.state.tabTaxe.length; i++) {
- if (this.state.taxes_selected[i] !== undefined) {
- if (this.state.taxes_selected[i].has_image_capture === "1") {
- taxes_to_send.push({
- has_image_capture: "1",
- image: this.state.taxes_selected[i].image,
- name: this.state.taxes_selected[i].name,
- 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],
- 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({
- has_image_capture: "0",
- id_network_tax: this.state.taxes_selected[i].id,
- 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],
- 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],
- });
- }
- }
- }
-
- if (this.state.publicites_taxes !== null) {
- let publicites_taxes = new Array();
- publicites_taxes.push({
- ...this.state.publicites_taxes,
- id_network_tax: this.state.publicites_taxes.id
- });
- data['secondary_taxes'] = publicites_taxes;
- }
-
- data['taxes'] = taxes_to_send;
- data['required_taxes'] = this.state.required_taxes.filter((element, i) => element.id_network_tax === this.state.selectedTax?.id)
- //data['required_taxes'] = this.state.required_taxes;
- data['id_company_type'] = this.state.companies_types_selected;
- data['identification_number'] = this.state.identification_number;
- data['trade_registry'] = this.state.trade_registry;
- data['responsable_name'] = this.state.responsable_name;
- data['technical_approval'] = this.state.technical_approval;
- data['municipality'] = this.state.municipality;
- data['municipality'] = this.state.municipality;
- data['neighborhood'] = this.state.neighborhood;
- data['district'] = this.state.district;
- data['id_patente'] = this.state.id_patente;
- data['TVA'] = this.state.TVA;
- data['IRPP'] = this.state.IRPP;
- data['licence'] = this.state.licence;
- data['activity_type'] = this.state.activity_type;
- data['year_tax_paid_N_1'] = this.state.year_tax_paid_N;
- data['year_tax_paid_N_2'] = this.state.year_tax_paid_N_1;
- data['year_tax_paid_N_3'] = this.state.year_tax_paid_N_2;
- data['latitude'] = this.state.data.latitude;
- data['longitude'] = this.state.data.longitude;
- data['player_id'] = this.state.player_id;
- data['accountType'] = this.state.accountType;
-
- data['cni_number'] = this.state.cni_number;
- data['birth_date'] = this.state.birth_date;
- data['birth_place'] = this.state.birth_place;
- data['birth_country'] = this.state.birth_country;
- data['nationality_country'] = this.state.nationality_country;
- data['father_lastname'] = this.state.father_lastname;
- data['father_firstname'] = this.state.father_firstname;
- data['mother_lastname'] = this.state.mother_lastname;
- data['mother_firstname'] = this.state.mother_firstname;
-
- data['signboard'] = this.state.signboard;
- data['entreprise_creation_date'] = this.state.entreprise_creation_date;
- for (let i in user) {
- data[i] = user[i];
- }
- data['category'] = user.category;
-
- data['active'] = '0';
- // Ajout de la logique conditionnelle pour vider les champs en fonction du type de compte.
- if (this.state.accountType === "PP") {
- // Pour une personne physique, on s'assure que les champs spécifiques à une personne morale soient à null.
- data['signboard'] = null;
- data['entreprise_creation_date'] = null;
- data['technical_approval'] = null;
- data['id_patente'] = null;
- } else if (this.state.accountType === "PM") {
- // Pour une personne morale, on met à null les champs spécifiques à une personne physique.
- data['cni_number'] = null;
- data['birth_date'] = null;
- data['birth_place'] = null;
- data['birth_country'] = null;
- data['nationality_country'] = null;
- data['father_lastname'] = null;
- data['father_firstname'] = null;
- data['mother_lastname'] = null;
- data['mother_firstname'] = null;
- }
- console.log("DATA TO SEND CONVERT", data);
-
- 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
- )) {
-
- /* ---------- 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});
- }
- });
-
- 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.setState({isLoading: false})
- }]
- );
- }
-
- } else {
- this.setState({isLoading: false}); // PP / PM manquant
- }
-
- } 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));
- createGeolocatedAccount(data).then((result) => {
- console.log("here2===>>",result);
- if (result.success !== undefined && result.success === 1) {
- const message = result.category === 'super' ? I18n.t("HYPERVISOR_MUST_VALIDATE_SUPERVISOR")
- : I18n.t("ACCOUNT_SUCCESSFULL_CREATED")
- Alert.alert("", message, [{
- text: "Ok",
- onPress: () => {
- this.props.navigation.popToTop()
- }
- }]);
- setTimeout(() => {
- this.setState({isLoading: false})
-
- }, 1000)
- this.props.navigator.push({
- screen: route.login
- })
- this.setState({isLoading: false})
- } else {
-
- if (result.error !== undefined) {
- switch (result.error) {
- case -3:
- Alert.alert("", I18n.t('UNABLE_TO_CREATE_ACCOUNT'), [{
- text: "Ok",
- onPress: () => {
- }
- }])
- break;
- default:
- if (result.error_msg)
- Alert.alert("", result.error_msg, [{
- text: "Ok",
- onPress: () => {
- }
- }])
- else if (result.sql_error)
- Alert.alert(I18n.t('UNABLE_TO_CREATE_ACCOUNT'), result.sql_error, [{
- text: "Ok",
- onPress: () => {
- }
- }])
- }
- this.setState({isLoading: false})
- }
- }
- }).catch((error) => {
- this.setState({isLoading: false})
- });
- }
- } else {
- this.setState({isLoading: false})
-
- }
- }
- }
-
- checkOrShake(champ, view, scroll = false) {
- let res = !_.isNil(champ);
- console.log("CheckOrShake field condition", res, "Animatable view", view, "scrollTo", scroll);
- if (!res) {
-
- if (view !== undefined)
- view.shake(800);
- }
-
- if (scroll)
- this._scrollView.scrollTo(0);
- return res;
- }
-
- checkOrAlert(champ, message, scroll = false) {
- let res = !_.isNil(champ);
- if (!res) {
- Alert.alert(I18n.t("ERROR_LABEL"), message, [{
- text: "Ok",
- onPress: () => {
- this.setState({isLoading: false});
- }
- }]);
- }
-
- if (scroll)
- this._scrollView.scrollTo(0);
- return res;
- }
-
- checkIfArrayValueIsNull(tab, key) {
- let size = 0;
- tab.map((value) => {
- if (!_.isNil(value[key]))
- size++;
- });
- if (size === tab.length)
- return " ";
- else
- return null;
- }
-
- prepareModal() {
- return (
-
- {I18n.t("LOADING_DESCRIPTION_COUNTRY")}
-
-
- )
- }
-
- render() {
- return (
- <>
- {this.state.isActif ?
- this.renderActifAccount()
- : this.renderUserGeoAccount()}
- >
- )
-
- }
+ prepareModal() {
+ return (
+
+
+ {I18n.t('LOADING_DESCRIPTION_COUNTRY')}
+
+
+
+ );
+ }
+ render() {
+ return (
+ <>
+ {this.state.isActif
+ ? this.renderActifAccount()
+ : this.renderUserGeoAccount()}
+ >
+ );
+ }
}
-const
- maptStateToProps = state => ({
- loading: state.saveActifSocietyReducer.loading,
- result: state.saveActifSocietyReducer.result,
- error: state.saveActifSocietyReducer.error,
- });
+const maptStateToProps = state => ({
+ loading: state.saveActifSocietyReducer.loading,
+ result: state.saveActifSocietyReducer.result,
+ error: state.saveActifSocietyReducer.error,
+});
-const
- mapDispatchToProps = dispatch => bindActionCreators({
- saveActifSocietyAction,
- saveActifSocietyReset,
+const mapDispatchToProps = dispatch =>
+ bindActionCreators(
+ {
+ saveActifSocietyAction,
+ saveActifSocietyReset,
+ },
+ dispatch,
+ );
- }, dispatch);
+export default connect(maptStateToProps, mapDispatchToProps)(CreateUserStep);
-export default connect(maptStateToProps, mapDispatchToProps)
+const LONG_LIST = [
+ 'List element 1',
+ 'List element 2',
-(
- CreateUserStep
-)
-;
+ 'List element 5',
+ 'List element 6',
+ 'List element 7',
+ 'List element 8',
+ ,
+];
-const
- LONG_LIST = [
- 'List element 1',
- 'List element 2',
-
- 'List element 5',
- 'List element 6',
- 'List element 7',
- 'List element 8',
- ,
- ];
-
-const
- styles = StyleSheet.create({
- rowContainer: {
- height: 52,
- flex: 1,
- flexDirection: 'row',
- justifyContent: 'flex-start',
- alignItems: 'center',
- },
- iconContainer: {
- marginRight: 16,
- },
- container: {
- flex: 1,
- backgroundColor: theme.primary,
- },
- checkboxContainer: {
- flexDirection: "row",
- marginBottom: 20,
- },
- checkbox: {
- alignSelf: "center",
- color: "white"
- },
- label: {
- margin: 8,
- color: "white"
- },
- textbtnvalide: {
- color: 'white',
- fontWeight: 'bold'
- },
- bigtitle: {
- color: 'white',
- fontSize: 20,
- flex: 1,
- fontWeight: 'bold',
- textAlign: 'center',
- margin: 20,
- },
- subbigtitle: {
- color: 'white',
- fontSize: 17,
- textAlign: 'center',
- margin: 5,
- },
- title: {
- fontSize: 22,
- fontWeight: 'bold',
- margin: 10,
- color: 'white'
- },
- map: {
- height: 200,
- marginRight: responsiveWidth(5),
- marginLeft: responsiveWidth(5),
- marginVertical: 10,
- },
- btnvalide: {
- marginTop: 20,
- marginLeft: 20,
- marginRight: 20,
- borderColor: 'transparent',
- backgroundColor: theme.accentLight,
- height: 52
- },
- input: {
- height: 60,
- marginTop: responsiveHeight(2),
- marginLeft: responsiveWidth(5),
- marginRight: responsiveWidth(5),
- borderRadius: 5,
- },
- contentPicker: {
- padding: 10,
- borderRadius: 8,
- flex: 1,
- alignItems: "center"
- },
- contain: {flexDirection: "row"},
- thumb: {
- borderRadius: 30,
- marginRight: 10
- },
- point: {
- width: 25,
- height: 25,
- borderRadius: 11,
- alignItems: "center",
- justifyContent: "center",
- position: "absolute",
- right: 9,
- bottom: 0
- },
- })
+const styles = StyleSheet.create({
+ rowContainer: {
+ height: 52,
+ flex: 1,
+ flexDirection: 'row',
+ justifyContent: 'flex-start',
+ alignItems: 'center',
+ },
+ iconContainer: {
+ marginRight: 16,
+ },
+ container: {
+ flex: 1,
+ backgroundColor: theme.primary,
+ },
+ checkboxContainer: {
+ flexDirection: 'row',
+ marginBottom: 20,
+ },
+ checkbox: {
+ alignSelf: 'center',
+ color: 'white',
+ },
+ label: {
+ margin: 8,
+ color: 'white',
+ },
+ textbtnvalide: {
+ color: 'white',
+ fontWeight: 'bold',
+ },
+ bigtitle: {
+ color: 'white',
+ fontSize: 20,
+ flex: 1,
+ fontWeight: 'bold',
+ textAlign: 'center',
+ margin: 20,
+ },
+ subbigtitle: {
+ color: 'white',
+ fontSize: 17,
+ textAlign: 'center',
+ margin: 5,
+ },
+ title: {
+ fontSize: 22,
+ fontWeight: 'bold',
+ margin: 10,
+ color: 'white',
+ },
+ map: {
+ height: 200,
+ marginRight: responsiveWidth(5),
+ marginLeft: responsiveWidth(5),
+ marginVertical: 10,
+ },
+ btnvalide: {
+ marginTop: 20,
+ marginLeft: 20,
+ marginRight: 20,
+ borderColor: 'transparent',
+ backgroundColor: theme.accentLight,
+ height: 52,
+ },
+ input: {
+ height: 60,
+ marginTop: responsiveHeight(2),
+ marginLeft: responsiveWidth(5),
+ marginRight: responsiveWidth(5),
+ borderRadius: 5,
+ },
+ contentPicker: {
+ padding: 10,
+ borderRadius: 8,
+ flex: 1,
+ alignItems: 'center',
+ },
+ contain: {flexDirection: 'row'},
+ thumb: {
+ borderRadius: 30,
+ marginRight: 10,
+ },
+ point: {
+ width: 25,
+ height: 25,
+ borderRadius: 11,
+ alignItems: 'center',
+ justifyContent: 'center',
+ position: 'absolute',
+ right: 9,
+ bottom: 0,
+ },
+});
diff --git a/app/screens/wallet/regisseur/NumeroQuitance.js b/app/screens/wallet/regisseur/NumeroQuitance.js
index 8f10c68..a56ac45 100644
--- a/app/screens/wallet/regisseur/NumeroQuitance.js
+++ b/app/screens/wallet/regisseur/NumeroQuitance.js
@@ -62,7 +62,7 @@ class NumeroQuitance extends Component {
static navigationOptions = () => {
return {
drawerLabel: () => null,
- headerTitle: I18n.t('QUITANCE'),
+ headerTitle: I18n.t('PAYMENT'),
headerTintColor: 'white',
headerStyle: {
backgroundColor: Color.primaryColor,
diff --git a/app/screens/wallet/regisseur/NumeroQuitanceDetail.js b/app/screens/wallet/regisseur/NumeroQuitanceDetail.js
index dbc47ad..d625129 100644
--- a/app/screens/wallet/regisseur/NumeroQuitanceDetail.js
+++ b/app/screens/wallet/regisseur/NumeroQuitanceDetail.js
@@ -74,8 +74,8 @@ class NumeroQuitanceDetail extends Component {
return {
drawerLabel: () => null,
- title: navigation.getParam("isModify", false) ? I18n.t('QUITANCE')
- : I18n.t('QUITANCE'),
+ title: navigation.getParam("isModify", false) ? I18n.t('PAYMENT')
+ : I18n.t('PAYMENT'),
headerTintColor: 'white',
headerStyle: {
backgroundColor: Color.primaryColor,
@@ -119,15 +119,16 @@ class NumeroQuitanceDetail extends Component {
added_revenue_orders_items: [],
displayAddOrdreRecette: false,
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: [
- {
- title: I18n.t('WALLET'),
- value: 'wallet'
- },
- {
- title: I18n.t('CASH'),
- value: 'cash'
- },
+ // {
+ // title: I18n.t('WALLET'),
+ // value: 'wallet'
+ // },
+ // {
+ // title: I18n.t('CASH'),
+ // value: 'cash'
+ // },
],
paymentMethod: 'wallet',
paymentUrl: '',
@@ -285,15 +286,16 @@ class NumeroQuitanceDetail extends Component {
if (nextProps.paymentMethod !== null) {
if (nextProps.paymentMethod.result !== null) {
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 = [
- {
- title: I18n.t('WALLET'),
- value: 'wallet'
- },
- {
- title: I18n.t('CASH'),
- value: 'cash'
- },
+ // {
+ // title: I18n.t('WALLET'),
+ // value: 'wallet'
+ // },
+ // {
+ // title: I18n.t('CASH'),
+ // value: 'cash'
+ // },
]
this.setState({
paymentMethods: [...paymentsMethods, ...nextProps.paymentMethod.result.response.methods]
@@ -947,7 +949,7 @@ class NumeroQuitanceDetail extends Component {
disabled={true}
textStyle={styles.textbtnstyle}
>
- {this.state.isModify ? I18n.t('MODIFY') : I18n.t('SAVE')}
+ {this.state.isModify ? I18n.t('MODIFY') : I18n.t('PAY')}
diff --git a/app/utils/UtilsFunction.js b/app/utils/UtilsFunction.js
index d51cf06..36b6ab7 100644
--- a/app/utils/UtilsFunction.js
+++ b/app/utils/UtilsFunction.js
@@ -491,7 +491,7 @@ export const optionOrdreRecetteScreen = {
export const optionNumeroQuitanceScreen = {
type: 'QUITANCE',
- title: 'QUITANCE',
+ title: 'NUMERO_QUITANCE',
subTitle: 'CHOOSE_OPTION',
options: [
{
diff --git a/app/utils/i18n/en.json b/app/utils/i18n/en.json
index 33e3e85..b3cea06 100644
--- a/app/utils/i18n/en.json
+++ b/app/utils/i18n/en.json
@@ -759,5 +759,6 @@
"TRADE_LICENSE": "Business License",
"MERCURIAL_VALUE": "Mercurial Value ",
"CONSTRUCTION_VALUE": "Enter the Construction Value",
- "BUILDING_CONSTRUCTED": "Building Constructed"
+ "BUILDING_CONSTRUCTED": "Building Constructed",
+ "PAY": "Pay"
}
diff --git a/app/utils/i18n/fr.json b/app/utils/i18n/fr.json
index 3acc5e1..0396508 100644
--- a/app/utils/i18n/fr.json
+++ b/app/utils/i18n/fr.json
@@ -45,7 +45,7 @@
"SUCCESS": "Succès",
"ETAT": "Etat",
"MY_ACCOUNT": "Mon compte",
- "WALLET": "Wallet",
+ "WALLET": "Portefeuille",
"DEPOSIT": "Dépôt",
"EN_ATTENTE_DE_VALIDATION": "En attente de validation",
"REMBOURSE": "Remboursé",
@@ -601,9 +601,9 @@
"ORDRE_RECETTE": "Ordre recette",
"NO_ORDRE_RECETTE": "Aucun ordre de 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",
- "SAISIR_QUITANCE": "Saisir paiement ou quittance",
+ "SAISIR_QUITANCE": "Gestion paiement ou quittance",
"CODE_AGENT": "Code agent ",
"AVIS_IMPOSITION": "Déclaration",
"AGENT_INFORMATION": "Informations sur l'agent",
@@ -616,7 +616,7 @@
"SAVE": "Enregistrer",
"TEXT_SUPPRESS_CONFIRM_TAXE": "Voulez vous vraiment supprimer cette taxe?",
"NUMERO_QUITANCE": "Numéro quittance",
- "QUITANCE": "Quitance",
+ "QUITANCE": "Quittance",
"ORDRE_DE_RECETTE": "Ordre de recette",
"MODIFY_ORDRE_DE_RECETTE": "Modifier ordre de recette",
"ORDRE_DE_RECETTE_NUMBER": "Numéro d'ordre de recette",
@@ -651,8 +651,8 @@
"ORDRE_RECETTE_RECEIPT": "Recette et quittance",
"HISTORY_OF": "Historique des",
"AVIS_IMPOSITIONS": "déclarations",
- "ORDRE_RECETTES_RECEIPTS": "recettes et quitances",
- "QUITANCES": "quitances",
+ "ORDRE_RECETTES_RECEIPTS": "recettes et quittances",
+ "QUITANCES": "quittances",
"PRINCIPAL_AMOUNT": "Montant principal",
"DATE_AVIS_IMPOSITION": "Date avis imposition",
"TEXT_NETWORK_UNABLE_CHOOSE_ANOTHER": "Ce réseau n'est pas actif, veuillez choisir un autre",
@@ -759,5 +759,6 @@
"TRADE_LICENSE": "Patente",
"MERCURIAL_VALUE": "Valeur mercuriale ",
"CONSTRUCTION_VALUE": "Saisir la valeur de la construction",
- "BUILDING_CONSTRUCTED": "Immeuble bâti"
+ "BUILDING_CONSTRUCTED": "Immeuble bâti",
+ "PAY": "Payer"
}
diff --git a/app/webservice/regisseur/WalletRegisseurApi.js b/app/webservice/regisseur/WalletRegisseurApi.js
index b8074a5..f62239f 100644
--- a/app/webservice/regisseur/WalletRegisseurApi.js
+++ b/app/webservice/regisseur/WalletRegisseurApi.js
@@ -604,6 +604,8 @@ export const savePenalityReset = () => {
};
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 authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';