diff --git a/ComApp/src/App/Store/Reducers/AppReducer.js b/ComApp/src/App/Store/Reducers/AppReducer.js
index c3110b8..dbfed9d 100644
--- a/ComApp/src/App/Store/Reducers/AppReducer.js
+++ b/ComApp/src/App/Store/Reducers/AppReducer.js
@@ -12,7 +12,10 @@ const initialState = {
currentOpenedDoc: {},
ShowIsActive: 0,
HomeBtns: {},
- mainColor: '#D4021D'
+ mainColor: '#D4021D',
+ FormSelect1: {},
+ FormSelect2: {},
+ FormCheck: [],
};
const reducer = (state = initialState, action) => {
@@ -21,12 +24,18 @@ const reducer = (state = initialState, action) => {
case 'INIT':
let ShowIsActive = Setting.get('ShowIsActive');
let MainColor = Setting.get('MainColor');
+ let FormSelect1 = Setting.get('FormSelect1');
+ let FormSelect2 = Setting.get('FormSelect2');
+ let FormCheck = Setting.get('FormCheck');
saved = Setting.get('isSetup');
return {
...state,
isSetup: saved === undefined ? false : saved.value === "true" ? true : false,
ShowIsActive: ShowIsActive === undefined ? false : ShowIsActive.value,
- mainColor: MainColor === undefined ? initialState.mainColor : MainColor === false ? initialState.mainColor : MainColor.value
+ mainColor: MainColor === undefined ? initialState.mainColor : MainColor === false ? initialState.mainColor : MainColor.value,
+ FormSelect1: FormSelect1 === undefined ? initialState.FormSelect1 : FormSelect1 === false ? initialState.FormSelect1 : JSON.parse(FormSelect1.value),
+ FormSelect2: FormSelect2 === undefined ? initialState.FormSelect2 : FormSelect2 === false ? initialState.FormSelect2 : JSON.parse(FormSelect2.value),
+ FormCheck: FormCheck === undefined ? initialState.FormCheck : FormCheck === false ? initialState.FormCheck : JSON.parse(FormCheck.value),
};
case 'INIT_HOME_BTNS': {
let HomeFolders = Setting.get('HomeFolders');
diff --git a/ComApp/src/App/Views/ContactDetailsScreen.js b/ComApp/src/App/Views/ContactDetailsScreen.js
index a551884..200ce7e 100644
--- a/ComApp/src/App/Views/ContactDetailsScreen.js
+++ b/ComApp/src/App/Views/ContactDetailsScreen.js
@@ -32,9 +32,13 @@ import { BarCodeScanner } from 'expo-barcode-scanner';
function mapStateToProps(state) {
return {
+ locale: state.locale.locale,
contacts: state.contacts,
currentUser: state.app.currentUser,
- mainColor: state.app.mainColor
+ mainColor: state.app.mainColor,
+ FormSelect1: state.app.FormSelect1,
+ FormSelect2: state.app.FormSelect2,
+ FormCheck: state.app.FormCheck,
};
}
@@ -78,15 +82,7 @@ class ContactDetailsScreen extends React.Component {
clientChecked: false,
prospectChecked: false,
otherChecked: false,
- p1: false,
- p2: false,
- p3: false,
- p4: false,
- p5: false,
- p6: false,
- p7: false,
- p8: false,
- p9: false,
+ productsCheck: [],
showQRcodevCard: false,
parsedType: null,
parsedDatas: [],
@@ -140,17 +136,6 @@ class ContactDetailsScreen extends React.Component {
{ cancelable: false },
);
} else {
- const products = [
- this.state.p1,
- this.state.p2,
- this.state.p3,
- this.state.p4,
- this.state.p5,
- this.state.p6,
- this.state.p7,
- this.state.p8,
- this.state.p9
- ];
const contact = {
id: Helpers.generateUUID(),
email: this.state.tmpEmail,
@@ -163,7 +148,7 @@ class ContactDetailsScreen extends React.Component {
company: this.state.tmpCompany,
address: this.state.tmpAddress,
phone: this.state.tmpPhone,
- products: JSON.stringify(products),
+ products: JSON.stringify(this.state.productsCheck),
notes: this.state.tmpNote,
visits: JSON.stringify(this.state.visits),
to_delete: false,
@@ -269,7 +254,6 @@ class ContactDetailsScreen extends React.Component {
tmpSelect1: contact.select1,
tmpSelect2: contact.select2,
tmpOther: contact.other,
- tmpProducts: contact.product,
});
if (contact.type === 'client') {
this.setState({ clientChecked: true });
@@ -287,18 +271,7 @@ class ContactDetailsScreen extends React.Component {
}
if (contact.products !== null) {
const tmp = JSON.parse(contact.products);
- this.setState({
- p1: tmp[0],
- p2: tmp[1],
- p3: tmp[2],
- p4: tmp[3],
- p5: tmp[4],
- p6: tmp[5],
- p7: tmp[6],
- p8: tmp[7],
- p9: tmp[8],
- p10: tmp[9],
- });
+ this.setState({ productsCheck: tmp });
}
}
@@ -460,29 +433,8 @@ class ContactDetailsScreen extends React.Component {
this.setState({ tmpSelect1: itemValue });
}
}}>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ {this.renderSelect(1)}
@@ -495,19 +447,8 @@ class ContactDetailsScreen extends React.Component {
this.setState({ tmpSelect2: itemValue });
}
}}>
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ {this.renderSelect(2)}
@@ -517,34 +458,7 @@ class ContactDetailsScreen extends React.Component {
flexWrap: 'wrap',
justifyContent: 'center',
}}>
- this.setState({ p1: !this.state.p1 })}
- containerStyle={styles.clearCheckbox}
- />
- this.setState({ p2: !this.state.p2 })}
- containerStyle={styles.clearCheckbox}
- />
- this.setState({ p3: !this.state.p3 })}
- containerStyle={styles.clearCheckbox}
- />
- this.setState({ p4: !this.state.p4 })}
- containerStyle={styles.clearCheckbox}
- />
+ {this.renderProductsCheck()}
@@ -850,6 +764,43 @@ class ContactDetailsScreen extends React.Component {
);
}
+
+ renderSelect(num) {
+ let objSelect = {};
+ let locale = this.props.locale;
+ if (num === 1) {
+ objSelect = this.props.FormSelect1.values;
+ } else if (num === 2) {
+ objSelect = this.props.FormSelect2.values;
+ }
+ return Object.keys(objSelect).map((item) => {
+ return (
+
+ )
+ });
+ }
+
+ renderProductsCheck() {
+ let locale = this.props.locale;
+ let obj = obj = this.props.FormCheck;
+ return Object.keys(obj).map((item) => {
+ return (
+ {
+ let pc = this.state.productsCheck;
+ pc[item] = !pc[item]
+ console.log(pc)
+ this.setState({ productsCheck: pc });
+ }}
+ containerStyle={styles.clearCheckbox}
+ />
+ )
+ });
+ }
}
export default connect(mapStateToProps, mapDispatchToProps)(ContactDetailsScreen);
diff --git a/ComApp/src/App/Views/InstallScreen.js b/ComApp/src/App/Views/InstallScreen.js
index 72f3431..cbdd507 100644
--- a/ComApp/src/App/Views/InstallScreen.js
+++ b/ComApp/src/App/Views/InstallScreen.js
@@ -110,6 +110,9 @@ class InstallScreen extends React.Component {
switch (key) {
case "MainColor":
case "AppStoreUUID":
+ case "FormSelect1":
+ case "FormSelect2":
+ case "FormCheck":
Setting.upsert({ key: key, value: value });
break;
case "SquaredLogo":
diff --git a/ComApp/src/Resources/Locales/de.json b/ComApp/src/Resources/Locales/de.json
index 822b81f..96f3546 100644
--- a/ComApp/src/Resources/Locales/de.json
+++ b/ComApp/src/Resources/Locales/de.json
@@ -55,11 +55,6 @@
"username": "Benutzername",
"password": "Passwort"
},
- "home_s": {
- "1": "Kataloge",
- "2": "Datenblätter",
- "3": "Andere"
- },
"search_s": {
"no_result": "Keine Ergebnisse"
},
@@ -119,53 +114,5 @@
"invalid_firstname": "ungültiger Vorname",
"camera_permission_denied": "Kameraerlaubnis verweigert",
"pending_camera_permission": "Warten auf Kameraerlaubnis"
- },
- "custom": {
- "select-1": {
- "title": "Type de commerce",
- "c1": "Commerce de détail",
- "c2": "Home Service / Freezer Center",
- "c3": "Restauration service à table",
- "c4": "Fast food et snacking",
- "c5": "Cafétaria / Self Service",
- "c6": "Société de restauration",
- "c7": "Restauration gré à gré / cuisine Centrale",
- "c8": "Distributeur indépendant",
- "c9": "Boulangerie pâtisserie",
- "c10": "PAI",
- "c11": "Destockeur",
- "c12": "Commerce Halal",
- "c13": "Restauration d'hébergement",
- "c14": "Centrale restauration commerciale",
- "c15": "Restauration évenementielle et parc",
- "c16": "Restauration de transport",
- "c17": "Marché public",
- "c18": "Cash",
- "c19": "Distributeur national",
- "c20": "Rungis",
- "c21": "Abbatoir",
- "c22": "Autre"
- },
- "select-2": {
- "title": "Site",
- "c1": "Celvia Dinde",
- "c2": "Celvia Elaborés",
- "c3": "Celvia Sérent",
- "c4": "Procanar",
- "c5": "Celtys",
- "c6": "Farmor",
- "c7": "Robichon",
- "c8": "Les Volailles de Kerana",
- "c9": "Bosher Volaille",
- "c10": "LDC Bretagne",
- "c11": "Doux Farmor",
- "c12": "Favreau"
- },
- "interest": {
- "p1": "Poulet",
- "p2": "Dinde",
- "p3": "Canard",
- "p4": "Autre"
- }
}
}
diff --git a/ComApp/src/Resources/Locales/en.json b/ComApp/src/Resources/Locales/en.json
index 99a8b76..1e2f7ec 100644
--- a/ComApp/src/Resources/Locales/en.json
+++ b/ComApp/src/Resources/Locales/en.json
@@ -55,11 +55,6 @@
"username": "Username",
"password": "Password"
},
- "home_s": {
- "1": "Catalogs",
- "2": "Data sheets",
- "3": "Others"
- },
"search_s": {
"no_result": "No Result"
},
@@ -119,53 +114,5 @@
"invalid_firstname": "Invalid firstname",
"camera_permission_denied": "Camera Permission Denied",
"pending_camera_permission": "Waiting for the camera permission"
- },
- "custom": {
- "select-1": {
- "title": "Type de commerce",
- "c1": "Commerce de détail",
- "c2": "Home Service / Freezer Center",
- "c3": "Restauration service à table",
- "c4": "Fast food et snacking",
- "c5": "Cafétaria / Self Service",
- "c6": "Société de restauration",
- "c7": "Restauration gré à gré / cuisine Centrale",
- "c8": "Distributeur indépendant",
- "c9": "Boulangerie pâtisserie",
- "c10": "PAI",
- "c11": "Destockeur",
- "c12": "Commerce Halal",
- "c13": "Restauration d'hébergement",
- "c14": "Centrale restauration commerciale",
- "c15": "Restauration évenementielle et parc",
- "c16": "Restauration de transport",
- "c17": "Marché public",
- "c18": "Cash",
- "c19": "Distributeur national",
- "c20": "Rungis",
- "c21": "Abbatoir",
- "c22": "Autre"
- },
- "select-2": {
- "title": "Site",
- "c1": "Celvia Dinde",
- "c2": "Celvia Elaborés",
- "c3": "Celvia Sérent",
- "c4": "Procanar",
- "c5": "Celtys",
- "c6": "Farmor",
- "c7": "Robichon",
- "c8": "Les Volailles de Kerana",
- "c9": "Bosher Volaille",
- "c10": "LDC Bretagne",
- "c11": "Doux Farmor",
- "c12": "Favreau"
- },
- "interest": {
- "p1": "Poulet",
- "p2": "Dinde",
- "p3": "Canard",
- "p4": "Autre"
- }
}
}
diff --git a/ComApp/src/Resources/Locales/fr.json b/ComApp/src/Resources/Locales/fr.json
index 2800eb3..8274f78 100644
--- a/ComApp/src/Resources/Locales/fr.json
+++ b/ComApp/src/Resources/Locales/fr.json
@@ -55,11 +55,6 @@
"password": "Mot de passe",
"missing_users": "Utilisateurs introuvables"
},
- "home_s": {
- "1": "Catalogues",
- "2": "Fiches techniques",
- "3": "Autres"
- },
"search_s": {
"no_result": "Aucun résultat"
},
@@ -123,53 +118,5 @@
"alert": {
"error": "Erreur",
"info": "Information"
- },
- "custom": {
- "select-1": {
- "title": "Type de commerce",
- "c1": "Commerce de détail",
- "c2": "Home Service / Freezer Center",
- "c3": "Restauration service à table",
- "c4": "Fast food et snacking",
- "c5": "Cafétaria / Self Service",
- "c6": "Société de restauration",
- "c7": "Restauration gré à gré / cuisine Centrale",
- "c8": "Distributeur indépendant",
- "c9": "Boulangerie pâtisserie",
- "c10": "PAI",
- "c11": "Destockeur",
- "c12": "Commerce Halal",
- "c13": "Restauration d'hébergement",
- "c14": "Centrale restauration commerciale",
- "c15": "Restauration évenementielle et parc",
- "c16": "Restauration de transport",
- "c17": "Marché public",
- "c18": "Cash",
- "c19": "Distributeur national",
- "c20": "Rungis",
- "c21": "Abbatoir",
- "c22": "Autre"
- },
- "select-2": {
- "title": "Site",
- "c1": "Celvia Dinde",
- "c2": "Celvia Elaborés",
- "c3": "Celvia Sérent",
- "c4": "Procanar",
- "c5": "Celtys",
- "c6": "Farmor",
- "c7": "Robichon",
- "c8": "Les Volailles de Kerana",
- "c9": "Bosher Volaille",
- "c10": "LDC Bretagne",
- "c11": "Doux Farmor",
- "c12": "Favreau"
- },
- "interest": {
- "p1": "Poulet",
- "p2": "Dinde",
- "p3": "Canard",
- "p4": "Autre"
- }
}
}