<div class="row justify-content-center">
  <div class="col-md-4">
    <div class="card shadow-sm">
      <div class="card-body">
        <%= errors_summary_for @user %>

        <%= bootstrap_form_with model: @user, url: profile_path, local: true do |form| %>
          <div class="text-center">
            <% if @user.avatar.attached? %>
              <%= image_tag(profile_variant(@user.avatar), class: "rounded-circle", alt: "User Avatar") %>
            <% else %>
              <%= text_avatar(@user, size: 6.25) %>
            <% end %>
            <p class="text-muted mt-2">
              <% # TODO: Use null object pattern %>
              <% if Current.account %>
                <%= @user.role_for(Current.account).to_s.titleize %>
            <% end %>
            </p>
          </div>

          <div class="mt-3">
            <%= form.file_field :avatar, accept: "image/*", direct_upload: true %>
            <%= form.text_field :first_name %>
            <%= form.text_field :last_name %>
            <%= form.time_zone_select :time_zone, nil, {default: @user.time_zone}, class: "form-control custom-select" %>
          </div>

          <div class="pt-3">
            <%= form.submit t("profiles.form.submit"), class: "btn btn-block btn-primary", data: { disable_with: t("shared.disable_with") } %>
          </div>
        <% end %>
      </div>
    </div>
  </div>
</div>
