diff --git a/Frontend/screens/CarAdd.js b/Frontend/screens/CarAdd.js index 401c4c9..30646ba 100644 --- a/Frontend/screens/CarAdd.js +++ b/Frontend/screens/CarAdd.js @@ -53,7 +53,7 @@ eroare = { validForm = () => { //Eroare nume if (this.state.nume.length > 11) { - this.eroare.camp1 = "Maxim 10 caractere" + this.eroare.camp1 = "Maximum 10 characters" } else { this.eroare.camp1 = '' @@ -61,27 +61,33 @@ eroare = { //Eroare distanta var n = Number(this.state.distantaMax); if (isNaN(n)) { - this.eroare.camp2 = "Distanta gresita" + this.eroare.camp2 = "Wrong autonomy" } else { this.eroare.camp2 = '' } if (this.state.distantaMax[0] == '0') { - this.eroare.camp2 = "Distanta gresita" + this.eroare.camp2 = "Wrong distance" } //Eroare baterie n = Number(this.state.capacBaterie) if (this.state.capacBaterie.length > 6 || (isNaN(n) || this.state.capacBaterie[0] == '0')) { - this.eroare.camp3 = "Valoare gresita" + this.eroare.camp3 = "Wrong capacity" } else { this.eroare.camp3 = '' } //Eroare culoare + if (this.state.culoare.length > 11) { + this.eroare.camp4 = "Maximum 10 characters" + } + else { + this.eroare.camp4 = '' + } //Eroare nrkm n = Number(this.state.numarKm) if (isNaN(n) || (this.state.numarKm[0] == '0' && this.state.numarKm.length > 1)) { - this.eroare.camp5 = "Kilometraj gresit" + this.eroare.camp5 = "Wrong kilometers" } else { this.eroare.camp5 = '' @@ -89,11 +95,11 @@ eroare = { //Eroare CaiPutere n = Number(this.state.caiPutere) if (isNaN(n) == true) { - this.eroare.camp6 = "Valoare gresita" + this.eroare.camp6 = "Wrong value" } else { if (n < 50 && (this.state.caiPutere != '')) { - this.eroare.camp6 = "Valoare prea mica" + this.eroare.camp6 = "The value is too low" } else { this.eroare.camp6 = '' @@ -111,13 +117,13 @@ eroare = { fara_erori = 1; } if ((fara_erori == 1) && (campuri_necompletate == 0)) { - alert("Succer"); + alert("Succes"); } if (campuri_necompletate == 1) { - alert("Campuri necompletate"); + alert("No completed fields"); } if (fara_erori == 0) { - alert("Erori"); + alert("Errors"); } console.log(this.state) } @@ -173,7 +179,7 @@ eroare = { placeholderTextColor = "white" autoCapitalize = "none" onChangeText = {this.handleculoare}/> - {this.validForm() ? {this.eroare.camp5} : null} + {this.validForm() ? {this.eroare.camp4} : null} @@ -183,7 +189,7 @@ eroare = { placeholderTextColor = "white" autoCapitalize = "none" onChangeText = {this.handlenumarKm}/> - {this.validForm() ? {this.eroare.camp6} : null} + {this.validForm() ? {this.eroare.camp5} : null} @@ -192,8 +198,8 @@ eroare = { placeholder = "Horse power" placeholderTextColor = "white" autoCapitalize = "none" - onChangeText = {this.handlecaiPutere}/> - + onChangeText = {this.handlecaiPutere}/> + {this.validForm() ? {this.eroare.camp6} : null} { underlineColorAndroid="transparent" placeholder="Introduce battery autonomy.." placeholderTextColor="white" + keyboardType = 'numeric' autoCapitalize="none" onChangeText={(text) => setAutonomy(text)} /> @@ -263,4 +264,4 @@ const styles = StyleSheet.create({ }, }); -export default MapHomeScreen; +export default MapHomeScreen; \ No newline at end of file