- content_for :page_title do
  = t(".title")

= render 'admin/shared/enterprises_sub_menu'

%div
  %h2= t(".connect")
  %br

  - if @account
    = t(".connected", uid: @account.uid)
    %br
    %br

    = t(".view_account")
    = link_to t(".les_communs_link"), "#{ Devise.omniauth_configs[:openid_connect].options[:issuer] }/account"
    %br
    %br
    = button_to t(".disconnect"), admin_oidc_setting_path(@account), method: :delete

    - if @account.refresh_token.blank?
      %br
      %br
      %p= t(".note_expiry")
      %br
      %br
      = button_to t(".refresh"),
        Spree::Core::Engine.routes.url_helpers.spree_user_openid_connect_omniauth_authorize_path(auth_type: "login"),
        data: { method: :post, "ujs-navigate": "false" }

  - else
    = t(".link_your_account")
    %br
    %br
    = button_to t(".link_account_button"),
      Spree::Core::Engine.routes.url_helpers.spree_user_openid_connect_omniauth_authorize_path(auth_type: "login"),
      data: { method: :post, "ujs-navigate": "false" }
