extends includes/template.pug

block body
  if !isValid
    .s-empty-state.wmx4.p48
      != icons.Spots.SpotExpireXL
      p This QR code has expired.
      p Refresh the guild management page to generate a new one.

  else
    - let guild = discord.guilds.get(guild_id)

    .s-page-title.mb24
      h1.s-page-title--header= guild.name

    .d-flex.g16#form-container
      .fl-grow1
        h2.fs-headline1 Invite a Matrix user

        form.d-flex.gy16.fd-column(method="post" action=rel("/api/invite") hx-post=rel("/api/invite") hx-indicator="#invite-button" hx-select="#ok" hx-target="#form-container")
          .d-flex.gy4.fd-column
            label.s-label(for="mxid") Matrix ID
            input.fl-grow1.s-input.wmx3#mxid(name="mxid" required placeholder="@user:example.org")
          .d-flex.gy4.fd-column
            label.s-label(for="permissions") Permissions
            .s-select
              select#permissions(name="permissions")
                option(value="default") Default
                option(value="moderator") Moderator
                option(value="admin") Admin
          input(type="hidden" name="nonce" value=nonce)
          div
            button.s-btn.s-btn__filled#invite-button Invite
