Add variable form from BO
This commit is contained in:
parent
e43c064da7
commit
829fa5f63b
6 changed files with 64 additions and 260 deletions
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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 });
|
||||
}
|
||||
}}>
|
||||
<Picker.Item label={i18n.t('custom.select-1.title')} value="0" />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c1')} value="commerce-de-detail" />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c2')} value={'home-service-freezer-center'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c3')} value={'restauration-service-a-table'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c4')} value={'fast-food-et-snacking'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c5')} value={'cafetaria-self-service'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c6')} value={'societe-de-restauration'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c7')} value={'restauration-gre-a-gre-cuisine-centrale'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c8')} value={'distributeur-independant'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c9')} value={'boulangerie-patisserie'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c10')} value={'pai'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c11')} value={'destockeur'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c12')} value={'commerce-halal'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c13')} value={'restauration-d-hebergement'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c14')} value={'centrale-restauration-commerciale'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c15')} value={'restauration-evenementielle-et-parc'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c16')} value={'restauration-de-transport'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c17')} value={'marche-public'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c18')} value={'cash'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c19')} value={'distributeur-national'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c20')} value={'rungis'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c21')} value={'abbatoir'} />
|
||||
<Picker.Item label={i18n.t('custom.select-1.c22')} value={'autre'} />
|
||||
<Picker.Item label={this.props.FormSelect1.title[this.props.locale]} value="0" />
|
||||
{this.renderSelect(1)}
|
||||
</Picker>
|
||||
</View>
|
||||
<View style={{ flex: 1, flexDirection: 'row' }}>
|
||||
|
|
@ -495,19 +447,8 @@ class ContactDetailsScreen extends React.Component {
|
|||
this.setState({ tmpSelect2: itemValue });
|
||||
}
|
||||
}}>
|
||||
<Picker.Item label={i18n.t('custom.select-2.title')} value="0" />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c1')} value={'celvia-dinde'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c2')} value={'celvia-elabores'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c3')} value={'celvia-serent'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c4')} value={'procanar'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c5')} value={'celtys'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c6')} value={'farmor'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c7')} value={'robichon'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c8')} value={'les-volailles-de-keranna'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c9')} value={'bosher-volaille'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c10')} value={'ldc-bretagne'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c11')} value={'doux-farmor'} />
|
||||
<Picker.Item label={i18n.t('custom.select-2.c12')} value={'favreau'} />
|
||||
<Picker.Item label={this.props.FormSelect2.title[this.props.locale]} value="0" />
|
||||
{this.renderSelect(2)}
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
|
|
@ -517,34 +458,7 @@ class ContactDetailsScreen extends React.Component {
|
|||
flexWrap: 'wrap',
|
||||
justifyContent: 'center',
|
||||
}}>
|
||||
<CheckBox
|
||||
checkedColor={this.props.mainColor}
|
||||
title={i18n.t('custom.interest.p1')}
|
||||
checked={this.state.p1}
|
||||
onPress={() => this.setState({ p1: !this.state.p1 })}
|
||||
containerStyle={styles.clearCheckbox}
|
||||
/>
|
||||
<CheckBox
|
||||
checkedColor={this.props.mainColor}
|
||||
title={i18n.t('custom.interest.p2')}
|
||||
checked={this.state.p2}
|
||||
onPress={() => this.setState({ p2: !this.state.p2 })}
|
||||
containerStyle={styles.clearCheckbox}
|
||||
/>
|
||||
<CheckBox
|
||||
checkedColor={this.props.mainColor}
|
||||
title={i18n.t('custom.interest.p3')}
|
||||
checked={this.state.p3}
|
||||
onPress={() => this.setState({ p3: !this.state.p3 })}
|
||||
containerStyle={styles.clearCheckbox}
|
||||
/>
|
||||
<CheckBox
|
||||
checkedColor={this.props.mainColor}
|
||||
title={i18n.t('custom.interest.p4')}
|
||||
checked={this.state.p4}
|
||||
onPress={() => this.setState({ p4: !this.state.p4 })}
|
||||
containerStyle={styles.clearCheckbox}
|
||||
/>
|
||||
{this.renderProductsCheck()}
|
||||
</View>
|
||||
</ScrollView>
|
||||
<View style={{ flex: 1, margin: 5 }}>
|
||||
|
|
@ -850,6 +764,43 @@ class ContactDetailsScreen extends React.Component {
|
|||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
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 (
|
||||
<Picker.Item key={item} label={objSelect[item][locale]} value={item} />
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
renderProductsCheck() {
|
||||
let locale = this.props.locale;
|
||||
let obj = obj = this.props.FormCheck;
|
||||
return Object.keys(obj).map((item) => {
|
||||
return (
|
||||
<CheckBox
|
||||
key={item}
|
||||
checkedColor={this.props.mainColor}
|
||||
title={obj[item][locale]}
|
||||
checked={this.state.productsCheck[item]}
|
||||
onPress={() => {
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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":
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue