Skip to content

Commit

Permalink
Merge pull request #251 from vtfk/remove-status
Browse files Browse the repository at this point in the history
Fjern status
  • Loading branch information
MatsAnd authored Feb 23, 2021
2 parents 2cac828 + f16a35b commit dec966c
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 36 deletions.
6 changes: 0 additions & 6 deletions src/pages/ActivityLog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { PreviewDocumentModal } from '../../containers/PreviewDocumentModal'

import './styles.scss'
import repackDocumentType from '../../lib/repack-document-type'
import repackDocumentStatus from '../../lib/repack-document-status'

export function ActivityLog () {
const [documentModalState, setDocumentModalState] = useState(false)
Expand Down Expand Up @@ -117,7 +116,6 @@ export function ActivityLog () {
<th><Paragraph size='small'>Elev</Paragraph></th>
<th><Paragraph size='small'>Dokumenttype</Paragraph></th>
<th><Paragraph size='small'>Dato</Paragraph></th>
<th><Paragraph size='small'>Status</Paragraph></th>
<th><Paragraph size='small'>Sendt av</Paragraph></th>
<th className='actions-th'><Paragraph size='small'>Ny handling</Paragraph></th>
</tr>
Expand All @@ -136,7 +134,6 @@ export function ActivityLog () {
</td>
<td><Skeleton randomWidth={[40, 90]} /></td>
<td><Skeleton width='90px' /></td>
<td><Skeleton /></td>
<td width='200px'><Skeleton randomWidth={[40, 80]} /></td>
<td><Skeleton width='40%' /></td>
</tr>
Expand Down Expand Up @@ -166,9 +163,6 @@ export function ActivityLog () {
<td>
<Paragraph><Link tabIndex={-1} aria-label='Klikk for å åpne' aria-hidden onClick={() => openPreviewModal(doc)}><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Link></Paragraph>
</td>
<td>
<Paragraph>{repackDocumentStatus(doc.status)}</Paragraph>
</td>
<td>
<Paragraph>{doc.teacher.name}</Paragraph>
</td>
Expand Down
17 changes: 7 additions & 10 deletions src/pages/Class/basisgruppe.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import ClassTile from '../../components/class-tile'
import ClassTileGroup from '../../components/class-tile-group'

import { ROUTES } from '../../config/constants'
import repackDocumentStatus from '../../lib/repack-document-status'
import repackDocumentType from '../../lib/repack-document-type'

import { PreviewDocumentModal } from '../../containers/PreviewDocumentModal'
Expand Down Expand Up @@ -39,9 +38,6 @@ export function Basisgruppe ({ group, documents, conversations, notes }) {
<ClassTile label='varselbrev' value={documents ? documents.length : 0} />
<ClassTile label='dokumenterte elevsamtaler' value={conversations ? conversations.length : 0} />
<ClassTile label='notater til elevmappa' value={notes ? notes.length : 0} />
{/* <ClassTile label='utplasseringer' value={0} />
<ClassTile label='lokale læreplaner arkivert' value={0} />
<ClassTile label='tilbakemeldinger' value={0} /> */}
</ClassTileGroup>

<ClassPanel icon='students' title='Elever'>
Expand Down Expand Up @@ -95,10 +91,10 @@ export function Basisgruppe ({ group, documents, conversations, notes }) {
<Paragraph><Link onClick={() => openPreviewModal(doc)} aria-label='Klikk for å åpne'>{repackDocumentType(doc.type, doc.variant)}</Link></Paragraph>
</td>
<td>
<Paragraph><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Paragraph>
<Paragraph><Link onClick={() => openPreviewModal(doc)} aria-label='Klikk for å åpne' tabIndex='-1'>{doc.content.period ? doc.content.period.nb : ''}</Link></Paragraph>
</td>
<td>
<Paragraph>{repackDocumentStatus(doc.status)}</Paragraph>
<Paragraph><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Paragraph>
</td>
</tr>
)
Expand Down Expand Up @@ -131,11 +127,12 @@ export function Basisgruppe ({ group, documents, conversations, notes }) {
</div>
</td>
<td>
<Paragraph><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Paragraph>
<Paragraph><Link onClick={() => openPreviewModal(doc)} aria-label='Klikk for å åpne'>{doc.variant === 'samtale' ? 'Elevsamtale gjennomført' : 'Eleven ønsket ikke samtale'}</Link></Paragraph>
</td>
<td>
<Paragraph>{repackDocumentStatus(doc.status, true)}</Paragraph>
<Paragraph><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Paragraph>
</td>
<td />
</tr>
)
})
Expand Down Expand Up @@ -167,10 +164,10 @@ export function Basisgruppe ({ group, documents, conversations, notes }) {
</div>
</td>
<td>
<Paragraph><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Paragraph>
<Paragraph>{doc.teacher.name}</Paragraph>
</td>
<td>
<Paragraph>{repackDocumentStatus(doc.status, true)}</Paragraph>
<Paragraph><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Paragraph>
</td>
</tr>
)
Expand Down
7 changes: 3 additions & 4 deletions src/pages/Class/undervisningsgruppe.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import ClassPanel from '../../components/class-panel'

import { ROUTES } from '../../config/constants'
import repackDocumentType from '../../lib/repack-document-type'
import repackDocumentStatus from '../../lib/repack-document-status'

import { PreviewDocumentModal } from '../../containers/PreviewDocumentModal'

Expand Down Expand Up @@ -43,7 +42,7 @@ export function Undervisningsgruppe ({ group, documents, loading }) {
<Skeleton variant='rectangle' height='126px' width='calc(100% / 3 - (32px))' style={{ marginLeft: '32px' }} />
<Skeleton variant='rectangle' height='126px' width='calc(100% / 3 - (32px))' style={{ marginLeft: '32px' }} />
</>
)
)
: <ClassTile label='varselbrev i faget' value={documents ? documents.length : <Skeleton width='70px' />} />
}
</ClassTileGroup>
Expand Down Expand Up @@ -133,10 +132,10 @@ export function Undervisningsgruppe ({ group, documents, loading }) {
<Paragraph><Link onClick={() => openPreviewModal(doc)} aria-label='Klikk for å åpne'>{repackDocumentType(doc.type, doc.variant)}</Link></Paragraph>
</td>
<td>
<Paragraph><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Paragraph>
<Paragraph><Link onClick={() => openPreviewModal(doc)} aria-label='Klikk for å åpne' tabIndex='-1'>{doc.content.period ? doc.content.period.nb : ''}</Link></Paragraph>
</td>
<td>
<Paragraph>{repackDocumentStatus(doc.status)}</Paragraph>
<Paragraph><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Paragraph>
</td>
</tr>
)
Expand Down
5 changes: 0 additions & 5 deletions src/pages/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { PreviewDocumentModal } from '../../containers/PreviewDocumentModal'

import './styles.scss'
import repackDocumentType from '../../lib/repack-document-type'
import repackDocumentStatus from '../../lib/repack-document-status'

export function Home () {
const { user } = useSession()
Expand Down Expand Up @@ -137,7 +136,6 @@ export function Home () {
<td><Skeleton randomWidth={[40, 70]} /></td>
<td><Skeleton width='60%' /></td>
<td><Skeleton /></td>
<td><Skeleton /></td>
</tr>
)
})
Expand Down Expand Up @@ -168,9 +166,6 @@ export function Home () {
<td>
<Paragraph><Link tabIndex={-1} aria-label='Klikk for å åpne' aria-hidden onClick={() => openPreviewModal(doc)}><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Link></Paragraph>
</td>
<td>
<Paragraph>{repackDocumentStatus(doc.status)}</Paragraph>
</td>
<td>
<IconDropdownNav>
<IconDropdownNavItem onClick={() => { openPreviewModal(doc) }} title={`Åpne ${doc.type === 'yff' ? doc.variant.replace('ae', 'æ') : doc.type}`} />
Expand Down
69 changes: 58 additions & 11 deletions src/pages/Student/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { PreviewDocumentModal } from '../../containers/PreviewDocumentModal'

import './styles.scss'
import repackDocumentType from '../../lib/repack-document-type'
import repackDocumentStatus from '../../lib/repack-document-status'
import StudentCard from '../../components/student-card'

export function Student ({ match, ...props }) {
Expand All @@ -32,6 +31,7 @@ export function Student ({ match, ...props }) {
const [student, setStudent] = useState(null)
const [documents, setDocuments] = useState(null)
const [notes, setNotes] = useState(null)
const [conversations, setConversations] = useState(null)

const { id, docId } = match.params
if (docId) console.log('DocumentId', docId)
Expand All @@ -52,8 +52,10 @@ export function Student ({ match, ...props }) {
// TODO: Display error message

const docsOrderedByModified = docs.data.sort((a, b) => (a.modified[0].timestamp < b.modified[0].timestamp) ? 1 : -1)
const docsExceptNotes = docsOrderedByModified.filter((item) => item.type !== 'notat')
const docsExceptNotes = docsOrderedByModified.filter((item) => !['notat', 'samtale'].includes(item.type))
const notes = docsOrderedByModified.filter((item) => item.type === 'notat')
const conversations = docsOrderedByModified.filter((item) => item.type === 'samtale')
setConversations(conversations)
setDocuments(docsExceptNotes)
setNotes(notes)

Expand Down Expand Up @@ -158,7 +160,7 @@ export function Student ({ match, ...props }) {
</Sentry.ErrorBoundary>

<ClassPanel
icon='activity' title='Varsler og samtaler' link={
icon='activity' title='Varselbrev' link={
<IconButtonLink icon='add' className='add-more-button' onClick={() => { openDocumentModal() }}>
Nytt dokument
</IconButtonLink>
Expand Down Expand Up @@ -186,7 +188,7 @@ export function Student ({ match, ...props }) {
<Paragraph>{repackDocumentType(doc.type, doc.variant)}</Paragraph>
</td>
<td>
<Paragraph>{repackDocumentStatus(doc.status, true)}</Paragraph>
<Paragraph>{doc.content.period ? doc.content.period.nb : ''}</Paragraph>
</td>
</tr>
)
Expand All @@ -196,7 +198,54 @@ export function Student ({ match, ...props }) {
documents && documents.length === 0 &&
<tr>
<td style={{ textAlign: 'left' }}>
<Paragraph>Denne eleven har ingen registrerte varsler eller samtaler.</Paragraph>
<Paragraph>Denne eleven har ingen registrerte varsler.</Paragraph>
</td>
</tr>
}

</ClassPanel>
<ClassPanel
icon='activity' title='Elevsamtaler' link={
<IconButtonLink icon='add' className='add-more-button' onClick={() => { openDocumentModal() }}>
Ny samtale
</IconButtonLink>
}
>
{
!conversations && Array(5).fill().map(function (i) {
return (
<tr key={i}>
<td><Skeleton randomWidth={[30, 70]} /></td>
<td><Skeleton width='60%' /></td>
<td><Skeleton randomWidth={[20, 100]} /></td>
<td />
</tr>
)
})
}
{
conversations && conversations.map(function (doc, index) {
return (
<tr key={doc.id} onClick={() => openPreviewModal(doc)} className='clickable' aria-label='Klikk for å åpne' title='Klikk for å åpne' tabIndex={0}>
<td>
<Paragraph><Moment locale='nb' format='DD. MMM YYYY'>{doc.created.timestamp}</Moment></Paragraph>
</td>
<td>
<Paragraph>{doc.variant === 'samtale' ? 'Elevsamtale gjennomført' : 'Eleven ønsket ikke samtale'}</Paragraph>
</td>
<td>
<Paragraph>{doc.teacher.name}</Paragraph>
</td>
<td />
</tr>
)
})
}
{
conversations && conversations.length === 0 &&
<tr>
<td style={{ textAlign: 'left' }}>
<Paragraph>Denne eleven har ingen registrerte elevsamtaler.</Paragraph>
</td>
</tr>
}
Expand All @@ -219,7 +268,7 @@ export function Student ({ match, ...props }) {
<tr key={i}>
<td><Skeleton width='60%' /></td>
<td><Skeleton /></td>
<td><Skeleton /></td>
<td />
</tr>
)
})
Expand All @@ -234,9 +283,7 @@ export function Student ({ match, ...props }) {
<td>
<Paragraph>{note.teacher.name}</Paragraph>
</td>
<td>
<Paragraph>{repackDocumentStatus(note.status, true)}</Paragraph>
</td>
<td />
</tr>
)
})
Expand All @@ -251,12 +298,12 @@ export function Student ({ match, ...props }) {
}
</ClassPanel>
</>
)
)
: (
<Paragraph>
Du har ikke tilgang til denne eleven. Kontakt Extensansvarlig.
</Paragraph>
)
)
}
</div>
</DefaultLayout>
Expand Down

1 comment on commit dec966c

@vercel
Copy link

@vercel vercel bot commented on dec966c Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.