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
25 changes: 8 additions & 17 deletions src/controllers/fichas-tombos-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,25 +218,16 @@ export default function fichaTomboController(request, response, next) {
});
})
.then(async resultado => {
const { tombo, identificacao, fotos } = resultado;
// IMPORTANTE: Ao mexerem na ficha tombo, deixem os
// campos como opcionais, pois a ficha pode ser gerada
// mesmo sem possuirem todos os dados preenchidos no tombo

// await Subfamilia.findAll({
// where: {
// familia_id: dadosTombo.familia?.id,
// },
// include: [
// {
// model: Autor,
// attributes: ['id', 'nome'],
// as: 'autor',
// },
// ],
// });
const { tombo, identificacao, fotos } = resultado;

const coletores = `${!!tombo?.coletore?.nome !== false ? tombo?.coletore?.nome?.concat(' ') : ''}${tombo?.coletor_complementar ? tombo.coletor_complementar?.complementares : ''}`;

const localColeta = tombo.local_coleta;
const cidade = localColeta.cidade || '';
const localColeta = tombo?.local_coleta;
const cidade = localColeta?.cidade || '';
const estado = cidade?.estado || '';
const pais = estado?.pais || '';

Expand Down Expand Up @@ -265,8 +256,8 @@ export default function fichaTomboController(request, response, next) {
tombo: {
...tombo,
coletores,
latitude: converteDecimalParaGMSSinal(tombo.latitude, true),
longitude: converteDecimalParaGMSSinal(tombo.longitude, true),
latitude: tombo.latitude && converteDecimalParaGMSSinal(tombo.latitude, true),
longitude: tombo.longitude && converteDecimalParaGMSSinal(tombo.longitude, true),
data_tombo: formataDataSaida(tombo.data_tombo),
data_coleta: formataColunasSeparadas(tombo.data_coleta_dia, tombo.data_coleta_mes, tombo.data_coleta_ano),
},
Expand Down
19 changes: 13 additions & 6 deletions src/views/ficha-tombo.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,24 @@
<div>
<b class="fs-14">Identificador:</b> <%- identificador %>
</div>
<div>
<b class="fs-14">Data:</b> <%- romano_data_identificacao %>
</div>
<% if (romano_data_identificacao) { %>
<div>
<b class="fs-14">Data:</b> <%- romano_data_identificacao %>
</div>
<% } %>
<% if (!romano_data_identificacao) { %>
<div>
<b class="fs-14" style="margin-right: 6.5rem;">Data:</b>
</div>
<% } %>
</div>
<div>
<b class="fs-14">Local de Coleta:</b>
<% if (localColeta && localColeta.complemento) { %>
<%- localColeta.complemento %>
<% } %>
<% if (localColeta && localColeta.descricao) { %>
- <%- localColeta.descricao %>
<%- localColeta.descricao %>
<% } %>
<% if (cidade && cidade.nome) { %>
- <%- cidade.nome %>
Expand All @@ -236,8 +243,8 @@
<% if (tombo.relevo) { %>
- Relevo: <%- tombo.relevo.nome %>
<% } %>
<% if (tombo.vegetacao) { %>
- Vegetação: <%- tombo.vegetacao.nome %>
<% if (tombo.vegetaco) { %>
- Vegetação: <%- tombo.vegetaco.nome %>
<% } %>
<% if (tombo && tombo.latitude) { %>
- Latitude: <%- tombo.latitude %>
Expand Down
Loading