ask/app/views/admin/asks/_index.html.erb

68 lines
2.5 KiB
Plaintext

<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<% tmp = f.to_s.gsub(/ask\./,'') %>
<% if @ask_setting.default_setting[tmp].nil? || @ask_setting.default_setting[tmp] %>
<%= thead(f) %>
<% end %>
<% end %>
</tr>
</thead>
<tbody>
<%
situation_class_relation = {
"is_waiting"=>"label-important",
"is_processed"=>"label-warning",
"is_referral"=>"",
"is_published"=>"label-success"
}
situation_trans = AskTicketStatus.all.map{|a| [a.key, a.title]}.to_h
%>
<% @askquestions.each do |b| %>
<tr>
<td>
<span class='label <%=situation_class_relation[b.situation]%>'><%= situation_trans[b.situation] %></span>
</td>
<td>
<%= b.category.title rescue 'category not set' %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(b) %>
<li><a href="/<%= I18n.locale %>/admin/asks/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/asks/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
<li><a href="/<%= I18n.locale %>/admin/asks/<%=b.id.to_s%>/print" target="_blank"><%= t('ask.print') %></a></li>
</ul>
</div>
</td>
<td>
<% if b.situation == 'is_published' %>
<%= link_to b.title,((Page.where(:module=>'ask').first.url+"?item=#{b.id}") rescue "javascript:alert('#{t('ask.no_index_page')}')") %>
<% else %>
<%= b.title %>
<% end %>
</td>
<% if @ask_setting.default_setting['name'].nil? || @ask_setting.default_setting['name'] %>
<td>
<%= b.name %>
</td>
<% end %>
<% if @ask_setting.default_setting['phone'] %>
<td><%= b.phone %></td>
<% end %>
<% if @ask_setting.default_setting['appointment'] %>
<td><%= b.appointment.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
<% end %>
<td><%= b.created_at.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
<td><%= b.ip %></td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@askquestions), class: "pagination pagination-centered"
end
%>