Skip to content

Commit

Permalink
Merge pull request #43 from reflejar/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mpvaldez authored Jan 12, 2024
2 parents 13a85b1 + e68797f commit f32a068
Show file tree
Hide file tree
Showing 3 changed files with 479 additions and 427 deletions.
61 changes: 35 additions & 26 deletions pages/jurisprudencia/componentes/fallos.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,59 @@
from dash import dash, html, dcc, Input, Output, State, callback
import dash_bootstrap_components as dbc
from dash_loading_spinners import Hash

from pages.constantes import LIMA

from ..data import DATA

Fallos = dbc.Row(dbc.Col(html.Div(id='fallos-judiciales', className="navbar-nav-scroll", ), class_name="mt-5"))
Fallos = dbc.Row(dbc.Col(Hash(html.Div(id='fallos-judiciales', className="navbar-nav-scroll", ), color=LIMA), class_name="mt-5"))

@callback(
Output('fallos-judiciales','children'),
[
Input("select-voces-tematicas",'value'),
Input("select-provincia",'value'),
Input("select-tipo-fallo",'value'),
Input("select-organismo",'value')
]
)
def update_fallos(voces, provincia, tipo, organismo):
def update_fallos(voces, provincia, tipo):
df = DATA['contenido'].copy()
cards = []

if voces:
if voces and not "Todas" in voces:
df = df[df['Voces temáticas']==voces]
if provincia:
if provincia and not "Todos" in provincia:
df = df[df['Provincia']==provincia]
if tipo:
if tipo and not "Todos" in tipo:
df = df[df['Tipo de fallo']==tipo]
if organismo:
df = df[df['Organismo judicial o administrativo']==organismo]

for _, row in df.iterrows():

if len(df) == 0:
cards.append(dbc.Card(dbc.CardBody(
html.Div([
html.P("No hay resultados para los filtros aplicados"),
], className="poppins text-center small mx-2")
), className="mx-3 p-3 card-jurisprudencia"))
else:
for _, row in df.iterrows():
cards.append(dbc.Card(dbc.CardBody(
html.Div([
html.Span([html.B('AÑO: '), f"{row['Año']}"], className="mx-2"),
html.Span([html.B('PROVINCIA: '), f"{row['Provincia']}"], className="mx-2"),
html.Span([html.B('CIUDAD: '), f"{row['Ciudad']}"], className="mx-2"),
], className="text-end juris-encabezado"),
html.Hr(),
html.P([html.B("VOCES TEMÁTICAS: "), row['Voces temáticas']]),
html.P([html.B("JURISDICCIÓN TERRITORIAL: "), row['Jurisdicción territorial']]),
html.P([html.B("ORGANISMO: "), row['Organismo judicial o administrativo']]),
html.P([html.B("AUTOS: "), row['Autos']]),
html.Hr(),
html.P([html.B("TIPO DE FALLO: "), row['Tipo de fallo']]),
html.P([html.B("SÍNTESIS DE FALLO: "), html.U(f"Página: {row['Página']}")]),
html.P(row['Sintesis del fallo']),
html.A("Ver fallo completo", className="btn btn-primary text-dark")
], className="poppins small mx-2")
), className="mb-4 mx-3 p-3 card-jurisprudencia"))

html.Div([
html.Span([html.B('AÑO: '), f"{row['Año']}"], className="mx-2"),
html.Span([html.B('PROVINCIA: '), f"{row['Provincia']}"], className="mx-2"),
html.Span([html.B('CIUDAD: '), f"{row['Ciudad']}"], className="mx-2"),
], className="text-end juris-encabezado"),
html.Hr(),
html.P([html.B("VOCES TEMÁTICAS: "), row['Voces temáticas']]),
html.P([html.B("JURISDICCIÓN TERRITORIAL: "), row['Jurisdicción territorial']]),
html.P([html.B("ORGANISMO: "), row['Organismo judicial o administrativo']]),
html.P([html.B("AUTOS: "), row['Autos']]),
html.Hr(),
html.P([html.B("TIPO DE FALLO: "), row['Tipo de fallo']]),
html.P([html.B("SÍNTESIS DE FALLO: "), html.U(f"Página: {row['Página']}")]),
html.P(row['Sintesis del fallo']),
html.A("Ver fallo completo", href=f"https://drive.google.com/file/d/17qtstKAxwjIn3aqND3kISzkPJjO7l3aF/view#page={row['Página']}", target="_blank", className="btn btn-primary text-dark")
], className="poppins small mx-2")
), className="mb-4 mx-3 p-3 card-jurisprudencia"))

return cards
41 changes: 13 additions & 28 deletions pages/jurisprudencia/componentes/filtros.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from ..data import DATA

print(DATA['filtros']['provincia'])
Filtros = dbc.Row([
dbc.Col(
html.H5("Filtrar por", className="text-white fw-bold"),
Expand All @@ -11,53 +12,37 @@
),
dbc.Col([
dcc.Dropdown(
id="select-voces-tematicas",
options=DATA['filtros']['voces-tematicas'],
id="select-provincia",
options=['Todos los distritos'] + DATA['filtros']['provincia'],
searchable = True,
placeholder = 'Voces temáticas',
placeholder = 'Distrito',
className="mt-1",
optionHeight=50,
maxHeight=300
)
],
md=12, lg=6
md=12, lg=4
),
dbc.Col([
dcc.Dropdown(
id="select-provincia",
options=DATA['filtros']['provincia'],
id="select-voces-tematicas",
options=['Todas las voces temáticas'] + DATA['filtros']['voces-tematicas'],
searchable = True,
placeholder = 'Provincia',
placeholder = 'Voces temáticas',
className="mt-1",
maxHeight=300
optionHeight=50,
)
],
md=12, lg=6
),
md=12, lg=4
),
dbc.Col([
dcc.Dropdown(
id="select-tipo-fallo",
options=DATA['filtros']['tipo-fallo'],
options=['Todos los tipos de fallos'] + DATA['filtros']['tipo-fallo'],
searchable = True,
placeholder = 'Tipo de fallo',
className="mt-1",
optionHeight=50,
maxHeight=300
)
],
md=12, lg=6
),
dbc.Col([
dcc.Dropdown(
id="select-organismo",
options=DATA['filtros']['organismo'],
searchable = True,
placeholder = 'Organismo',
className="mt-1",
optionHeight=100,
maxHeight=300
)
],
md=12, lg=6
md=12, lg=4
),
])
Loading

0 comments on commit f32a068

Please sign in to comment.