Skip to content

Commit

Permalink
Actos con fecha
Browse files Browse the repository at this point in the history
  • Loading branch information
vtamara committed Apr 3, 2024
1 parent 74c8c06 commit 0274282
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/controllers/cor1440_gen/actividades_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def atributos_show
]
end

def registrar_en_bitacora
true
end

def otros_impedimentos_para_borrar_persona_ex_asistente(a)
# Estar como víctima en un caso es impedimento
if Sivel2Gen::Victima.where(persona_id: a.persona_id).count > 0
Expand Down
4 changes: 3 additions & 1 deletion app/models/msip/persona.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class Persona < ActiveRecord::Base
foreign_key: "persona_id",
validate: true,
dependent: :destroy,
class_name: "::Aporte"
class_name: "::Aporte",
inverse_of: :persona

accepts_nested_attributes_for :aporte,
allow_destroy: true,
reject_if: :all_blank
Expand Down
1 change: 1 addition & 0 deletions app/views/msip/personas/_aporte_campos.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
class: 'btn btn-sm btn-danger',
data: {
turbo_frame: "aporte_#{f.index}",
turbo_method: :delete,
disable_with: false
} %>
</div>
Expand Down
5 changes: 2 additions & 3 deletions app/views/msip/personas/_campo_aportes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
<%= f.simple_fields_for :aporte,
f.object.aporte.order([:anio,:mes]),
child_index: params[:index] do |apo| %>
<%= render partial: "aporte_campos",
locals: {f: apo}
%>
x
<!--%= render partial: "aporte_campos", locals: {f: apo} %-->
<% end %>
</div>
</div>
Expand Down
46 changes: 46 additions & 0 deletions app/views/sivel2_gen/actos/_actos_tabla.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<%= fields model: @caso do |form| %>
<div class="div-tabla">
<div class="div-tabla-cuerpo">
<% if @caso && @caso.acto %>
<% index = 0 %>
<% @caso.acto.try(:each) do |acto| %>

<div class="div-tabla-fila">
<div class="div-tabla-celda" style="width: 10em">
<%= acto.presponsable.nombre %>
</div>
<div class="div-tabla-celda" style="width: 10em">
<%= acto.categoria.supracategoria.tviolencia_id + acto.categoria.id.to_s + ' ' + acto.categoria.nombre %>
</div>
<div class="div-tabla-celda" style="width: 10em">
<%if acto.persona.nombres == 'N' && acto.persona.apellidos == 'N' %>
<%= acto.persona.sin_identificacion %>
<% else %>
<%= acto.persona.nombres + ' ' + acto.persona.apellidos %>
<% end %>
</div>
<div class="div-tabla-celda" style="width: 10em">
<% if acto.fecha %>
<%= acto.fecha %>
<% end %>
</div>
<div class="div-tabla-celda" style="width: 10em">
<%= link_to "Eliminar",
sivel2_gen.eliminar_acto_path(id: acto.id, index: index),
formmethod: :delete,
formnovalidate: true,
class: 'btn btn-sm btn-danger',
data: {
turbo_frame: "acto_#{index}",
"turbo-stream": "turbo-stream",
"turbo-method": :delete,
turbo: true,
} %>
</div>
</div>
<% index += 1 %>
<% end %>
<% end %>
</div>
</div>
<% end %>
8 changes: 8 additions & 0 deletions app/views/sivel2_gen/actos/_resto_campos_tabla.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="div-tabla-celda" style="max-width: 10em">
<%= date_field_tag "caso_acto_fecha", "",
"data-toggle": 'tooltip',
name: "caso[acto_fecha]",
title: "Fecha del acto de violencia. "\
"Después no olvide presionar el botón Añadir Acto(s)."
%>
</div>
1 change: 1 addition & 0 deletions app/views/sivel2_gen/actos/_resto_enc_tabla.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="div-tabla-celda" style="width: 10em"><b>Fecha</b></div>

0 comments on commit 0274282

Please sign in to comment.