Skip to content

Commit

Permalink
wip: cadastro pesquisador
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedsoupe committed Jan 25, 2024
1 parent 0420b19 commit 3276c37
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 8 deletions.
1 change: 1 addition & 0 deletions assets/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ footer {
@import "./textarea.scss";
@import "./tabela.scss";
@import "./label.scss";
@import "./dropdown.scss";

// Páginas
// Sem autenticação
Expand Down
1 change: 0 additions & 1 deletion assets/css/dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
display: none;
position: relative;
overflow: auto;

}

.dropdown:hover .dropdown-options {
Expand Down
23 changes: 23 additions & 0 deletions assets/css/pages/app/researcher/cadastro_pesquisador.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.nav-menu {
@apply flex flex-col items-center justify-between w-full;

height: 26.875rem;

.nav-item {
@apply text-black-60 flex items-center justify-center;
}
}

.item-secao {
@apply justify-between items-center;
@apply w-full border-black-10 bg-white-100;

display: flex;
flex-wrap: wrap;
align-content: flex-start;
}

.item-fieldset {
width: 17.25rem;
height: 5.25rem;
}
61 changes: 61 additions & 0 deletions lib/pescarte_web/live/pesquisa/cadastro_pesquisador_live.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
defmodule PlataformaDigital.Pesquisa.CadastroPesquisadorLive do
use PescarteWeb, :auth_live_view

@impl true
def mount(_params, _session, socket) do
# cadastro_params = %{"form" => form, "field_names" => field_names}

{:ok,
socket
|> assign(:form_title, "Cadastrar Novo Pesquisador")
|> assign(:form, to_form(%{}, as: :user))
# |> assign(:form_dados, get_dados_cadastro)
|> assign(:field_names, get_cadastro_field_names(:cadastro))}
end

# para criar um user no login:
# def create(conn, %{"user" => user_params}) do
# %{"cpf" => cpf, "password" => password} = user_params

# case UsuarioHandler.fetch_usuario_by_cpf_and_password(cpf, password) do
# {:error, :not_found} -> render(conn, :show, error_message: @err_msg)
# {:ok, user} -> Authentication.log_in_user(conn, user, user_params)
# end
# end

# @impl true
# def handle_params(params, _uri, socket) do
# {:noreply, apply_action(socket, socket.assigns.live_action, params)}
# end

# defp apply_action(socket, :new, _params) do
# socket
# |> assign(:title, "Novo Pesquisador")
# |> assign(:cadastro, %Pesquisador{})
# end

defp get_cadastro_field_names(:cadastro) do
[
{"Dados Pessoais", :dados},
{"Endereço", :endereco},
{"Vínculo Institucional", :vinculo},
{"Orientador", :orientador}
]

# %{dados: dados, endereco: endereco, vinculo: vinculo}
end

# defp get_dados_cadastro do
# [
# {"primeiro_nome", :primeiro_nome},
# {"sobrenome", :sobrenome},
# {"data_nascimento", :data_nascimento}
# ]
# end

# @impl true trecho para entender.....
# {:ok, assign(socket, note_text: "", draft_notes: [], published_notes: [], error: "")}
# def handle_event("create_pesquisador", %{"note_text" => note_text}, socket) do
# {:noreply, assign(socket, draft_notes: [note_text | socket.assigns.draft_notes])}
# end
end
130 changes: 130 additions & 0 deletions lib/pescarte_web/live/pesquisa/cadastro_pesquisador_live.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<div class="report-wrapper">
<.text size="h1" color="text-blue-100"><%= @form_title %></.text>
<.simple_form for={@form} action={~p"/app/pesquisa/cadastro"} class="report-wrapper">
<.text size="h3" color="text-blue-100"><%= @field_names[:dados] %></.text>

<.text size="h3" color="text-blue-100">Dados Pessoais</.text>
<div class="nav-item">
<fieldset class="login-fieldset">
<.text_input field={@form[:primeiro_nome]} value="" type="text" label="Nome" required />
</fieldset>
<fieldset class="login-fieldset">
<.text_input field={@form[:sobrenome]} value="" type="text" label="SobreNome" required />
</fieldset>
<fieldset class="login-fieldset">
<.text_input
field={@form[:data_nascimento]}
value=""
type="date"
label="Data de Nascimento"
required
/>
</fieldset>
</div>

<div class="nav-item">
<fieldset class="login-fieldset">
<.text_input
field={@form[:cpf]}
value=""
type="text"
label="CPF"
required
phx-hook="CpfNumberMask"
/>
</fieldset>
<fieldset class="login-fieldset">
<.text_input field={@form[:telefone]} value="" type="text" label="Telefone" required />
</fieldset>
<fieldset class="login-fieldset">
<.text_input
field={@form[:contato_email]}
value=""
type="email"
placeholder="[email protected]"
label="Email"
required
/>
</fieldset>
</div>
<div class="item-secao flex-cols">
<div class="form-group">
<label for="exampleSelect">Tipo de Usuário</label>
<select id="exampleSelect" class="form-control">
<option name="tipo" value="">Administrador</option>
<option name="tipo" value="">Pesquisador</option>
<option name="tipo" value="">Pescador</option>
</select>
</div>
</div>

<.text size="h3" color="text-blue-100">Endereço</.text>
<div class="nav-item">
<fieldset class="login-fieldset">
<.text_input field={@form[:rua]} value="" type="text" label="Endereço" required />
</fieldset>
<fieldset class="login-fieldset">
<.text_input field={@form[:numero]} value="" type="text" label="Número" required />
</fieldset>
<fieldset class="login-fieldset">
<.text_input field={@form[:cidade]} value="" type="text" label="Cidade" required />
</fieldset>
<fieldset class="login-fieldset">
<.text_input
field={@form[:cep]}
value=""
type="text"
placeholder="00000-00"
label="CEP"
required
/>
</fieldset>
</div>

<div class="form-group flex-cols">
<label for="exampleSelect">UF</label>
<select id="exampleSelect" class="form-control">
<option name="estado" value="">RJ</option>
<option name="estado" value="">ES</option>
<option name="estado" value="">SP</option>
</select>
</div>

<.text size="h3" color="text-blue-100">Vínculo Institucional</.text>
<div class="nav-item">
<fieldset class="login-fieldset">
<.text_input field={@form[:bolsa]} value="" type="checkbox" label="Pesquisador" required />
</fieldset>
<fieldset class="login-fieldset">
<.text_input field={@form[:bolsa]} value="" type="checkbox" label="Professor" required />
</fieldset>
<fieldset class="login-fieldset">
<.text_input field={@form[:bolsa]} value="" type="checkbox" label="Técnico" required />
</fieldset>
<fieldset class="login-fieldset">
<.text_input field={@form[:bolsa]} value="" type="checkbox" label="Aluno" required />
</fieldset>
</div>
</.simple_form>
<div class="buttons-wrapper flex-center">
<.button
name="save"
value="save-cadastro"
style="primary"
phx-disable-with="Salvando….."
submit
>
<Lucideicons.save /> Salvar respostas
</.button>

<.button
name="save"
value="send-cadastro"
style="primary"
phx-disable-with="Enviando..."
submit
>
<Lucideicons.send /> Enviar cadastro
</.button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
/>

<.button :if={@current_user.tipo == :admin} style="primary" click="register">
<Lucideicons.user_plus /> Cadastrar
<DesignSystem.link navigate={~p"/app/pesquisa/cadastro"}>
<Lucideicons.user_plus /> Cadastrar
</DesignSystem.link>
</.button>
</div>

Expand Down
8 changes: 4 additions & 4 deletions lib/pescarte_web/live/pesquisa/relatorio_live/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ defmodule PescarteWeb.Pesquisa.RelatorioLive.Index do
# ================= Vamos trabalhar o dropdown do "Preencher Relatório" 09-14/10/2023
@impl true
def handle_event("mensal_report", _, socket) do
{:noreply, Phoenix.LiveView.redirect(socket, to: ~p"/app/pesquisa/pesquisadores")}
{:noreply, redirect(socket, to: ~p"/app/pesquisa/pesquisadores")}
# ~p"/app/pesquisa/relatorios"
end

def handle_event("trimestral_report", _, socket) do
{:noreply, Phoenix.LiveView.redirect(socket, to: ~p"/app/pesquisa/pesquisadores")}
{:noreply, redirect(socket, to: ~p"/app/pesquisa/pesquisadores")}
end

def handle_event("bienal_report", _, socket) do
{:noreply, Phoenix.LiveView.redirect(socket, to: ~p"/app/pesquisa/pesquisadores")}
{:noreply, redirect(socket, to: ~p"/app/pesquisa/pesquisadores")}
end

def handle_event("anual_report", _, socket) do
{:noreply, Phoenix.LiveView.redirect(socket, to: ~p"/app/pesquisa/pesquisadores")}
{:noreply, redirect(socket, to: ~p"/app/pesquisa/pesquisadores")}
end

defp apply_action(socket, :edit, %{"id" => id}) do
Expand Down
1 change: 1 addition & 0 deletions lib/pescarte_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ defmodule PescarteWeb.Router do
on_mount: [{PescarteWeb.Authentication, :ensure_authenticated}] do
live("/perfil", ProfileLive)
live("/pesquisadores", ListPesquisadorLive)
live("/cadastro", CadastroPesquisadorLive)

scope "/relatorios" do
live("/", RelatorioLive.Index, :index)
Expand Down
34 changes: 32 additions & 2 deletions lib/pescarte_web/templates/landing_html/show.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
<div class="links">
<div class="links-item">
<img src={~p"/images/landing/pesquisa.png"} />
<.text size="h3" color="text-white-100">Fotos</.text>
<DesignSystem.link href={~p"/fotos"} class="text-sm font-semibold">
<.text size="h3" color="text-white-100">Fotos</.text>
</DesignSystem.link>
<.text size="base" color="text-white-100">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Mídias do Projeto
</.text>
<.button style="primary">
Saiba mais <Lucideicons.arrow_right class="text-white-100" />
Expand Down Expand Up @@ -41,6 +43,34 @@
Saiba mais <Lucideicons.arrow_right class="text-white-100" />
</.button>
</div>
<div class="links-item">
<img src={~p"/images/landing/pescadores.png"} />
<a href="https://cotacoes.pescarte.uenf.br/">
<.text size="h3" color="text-white-100">Aplicativos Públicos</.text>
<.text size="base" color="text-white-100">
Cotações de Pescados...
</.text>
</a>
</div>
<div class="links-item">
<img src={~p"/images/landing/pescado.png"} />
<.text size="h3" color="text-white-100">Aplicativo CENSO</.text>
<.text size="base" color="text-white-100">
e-Quest 2.0...
</.text>
<.button style="primary">
Saiba mais <Lucideicons.arrow_right class="text-white-100" />
</.button>
</div>
<div class="links-item">
<img src={~p"/images/landing/pescadores.png"} />
<a href="https://dadosmeteorologicos.uenf.br/">
<.text size="h3" color="text-white-100">Aplicativos Públicos</.text>
<.text size="base" color="text-white-100">
Dados Meteorológicos...
</.text>
</a>
</div>
</div>
<div class="about">
<section class="about-text">
Expand Down

0 comments on commit 3276c37

Please sign in to comment.