Skip to content

Commit

Permalink
Service worker attachment support in applications
Browse files Browse the repository at this point in the history
  • Loading branch information
Wnt committed Dec 18, 2024
1 parent 950d791 commit bf1d551
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,21 @@ export default React.memo(function ApplicationEditView({
/>
</>
)}
<Label>
{i18n.application.additionalInfo.serviceWorkerAttachmentsTitle}
</Label>

<FileUploadGridContainer>
<FileUpload
onUpload={onUploadAttachment('SERVICE_WORKER_ATTACHMENT')}
onDelete={onDeleteAttachment}
getDownloadUrl={getAttachmentUrl}
files={attachments.filter(
(a) => a.type === 'SERVICE_WORKER_ATTACHMENT'
)}
data-qa="file-upload-service-worker"
/>
</FileUploadGridContainer>
</ListGrid>
</CollapsibleSection>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export default React.memo(function ApplicationReadView({
({ type }) => type === 'EXTENDED_CARE'
)

const serviceWorkerAttachments = attachments.filter(
({ type }) => type === 'SERVICE_WORKER_ATTACHMENT'
)

const connectedDaycare = type === 'PRESCHOOL' && serviceNeed !== null
const paid = type === 'DAYCARE' || connectedDaycare

Expand Down Expand Up @@ -576,6 +580,25 @@ export default React.memo(function ApplicationReadView({
<span>{child.diet}</span>
</>
)}
<Label>
{i18n.application.additionalInfo.serviceWorkerAttachmentsTitle}
</Label>
<AttachmentContainer>
{serviceWorkerAttachments.length ? (
<>
{serviceWorkerAttachments.map((attachment) => (
<Attachment
key={attachment.id}
attachment={attachment}
receivedAt={attachmentReceivedAt(attachment)}
data-qa={`service-need-attachment-${attachment.name}`}
/>
))}
</>
) : (
<Dimmed>Ei liitteitä</Dimmed>
)}
</AttachmentContainer>
</ListGrid>
</CollapsibleSection>

Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib-common/generated/api-types/attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { AttachmentId } from './shared'
export type AttachmentType =
| 'URGENCY'
| 'EXTENDED_CARE'
| 'SERVICE_WORKER_ATTACHMENT'

/**
* Generated from fi.espoo.evaka.attachment.IncomeAttachment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,8 @@ export const fi = {
applicationInfo: 'Hakemuksen lisätiedot',
allergies: 'Allergiat',
diet: 'Erityisruokavalio',
maxFeeAccepted: 'Suostumus korkeimpaan maksuun'
maxFeeAccepted: 'Suostumus korkeimpaan maksuun',
serviceWorkerAttachmentsTitle: 'Palveluohjauksen liitteet'
},
decisions: {
title: 'Päätökset',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ data class MessageAttachment(val id: AttachmentId, val name: String, val content
enum class AttachmentType {
URGENCY,
EXTENDED_CARE,
SERVICE_WORKER_ATTACHMENT,
}

0 comments on commit bf1d551

Please sign in to comment.