- return unless local_assigns.fetch(:license)

- if license.restricted?(:active_user_count)
  - restricted = license.restrictions[:active_user_count]
  - licensed_users = number_with_delimiter(restricted)
- else
  - licensed_users = _('Unlimited')

- max_user_count = maximum_user_count

- if restricted && max_user_count > restricted
  - users_over_license = max_user_count - restricted
- else
  - users_over_license = 0

- true_up_url = 'https://about.gitlab.com/license-faq/'
- true_up_link_start = '<a href="%{url}">'.html_safe % { url: true_up_url }
- link_end = '</a>'.html_safe

.license-panel.gl-mt-3
  .d-flex.pb-2
    .col-sm-6.d-flex.pl-0
      .info-well.dark-well
        .well-segment.well-centered
          %h3.center
            = _('Users in License:')
            = licensed_users
          %hr
          - if @license.will_expire?
            = _('Your license is valid from')
            %strong<>
              = _(' %{start} to %{end}') % { start: @license.starts_at, end: @license.expires_at }
            \.
          = _('The %{link_start}true-up model%{link_end} allows having more users, and additional users will incur a retroactive charge on renewal.').html_safe % { link_start: true_up_link_start, link_end: link_end }
          = seats_calculation_message(@license)
    .col-sm-6.d-flex.pr-0
      .info-well.dark-well
        .well-segment.well-centered
          %h3.center
            = _('Active Users:')
            = number_with_delimiter current_active_user_count
          %hr
            %p
            = _('This is the number of currently active users on your installation, and this is the minimum number you need to purchase when you renew your license.')
  .d-flex.pb-3
    .col-sm-6.d-flex.pl-0
      .info-well.dark-well.flex-fill
        .well-segment.well-centered
          %h3.center
            = _('Maximum Users:')
            = number_with_delimiter max_user_count
          %hr
            = _('This is the highest peak of users on your installation since the license started.')
    .col-sm-6.d-flex.pr-0
      .info-well.dark-well
        .well-segment.well-centered
          %h3.center
            = _('Users over License:')
            = number_with_delimiter users_over_license
          %hr
            - support_link_start = '<a href="%{url}">'.html_safe % { url: ::EE::CUSTOMER_SUPPORT_URL }
            = _('The %{true_up_link_start}true-up model%{link_end} has a retroactive charge for these users at the next renewal. If you want to update your license sooner to prevent this, %{support_link_start}please contact our Support team%{link_end}.').html_safe % { support_link_start: support_link_start, true_up_link_start: true_up_link_start, link_end: link_end }
