@structures = current_user.organisation.structures
@classrooms = current_user.organisation.classrooms
+ params[:date] ||= Date.today
+
unless params[:structure_id].blank?
@absences = @absences.joins(enfant: [:compte]).where(comptes: { structure_id: params[:structure_id] })
@classrooms = @classrooms.where(structure_id: params[:structure_id])
@prestation_types = current_user.organisation.prestation_types
@prestations = current_user.organisation.prestations
+ params[:date] ||= Date.today
+
unless params[:structure_id].blank?
@prestations = @prestations.joins(enfant: [:compte]).where(comptes: { structure_id: params[:structure_id] })
@classrooms = @classrooms.where(structure_id: params[:structure_id])
@classrooms = current_user.organisation.classrooms
@prestation_types = current_user.organisation.prestation_types
+ params[:date] ||= Date.today
+
unless params[:structure_id].blank?
@reservations = @reservations.joins(enfant: [:compte]).where(comptes: { structure_id: params[:structure_id] })
@classrooms = @classrooms.where(structure_id: params[:structure_id])
<%= bootstrap_form_with(model: absence, local: true) do |form| %>
<p>
<h2>
- <%= @absence.enfant.nom_et_prénom %>
+ <%= @absence.try(:enfant).try(:nom_et_prénom) %>
</h2>
</p>
--- /dev/null
+<%= bootstrap_form_with(url: absences_path, model: absence, method: :post, local: true) do |form| %>
+
+ <%= form.hidden_field :enfant_id %>
+ <%= form.date_select :début %>
+ <%= form.date_select :fin %>
+ <%= form.check_box :matin, custom: :switch %>
+ <%= form.check_box :midi, custom: :switch %>
+ <%= form.check_box :soir, custom: :switch %>
+ <br />
+
+ <div class="actions">
+ <%= form.submit %>
+ </div>
+<% end %>
</table>
<%= will_paginate @absences, renderer: WillPaginate::ActionView::BootstrapLinkRenderer %>
-<br>
+<br>
\ No newline at end of file
<td><%= compte.cp %></td>
<td><%= compte.ville %></td>
<td><%= compte.num_allocataire %></td>
- <td><%= compte.enfants_count %></td>
- <td><%= compte.mémo %></td>
+ <td><%= compte.enfants.pluck(:prénom).join(', ') %> (<%= compte.enfants_count %>)</td>
<td><% if policy(compte).edit? %>
<%= link_to edit_compte_path(compte) do %>
<i class="far fa-edit"></i>
<th>Ville</th>
<th>Num allocataire</th>
<th>Enfants</th>
- <th>Mémo</th>
<th colspan="2"></th>
</tr>
</thead>
</p>
<% if policy(@compte).edit? %>
- <%= link_to edit_compte_path(@compte), class: "text-primary" do %>
+ <%= link_to edit_compte_path(@compte), class: "btn text-primary" do %>
<i class="far fa-edit"></i> Editer
<% end %>
<% end %>
<tr>
<td><%= enfant.nom %></td>
<td><%= link_to enfant.prénom, enfant, class: "text-primary" %></td>
- <td><%= enfant.date_naissance %></td>
+ <td><%= l enfant.date_naissance %></td>
<td><%= enfant.classroom.nom %></td>
- <td><%= enfant.menuSP %></td>
- <td><%= enfant.menuALL %></td>
- <td><%= link_to 'Show', enfant %></td>
+ <td class="text-center"><i class="<%= enfant.menuSP ? "far fa-check-circle" : "" %>"></i></td>
+ <td class="text-center"><i class="<%= enfant.menuALL ? "far fa-check-circle" : "" %>"></i></td>
+ <td>
+ <% if policy(enfant).edit? %>
+ <%= link_to edit_enfant_path(enfant) do %>
+ <i class="far fa-edit"></i>
+ <% end %>
+ <% end %>
+ </td>
+ <td>
+ <% if policy(enfant).destroy? %>
+ <%= link_to enfant, method: :delete, data: { confirm: 'Etes-vous bien certain.e ???' } do %>
+ <i class="fas fa-trash-alt"></i>
+ <% end %>
+ <% end %>
+ </td>
</tr>
<% end %>
</table>
</p>
-<%= link_to new_enfant_path(compte_id: @compte), class: "text-primary" do %>
+<%= link_to new_enfant_path(compte_id: @compte), class: "btn text-primary" do %>
<i class="fas fa-plus-circle"></i> Ajouter un enfant
<% end %>
<td><%= l enfant.date_naissance %></td>
<td class="text-center"><i class="<%= enfant.menuSP ? "far fa-check-circle" : "" %>"></i></td>
<td class="text-center"><i class="<%= enfant.menuALL ? "far fa-check-circle" : "" %>"></i></td>
- <td><% if policy(enfant).edit? %>
- <%= link_to edit_compte_path(enfant) do %>
- <i class="far fa-edit"></i>
+ <td>
+ <% if policy(enfant).edit? %>
+ <%= link_to edit_enfant_path(enfant) do %>
+ <i class="far fa-edit"></i>
<% end %>
<% end %>
</td>
<td>
<% if policy(enfant).destroy? %>
- <%= link_to enfant, method: :delete, data: { confirm: 'Etes-vous bien certain.e ???' } do %>
- <i class="fas fa-trash-alt"></i>
- <% end %>
+ <%= link_to enfant, method: :delete, data: { confirm: 'Etes-vous bien certain.e ???' } do %>
+ <i class="fas fa-trash-alt"></i>
+ <% end %>
<% end %>
</td>
</tr>
<%= form.hidden_field :compte_id %>
<h3>Compte: <%= enfant.compte.civilité %> <%= enfant.compte.nom %></h3>
-
+ <hr />
+
<div class="row">
<div class="col"><%= form.select :classroom_id, options_from_collection_for_select(@classrooms, 'id', 'nom'), { label: "Classe" }, { class: "selectpicker" } %></div>
<div class="col"><%= form.text_field :nom, required: true %></div>
<h1>Ajouter Enfant</h1>
-<br />
<%= render 'form', enfant: @enfant %>
</table>
<% if policy(Absence).edit? %>
- <%= link_to new_absence_path(enfant_id: @enfant), class: "text-primary" do %>
+ <%= link_to new_absence_path(enfant_id: @enfant), class: 'btn text-primary', data: {toggle: "modal", target: "#myModal" } do %>
<i class="fas fa-plus-circle"></i> Ajouter une absence
<% end %>
<% end %>
</p>
<br />
+
+<!-- The Modal -->
+<div class="modal" id="myModal">
+ <div class="modal-dialog">
+ <div class="modal-content">
+
+ <!-- Modal Header -->
+ <div class="modal-header">
+ <h4 class="modal-title">Nouvelle Absence</h4>
+ <button type="button" class="close" data-dismiss="modal">×</button>
+ </div>
+
+ <!-- Modal body -->
+ <div class="modal-body">
+ <%= render 'absences/modal_form', absence: Absence.new(enfant_id: @enfant.id) %>
+ </div>
+ </div>
+ </div>
+</div>
<%= csp_meta_tag %>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_include_tag 'application' %>