<DModalBody @title={{this.modalTitle}}>
  <ConditionalLoadingSpinner @condition={{this.loadingUser}}>
    {{#if this.errorMessage}}
      <div class="alert alert-error">{{this.errorMessage}}</div>
    {{/if}}

    {{#if this.canPenalize}}
      <div class="penalty-duration-controls">
        {{#if (eq this.penaltyType "suspend")}}
          <FutureDateInput
            @class="suspend-until"
            @label="admin.user.suspend_duration"
            @clearable={{false}}
            @input={{this.penalizeUntil}}
            @onChangeInput={{action (mut this.penalizeUntil)}}
          />
        {{else if (eq this.penaltyType "silence")}}
          <FutureDateInput
            @class="silence-until"
            @label="admin.user.silence_duration"
            @clearable={{false}}
            @input={{this.penalizeUntil}}
            @onChangeInput={{action (mut this.penalizeUntil)}}
          />
        {{/if}}
      </div>

      {{#if (eq this.penaltyType "suspend")}}
        <div class="penalty-reason-visibility">
          {{#if this.siteSettings.hide_suspension_reasons}}
            {{html-safe (i18n "admin.user.suspend_reason_hidden_label")}}
          {{else}}
            {{html-safe (i18n "admin.user.suspend_reason_label")}}
          {{/if}}
        </div>
      {{/if}}

      <AdminPenaltyReason
        @penaltyType={{this.penaltyType}}
        @reason={{this.reason}}
        @message={{this.message}}
      />

      {{#if this.postId}}
        <AdminPenaltyPostAction
          @postId={{this.postId}}
          @postAction={{this.postAction}}
          @postEdit={{this.postEdit}}
        />
      {{/if}}

      {{#if this.user.similar_users}}
        <AdminPenaltySimilarUsers
          @penaltyType={{this.penaltyType}}
          @user={{this.user}}
          @selectedUserIds={{this.otherUserIds}}
        />
      {{/if}}

    {{else}}
      {{#if (eq this.penaltyType "suspend")}}
        <div class="cant-suspend">{{i18n "admin.user.cant_suspend"}}</div>
      {{else if (eq this.penaltyType "silence")}}
        <div class="cant-silence">{{i18n "admin.user.cant_silence"}}</div>
      {{/if}}
    {{/if}}
    <div class="penalty-history">{{html-safe this.penaltyHistory}}</div>
  </ConditionalLoadingSpinner>
</DModalBody>

<div class="modal-footer">
  <DButton
    @class="btn-danger perform-penalize"
    @action={{this.penalizeUser}}
    @disabled={{this.submitDisabled}}
    @icon="ban"
    @label={{this.buttonLabel}}
  />
  <DModalCancel @close={{route-action "closeModal"}} />
  <ConditionalLoadingSpinner @condition={{this.loading}} @size="small" />
</div>