$newline never

$# SPDX-FileCopyrightText: 2022 Steffen Jost <jost@tcs.ifi.lmu.de>
$#
$# SPDX-License-Identifier: AGPL-3.0-or-later

$if null quals 
  _{MsgQualificationUserNone}
$else   
  $forall (Entity _ quali, mbQualUsr, mbLmsUsr, validity) <- quals
    <section>
      <div .container>
        <h2>
          #{qualificationShorthand quali} #
          #{statusQualificationBlock (E.unValue validity)} #
          #{qualificationName quali} (#{qualificationSchool quali})
        <div .container>
          <dl .deflist>
            $maybe (Entity quid qualUsr) <- mbQualUsr    
              <dt .deflist__dt>_{MsgLmsQualificationValidUntil}
              <dd .deflist__dd>^{formatTimeW SelFormatDate (qualificationUserValidUntil qualUsr)}
                $if not (qualificationUserScheduleRenewal qualUsr)
                  \ #{icon IconNoNotification}
              $maybe qblock <- Map.lookup quid qblocks
                <dt .deflist__dt>_{MsgTableQualificationBlockedDue}
                <dd .deflist__dd>
                  <ul>
                    $forall (Entity _ block, blockerDN) <- qblock
                      <li>
                        #{iconQualificationBlock (view _qualificationUserBlockUnblock block)}
                        \ #{view _qualificationUserBlockReason  block} #
                        $maybe bdn <- E.unValue blockerDN                          
                          ^{editedByW SelFormatDateTime (view _qualificationUserBlockFrom block) bdn}
                        $nothing 
                          ^{formatTimeW SelFormatDateTime (view _qualificationUserBlockFrom block)}
              <dt .deflist__dt>_{MsgTableQualificationLastRefresh}
              <dd .deflist__dd>^{formatTimeW SelFormatDate (qualificationUserLastRefresh qualUsr)}
              <dt .deflist__dt>_{MsgTableQualificationFirstHeld}
              <dd .deflist__dd>^{formatTimeW SelFormatDate (qualificationUserFirstHeld qualUsr)}

            $maybe (Entity _ lmsUsr) <- mbLmsUsr    
              <dt .deflist__dt>_{MsgTableLmsStarted}
              <dd .deflist__dd>^{formatTimeW SelFormatDateTime (lmsUserStarted lmsUsr)}
              $maybe _ <- lmsUserStatus lmsUsr
                <dt .deflist__dt>_{MsgTableLmsStatus}
                <dd .deflist__dd>^{lmsUserStatusWidget True Nothing lmsUsr}
              <dt .deflist__dt>_{MsgTableLmsIdent}
              <dd .deflist__dd>
                <a href=@{LmsIdentR (qualificationSchool quali) (qualificationShorthand quali) (lmsUserIdent lmsUsr)}>
                  <span .email>
                    #{getLmsIdent (lmsUserIdent lmsUsr)}
              <dt .deflist__dt>_{MsgTableLmsPin}
              <dd .deflist__dd >
                <span .email>
                  #{lmsUserPin lmsUsr}
                <br>
                ^{formatTimeW SelFormatDateTime (lmsUserDatePin lmsUsr)} 
                $if lmsUserResetPin lmsUsr
                  \ #{icon IconReset}
              $maybe ts <- lmsUserReceived lmsUsr
                <dt .deflist__dt>_{MsgTableLmsReceived}
                <dd .deflist__dd>^{formatTimeW SelFormatDateTime ts}
              $maybe ts <- lmsUserNotified lmsUsr
                <dt .deflist__dt>_{MsgTableLmsNotified}
                <dd .deflist__dd>^{formatTimeW SelFormatDateTime ts}
              $maybe ts <- lmsUserEnded lmsUsr
                <dt .deflist__dt>_{MsgTableLmsEnded}
                <dd .deflist__dd>^{formatTimeW SelFormatDateTime ts}
            $nothing 
                <dt .deflist__dt>_{MsgLmsInactive}
                <dd .deflist__dd> 
