scinote-web/app/views/reports/index.html.erb

112 lines
5.1 KiB
Text
Raw Normal View History

2018-07-19 23:56:42 +08:00
<% content_for :head do %>
<meta name="turbolinks-cache-control" content="no-cache">
<% end %>
<% provide(:head_title, t('projects.reports.index.head_title').html_safe) %>
<%= stylesheet_link_tag 'datatables' %>
2016-02-12 23:52:43 +08:00
<div class="content-pane">
<div id="content-reports-index">
<div class="row">
<div class="col-md-12">
<% if can_manage_reports?(current_team) %>
2018-07-19 23:56:42 +08:00
<%= link_to '#', remote: true, class: 'btn btn-primary', id: 'new-report-btn' do %>
<span class="fas fa-plus" aria-hidden="true"></span>
<span class="hidden-xs"><%=t "projects.reports.index.new" %></span>
<% end %>
<%= link_to "", remote: true, class: "btn btn-default", id: "edit-report-btn" do %>
<span class="fas fa-pencil-alt" aria-hidden="true"></span>
<span class="hidden-xs"><%=t "projects.reports.index.edit" %></span>
<% end %>
<%= link_to "", remote: true, class: "btn btn-default", id: "delete-reports-btn" do %>
<span class="fas fa-times" aria-hidden="true"></span>
<span class="hidden-xs"><%=t "projects.reports.index.delete" %></span>
<% end %>
<% end %>
</div>
</div>
<br />
<div class="row">
<div class="col-md-12">
<div class="reports-datatable">
<table id="reports-table"
class="table"
data-source="<%= reports_datatable_path(format: :json) %>">
<thead>
<tr>
<th id="select-all"><input name="select_all" type="checkbox"></th>
<th id="project-name"><%=t 'projects.reports.index.thead_project_name' %></th>
<th id="report-name"><%=t 'projects.reports.index.thead_name' %></th>
<th id="report-created-by"><%=t 'projects.reports.index.thead_created_by' %></th>
<th id="report-last-modified-by"><%=t 'projects.reports.index.thead_last_modified_by' %></th>
<th id="report-created-at"><%=t 'projects.reports.index.thead_created_at' %></th>
<th id="report-updated-at"><%=t 'projects.reports.index.thead_updated_at' %></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
2016-02-12 23:52:43 +08:00
</div>
<!-- Save report modal -->
<div class="modal" id="delete-reports-modal" tabindex="-1" role="dialog" aria-labelledby="delete-reports-modal-label">
<%= bootstrap_form_tag url: reports_destroy_path, method: :post, id: "delete-reports-form" do |f| %>
2016-02-12 23:52:43 +08:00
<input type="hidden" name="report_ids" id="report-ids">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="delete-reports-modal-label"><%=t "projects.reports.index.modal_delete.head_title" %></h4>
</div>
<div class="modal-body">
<%=t "projects.reports.index.modal_delete.message" %>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
<%= f.button t("projects.reports.index.modal_delete.delete"), class: "btn btn-danger", id: "confirm-delete-reports-btn", name: nil %>
2016-02-12 23:52:43 +08:00
</div>
</div>
</div>
<% end %>
</div>
2018-07-19 23:56:42 +08:00
<div class="modal" id="new-report-modal" tabindex="-1" role="dialog" aria-labelledby="create-reports-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="new-report-modal-label"><%=t "projects.reports.index.modal_new.head_title" %></h4>
</div>
<div class="modal-body">
2018-04-23 18:26:21 +08:00
<p><%=t "projects.reports.index.modal_new.message" %></p>
<div class="form-group">
<label><%=t "projects.reports.index.modal_new.projects" %></label>
<% if @visible_projects&.length > 0 %>
<select class="form-control selectpicker" data-abs-min-length="2" data-live-search="true">
<% @visible_projects.each do |project| %>
<option value="<%= project.path %>"><%= project.name %></option>
<% end %>
</select>
<% else %>
<p><%=t 'projects.reports.index.modal_new.no_projects' %></p>
<% end %>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
<button id="new-report-reports-btn"
class="btn btn-success"
data-new-report-path="<%= @visible_projects.first.path if @visible_projects.first %>"
<%= 'disabled' unless @visible_projects&.length > 0 %>
><%=t 'projects.reports.index.modal_new.create' %></button>
</div>
</div>
</div>
</div>
<%= javascript_include_tag("reports/reports_datatable") %>