diff --git a/src/pages/ActivityLog/index.js b/src/pages/ActivityLog/index.js index cb3d71cc..58cd4033 100644 --- a/src/pages/ActivityLog/index.js +++ b/src/pages/ActivityLog/index.js @@ -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) @@ -117,7 +116,6 @@ export function ActivityLog () { Elev Dokumenttype Dato - Status Sendt av Ny handling @@ -136,7 +134,6 @@ export function ActivityLog () { - @@ -166,9 +163,6 @@ export function ActivityLog () { openPreviewModal(doc)}>{doc.created.timestamp} - - {repackDocumentStatus(doc.status)} - {doc.teacher.name} diff --git a/src/pages/Class/basisgruppe.js b/src/pages/Class/basisgruppe.js index 4b0ccc3f..3128539a 100644 --- a/src/pages/Class/basisgruppe.js +++ b/src/pages/Class/basisgruppe.js @@ -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' @@ -39,9 +38,6 @@ export function Basisgruppe ({ group, documents, conversations, notes }) { - {/* - - */} @@ -95,10 +91,10 @@ export function Basisgruppe ({ group, documents, conversations, notes }) { openPreviewModal(doc)} aria-label='Klikk for å åpne'>{repackDocumentType(doc.type, doc.variant)} - {doc.created.timestamp} + openPreviewModal(doc)} aria-label='Klikk for å åpne' tabIndex='-1'>{doc.content.period ? doc.content.period.nb : ''} - {repackDocumentStatus(doc.status)} + {doc.created.timestamp} ) @@ -131,11 +127,12 @@ export function Basisgruppe ({ group, documents, conversations, notes }) { - {doc.created.timestamp} + openPreviewModal(doc)} aria-label='Klikk for å åpne'>{doc.variant === 'samtale' ? 'Elevsamtale gjennomført' : 'Eleven ønsket ikke samtale'} - {repackDocumentStatus(doc.status, true)} + {doc.created.timestamp} + ) }) @@ -167,10 +164,10 @@ export function Basisgruppe ({ group, documents, conversations, notes }) { - {doc.created.timestamp} + {doc.teacher.name} - {repackDocumentStatus(doc.status, true)} + {doc.created.timestamp} ) diff --git a/src/pages/Class/undervisningsgruppe.js b/src/pages/Class/undervisningsgruppe.js index 0e86f633..6bfdaf6d 100644 --- a/src/pages/Class/undervisningsgruppe.js +++ b/src/pages/Class/undervisningsgruppe.js @@ -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' @@ -43,7 +42,7 @@ export function Undervisningsgruppe ({ group, documents, loading }) { - ) + ) : } /> } @@ -133,10 +132,10 @@ export function Undervisningsgruppe ({ group, documents, loading }) { openPreviewModal(doc)} aria-label='Klikk for å åpne'>{repackDocumentType(doc.type, doc.variant)} - {doc.created.timestamp} + openPreviewModal(doc)} aria-label='Klikk for å åpne' tabIndex='-1'>{doc.content.period ? doc.content.period.nb : ''} - {repackDocumentStatus(doc.status)} + {doc.created.timestamp} ) diff --git a/src/pages/Home/index.js b/src/pages/Home/index.js index 97fd79c9..8a7e8338 100644 --- a/src/pages/Home/index.js +++ b/src/pages/Home/index.js @@ -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() @@ -137,7 +136,6 @@ export function Home () { - ) }) @@ -168,9 +166,6 @@ export function Home () { openPreviewModal(doc)}>{doc.created.timestamp} - - {repackDocumentStatus(doc.status)} - { openPreviewModal(doc) }} title={`Åpne ${doc.type === 'yff' ? doc.variant.replace('ae', 'æ') : doc.type}`} /> diff --git a/src/pages/Student/index.js b/src/pages/Student/index.js index 1388ec95..9fcffd41 100644 --- a/src/pages/Student/index.js +++ b/src/pages/Student/index.js @@ -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 }) { @@ -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) @@ -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) @@ -158,7 +160,7 @@ export function Student ({ match, ...props }) { { openDocumentModal() }}> Nytt dokument @@ -186,7 +188,7 @@ export function Student ({ match, ...props }) { {repackDocumentType(doc.type, doc.variant)} - {repackDocumentStatus(doc.status, true)} + {doc.content.period ? doc.content.period.nb : ''} ) @@ -196,7 +198,54 @@ export function Student ({ match, ...props }) { documents && documents.length === 0 && - Denne eleven har ingen registrerte varsler eller samtaler. + Denne eleven har ingen registrerte varsler. + + + } + + + { openDocumentModal() }}> + Ny samtale + + } + > + { + !conversations && Array(5).fill().map(function (i) { + return ( + + + + + + + ) + }) + } + { + conversations && conversations.map(function (doc, index) { + return ( + openPreviewModal(doc)} className='clickable' aria-label='Klikk for å åpne' title='Klikk for å åpne' tabIndex={0}> + + {doc.created.timestamp} + + + {doc.variant === 'samtale' ? 'Elevsamtale gjennomført' : 'Eleven ønsket ikke samtale'} + + + {doc.teacher.name} + + + + ) + }) + } + { + conversations && conversations.length === 0 && + + + Denne eleven har ingen registrerte elevsamtaler. } @@ -219,7 +268,7 @@ export function Student ({ match, ...props }) { - + ) }) @@ -234,9 +283,7 @@ export function Student ({ match, ...props }) { {note.teacher.name} - - {repackDocumentStatus(note.status, true)} - + ) }) @@ -251,12 +298,12 @@ export function Student ({ match, ...props }) { } - ) + ) : ( Du har ikke tilgang til denne eleven. Kontakt Extensansvarlig. - ) + ) }