2018-07-19 23:56:42 +08:00
|
|
|
<% content_for :head do %>
|
|
|
|
<meta name="turbolinks-cache-control" content="no-cache">
|
|
|
|
<% end %>
|
|
|
|
|
2018-04-18 22:47:52 +08:00
|
|
|
<% provide(:head_title, t('projects.reports.index.head_title').html_safe) %>
|
|
|
|
<%= stylesheet_link_tag 'datatables' %>
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-05-08 22:33:42 +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 %>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-plus" aria-hidden="true"></span>
|
2018-05-08 22:33:42 +08:00
|
|
|
<span class="hidden-xs"><%=t "projects.reports.index.new" %></span>
|
|
|
|
<% end %>
|
|
|
|
<%= link_to "", remote: true, class: "btn btn-default", id: "edit-report-btn" do %>
|
2018-05-22 22:55:58 +08:00
|
|
|
<span class="fas fa-pencil-alt" aria-hidden="true"></span>
|
2018-05-08 22:33:42 +08:00
|
|
|
<span class="hidden-xs"><%=t "projects.reports.index.edit" %></span>
|
|
|
|
<% end %>
|
|
|
|
<%= link_to "", remote: true, class: "btn btn-default", id: "delete-reports-btn" do %>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-times" aria-hidden="true"></span>
|
2018-05-08 22:33:42 +08:00
|
|
|
<span class="hidden-xs"><%=t "projects.reports.index.delete" %></span>
|
|
|
|
<% end %>
|
2018-04-18 22:47:52 +08:00
|
|
|
<% end %>
|
2018-05-08 22:33:42 +08:00
|
|
|
</div>
|
2018-04-18 22:47:52 +08:00
|
|
|
</div>
|
2018-05-08 22:33:42 +08:00
|
|
|
<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>
|
2018-04-18 22:47:52 +08:00
|
|
|
</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">
|
2018-04-18 22:47:52 +08:00
|
|
|
<%= 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">×</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>
|
2018-04-25 19:57:12 +08:00
|
|
|
<%= 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">
|
2018-04-18 22:47:52 +08:00
|
|
|
<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">×</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>
|
2018-04-20 17:57:52 +08:00
|
|
|
<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 %>
|
2018-04-25 19:57:12 +08:00
|
|
|
</div>
|
2018-04-18 22:47:52 +08:00
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2018-04-25 19:57:12 +08:00
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
|
2018-04-18 22:47:52 +08:00
|
|
|
<button id="new-report-reports-btn"
|
2018-04-25 19:57:12 +08:00
|
|
|
class="btn btn-success"
|
2018-04-18 22:47:52 +08:00
|
|
|
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") %>
|