diff --git a/public/locales/en/filterTombos.json b/public/locales/en/filterTombos.json new file mode 100644 index 0000000..02425b8 --- /dev/null +++ b/public/locales/en/filterTombos.json @@ -0,0 +1,12 @@ +{ + "labelIdentificador": "Identifier", + "labelColetor": "Collector", + "labelNumeroColeta": "Collection Number", + "placeholderIdentificador": "Type the identifier's name", + "placeholderColetor": "Type the collector's name", + "placeholderNumeroColeta": "Select a collector first", + "nenhumResultado": "No results", + "nenhumNumeroColeta": "No collection number available", + "adicionarFiltro": "Add Filter", + "remover": "Remove" +} diff --git a/public/locales/en/listaTombosScreen.json b/public/locales/en/listaTombosScreen.json new file mode 100644 index 0000000..8817218 --- /dev/null +++ b/public/locales/en/listaTombosScreen.json @@ -0,0 +1,63 @@ +{ + "titulo": "Records", + "colHcf": "HCF", + "colNomePopular": "Common name", + "colNomeCientifico": "Scientific name", + "colDataColeta": "Collection date", + "colColetor": "Collector", + "colAcao": "Action", + "buscarTombo": "Search record", + "labelHcf": "HCF:", + "labelTipo": "Type:", + "placeholderSelecione": "Select", + "tipoParatipo": "Paratype", + "tipoIsotipo": "Isotype", + "labelSituacao": "Status:", + "situacaoRegular": "Regular", + "situacaoPermutado": "Exchanged", + "situacaoEmprestado": "On loan", + "situacaoDoado": "Donated", + "labelNomeCientifico": "Scientific name:", + "placeholderNomeCientifico": "Passiflora edulis", + "labelNomePopular": "Common name:", + "placeholderNomePopular": "Passion fruit", + "labelCodigoBarraFoto": "Photo barcode:", + "placeholderCodigoBarraFoto": "Enter the barcode", + "notifExcluirTombo": "Delete record", + "tomboExcluido": "The record was deleted successfully.", + "erroExcluirTombo": "There was a problem deleting the record, please try again.", + "confirmExcluirTitulo": "Are you sure you want to delete this record?", + "confirmExcluirConteudo": "By clicking YES, the record will be deleted.", + "notifBuscarTombos": "Search records", + "erroBuscarTombos": "Error fetching the records.", + "erroBuscarTombosFalha": "Failed to fetch records.", + "alerta": "Alert", + "erroMinMaxColunas": "Select a minimum of 1 and a maximum of 5 columns to export.", + "erroInformePeriodo": "Enter a range, specific records or a date range to export", + "erroExportacaoUnica": "Data export must be done by a range, specific records or a date range, never using two or more", + "panelHeaderCampos": "Select the fields to be exported:", + "tagHcf": "HCF", + "tagDataColeta": "Collection Date", + "tagFamilia": "Family", + "tagSubfamilia": "Subfamily", + "tagGenero": "Genus", + "tagEspecie": "Species", + "tagSubespecie": "Subspecies", + "tagVariedade": "Variety", + "tagSequencia": "Record sequence", + "tagCodigoBarra": "Barcode", + "tagLatitude": "Latitude", + "tagLongitude": "Longitude", + "tagAltitude": "Altitude", + "tagNumeroColeta": "Collection No.", + "tagColetores": "Collectors", + "aPartirDe": "From:", + "ate": "To:", + "ou": "OR", + "numerosTombos": "Record numbers to be exported:", + "aPartirDataTombo": "From the record date:", + "placeholderDataInicial": "Select the initial record date", + "ateDataTombo": "To the record date:", + "placeholderDataFinal": "Select the final record date", + "exportar": "Export" +} diff --git a/public/locales/es/filterTombos.json b/public/locales/es/filterTombos.json new file mode 100644 index 0000000..fcb58be --- /dev/null +++ b/public/locales/es/filterTombos.json @@ -0,0 +1,12 @@ +{ + "labelIdentificador": "Identificador", + "labelColetor": "Colector", + "labelNumeroColeta": "Número de Colecta", + "placeholderIdentificador": "Escriba el nombre del identificador", + "placeholderColetor": "Escriba el nombre del colector", + "placeholderNumeroColeta": "Seleccione un colector primero", + "nenhumResultado": "Ningún resultado", + "nenhumNumeroColeta": "Ningún número de colecta disponible", + "adicionarFiltro": "Agregar Filtro", + "remover": "Eliminar" +} diff --git a/public/locales/es/listaTombosScreen.json b/public/locales/es/listaTombosScreen.json new file mode 100644 index 0000000..22e0566 --- /dev/null +++ b/public/locales/es/listaTombosScreen.json @@ -0,0 +1,63 @@ +{ + "titulo": "Registros", + "colHcf": "HCF", + "colNomePopular": "Nombre popular", + "colNomeCientifico": "Nombre científico", + "colDataColeta": "Fecha de colecta", + "colColetor": "Colector", + "colAcao": "Acción", + "buscarTombo": "Buscar registro", + "labelHcf": "HCF:", + "labelTipo": "Tipo:", + "placeholderSelecione": "Seleccione", + "tipoParatipo": "Paratipo", + "tipoIsotipo": "Isotipo", + "labelSituacao": "Situación:", + "situacaoRegular": "Regular", + "situacaoPermutado": "Permutado", + "situacaoEmprestado": "Prestado", + "situacaoDoado": "Donado", + "labelNomeCientifico": "Nombre científico:", + "placeholderNomeCientifico": "Passiflora edulis", + "labelNomePopular": "Nombre popular:", + "placeholderNomePopular": "Maracuyá", + "labelCodigoBarraFoto": "Código de barras de la foto:", + "placeholderCodigoBarraFoto": "Escriba el código de barras", + "notifExcluirTombo": "Eliminar registro", + "tomboExcluido": "El registro fue eliminado con éxito.", + "erroExcluirTombo": "Hubo un problema al eliminar el registro, inténtelo de nuevo.", + "confirmExcluirTitulo": "¿Está seguro de que desea eliminar este registro?", + "confirmExcluirConteudo": "Al hacer clic en SÍ, el registro será eliminado.", + "notifBuscarTombos": "Buscar registros", + "erroBuscarTombos": "Error al buscar los registros.", + "erroBuscarTombosFalha": "Error al buscar registros.", + "alerta": "Alerta", + "erroMinMaxColunas": "Seleccione un mínimo de 1 y un máximo de 5 columnas para exportar.", + "erroInformePeriodo": "Indique un período, registros específicos o un intervalo de fechas para exportar", + "erroExportacaoUnica": "La exportación de los datos debe hacerse por un período, registros específicos o un intervalo de fechas, nunca utilizando dos o más", + "panelHeaderCampos": "Seleccione los campos a exportar:", + "tagHcf": "HCF", + "tagDataColeta": "Fecha de Colecta", + "tagFamilia": "Familia", + "tagSubfamilia": "Subfamilia", + "tagGenero": "Género", + "tagEspecie": "Especie", + "tagSubespecie": "Subespecie", + "tagVariedade": "Variedad", + "tagSequencia": "Secuencia del registro", + "tagCodigoBarra": "Código de barras", + "tagLatitude": "Latitud", + "tagLongitude": "Longitud", + "tagAltitude": "Altitud", + "tagNumeroColeta": "N.º Colecta", + "tagColetores": "Colectores", + "aPartirDe": "A partir de:", + "ate": "Hasta:", + "ou": "O", + "numerosTombos": "Números de los registros a exportar:", + "aPartirDataTombo": "A partir de la fecha de registro:", + "placeholderDataInicial": "Seleccione la fecha de registro inicial", + "ateDataTombo": "Hasta la fecha de registro:", + "placeholderDataFinal": "Seleccione la fecha de registro final", + "exportar": "Exportar" +} diff --git a/public/locales/pt-BR/filterTombos.json b/public/locales/pt-BR/filterTombos.json new file mode 100644 index 0000000..1fbc76d --- /dev/null +++ b/public/locales/pt-BR/filterTombos.json @@ -0,0 +1,12 @@ +{ + "labelIdentificador": "Identificador", + "labelColetor": "Coletor", + "labelNumeroColeta": "Número de Coleta", + "placeholderIdentificador": "Digite o nome do identificador", + "placeholderColetor": "Digite o nome do coletor", + "placeholderNumeroColeta": "Selecione um coletor primeiro", + "nenhumResultado": "Nenhum resultado", + "nenhumNumeroColeta": "Nenhum número de coleta disponível", + "adicionarFiltro": "Adicionar Filtro", + "remover": "Remover" +} diff --git a/public/locales/pt-BR/listaTombosScreen.json b/public/locales/pt-BR/listaTombosScreen.json new file mode 100644 index 0000000..bd8af64 --- /dev/null +++ b/public/locales/pt-BR/listaTombosScreen.json @@ -0,0 +1,63 @@ +{ + "titulo": "Tombos", + "colHcf": "HCF", + "colNomePopular": "Nome popular", + "colNomeCientifico": "Nome científico", + "colDataColeta": "Data de coleta", + "colColetor": "Coletor", + "colAcao": "Ação", + "buscarTombo": "Buscar tombo", + "labelHcf": "HCF:", + "labelTipo": "Tipo:", + "placeholderSelecione": "Selecione", + "tipoParatipo": "Parátipo", + "tipoIsotipo": "Isótipo", + "labelSituacao": "Situação:", + "situacaoRegular": "Regular", + "situacaoPermutado": "Permutado", + "situacaoEmprestado": "Emprestado", + "situacaoDoado": "Doado", + "labelNomeCientifico": "Nome científico:", + "placeholderNomeCientifico": "Passiflora edulis", + "labelNomePopular": "Nome popular:", + "placeholderNomePopular": "Maracujá", + "labelCodigoBarraFoto": "Código de barras da foto:", + "placeholderCodigoBarraFoto": "Digite o código de barras", + "notifExcluirTombo": "Excluir tombo", + "tomboExcluido": "O tombo foi excluído com sucesso.", + "erroExcluirTombo": "Houve um problema ao excluir o tombo, tente novamente.", + "confirmExcluirTitulo": "Você tem certeza que deseja excluir este tombo?", + "confirmExcluirConteudo": "Ao clicar em SIM, o tombo será excluído.", + "notifBuscarTombos": "Buscar tombos", + "erroBuscarTombos": "Erro ao buscar os tombos.", + "erroBuscarTombosFalha": "Falha ao buscar tombos.", + "alerta": "Alerta", + "erroMinMaxColunas": "Selecione o mínimo de 1 e o máximo de 5 colunas para exportar.", + "erroInformePeriodo": "Informe um período, tombos específicos ou período de datas para exportar", + "erroExportacaoUnica": "A exportação dos dados deve ser feita por um período, tombos específicos ou período de datas, nunca utilizando dois ou mais", + "panelHeaderCampos": "Selecione os campos a serem exportados:", + "tagHcf": "HCF", + "tagDataColeta": "Data da Coleta", + "tagFamilia": "Família", + "tagSubfamilia": "Subfamília", + "tagGenero": "Gênero", + "tagEspecie": "Espécie", + "tagSubespecie": "Subespécie", + "tagVariedade": "Variedade", + "tagSequencia": "Sequencia do tombo", + "tagCodigoBarra": "Codigo de barra", + "tagLatitude": "Latitude", + "tagLongitude": "Longitude", + "tagAltitude": "Altitude", + "tagNumeroColeta": "Nº Coleta", + "tagColetores": "Coletores", + "aPartirDe": "A partir de:", + "ate": "Até:", + "ou": "OU", + "numerosTombos": "Numeros dos tombos a serem exportados:", + "aPartirDataTombo": "A partir da data de tombo:", + "placeholderDataInicial": "Seleciona a data de tombo inicial", + "ateDataTombo": "Até a data de tombo:", + "placeholderDataFinal": "Seleciona a data de tombo final", + "exportar": "Exportar" +} diff --git a/src/components/FilterTombos.jsx b/src/components/FilterTombos.jsx index 3b2de31..1572141 100644 --- a/src/components/FilterTombos.jsx +++ b/src/components/FilterTombos.jsx @@ -11,15 +11,14 @@ import { Spin } from 'antd' import axios from 'axios' -import { useTranslation } from 'react-i18next' +import { withTranslation } from 'react-i18next' import { PlusCircleOutlined, MinusCircleOutlined } from '@ant-design/icons' const { Panel } = Collapse const { Option } = Select -const FilterTombos = ({ onChange }) => { - const { t } = useTranslation('tombo') +const FilterTombos = ({ onChange, t}) => { const [selectedFilters, setSelectedFilters] = useState([]) const [filterValues, setFilterValues] = useState({}) @@ -150,11 +149,11 @@ const FilterTombos = ({ onChange }) => { const availableFilters = [ { key: 'identificador_id', - label: t('identifierFilter'), + label: t('filterTombos:labelIdentificador'), component: ( { notFoundContent={ loadingColetor ? - : t('noResult') + : t('filterTombos:nenhumResultado') } style={{ width: '100%' }} > @@ -208,12 +207,12 @@ const FilterTombos = ({ onChange }) => { }, { key: 'numero_coleta', - label: t('collectionNumberFilter'), + label: t('filterTombos:labelNumeroColeta'), component: ( - - + )} @@ -362,16 +325,16 @@ class ListaTombosScreen extends Component { - {this.tTombo('status')} + {t('listaTombosScreen:labelSituacao')} {getFieldDecorator('situacao')( - + + + + )} @@ -382,36 +345,36 @@ class ListaTombosScreen extends Component { - {this.tTombo('detailScientificName')} + {t('listaTombosScreen:labelNomeCientifico')} {getFieldDecorator('nomeCientifico')( - + )} - {this.tTombo('popularName')} + {t('listaTombosScreen:labelNomePopular')} {getFieldDecorator('nomePopular')( - + )} - {this.tTombo('barcodePhoto')} + {t('listaTombosScreen:labelCodigoBarraFoto')} {getFieldDecorator('codigoBarraFoto')( - + )} @@ -440,7 +403,7 @@ class ListaTombosScreen extends Component { }} className="login-form-button" > - {this.tTombo('clear')} + {t('common:limpar')} @@ -451,7 +414,7 @@ class ListaTombosScreen extends Component { htmlType="submit" className="login-form-button ant-btn-pesquisar" > - {this.props.t('common:pesquisar')} + {t('common:pesquisar')} @@ -504,7 +467,7 @@ class ListaTombosScreen extends Component { .map(extraiApenasChave) if (campos.length < 1 || campos.length > 5) { - this.openNotificationWithIcon('warning', this.tTombo('alert'), this.tTombo('exportMinMaxColumns')) + this.openNotificationWithIcon('warning', this.props.t('listaTombosScreen:alerta'), this.props.t('listaTombosScreen:erroMinMaxColunas')) return } @@ -515,12 +478,12 @@ class ListaTombosScreen extends Component { ].filter(item => item === true) if (grupos.length === 0) { - this.openNotificationWithIcon('warning', this.tTombo('alert'), this.tTombo('exportProvideFilter')) + this.openNotificationWithIcon('warning', this.props.t('listaTombosScreen:alerta'), this.props.t('listaTombosScreen:erroInformePeriodo')) return } if (grupos.length > 1) { - this.openNotificationWithIcon('warning', this.tTombo('alert'), this.tTombo('exportOnlyOneGroup')) + this.openNotificationWithIcon('warning', this.props.t('listaTombosScreen:alerta'), this.props.t('listaTombosScreen:erroExportacaoUnica')) return } @@ -575,11 +538,12 @@ class ListaTombosScreen extends Component { renderExportar(getFieldDecorator) { const { fetching, data } = this.state + const { t } = this.props return (
- + @@ -587,7 +551,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('hcf')( {' '} - {this.tTombo('tableHcf')} + {t('listaTombosScreen:tagHcf')} )} @@ -597,7 +561,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('data_coleta')( {' '} - {this.tTombo('exportCollectionDate')} + {t('listaTombosScreen:tagDataColeta')} )} @@ -607,7 +571,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('familia')( {' '} - {this.tTombo('family').replace(':', '')} + {t('listaTombosScreen:tagFamilia')} )} @@ -617,7 +581,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('subfamilia')( {' '} - {this.tTombo('subfamily').replace(':', '')} + {t('listaTombosScreen:tagSubfamilia')} )} @@ -627,7 +591,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('genero')( {' '} - {this.tTombo('genus').replace(':', '')} + {t('listaTombosScreen:tagGenero')} )} @@ -637,7 +601,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('especie')( {' '} - {this.tTombo('species').replace(':', '')} + {t('listaTombosScreen:tagEspecie')} )} @@ -647,7 +611,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('subespecie')( {' '} - {this.tTombo('subspecies').replace(':', '')} + {t('listaTombosScreen:tagSubespecie')} )} @@ -657,7 +621,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('variedade')( {' '} - {this.tTombo('variety').replace(':', '')} + {t('listaTombosScreen:tagVariedade')} )} @@ -667,7 +631,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('sequencia')( {' '} - {this.tTombo('sequenceTombo')} + {t('listaTombosScreen:tagSequencia')} )} @@ -677,7 +641,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('codigo_barra')( {' '} - {this.tTombo('barcode')} + {t('listaTombosScreen:tagCodigoBarra')} )} @@ -687,7 +651,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('latitude')( {' '} - {this.tTombo('latitude').replace(':', '')} + {t('listaTombosScreen:tagLatitude')} )} @@ -697,7 +661,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('longitude')( {' '} - {this.tTombo('longitude').replace(':', '')} + {t('listaTombosScreen:tagLongitude')} )} @@ -707,7 +671,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('altitude')( {' '} - {this.tTombo('altitude').replace(':', '')} + {t('listaTombosScreen:tagAltitude')} )} @@ -717,7 +681,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('numero_coleta')( {' '} - {this.tTombo('collectionNumberShort')} + {t('listaTombosScreen:tagNumeroColeta')} )} @@ -727,7 +691,7 @@ class ListaTombosScreen extends Component { {getFieldDecorator('coletores')( {' '} - {this.tTombo('collectors').replace(':', '')} + {t('listaTombosScreen:tagColetores')} )} @@ -737,7 +701,7 @@ class ListaTombosScreen extends Component { - {this.tTombo('from')} + {t('listaTombosScreen:aPartirDe')} @@ -751,7 +715,7 @@ class ListaTombosScreen extends Component { - {this.tTombo('until')} + {t('listaTombosScreen:ate')} @@ -766,12 +730,12 @@ class ListaTombosScreen extends Component {
- {this.tTombo('or')} + {t('listaTombosScreen:ou')} - {this.tTombo('exportSpecificTombos')} + {t('listaTombosScreen:numerosTombos')} @@ -795,13 +759,13 @@ class ListaTombosScreen extends Component {
- {this.tTombo('or')} + {t('listaTombosScreen:ou')}
- {this.tTombo('fromTomboDate')} + {t('listaTombosScreen:aPartirDataTombo')} @@ -809,7 +773,7 @@ class ListaTombosScreen extends Component { )} @@ -817,7 +781,7 @@ class ListaTombosScreen extends Component { - {this.tTombo('untilTomboDate')} + {t('listaTombosScreen:ateDataTombo')} @@ -825,7 +789,7 @@ class ListaTombosScreen extends Component { )} @@ -840,7 +804,7 @@ class ListaTombosScreen extends Component { htmlType="submit" style={{ backgroundColor: '#FF7F00', borderColor: '#FF7F00' }} > - {this.tTombo('export')} + {t('listaTombosScreen:exportar')}
@@ -852,9 +816,49 @@ class ListaTombosScreen extends Component { render() { const { getFieldDecorator } = this.props.form + const { t } = this.props + + const columns = [ + { + title: t('listaTombosScreen:colHcf'), + type: 'number', + key: 'hcf', + width: 100 + }, + { + title: t('listaTombosScreen:colNomePopular'), + type: 'text', + key: 'nomePopular', + width: 200 + }, + { + title: t('listaTombosScreen:colNomeCientifico'), + type: 'text', + key: 'nomeCientifico', + width: 200 + }, + { + title: t('listaTombosScreen:colDataColeta'), + type: 'text', + key: 'data', + width: 100 + }, + { + title: t('listaTombosScreen:colColetor'), + type: 'text', + key: 'coletor', + width: 200 + }, + { + title: t('listaTombosScreen:colAcao'), + key: 'acao', + width: 120 + } + ] + return (
- + {this.renderPainelBusca(getFieldDecorator)} @@ -877,4 +881,6 @@ class ListaTombosScreen extends Component { ) } } -export default withTranslation()(Form.create()(ListaTombosScreen)) +const ListaTombosScreenWithForm = Form.create()(ListaTombosScreen) + +export default withTranslation()(ListaTombosScreenWithForm)