$newline never

$# SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <vaupel.sarah@campus.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>,Winnie Ros <winnie.ros@campus.lmu.de>
$#
$# SPDX-License-Identifier: AGPL-3.0-or-later

$maybe subCId <- mcid
  $maybe wdgt <- correctionWdgt
    <section>
      <h2>_{MsgTableRating}

      $maybe warning <- correctionVisibleWarnWidget
        ^{warning}

      ^{wdgt}

  $if subUsersVisible
    <section>
      <h2>
        _{MsgSubmissionUserTable}

      ^{maybeVoid multipleSubmissionWarnWidget}

      $if not (null subUsers)
        <div .scrolltable>
          <table .table .table--striped .table--hover>
            <thead>
              <tr .table__row .table__row--head>
                <th .table__th>
                  <div .table__td-content>
                    _{MsgSubmissionUserDisplayName}
                $if isLecturer
                  <th .table__th>
                    <div .table__td-content>
                      _{MsgSubmissionUserMatriculation}
                <th .table__th>
                  <div .table__td-content>
                    _{MsgSubmissionUserEmail}
                $if doAuthorshipStatements
                  <th .table__th>
                    <div .table__td-content>
                      ^{simpleLinkI MsgSubmissionUserAuthorshipStatementState (CSubmissionR tid ssh csh shn subCId SubAuthorshipStatementsR)}
                      ^{iconTooltip asStatusExplainWdgt Nothing True}
            <tbody>
              $forall subUser <- subUsers
                $case subUser
                  $of Left email
                    <tr .table__row>
                      <td .table__td>
                      $if isLecturer
                        <td .table__td>
                      <td .table__td>
                        <div .table__td-content .email>
                          <a href="mailto:#{email}">
                            #{email}
                      $if isLecturer && doAuthorshipStatements
                        <td .table__td>
                  $of Right (uCId, User{userDisplayName, userSurname, userEmail, userMatrikelnummer}, stmt)
                    <tr .table__row>
                      <td .table__td>
                        <div .table__td-content>
                          ^{simpleLink (nameWidget userDisplayName userSurname) (CourseR tid ssh csh (CUserR uCId))}
                      $if isLecturer
                        <td .table__td>
                          <div .table__td-content>
                            $maybe matriculation <- userMatrikelnummer
                              #{matriculation}
                      <td .table__td>
                        <div .table__td-content .email>
                          <a href="mailto:#{userEmail}">
                            #{userEmail}
                      $if doAuthorshipStatements
                        <td .table__td .heated style="--hotness: #{boolHeat (stmt /= ASExists)}">
                          <div .table__td-content>
                            _{stmt}
      $else
        ^{notification NotificationBroad =<< messageIconI Error IconSubmissionNoUsers MsgSubmissionNoUsers}

  <section>
    $case sheetSubmissionMode
      $of SubmissionMode False Nothing
        <p>
          _{MsgSubmissionNoUploadExpected}
      $of _
        <h2>
          $if filesCorrected
            _{MsgSubmissionFilesCorrected}
          $else
            _{MsgSubmissionFiles}
        <p>
          $if showCorrection
            $maybe url <- urlArchive
              <a href=#{url}>_{MsgSubmissionArchiveCorrected}
            \ (
            $maybe url <- urlOriginal
              <a href=#{url}>_{MsgSubmissionOriginal}
            )
          $else
            $maybe url <- urlOriginal
              <a href=#{url}>_{MsgSubmissionArchive}

        $maybe fileTable <- mFileTable
          ^{fileTable}

    $if maySubmit && not (null lastEdits)
      <h3>_{MsgTableLastEdit}
      <ul>
        $forall (mbName,time) <- lastEdits
          $maybe name <- mbName
            <li>_{MsgEditedBy name time}
          $nothing
            <li>#{time}

  $if maySubmit
    <section>
      <h2>_{MsgSubmissionReplace}
      ^{formWidget}
$nothing
  ^{formWidget}
