mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-08 03:10:20 +00:00
55 lines
2.1 KiB
Plaintext
55 lines
2.1 KiB
Plaintext
- full_permissions = (spree_current_user.admin? || spree_current_user == @enterprise&.owner)
|
|
|
|
.row
|
|
= t '.description'
|
|
|
|
- if full_permissions && @enterprise.users.count > 0
|
|
- enterprise_role_ids_by_user_id = @enterprise.enterprise_roles.pluck(:user_id, :id).to_h
|
|
|
|
%table.managers
|
|
%thead
|
|
%tr
|
|
%th= t('.manager')
|
|
%th.center
|
|
= t('.owner')
|
|
= render AdminTooltipComponent.new(text: t('.owner_tip'), link_text: %[<i class="fa fa-question-circle"></i>].html_safe, link: nil)
|
|
%th.center
|
|
= t('.contact')
|
|
= render AdminTooltipComponent.new(text: t('.contact_tip'), link_text: %[<i class="fa fa-question-circle"></i>].html_safe, link: nil)
|
|
%tbody
|
|
- @enterprise.users.each do |user|
|
|
- contact = user.id == @enterprise.contact&.id
|
|
- owner = user.id == @enterprise.owner&.id
|
|
%tr{ id: "manager-#{user.id}" }
|
|
%td
|
|
= user.email
|
|
|
|
- if user.confirmed?
|
|
%i.confirmation.confirmed.fa.fa-check-circle{ "ofn-with-tip": t('.email_confirmed') }
|
|
- else
|
|
%i.confirmation.unconfirmed.fa.fa-exclamation-triangle{ "ofn-with-tip": t('.email_not_confirmed') }
|
|
|
|
%td.center
|
|
- if user.confirmed?
|
|
= f.label :owner_id, t(".set_as_owner", email: user.email), class: "sr-only", value: user.id
|
|
= f.radio_button :owner_id, user.id
|
|
%td.center
|
|
- if user.confirmed?
|
|
= f.label :owner_id, t(".set_as_contact", email: user.email), class: "sr-only", value: user.id
|
|
= f.radio_button :contact_id, user.id
|
|
%td.actions
|
|
- if !owner && !contact
|
|
= link_to_delete user, no_text: true, url: admin_enterprise_role_path(id: enterprise_role_ids_by_user_id[user.id])
|
|
- else
|
|
%a{ class: "icon-trash no-text disabled" }
|
|
|
|
%a.button{ href: "#{new_admin_enterprise_user_invitation_path(@enterprise)}", data: { turbo_stream: true, turbo: true } }
|
|
%i.icon-plus
|
|
= t('.invite_manager')
|
|
%br
|
|
|
|
- else
|
|
- @enterprise.users.each do |manager|
|
|
= manager.email
|
|
%br
|