%h2.group-title Anhöriga
- if @refugee.relationships.empty? && @refugee.inverse_relationships.empty?
  = "Har inte angivits som anhörig till någon annan i systemet"

- if @refugee.relationships.present?
  %h3= "#{@refugee.name} är anhörig till:"
  %ul.related
    - @refugee.relationships.each  do |r|
      %li
        = link_to r.related.name, refugee_path(r.related)
        = "(#{r.type_of_relationship.name})"

.actions
  - if can? :edit, @refugee
    = link_to "Ny anhörig", new_refugee_relationship_path(@refugee), class: "btn btn-default btn-sm"
    = link_to "Redigera anhöriga", refugee_relationships_path(@refugee), class: "btn btn-default btn-sm"

- if @refugee.inverse_relationships.present?
  %h3= "#{@refugee.name} är uppgiven som anhörig av:"
  %ul.related
    - @refugee.inverse_relationships.each  do |r|
      %li
        = link_to r.refugee.name, refugee_path(r.refugee)
        = "(#{r.type_of_relationship.name})"


= show_attribute('refugee.other_relateds', @refugee.other_relateds)

%h2.group-title Anhöriga
- no_relatives = @refugee.relationships.empty? && @refugee.inverse_relationships.empty?
- if no_relatives
  = "Har inte angivits som anhörig till någon annan i systemet"

- if @refugee.relationships.present?
  %h3= "#{@refugee.name} är anhörig till:"
  %ul.related
    - @refugee.relationships.each  do |r|
      %li
        = link_to r.related.name, refugee_path(r.related)
        = "(#{r.type_of_relationship.name})"

.actions
  - if can? :edit, @refugee
    = link_to "Ny anhörig", new_refugee_relationship_path(@refugee), class: "btn btn-default btn-sm"
    - unless no_relatives
      = link_to "Redigera anhöriga", refugee_relationships_path(@refugee), class: "btn btn-default btn-sm"

- if @refugee.inverse_relationships.present?
  %h3= "#{@refugee.name} är uppgiven som anhörig av:"
  %ul.related
    - @refugee.inverse_relationships.each  do |r|
      %li
        = link_to r.refugee.name, refugee_path(r.refugee)
        = "(#{r.type_of_relationship.name})"


= show_attribute('refugee.other_relateds', @refugee.other_relateds)

Hide button when no relatives are avialable
Hide button when no relatives are avialable
