Skip to content

Commit

Permalink
Create validations for Create Owner
Browse files Browse the repository at this point in the history
Related to issue #4;

Signed-off by: antoniocoj <[email protected]>
Signed-off-by: Lucas Amoêdo <[email protected]>
  • Loading branch information
LucasAmoedo committed Apr 28, 2017
1 parent 66d9815 commit 8fc345b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"react-scripts": "0.9.5"
},
"dependencies": {
"admin-on-rest": "~0.9.2",
"admin-on-rest": "^1.0.0",
"jquery": "^3.2.1",
"material-ui": "~0.16.4",
"react": "~15.4.0",
"react-dom": "~15.4.0",
"material-ui": "~0.17.4",
"react": "~15.5.4",
"react-dom": "~15.5.4",
"react-redux": "^5.0.1",
"react-tap-event-plugin": "~2.0.0",
"redux-form": "^6.6.3",
Expand Down
3 changes: 1 addition & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import PostIcon from 'material-ui/svg-icons/action/book';
import UserIcon from 'material-ui/svg-icons/social/person';
import OwnerIcon from 'material-ui/svg-icons/social/person-outline';
Expand All @@ -9,8 +10,6 @@ import BathAndGroomingIcon from 'material-ui/svg-icons/places/hot-tub';
import FinancialReportIcon from 'material-ui/svg-icons/editor/attach-money';
import getMuiTheme from 'material-ui/styles/getMuiTheme';


import React from 'react';
import { jsonServerRestClient, Admin, Resource } from 'admin-on-rest';
import { Delete } from 'admin-on-rest/lib/mui';
import { PostList, PostEdit, PostCreate } from './Categories/Example';
Expand Down
10 changes: 10 additions & 0 deletions src/Categories/Owners/OwnerCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const federalStates = [
{ id: 'TO', name: 'Tocantins (TO)' },
];

const required = value => (value ? undefined : 'Campo obrigatório');

export class OwnerCreate extends Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -106,18 +108,22 @@ export class OwnerCreate extends Component {
<TextInput
source="cpf"
label="CPF"
validate={ required }
/>
<TextInput
source="ownerName"
label="Primeiro Nome"
validate={ required }
/>
<TextInput
source="ownerLastName"
label="Sobrenome"
validate={ required }
/>
<TextInput
source="phoneNumber"
label="Telefone"
validate={ required }
/>
<TextInput
source="zipCode"
Expand All @@ -127,10 +133,12 @@ export class OwnerCreate extends Component {
<TextInput
source="publicPlace"
label="Endereço"
validate={ required }
/>
<TextInput
source="addressNumber"
label="Número"
validate={ required }
/>
<TextInput
source="complement"
Expand All @@ -139,10 +147,12 @@ export class OwnerCreate extends Component {
<TextInput
source="neighborhood"
label="Bairro"
validate={ required }
/>
<TextInput
source="city"
label="Cidade"
validate={ required }
/>
<SelectInput
source="district"
Expand Down

0 comments on commit 8fc345b

Please sign in to comment.