Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions Frontend/screens/CarAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,53 @@ 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 = ''
}
//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 = ''
}
//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 = ''
Expand All @@ -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)
}
Expand Down Expand Up @@ -173,7 +179,7 @@ eroare = {
placeholderTextColor = "white"
autoCapitalize = "none"
onChangeText = {this.handleculoare}/>
{this.validForm() ? <Text style={{ color: 'red' }}>{this.eroare.camp5}</Text> : null}
{this.validForm() ? <Text style={{ color: 'red' }}>{this.eroare.camp4}</Text> : null}

<View style={styles.separator}></View>

Expand All @@ -183,7 +189,7 @@ eroare = {
placeholderTextColor = "white"
autoCapitalize = "none"
onChangeText = {this.handlenumarKm}/>
{this.validForm() ? <Text style={{ color: 'red' }}>{this.eroare.camp6}</Text> : null}
{this.validForm() ? <Text style={{ color: 'red' }}>{this.eroare.camp5}</Text> : null}

<View style={styles.separator}></View>

Expand All @@ -192,8 +198,8 @@ eroare = {
placeholder = "Horse power"
placeholderTextColor = "white"
autoCapitalize = "none"
onChangeText = {this.handlecaiPutere}/>

onChangeText = {this.handlecaiPutere}/>
{this.validForm() ? <Text style={{ color: 'red' }}>{this.eroare.camp6}</Text> : null}
<View style={styles.separator}></View>

<TouchableOpacity
Expand Down
12 changes: 6 additions & 6 deletions Frontend/screens/CarUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class CarUpdate extends React.Component {
<View style = {styles.containerForm}>
<TextInput style = {styles.input}
underlineColorAndroid = "transparent"
placeholder = "Nume masina"
placeholder = "Car name"
placeholderTextColor = "white"
autoCapitalize = "none"
defaultValue={this.state.name}
Expand All @@ -50,7 +50,7 @@ export default class CarUpdate extends React.Component {

<TextInput style = {styles.input}
underlineColorAndroid = "transparent"
placeholder = "Distanta maxima (km)"
placeholder = "Autonomy"
placeholderTextColor = "white"
keyboardType = 'numeric'
autoCapitalize = "none"
Expand All @@ -61,7 +61,7 @@ export default class CarUpdate extends React.Component {

<TextInput style = {styles.input}
underlineColorAndroid = "transparent"
placeholder = "Capacitate baterie"
placeholder = "Battery capacity"
placeholderTextColor = "white"
keyboardType = 'numeric'
autoCapitalize = "none"
Expand All @@ -72,7 +72,7 @@ export default class CarUpdate extends React.Component {

<TextInput style = {styles.input}
underlineColorAndroid = "transparent"
placeholder = "Culoare"
placeholder = "Color"
placeholderTextColor = "white"
autoCapitalize = "none"
defaultValue={this.state.color}
Expand All @@ -82,7 +82,7 @@ export default class CarUpdate extends React.Component {

<TextInput style = {styles.input}
underlineColorAndroid = "transparent"
placeholder = "Numar km"
placeholder = "Kilometers"
placeholderTextColor = "white"
keyboardType = 'numeric'
autoCapitalize = "none"
Expand All @@ -93,7 +93,7 @@ export default class CarUpdate extends React.Component {

<TextInput style = {styles.input}
underlineColorAndroid = "transparent"
placeholder = "Cai putere"
placeholder = "Horse power"
keyboardType = 'numeric'
placeholderTextColor = "white"
autoCapitalize = "none"
Expand Down
3 changes: 2 additions & 1 deletion Frontend/screens/MapHomeScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ const MapHomeScreen = ({ navigation }) => {
underlineColorAndroid="transparent"
placeholder="Introduce battery autonomy.."
placeholderTextColor="white"
keyboardType = 'numeric'
autoCapitalize="none"
onChangeText={(text) => setAutonomy(text)}
/>
Expand Down Expand Up @@ -263,4 +264,4 @@ const styles = StyleSheet.create({
},
});

export default MapHomeScreen;
export default MapHomeScreen;