Skip to content

Commit

Permalink
ajustes site
Browse files Browse the repository at this point in the history
  • Loading branch information
goveiat committed Dec 10, 2018
1 parent cd5b5dc commit 0f29677
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 30 deletions.
18 changes: 9 additions & 9 deletions .firebase/hosting.YnVpbGQ.cache
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
asset-manifest.json,1544411773210,1b392505c27f8cb6c6e84032517e9023ea8a7ce9f2174067efc8ccbdf11c5dd6
favicon.ico,1544411687729,c599b7a91ab3627e3538125d9f40adc2d4bf949046984262670545dc7738af06
index.html,1544411773210,e861fa7191e4d79c0d8d6a78c11168c7e8fcc80f51f5117845a3bd5a27a88613
manifest.json,1544411687761,c6882e497db70921ef49b81fefb9a9340b60bea08350e5dbd0509d9d9af0a43b
service-worker.js,1544411773570,73085c427e5914c934f5dfa87885b1b2f1303bfbad211142bc07440848743fc1
static/css/main.2f31e213.css,1544411773310,d98a8d218f2bb92d127ba28c22dffa5338fa6643b7e173a5b6c7f902df856fec
static/css/main.2f31e213.css.map,1544411773314,cad31e75d98cf780bdb5fdf2e4aae749c28d49ec77f551438976e35efa88cfa0
static/js/main.3843688d.js,1544411773238,8ec85051de2967d12baf3ee249a6c22679d772644f257b30e3c6d2f30407c5e0
static/js/main.3843688d.js.map,1544411773314,aa5e65b9e57625e9bd57341a81dce947b10977d6abe8ee59a97554cbd8229678
asset-manifest.json,1544445375326,c4cf481c5354b2d799fc1efbe29047f7e016ca78506ae0f8cf87e6c585bef037
index.html,1544445375326,a8b25723a8cea0ff13c7d1e2d0ffb94f3febc79a7f6731374450b6b8ca7b19af
service-worker.js,1544445375658,39a046185ac9b49e1e318ce82e9baacda7bcb13c5c0a32a62287936352e14792
manifest.json,1544445307701,c6882e497db70921ef49b81fefb9a9340b60bea08350e5dbd0509d9d9af0a43b
favicon.ico,1544445307689,c599b7a91ab3627e3538125d9f40adc2d4bf949046984262670545dc7738af06
static/css/main.2f31e213.css,1544445375422,d98a8d218f2bb92d127ba28c22dffa5338fa6643b7e173a5b6c7f902df856fec
static/css/main.2f31e213.css.map,1544445375390,cad31e75d98cf780bdb5fdf2e4aae749c28d49ec77f551438976e35efa88cfa0
static/js/main.2efedd76.js,1544445375422,2e69c436a8e8aeb0caabe4a28c7dbf12eb7c896d3006c443c37ee3421881c232
static/js/main.2efedd76.js.map,1544445375386,f77a527b0460492a97820cf331b23e1931ab606e178f959b105f045b95b2ef37
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "site",
"version": "0.1.4",
"version": "0.1.5",
"private": true,
"dependencies": {
"antd": "^3.8.1",
Expand Down
41 changes: 24 additions & 17 deletions src/Anatomp/FormLocalizacao.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import TextArea from 'antd/lib/input/TextArea';
const FormItem = Form.Item;
const Option = Select.Option

const Label = ({ children }) => (
<div style={{ color: '#000000d1', marginBottom: 5, marginTop: 15 }}>
const Label = ({ children, error = null }) => (
<div style={{ color: error ? '#f5222d' : '#000000d1', marginBottom: 5, marginTop: 15 }}>
{children}
</div>
)
Expand All @@ -23,7 +23,7 @@ class FormLocalizacao extends Component {

render() {

const { model, onChange, partes, item } = this.props;
const { model, onChange, partes, item, erroLocalizacao } = this.props;

const {
referenciaParaReferenciado,
Expand All @@ -36,20 +36,27 @@ class FormLocalizacao extends Component {

return (
<div layout="vertical" style={{ padding: 0 }}>
<Label>A parte <span style={{ fontWeight: 'bold' }}>{item.parte.nome}</span> é referenciada pela parte:</Label>
<Select
showSearch
notFoundContent='Nenhuma parte foi encontrada'
style={{ width: '100%' }}
placeholder="Parte anatômica"
value={referencia}
optionFilterProp="children"
onChange={v => {
onChange('referencia')(v)
}}
>
{partes.map(({ nome, _id }) => <Option value={_id} key={_id}>{nome}</Option>)}
</Select>
<Label error={erroLocalizacao}>A parte <span style={{ fontWeight: 'bold' }}>{item.parte.nome}</span> é referenciada pela parte:</Label>
<Form>
<FormItem
validateStatus={erroLocalizacao != null ? 'error' : ''}
help={erroLocalizacao}
>
<Select
showSearch
notFoundContent='Nenhuma parte foi encontrada'
style={{ width: '100%' }}
placeholder="Parte anatômica"
value={referencia}
optionFilterProp="children"
onChange={v => {
onChange('referencia')(v)
}}
>
{partes.map(({ nome, _id }) => <Option value={_id} key={_id}>{nome}</Option>)}
</Select>
</FormItem>
</Form>
<Label>A parte <span style={{ fontWeight: 'bold' }}>{item.parte.nome}</span> em relação à parte <span style={{ fontWeight: 'bold' }}>{nomeSel}</span> está localizada:</Label>
<Num value={referenciaParaReferenciado} onChange={onChange('referenciaParaReferenciado')} />
<Label>A parte <span style={{ fontWeight: 'bold' }}>{nomeSel}</span> em relação à parte <span style={{ fontWeight: 'bold' }}>{item.parte.nome}</span> está localizada:</Label>
Expand Down
11 changes: 8 additions & 3 deletions src/Anatomp/FormMapa.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class FormMapa extends Component {
state = {
loading: false,
open: false,
erroLocalizacao: null,
toEditRefRel: {
model: {},
idx: '',
Expand All @@ -28,7 +29,7 @@ class FormMapa extends Component {
}

render() {
const { loading, open, toEditRefRel } = this.state;
const { loading, open, toEditRefRel, erroLocalizacao } = this.state;
const { onChangeMapa, mapa, pecasFisicas, onAddPecaFisica, onRemovePecaFisica, erros } = this.props;

const _erros = {
Expand Down Expand Up @@ -107,7 +108,7 @@ class FormMapa extends Component {
cancelText='Cancelar'
onCancel={this.onClose}
>
<FormLocalizacao {...toEditRefRel} onChange={this.onChangeRefRel} partes={mapa.map(i => i.parte)} />
<FormLocalizacao erroLocalizacao={erroLocalizacao} {...toEditRefRel} onChange={this.onChangeRefRel} partes={mapa.map(i => i.parte)} />
</Modal>
</FormItem>
</Form>
Expand All @@ -119,6 +120,7 @@ class FormMapa extends Component {
const { toEditRefRel } = this.state;

this.setState({
erroLocalizacao: null,
toEditRefRel: {
...toEditRefRel,
model: {
Expand All @@ -138,7 +140,8 @@ class FormMapa extends Component {
this.props.onChangeMapa('referenciaRelativa', idx, idxLoc, {numero})({ ...model });
this.onClearRefRel()
}else{
this.props.onOpenSnackbar(`Informe a localização desta parte para utilizá-la como referência`, 'warning');
this.setState({erroLocalizacao: 'A localização desta parte ainda não foi setada'})
// this.props.onOpenSnackbar(`Informe a localização desta parte para utilizá-la como referência`, 'warning');
}
}else{
this.props.onChangeMapa('referenciaRelativa', idx, idxLoc)({ ...model });
Expand All @@ -149,6 +152,7 @@ class FormMapa extends Component {
onClearRefRel = () => {
this.setState({
open: false,
erroLocalizacao: null,
toEditRefRel: {
model: {},
idx: '',
Expand All @@ -162,6 +166,7 @@ class FormMapa extends Component {
if(e.target.checked){
this.setState({
open: true,
erroLocalizacao: null,
toEditRefRel: { model, idx, idxLoc, item }
})
}else{
Expand Down

0 comments on commit 0f29677

Please sign in to comment.