mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
76 lines
3.6 KiB
Plaintext
76 lines
3.6 KiB
Plaintext
- owner_email = @enterprise&.owner&.email || ""
|
|
- full_permissions = (spree_current_user.admin? || spree_current_user == @enterprise&.owner)
|
|
|
|
.row
|
|
.three.columns.alpha
|
|
=f.label :owner_id, t('.owner')
|
|
- if full_permissions
|
|
%span.required *
|
|
= render partial: 'admin/shared/whats_this_tooltip', locals: {tooltip_text: t('.owner_tip')}
|
|
.eight.columns.omega
|
|
- if full_permissions
|
|
= f.hidden_field :owner_id, class: "select2 fullwidth", 'user-select' => 'Enterprise.owner', 'ng-model' => 'Enterprise.owner'
|
|
- else
|
|
= owner_email
|
|
|
|
.row
|
|
.three.columns.alpha
|
|
=f.label :user_ids, t('.notifications')
|
|
- if full_permissions
|
|
%span.required *
|
|
= render partial: 'admin/shared/whats_this_tooltip', locals: {tooltip_text: t('.contact_tip')}
|
|
.eight.columns.omega
|
|
- if full_permissions
|
|
%select.select2.fullwidth{ id: 'receives_notifications_dropdown', name: 'receives_notifications', "ng-model": 'receivesNotifications', "ng-init": "receivesNotifications = '#{@enterprise.contact.id}'" }
|
|
%option{ value: '{{user.id}}', "ng-repeat": 'user in Enterprise.users', "ng-selected": "user.id == #{@enterprise.contact.id}", "ng-hide": '!user.confirmed' }
|
|
{{user.email}}
|
|
- else
|
|
= @enterprise.contact.email
|
|
|
|
.row
|
|
.three.columns.alpha
|
|
=f.label :user_ids, t('.managers')
|
|
- if full_permissions
|
|
%span.required *
|
|
= render partial: 'admin/shared/whats_this_tooltip', locals: {tooltip_text: t('.managers_tip')}
|
|
.eight.columns.omega
|
|
- if full_permissions
|
|
%table.managers
|
|
%tr
|
|
%td
|
|
- # Ignore this input in the submit
|
|
= hidden_field_tag :ignored, nil, class: "select2 fullwidth", 'user-select' => 'newManager', 'ng-model' => 'newManager'
|
|
%td.actions
|
|
%tr.animate-repeat{ id: "manager-{{manager.id}}", "ng-repeat": 'manager in Enterprise.users' }
|
|
%td
|
|
= hidden_field_tag "enterprise[user_ids][]", nil, multiple: true, 'ng-value' => 'manager.id'
|
|
{{ manager.email }}
|
|
%i.confirmation.confirmed.fa.fa-check-circle{ "ofn-with-tip": t('.email_confirmed'), "ng-show": 'manager.confirmed' }
|
|
%i.confirmation.unconfirmed.fa.fa-exclamation-triangle{ "ofn-with-tip": t('.email_not_confirmed'), "ng-show": '!manager.confirmed' }
|
|
%i.role.contact.fa.fa-envelope-o{ "ofn-with-tip": t('.contact'), "ng-show": 'manager.id == receivesNotifications' }
|
|
%i.role.owner.fa.fa-star{ "ofn-with-tip": t('.owner'), "ng-show": 'manager.id == Enterprise.owner.id' }
|
|
%td.actions
|
|
%a{ class: "icon-trash no-text", "ng-click": 'removeManager(manager)', "ng-class": "{disabled: manager.id == Enterprise.owner.id || manager.id == receivesNotifications}" }
|
|
|
|
- else
|
|
- @enterprise.users.each do |manager|
|
|
= manager.email
|
|
%br
|
|
|
|
- if full_permissions
|
|
%form
|
|
.row
|
|
.three.columns.alpha
|
|
%label
|
|
= t('.invite_manager')
|
|
= render partial: 'admin/shared/whats_this_tooltip', locals: {tooltip_text: t('.invite_manager_tip')}
|
|
.eight.columns.omega
|
|
.row
|
|
%a.button{ "data-controller": "help-modal-link", "data-action": "click->help-modal-link#open", "data-help-modal-link-target-value": "invite-manager-modal" }
|
|
= t('.add_unregistered_user')
|
|
|
|
-# add to admin footer to avoid nesting invitation form inside enterprise form
|
|
- content_for :admin_footer do
|
|
= render HelpModalComponent.new(id: "invite-manager-modal", close_button: false) do
|
|
= render partial: 'admin/enterprises/form/add_new_unregistered_manager', locals: { error: nil, success: nil }
|