Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/relatorio anual #126

Closed
wants to merge 14 commits into from
Closed
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
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ RUN chown nobody /pescarte

RUN apt-get update -y
RUN apt-get install -y iputils-ping libstdc++6 glibc-source \
openssl libncurses5 locales postgresql-client \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \
&& locale-gen
openssl libncurses5 locales postgresql-client \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \
&& locale-gen

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
Expand Down
1 change: 1 addition & 0 deletions apps/plataforma_digital/assets/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ footer {
// Com autenticação
@import "./pages/app/researcher/profile.scss";
@import "./pages/app/researcher/relatorio/mensal.scss";
@import "./pages/app/researcher/relatorio/anual.scss";

// Páginas de Erros
@import "./errors/404.scss";
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.yearly-report-wrapper {
@apply w-full;

padding: 0 2.5rem;
overflow-y: scroll;
height: calc(100vh - $footer-height);

> h1 {
margin: 2.5rem 0;
}

> form .report-field {
height: max-content;
margin-bottom: 2.25rem;

h3 {
margin-bottom: 0.75rem;
}

textarea {
@apply w-full;
min-height: 12rem;
}
}

button {
margin-bottom: 2rem;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
defmodule PlataformaDigital.Researcher.Relatorio.AnualLive do
use PlataformaDigital, :auth_live_view

import Timex.Format.DateTime.Formatter, only: [lformat!: 3]

alias ModuloPesquisa.Models.RelatorioAnualPesquisa

@locale "pt_BR"

# Título de cada campo completo e os respectivos ids
@report_field_names [
{"Plano de Trabalho", :plano_de_trabalho},
{"Resumo", :resumo},
{"Introdução", :introducao},
{"Embasamento Teórico", :embasamento_teorico},
{"Resultados", :resultados},
{"Atividades Acadêmicas", :atividades_academicas},
{"Atividades Não Acadêmicas", :atividades_nao_academicas},
{"Conclusão", :conclusao},
{"Referências", :referencias}
]

@impl true
def mount(_, _, socket) do
# TODO: finalizar tela
relatorio_anual =
%RelatorioAnualPesquisa{}
|> Ecto.Changeset.change()
|> to_form(as: :relatorio_anual)

{:ok,
socket
|> assign(field_names: @report_field_names)
|> assign(year: get_formatted_year(Date.utc_today()))
|> assign(form: relatorio_anual)}
end

attr :form, :any, required: true
attr :label, :string, required: true
attr :id, :string, required: true

defp report_field(assigns) do
~H"""
<.text_area field={@form[@id]} class="report-field">
<:label>
<.text size="h3" color="text-blue-100">
<%= @label %>
</.text>
</:label>
</.text_area>
"""
end

defp get_formatted_year(%Date{} = today) do
year = lformat!(today, "{YYYY}", @locale)

%{year: year}
end

# Events

@impl true
def handle_event("save", _params, socket) do
{:noreply, socket}
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="yearly-report-wrapper">
<.text size="h1" color="text-blue-100">
Relatório Mensal de Pesquisa do ano de <%= @year %>
</.text>

<.form :let={f} for={@form} phx-submit="save">
<.report_field :for={{name, id} <- @field_names} label={name} id={id} form={f} />

<.text size="h3" color="text-blue-100">Recursos</.text>

<.button style="primary" submit>
Salvar
</.button>
</.form>
</div>
2 changes: 2 additions & 0 deletions apps/plataforma_digital/lib/plataforma_digital/router.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule PlataformaDigital.Router do
alias PlataformaDigital.Researcher
use PlataformaDigital, :router

import PhoenixStorybook.Router
Expand Down Expand Up @@ -43,6 +44,7 @@ defmodule PlataformaDigital.Router do

scope "/relatorios" do
live "/mensal", Researcher.Relatorio.MensalLive
live "/anual", Researcher.Relatorio.AnualLive
end
end
end
Expand Down