mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
98 lines
4.1 KiB
Plaintext
98 lines
4.1 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 *
|
|
%div{'ofn-with-tip' => t('.owner_tip')}
|
|
%a= t('admin.whats_this')
|
|
.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 *
|
|
%div{'ofn-with-tip' => t('.contact_tip')}
|
|
%a= t('admin.whats_this')
|
|
.eight.columns.omega
|
|
- if full_permissions
|
|
%select.select2.fullwidth{id: 'receives_notifications_dropdown', name: 'receives_notifications', ng: {model: 'receivesNotifications', init: "receivesNotifications = '#{@enterprise.contact.id}'"}}
|
|
%option{ng: {repeat: 'user in Enterprise.users', selected: "user.id == #{@enterprise.contact.id}", hide: '!user.confirmed'}, value: '{{user.id}}'}
|
|
{{user.email}}
|
|
- else
|
|
= @enterprise.contact.email
|
|
|
|
.row
|
|
.three.columns.alpha
|
|
=f.label :user_ids, t('.managers')
|
|
- if full_permissions
|
|
%span.required *
|
|
%div{'ofn-with-tip' => t('.managers_tip')}
|
|
%a= t('admin.whats_this')
|
|
.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{ ng: {click: 'removeManager(manager)', class: "{disabled: manager.id == Enterprise.owner.id || manager.id == receivesNotifications}"}, :class => "icon-trash no-text" }
|
|
|
|
- else
|
|
- @enterprise.users.each do |manager|
|
|
= manager.email
|
|
%br
|
|
|
|
- if full_permissions
|
|
%form
|
|
.row
|
|
.three.columns.alpha
|
|
%label
|
|
= t('.invite_manager')
|
|
%div{'ofn-with-tip' => t('.invite_manager_tip')}
|
|
%a= t('admin.whats_this')
|
|
.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
|
|
%div{ng: {app: 'admin.enterprises', controller: 'enterpriseCtrl'}}
|
|
|
|
.margin-bottom-30.text-center
|
|
.text-big
|
|
= t('js.admin.modals.invite_title')
|
|
|
|
%p.alert-box.ok{ng: {show: 'invite_success'}}
|
|
{{invite_success}}
|
|
|
|
%p.alert-box.error{ng: {show: 'invite_errors'}}
|
|
{{invite_errors}}
|
|
|
|
%input#invite_email.fullwidth.margin-bottom-20{ng: {model: 'newUser'}}
|
|
|
|
.margin-bottom-20.text-center
|
|
%button.text-center.margin-top-10{ng: {show: '!invite_success', click: 'inviteManager()'}}
|
|
= t('js.admin.modals.invite')
|
|
%button.text-center.margin-top-10{"data-action": "click->help-modal#close", ng: {show: 'invite_success', click: 'resetModal();'}}
|
|
= t('js.admin.modals.close')
|