SU2-7 | Добавление модели Report с поддержкой загрузки файлов, обновление контроллера и представления для обработки отчетов, а также создание миграций для таблицы отчетов и активного хранилища.
This commit is contained in:
@@ -1,17 +1,25 @@
|
||||
<!-- app/views/reports/index.html.erb -->
|
||||
<div style="max-width: 500px; margin: 50px auto; padding: 20px;">
|
||||
<h1>Загрузка отчётов по ИНН</h1>
|
||||
<h1>Загрузка отчётов по ИНН</h1>
|
||||
|
||||
<% if notice %>
|
||||
<p style="color: green;"><%= notice %></p>
|
||||
<% end %>
|
||||
<% if notice %>
|
||||
<p style="color: green;"><%= notice %></p>
|
||||
<% end %>
|
||||
|
||||
<%= form_with url: reports_path, method: :post, local: true do |f| %>
|
||||
<div style="margin-bottom: 15px;">
|
||||
<%= f.label :inn, "Введите ИНН:" %>
|
||||
<%= f.text_field :inn, placeholder: "1234567890", required: true, style: "width: 100%; padding: 8px;" %>
|
||||
</div>
|
||||
<%= form_with url: reports_path, method: :post, local: true do |f| %>
|
||||
<%= f.label :inn, "Введите ИНН:" %>
|
||||
<%= f.text_field :inn, required: true %>
|
||||
<%= f.submit "Загрузить отчёт" %>
|
||||
<% end %>
|
||||
|
||||
<%= f.submit "Загрузить отчёт", style: "padding: 10px 20px; cursor: pointer;" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<h2>История загрузок</h2>
|
||||
<% @reports.each do |report| %>
|
||||
<div style="border: 1px solid #ccc; padding: 10px; margin: 10px 0;">
|
||||
<p>ИНН: <%= report.inn %> | Статус: <%= report.status %></p>
|
||||
<% if report.files.attached? %>
|
||||
<p>Файлы:</p>
|
||||
<% report.files.each do |file| %>
|
||||
<%= link_to file.filename, rails_blob_path(file, disposition: "attachment") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user