<% if content_for?(:ibox_title) %>
<%= yield :ibox_title %>
<% elsif is_action_edit? && @model.present?%>
<%= I18n.t("edit") %>
<%= @record.to_s %> - #<%= @record.id %>
<% elsif (is_action_create? || is_action_new?) && @model.present? %>
<%= I18n.t("new", model: I18n.t("model.#{@model.name.underscore}")) %>
<% elsif @record.present? && !@record.new_record? %>
<%= @record.to_s %>
#<%= @record.id %>
<% elsif @crud_helper.present? %>
<%= @crud_helper.subtitle(:index) %>
<%= @crud_helper.description(:index) %>
<% end %>
<% if @crud_helper.present? && (is_action_index? || is_action_query?) %>
<% @crud_helper.top_links.each do |link| %>
<% if link[:can].present? %>
<%= render_link(link,@clean_url) if self.instance_eval &link[:can] %>
<% else %>
<%= render_link(link,@clean_url) %>
<% end %>
<% end %>
<% if params[:associacao] %>
<% if @crud_helper.listing_fields.present? && should_listing?(@crud_helper, @model_permission) && should_listing_excel?(@crud_helper, @model_permission) %>
<%= link_to listing_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], q: params[:q], format: :xls), class: "btn btn-success btn-rounded" do %>
<%= I18n.t("devise.reports.excel").html_safe %>
<% end %>
<% end %>
<% else %>
<% if @crud_helper.listing_fields.present? && should_listing?(@crud_helper, @model) && should_listing_excel?(@crud_helper, @model) %>
<%= link_to listing_crud_path(model: @model.name.underscore, q: params[:q], format: :xls), class: "btn btn-success btn-rounded" do %>
<%= I18n.t("devise.reports.excel").html_safe %>
<% end %>
<% end %>
<% end %>
<% if @crud_helper.search_fields.present? %>
<% end %>
<% elsif is_action_show? %>
<% @crud_helper.actions_links.each do |name, options| %>
<% unless (options[:can].present? && !@record.instance_eval(&options[:can])) %>
<% if options[:url].present? %>
<% url = options[:url] %>
<% if options[:id] %>
<% url += options[:url].include?("?") ? "&id=#{@record.id}" : "?id=#{@record.id}" %>
<% else url.include?(":id") %>
<% url = url.gsub(":id", "#{@record.id}") %>
<% end %>
<% if options[:wiselink].present? && options[:wiselink] %>
<%= link_to t('name'), url, class: 'btn btn-success btn-xs pull-right m-l-xs', data: { push: 'partial', target: '#form' } %>
<% else %>
<%= link_to t(name), url, class: 'btn btn-success btn-xs pull-right m-l-xs' %>
<% end %>
<% elsif options[:partial].present? %>
<%= render options[:partial], record: @record, action: :show %>
<% end %>
<% end %>
<% end %>
<% if (@crud_helper.present? && @crud_helper.destroy_action) && should_destroy?(@crud_helper, @record) %>
<% if @crud_associacao.present? %>
<%= link_to I18n.t("destroy"), destroy_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-danger btn-xs pull-right m-l-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
<% else %>
<%= link_to I18n.t("destroy"), destroy_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-danger btn-xs pull-right m-l-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
<% end %>
<% end %>
<% if (@crud_helper.present? && @crud_helper.edit_action) && should_edit?(@crud_helper, @record) %>
<% if @crud_associacao.present? %>
<%= link_to I18n.t("edit"), edit_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs pull-right m-l-xs', data: {push: 'partial', target: '#form'} %>
<% else %>
<%= link_to I18n.t("edit"), edit_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs pull-right m-l-xs', data: {push: 'partial', target: '#form'} %>
<% end %>
<% end %>
<% if @crud_helper.printing_fields.present? && can_print_pdf?(@crud_helper, @record) %>
<% if @crud_associacao.present? %>
<%= link_to printing_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q], format: :pdf), class: "btn btn-success btn-xs pull-right m-l-xs", target: "_blank" do %>
<%= I18n.t("devise.printing").html_safe %>
<% end %>
<% else %>
<%= link_to printing_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q], format: :pdf), class: "btn btn-success btn-xs pull-right m-l-xs", target: "_blank" do %>
<%= I18n.t("devise.printing").html_safe %>
<% end %>
<% end %>
<% end %>
<% end %>