rutas cambiadas
This commit is contained in:
15
lib/derivantes_web/live/derivantes/derivantes_live.ex
Executable file
15
lib/derivantes_web/live/derivantes/derivantes_live.ex
Executable file
@ -0,0 +1,15 @@
|
||||
defmodule DerivantesWeb.DerivantesLive do
|
||||
use DerivantesWeb, :live_view
|
||||
use Phoenix.Component
|
||||
import Ecto.Query
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket}
|
||||
end
|
||||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<h1> Listado </h1>
|
||||
"""
|
||||
end
|
||||
end
|
154
lib/derivantes_web/live/derivantes/derivanteshash_live.ex
Executable file
154
lib/derivantes_web/live/derivantes/derivanteshash_live.ex
Executable file
@ -0,0 +1,154 @@
|
||||
defmodule DerivantesWeb.DerivantesHashLive do
|
||||
use DerivantesWeb, :live_view
|
||||
use Phoenix.Component
|
||||
import Ecto.Query
|
||||
|
||||
def mount(params, _session, socket) do
|
||||
IO.inspect(params)
|
||||
hash = params["hash"]
|
||||
incorrecto = if hash != "123" do
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
IO.inspect(incorrecto)
|
||||
socket =
|
||||
socket
|
||||
|> assign(:dato_incorrecto, incorrecto)
|
||||
|> assign(:logged_in, false)
|
||||
{:ok, socket}
|
||||
end
|
||||
|
||||
defmodule DateFormatter do
|
||||
def format_date(date_string) when is_binary(date_string) do
|
||||
anio = String.slice(date_string, 0..3)
|
||||
mes = String.slice(date_string, 4..5)
|
||||
dia = String.slice(date_string, 6..7)
|
||||
|
||||
"#{dia}/#{mes}/#{anio}"
|
||||
end
|
||||
|
||||
def format_hour(hour_string) when is_binary(hour_string) do
|
||||
hora = String.slice(hour_string, 0..1)
|
||||
minutos = String.slice(hour_string, 2..3)
|
||||
segundos = String.slice(hour_string, 4..6)
|
||||
|
||||
"#{hora}:#{minutos}:#{segundos}"
|
||||
end
|
||||
end
|
||||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<%= if @logged_in == false do %>
|
||||
<div class="log_in_container">
|
||||
<form class="log_in_form" phx-submit="login">
|
||||
<img src={~p"/images/sana_americano_logo.png"} alt="Sanatorio Americano Logo"/>
|
||||
<input class="imput_text" type="text" name="dni" placeholder="ID Paciente"/>
|
||||
<input class="submit_button" type="submit" value="Ingresar" id="submit">
|
||||
<%= if @dato_incorrecto == true do %>
|
||||
<h1 class="error_msg">Datos incorrectos</h1>
|
||||
<% end %>
|
||||
</form>
|
||||
<div class="info_panel">
|
||||
<p style="text-align: center;">Bienvenido a Entrega Digital <br> <b>Sanatorio Americano.</b></p>
|
||||
<br>
|
||||
<p> En este sitio, usted podrá visualizar los informes y estudios realizados en nuestra institución.</p>
|
||||
<br>
|
||||
<p>Si presenta inconvenientes con los datos ingresados, puede comunicarse con nosotros enviando un correo a
|
||||
<br>
|
||||
<b>mesadeayuda@sanatorio-americano.com.ar</b> detallando su nombre completo y D.N.I.</p>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="pantalla_estudios_header">
|
||||
<img src={~p"/images/sana_americano_logo.png"} alt="IM LOGO"/>
|
||||
</div>
|
||||
<%= if length(@studies) > 0 do %>
|
||||
<div class="estudio_patientname">
|
||||
<h1><%= List.first(@studies).lastname %>, <%= List.first(@studies).patientname %></h1>
|
||||
<p>Para ver su estudio haga click en Abrir.</p>
|
||||
</div>
|
||||
<div class="estudio_container">
|
||||
<div class="estudio_details">
|
||||
<p>Estudios</p>
|
||||
</div>
|
||||
<div class="estudio_icons">
|
||||
<p>Informe</p>
|
||||
<p>Imágenes</p>
|
||||
</div>
|
||||
</div>
|
||||
<%= for study <- @studies do %>
|
||||
<div class="estudio_container">
|
||||
<div class="estudio_details">
|
||||
<p><b>Fecha y hora:</b> <%= DateFormatter.format_date(study.fecha) %> - <%= DateFormatter.format_hour(study.hora) %></p>
|
||||
<p><b>Estudio:</b> <%= study.desc %></p>
|
||||
<p><b>DNI:</b> <%= study.dni %></p>
|
||||
<p><b>Accession N°</b> <%= study.accession %></p>
|
||||
</div>
|
||||
<div class="estudio_icons">
|
||||
<%= case {study.modality, study.esteco, study.estrx} do %>
|
||||
<% {"US", "F", _} -> %>
|
||||
<i class="fa-regular fa-file-lines fa-3x" style="color: #297177"></i>
|
||||
<% {modality, _, "E"} when modality != "US" -> %>
|
||||
<i class="fa-regular fa-file-lines fa-3x" style="color: #297177"></i>
|
||||
<% _ -> %>
|
||||
<i class="fa-solid fa-file-circle-question fa-3x" style="color: #DCDCDC"></i>
|
||||
<% end %>
|
||||
<%= if study.modality != "US" do %>
|
||||
<i class="fa-solid fa-file-circle-check fa-3x" style="color: #297177"></i>
|
||||
<% else %>
|
||||
<i class="fa-solid fa-file-circle-question fa-3x" style="color: #DCDCDC"></i>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
"""
|
||||
end
|
||||
|
||||
|
||||
def handle_event("login", %{"dni" => dni, "acc" => acc}, socket) do
|
||||
IO.inspect(dni)
|
||||
IO.inspect(acc)
|
||||
query = from vl in "V_LISTAINGRESOS",
|
||||
select: %{
|
||||
idstudy: field(vl, :ID)
|
||||
},
|
||||
where: field(vl, :TIPO_DOCUMENTO) == ^dni
|
||||
and field(vl, :ACCESSIONNUMBER) == ^acc
|
||||
|
||||
result = Derivantes.TdsRepo.all(query)
|
||||
|
||||
socket = case result do
|
||||
[] -> socket
|
||||
|> assign(:dato_incorrecto, true)
|
||||
_ -> query = from vl in "V_LISTAINGRESOS",
|
||||
select: %{
|
||||
idstudy: field(vl, :ID),
|
||||
estrx: field(vl, :ESTRX),
|
||||
esteco: field(vl, :ESTECO),
|
||||
desc: field(vl, :PROD_DESC),
|
||||
hora: field(vl, :START_TIME),
|
||||
fecha: field(vl, :START_DATE),
|
||||
modality: field(vl, :MODALITY),
|
||||
dni: field(vl, :TIPO_DOCUMENTO),
|
||||
lastname: field(vl, :PATIENTLASTNAME),
|
||||
accession: field(vl, :ACCESSIONNUMBER),
|
||||
patientname: field(vl, :PATIENTFIRSTNAME)
|
||||
},
|
||||
where: field(vl, :TIPO_DOCUMENTO) == ^dni,
|
||||
order_by: [desc: field(vl, :START_DATE)]
|
||||
|
||||
IO.inspect(query, label: "----> Query")
|
||||
estudios = Derivantes.TdsRepo.all(query)
|
||||
socket
|
||||
|> assign(dni: dni)
|
||||
|> assign(acc: acc)
|
||||
|> assign(logged_in: true)
|
||||
|> assign(studies: estudios)
|
||||
|> assign(dato_incorrecto: false)
|
||||
end
|
||||
{:noreply, socket}
|
||||
end
|
||||
end
|
@ -1,12 +0,0 @@
|
||||
defmodule DerivantesWeb.LoginLive.Index do
|
||||
use DerivantesWeb, :live_view
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket}
|
||||
end
|
||||
def handle_event(msg, _params, socket) do
|
||||
case msg do
|
||||
_ -> {:noreply, socket}
|
||||
end
|
||||
end
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
<h1>
|
||||
Hola mundo
|
||||
</h1>
|
@ -1,26 +0,0 @@
|
||||
defmodule DerivantesWeb.TestLive do
|
||||
|
||||
use DerivantesWeb, :live_view
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
|
||||
{:ok, socket}
|
||||
|
||||
end
|
||||
|
||||
def handle_event(msg, _params, socket) do
|
||||
case msg do
|
||||
_-> {:noreply, socket}
|
||||
end
|
||||
end
|
||||
|
||||
def render(assigns) do
|
||||
|
||||
~H"""
|
||||
<h1> Nuevo plug </h1>
|
||||
|
||||
"""
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -21,8 +21,8 @@ defmodule DerivantesWeb.UserConfirmationInstructionsLive do
|
||||
</.simple_form>
|
||||
|
||||
<p class="text-center mt-4">
|
||||
<.link href={~p"/users/register"}>Register</.link>
|
||||
| <.link href={~p"/users/log_in"}>Log in</.link>
|
||||
<.link href={~p"/derivantes/register"}>Register</.link>
|
||||
| <.link href={~p"/derivantes/log_in"}>Log in</.link>
|
||||
</p>
|
||||
</div>
|
||||
"""
|
||||
@ -36,7 +36,7 @@ defmodule DerivantesWeb.UserConfirmationInstructionsLive do
|
||||
if user = Accounts.get_user_by_email(email) do
|
||||
Accounts.deliver_user_confirmation_instructions(
|
||||
user,
|
||||
&url(~p"/users/confirm/#{&1}")
|
||||
&url(~p"/derivantes/confirm/#{&1}")
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -6,18 +6,18 @@ defmodule DerivantesWeb.UserConfirmationLive do
|
||||
def render(%{live_action: :edit} = assigns) do
|
||||
~H"""
|
||||
<div class="mx-auto max-w-sm">
|
||||
<.header class="text-center">Confirm Account</.header>
|
||||
<.header class="text-center">Confirmar Cuenta</.header>
|
||||
|
||||
<.simple_form for={@form} id="confirmation_form" phx-submit="confirm_account">
|
||||
<input type="hidden" name={@form[:token].name} value={@form[:token].value} />
|
||||
<:actions>
|
||||
<.button phx-disable-with="Confirming..." class="w-full">Confirm my account</.button>
|
||||
<.button phx-disable-with="Confirmando..." class="w-full">Confirmar mi cuenta</.button>
|
||||
</:actions>
|
||||
</.simple_form>
|
||||
|
||||
<p class="text-center mt-4">
|
||||
<.link href={~p"/users/register"}>Register</.link>
|
||||
| <.link href={~p"/users/log_in"}>Log in</.link>
|
||||
<.link href={~p"/derivantes/register"}>Registrarse</.link>
|
||||
| <.link href={~p"/derivantes/log_in"}>Ingresar</.link>
|
||||
</p>
|
||||
</div>
|
||||
"""
|
||||
|
@ -20,8 +20,8 @@ defmodule DerivantesWeb.UserForgotPasswordLive do
|
||||
</:actions>
|
||||
</.simple_form>
|
||||
<p class="text-center text-sm mt-4">
|
||||
<.link href={~p"/users/register"}>Register</.link>
|
||||
| <.link href={~p"/users/log_in"}>Log in</.link>
|
||||
<.link href={~p"/derivantes/register"}>Register</.link>
|
||||
| <.link href={~p"/derivantes/log_in"}>Log in</.link>
|
||||
</p>
|
||||
</div>
|
||||
"""
|
||||
@ -35,7 +35,7 @@ defmodule DerivantesWeb.UserForgotPasswordLive do
|
||||
if user = Accounts.get_user_by_email(email) do
|
||||
Accounts.deliver_user_reset_password_instructions(
|
||||
user,
|
||||
&url(~p"/users/reset_password/#{&1}")
|
||||
&url(~p"/derivantes/reset_password/#{&1}")
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -3,31 +3,50 @@ defmodule DerivantesWeb.UserLoginLive do
|
||||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<div class="mx-auto max-w-sm">
|
||||
<div class="max-w-sm flex justify-center flex-col m-auto">
|
||||
<.header class="text-center">
|
||||
Log in to account
|
||||
Entra en su cuenta
|
||||
<:subtitle>
|
||||
Don't have an account?
|
||||
<.link navigate={~p"/users/register"} class="font-semibold text-brand hover:underline">
|
||||
Sign up
|
||||
No tiene una?
|
||||
<.link navigate={~p"/derivantes/register"} class="font-semibold text-[#297177] hover:underline">
|
||||
Registre y active
|
||||
</.link>
|
||||
for an account now.
|
||||
su cuenta ahora.
|
||||
</:subtitle>
|
||||
</.header>
|
||||
|
||||
<.simple_form for={@form} id="login_form" action={~p"/users/log_in"} phx-update="ignore">
|
||||
<.input field={@form[:email]} type="email" label="Email" required />
|
||||
<.input field={@form[:password]} type="password" label="Password" required />
|
||||
<.simple_form
|
||||
for={@form}
|
||||
id="login_form"
|
||||
action={~p"/derivantes/log_in"}
|
||||
phx-update="ignore"
|
||||
class="auth_form"
|
||||
>
|
||||
<img src={~p"/images/sana_americano_logo.png"} alt="Sanatorio Americano Logo"/>
|
||||
<.input
|
||||
field={@form[:email]}
|
||||
type="email"
|
||||
label="Email"
|
||||
class="imput_text"
|
||||
required
|
||||
/>
|
||||
<.input
|
||||
field={@form[:password]}
|
||||
type="password"
|
||||
label="Contraseña"
|
||||
class="imput_text"
|
||||
required
|
||||
/>
|
||||
|
||||
<:actions>
|
||||
<.input field={@form[:remember_me]} type="checkbox" label="Keep me logged in" />
|
||||
<.link href={~p"/users/reset_password"} class="text-sm font-semibold">
|
||||
Forgot your password?
|
||||
<.input field={@form[:remember_me]} type="checkbox" label="Mantenerme conectado" class="accent-[#297177]"/>
|
||||
<.link href={~p"/derivantes/reset_password"} class="text-sm text-white font-semibold">
|
||||
Olvidó su contraseña?
|
||||
</.link>
|
||||
</:actions>
|
||||
<:actions>
|
||||
<.button phx-disable-with="Logging in..." class="w-full">
|
||||
Log in <span aria-hidden="true">→</span>
|
||||
<.button phx-disable-with="Entrando..." class="w-full submit_button">
|
||||
Entrar <span aria-hidden="true">→</span>
|
||||
</.button>
|
||||
</:actions>
|
||||
</.simple_form>
|
||||
|
@ -8,13 +8,13 @@ defmodule DerivantesWeb.UserRegistrationLive do
|
||||
~H"""
|
||||
<div class="mx-auto max-w-sm">
|
||||
<.header class="text-center">
|
||||
Register for an account
|
||||
Registre su nueva cuenta
|
||||
<:subtitle>
|
||||
Already registered?
|
||||
<.link navigate={~p"/users/log_in"} class="font-semibold text-brand hover:underline">
|
||||
Log in
|
||||
Ya tiene una cuenta?
|
||||
<.link navigate={~p"/derivantes/log_in"} class="font-semibold text-[#297177] hover:underline">
|
||||
Entre
|
||||
</.link>
|
||||
to your account now.
|
||||
a su cuenta ahora.
|
||||
</:subtitle>
|
||||
</.header>
|
||||
|
||||
@ -24,18 +24,19 @@ defmodule DerivantesWeb.UserRegistrationLive do
|
||||
phx-submit="save"
|
||||
phx-change="validate"
|
||||
phx-trigger-action={@trigger_submit}
|
||||
action={~p"/users/log_in?_action=registered"}
|
||||
action={~p"/derivantes/log_in?_action=registered"}
|
||||
method="post"
|
||||
class="auth_form"
|
||||
>
|
||||
<.error :if={@check_errors}>
|
||||
Oops, something went wrong! Please check the errors below.
|
||||
Hubo un error.
|
||||
</.error>
|
||||
|
||||
<.input field={@form[:email]} type="email" label="Email" required />
|
||||
<.input field={@form[:password]} type="password" label="Password" required />
|
||||
<img src={~p"/images/sana_americano_logo.png"} alt="Sanatorio Americano Logo"/>
|
||||
<.input class="imput_text w-40" field={@form[:email]} type="email" label="Email" required />
|
||||
<.input class="imput_text w-40" field={@form[:password]} type="password" label="Contraseña" required />
|
||||
|
||||
<:actions>
|
||||
<.button phx-disable-with="Creating account..." class="w-full">Create an account</.button>
|
||||
<.button phx-disable-with="Creating account..." class="submit_button">Create an account</.button>
|
||||
</:actions>
|
||||
</.simple_form>
|
||||
</div>
|
||||
@ -59,7 +60,7 @@ defmodule DerivantesWeb.UserRegistrationLive do
|
||||
{:ok, _} =
|
||||
Accounts.deliver_user_confirmation_instructions(
|
||||
user,
|
||||
&url(~p"/users/confirm/#{&1}")
|
||||
&url(~p"/derivantes/confirm/#{&1}")
|
||||
)
|
||||
|
||||
changeset = Accounts.change_user_registration(user)
|
||||
|
@ -31,8 +31,8 @@ defmodule DerivantesWeb.UserResetPasswordLive do
|
||||
</.simple_form>
|
||||
|
||||
<p class="text-center text-sm mt-4">
|
||||
<.link href={~p"/users/register"}>Register</.link>
|
||||
| <.link href={~p"/users/log_in"}>Log in</.link>
|
||||
<.link href={~p"/derivantes/register"}>Register</.link>
|
||||
| <.link href={~p"/derivantes/log_in"}>Log in</.link>
|
||||
</p>
|
||||
</div>
|
||||
"""
|
||||
@ -61,7 +61,7 @@ defmodule DerivantesWeb.UserResetPasswordLive do
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:info, "Password reset successfully.")
|
||||
|> redirect(to: ~p"/users/log_in")}
|
||||
|> redirect(to: ~p"/derivantes/log_in")}
|
||||
|
||||
{:error, changeset} ->
|
||||
{:noreply, assign_form(socket, Map.put(changeset, :action, :insert))}
|
||||
|
@ -37,7 +37,7 @@ defmodule DerivantesWeb.UserSettingsLive do
|
||||
<.simple_form
|
||||
for={@password_form}
|
||||
id="password_form"
|
||||
action={~p"/users/log_in?_action=password_updated"}
|
||||
action={~p"/derivantes/log_in?_action=password_updated"}
|
||||
method="post"
|
||||
phx-change="validate_password"
|
||||
phx-submit="update_password"
|
||||
@ -83,7 +83,7 @@ defmodule DerivantesWeb.UserSettingsLive do
|
||||
put_flash(socket, :error, "Email change link is invalid or it has expired.")
|
||||
end
|
||||
|
||||
{:ok, push_navigate(socket, to: ~p"/users/settings")}
|
||||
{:ok, push_navigate(socket, to: ~p"/derivantes/settings")}
|
||||
end
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
@ -124,7 +124,7 @@ defmodule DerivantesWeb.UserSettingsLive do
|
||||
Accounts.deliver_user_update_email_instructions(
|
||||
applied_user,
|
||||
user.email,
|
||||
&url(~p"/users/settings/confirm_email/#{&1}")
|
||||
&url(~p"/derivantes/settings/confirm_email/#{&1}")
|
||||
)
|
||||
|
||||
info = "A link to confirm your email change has been sent to the new address."
|
||||
|
Reference in New Issue
Block a user