Merge pull request #2008 from betagouv/fix_demande_view

ManagerDemandeView: does not bug when there is no demand
This commit is contained in:
gregoirenovel 2018-05-31 13:52:14 +02:00 committed by GitHub
commit 9c57a7f786
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,54 +8,58 @@
</h1> </h1>
</header> </header>
<section class="main-content__body main-content__body--flush"> <% if @pending_demandes.present? %>
<table> <section class="main-content__body main-content__body--flush">
<thead> <table>
<% keys = @pending_demandes.first.keys %> <thead>
<tr> <% keys = @pending_demandes.first.keys %>
<% keys.each do |key| %>
<th class="cell-label cell-label--string cell-label--false" scope="col" role="columnheader" aria-sort="none">
<%= key %>
</th>
<% end %>
<th class="cell-label cell-label--string cell-label--false" scope="col" role="columnheader" aria-sort="none">
</th>
</thead>
<tbody>
<% @pending_demandes.each do |demande| %>
<tr> <tr>
<% keys.each do |key| %> <% keys.each do |key| %>
<td class="cell-data cell-data--string"> <th class="cell-label cell-label--string cell-label--false" scope="col" role="columnheader" aria-sort="none">
<%= demande[key] %> <%= key %>
</td> </th>
<% end %> <% end %>
<td class="cell-data cell-data--string" style="text-align: center;"> <th class="cell-label cell-label--string cell-label--false" scope="col" role="columnheader" aria-sort="none">
<%= form_tag(manager_demandes_create_administrateur_path) do -%> </th>
<%= select_tag "stage_id", </thead>
options_for_select({ <tbody>
"administration centrale" => Pipedrive::DealAdapter::PIPEDRIVE_ADMIN_CENTRAL_STOCK_STAGE_ID, <% @pending_demandes.each do |demande| %>
"région" => Pipedrive::DealAdapter::PIPEDRIVE_REGIONS_STOCK_STAGE_ID, <tr>
"préfecture" => Pipedrive::DealAdapter::PIPEDRIVE_PREFECTURES_STOCK_STAGE_ID, <% keys.each do |key| %>
"département" =>Pipedrive::DealAdapter::PIPEDRIVE_DEPARTEMENTS_STOCK_STAGE_ID, <td class="cell-data cell-data--string">
"commune" => Pipedrive::DealAdapter::PIPEDRIVE_COMMUNES_STOCK_STAGE_ID, <%= demande[key] %>
"organisme" => Pipedrive::DealAdapter::PIPEDRIVE_ORGANISMES_STOCK_STAGE_ID </td>
}), <% end %>
style: 'margin-bottom: 20px; width: inherit;' %> <td class="cell-data cell-data--string" style="text-align: center;">
<%= form_tag(manager_demandes_create_administrateur_path) do -%>
<%= select_tag "stage_id",
options_for_select({
"administration centrale" => Pipedrive::DealAdapter::PIPEDRIVE_ADMIN_CENTRAL_STOCK_STAGE_ID,
"région" => Pipedrive::DealAdapter::PIPEDRIVE_REGIONS_STOCK_STAGE_ID,
"préfecture" => Pipedrive::DealAdapter::PIPEDRIVE_PREFECTURES_STOCK_STAGE_ID,
"département" =>Pipedrive::DealAdapter::PIPEDRIVE_DEPARTEMENTS_STOCK_STAGE_ID,
"commune" => Pipedrive::DealAdapter::PIPEDRIVE_COMMUNES_STOCK_STAGE_ID,
"organisme" => Pipedrive::DealAdapter::PIPEDRIVE_ORGANISMES_STOCK_STAGE_ID
}),
style: 'margin-bottom: 20px; width: inherit;' %>
<%= hidden_field_tag 'email', demande[:email] %> <%= hidden_field_tag 'email', demande[:email] %>
<%= hidden_field_tag 'person_id', demande[:person_id] %> <%= hidden_field_tag 'person_id', demande[:person_id] %>
<%= submit_tag 'Créer' %> <%= submit_tag 'Créer' %>
<% end -%> <% end -%>
</td> </td>
<td class="cell-data cell-data--string" style="text-align: center;"> <td class="cell-data cell-data--string" style="text-align: center;">
<%= button_to('Refuser', <%= button_to('Refuser',
manager_demandes_refuse_administrateur_path, manager_demandes_refuse_administrateur_path,
params: { person_id: demande[:person_id], email: demande[:email] }, params: { person_id: demande[:person_id], email: demande[:email] },
style: 'background-color: #FFFFFF; color: #293f54; border: 1px solid #dfe0e1') %> style: 'background-color: #FFFFFF; color: #293f54; border: 1px solid #dfe0e1') %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
</section> </section>
<% else %>
<h1>Aucune demande</h1>
<% end %>