Skip to content

Commit

Permalink
Merge branch 'master' into rediger_krav_modal
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremiahUy authored Nov 24, 2023
2 parents 64debf7 + ee1bb10 commit 1c6a474
Show file tree
Hide file tree
Showing 24 changed files with 695 additions and 1,305 deletions.
4 changes: 2 additions & 2 deletions apps/backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<graphql.version>21.0</graphql.version>
<flexmark.version>0.64.8</flexmark.version>

<microsoft-graph.version>5.76.0</microsoft-graph.version>
<microsoft-graph.version>5.77.0</microsoft-graph.version>
<msal4j.version>1.14.0</msal4j.version>

<!-- transitive versions -->
Expand All @@ -39,7 +39,7 @@
<stax2-api.version>4.2.2</stax2-api.version>

<!-- Test -->
<testcontainers.version>1.19.2</testcontainers.version>
<testcontainers.version>1.19.3</testcontainers.version>
<wiremock.version>2.27.2</wiremock.version>
<docx4j.version>11.4.9</docx4j.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ public LocalDateTime sistEndretDokumentasjon(EtterlevelseDokumentasjonResponse e

public EtterlevelseDokumentasjonStats stats(EtterlevelseDokumentasjonResponse etterlevelseDokumentasjon) {

var etterlevelser = etterlevelseService.getByEtterlevelseDokumentasjon(etterlevelseDokumentasjon.getId().toString());

List<KravResponse> krav;
List<KravResponse> irrelevantKrav;
List<KravResponse> utgaattKrav = convert(kravService.getByFilter(KravFilter.builder()
Expand All @@ -90,8 +88,8 @@ public EtterlevelseDokumentasjonStats stats(EtterlevelseDokumentasjonResponse et
}
});

var fylt = filter(krav, k -> etterlevelser.stream().anyMatch(e -> e.isEtterleves() && e.kravId().equals(k.kravId())));
var ikkeFylt = filter(krav, k -> !fylt.contains(k));
var fylt = filter(krav, k -> k.getEtterlevelser() != null && !k.getEtterlevelser().isEmpty());
var ikkeFylt = filter(krav, k -> k.getEtterlevelser() == null || k.getEtterlevelser().isEmpty() );

var irrelevant = filter(irrelevantKrav, i -> !fylt.contains(i) && !ikkeFylt.contains(i));

Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/admin/audit/AuditTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export enum ObjectType {
BehandlingData = 'BehandlingData',
Melding = 'Melding',
EtterlevelseArkiv = 'EtterlevelseArkiv',
EtterlevelseMetadata = 'EtterlevelseMetadata'
EtterlevelseMetadata = 'EtterlevelseMetadata',
}

export type NavigableItem = ObjectType | ListName.RELEVANS | ListName.UNDERAVDELING | ListName.TEMA | ListName.LOV
9 changes: 8 additions & 1 deletion apps/frontend/src/components/common/DataText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@ type DataTextProps = {
notFlexed?: boolean
header?: boolean
labelWidth?: string
fullWidth?: boolean
}

const DataText = (props: DataTextProps) => {
if (props.hideComponent) return null

let labelWidth = 'w-48'
if (props.labelWidth) {
labelWidth = 'w-[' + props.labelWidth + ']'
} else if (props.fullWidth) {
labelWidth = 'w-full'
}
const getLabel = () => {
if (props.header) {
return (
Expand All @@ -25,7 +32,7 @@ const DataText = (props: DataTextProps) => {
)
} else {
return (
<div className={`${props.labelWidth ? 'w-[' + props.labelWidth + ']' : 'w-48'} pr-2.5`}>
<div className={`${labelWidth} pr-2.5`}>
<Label size={'medium'}>{props.label}</Label>
</div>
)
Expand Down
15 changes: 3 additions & 12 deletions apps/frontend/src/components/common/DotTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ import { Markdown } from './Markdown'
import { Code, codelist, ListName } from '../../services/Codelist'
import { NavigableItem } from '../admin/audit/AuditTypes'

export const DotTag = (props: { children: ReactNode; noBulletPoints?: boolean }) => (
<div className="flex">
{!props.noBulletPoints && <li />}
<div className="break-words">{props.children}</div>
</div>
)

const Content = (props: { item: ReactNode | string; list?: ListName; linkCodelist?: boolean; markdown?: boolean }) => {
const { item, list, linkCodelist, markdown } = props
if (list) {
Expand All @@ -31,11 +24,10 @@ type DotTagsParams = {
markdown?: boolean
list?: ListName
inColumn?: boolean
noBulletPoints?: boolean
}

export const DotTags = (props: DotTagsParams) => {
const { commaSeparator, noBulletPoints } = props
const { commaSeparator } = props
const items = props.items || props.codes?.map((c) => c.code) || []

if (!items.length) return <>{'Ikke angitt'}</>
Expand All @@ -56,10 +48,9 @@ export const DotTags = (props: DotTagsParams) => {
<div className={`${props.inColumn ? 'block' : 'flex'} flex-wrap`}>
{items.map((item, i) => (
<div className={`${props.inColumn ? 'mb-1.5' : 'mb-0'} ${i < items.length && !commaSeparator ? 'mb-1.5' : 'mb-0'}`} key={i}>
<DotTag noBulletPoints={noBulletPoints}>
{' '}
<BodyShort className={'break-words'}>
<Content {...props} item={item} />{' '}
</DotTag>
</BodyShort>
</div>
))}
</div>
Expand Down
53 changes: 20 additions & 33 deletions apps/frontend/src/components/common/Inputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { Value } from 'baseui/select'
import { Code, codelist, ListName } from '../../services/Codelist'
import { SearchType } from '../../api/TeamApi'
import * as _ from 'lodash'
import { Datepicker } from 'baseui/datepicker'
import moment from 'moment'
import { Radio, RadioGroup } from 'baseui/radio'
import LabelWithTooltip from '../common/LabelWithTooltip'
import CustomInput from '../common/CustomizedInput'
Expand All @@ -18,8 +16,8 @@ import TextEditor from './TextEditor/TextEditor'
import { Error } from './ModalSchema'
import { ettlevColors } from '../../util/theme'
import { borderColor } from './Style'
import { Button, Detail, Label, Select, TextField, Textarea } from '@navikt/ds-react'
import { MarkdownInfo } from './Markdown'
import { DatePicker, Button, Detail, Label, Select, TextField, Textarea, useDatepicker } from '@navikt/ds-react'

export const FieldWrapper = ({ children, marginBottom }: { children: React.ReactNode; marginBottom?: boolean }) => {
return <div className={`${marginBottom ? 'mb-6' : ''}`}>{children}</div>
Expand Down Expand Up @@ -136,42 +134,31 @@ export const BoolField = (props: { label: string; name: string; nullable?: boole
</FieldWrapper>
)

export const DateField = (props: { label: string; name: string; caption?: ReactNode; tooltip?: string; error?: boolean }) => (
<FieldWrapper>
<Field name={props.name}>
{(p: FieldProps) => (
<FormControl label={<LabelWithTooltip label={props.label} tooltip={props.tooltip} />} error={p.meta.touched && p.meta.error} caption={props.caption}>
<Datepicker
clearable
formatString={'dd-MM-yyyy'}
value={p.field.value ? moment(p.field.value).toDate() : undefined}
onChange={({ date }) => {
const dateSingle = Array.isArray(date) ? date[0] : date
export const DateField = (props: { label: string; name: string; caption?: ReactNode; tooltip?: string; error?: boolean }) => {
const { datepickerProps, inputProps } = useDatepicker({})

return (
<FieldWrapper>
<Field name={props.name}>
{(p: FieldProps) => (
<DatePicker
{...datepickerProps}
onSelect={(date: any) => {
const dateSingle: Date = Array.isArray(date) ? date[0] : date
if (dateSingle) {
const newDate = dateSingle.setDate(dateSingle.getDate() + 1)
const formatedDate = new Date(newDate)
p.form.setFieldValue(props.name, formatedDate.toISOString().split('T')[0])
} else p.form.setFieldValue(props.name, undefined)
}}
overrides={{
Input: {
props: {
overrides: {
Root: {
style: {
...borderColor(props.error ? ettlevColors.red600 : undefined),
},
},
},
},
},
}}
/>
</FormControl>
)}
</Field>
</FieldWrapper>
)
>
<DatePicker.Input {...inputProps} label="Velg dato" />
</DatePicker>
)}
</Field>
</FieldWrapper>
)
}

const linkReg = /\[(.+)\]\((.+)\)/i
const linkNameFor = (t: string) => {
Expand Down
3 changes: 2 additions & 1 deletion apps/frontend/src/components/common/PropertyLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type LabelProps = {
header?: boolean
p1?: boolean
labelWidth?: string
fullWidth?: boolean
} & Or<{ children: React.ReactNode }, { markdown: string | string[]; vertical?: boolean }>

export const CustomLabel = (props: LabelProps) => {
Expand All @@ -29,7 +30,7 @@ export const CustomLabel = (props: LabelProps) => {
export const LabelAboveContent = (props: LabelProps) => {
if (props.hide || (empty(props.children) && empty(props.markdown))) return null
return (
<DataText notFlexed label={props.title} header={props.header} labelWidth={props.labelWidth}>
<DataText fullWidth={props.fullWidth} notFlexed label={props.title} header={props.header} labelWidth={props.labelWidth}>
{props.markdown ? (
<Markdown p1={props.p1} sources={Array.isArray(props.markdown) ? props.markdown : [props.markdown]} vertical={props.vertical} shortenLinks />
) : (
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/components/common/TeamName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { useTeam } from '../../api/TeamApi'
import { teamKatTeamLink } from '../../util/config'
import { Detail, Link } from '@navikt/ds-react'

export const TeamName = (props: { id: string; link?: boolean }) => {
export const TeamName = (props: { id: string; link?: boolean; big?: boolean }) => {
const [name] = useTeam()(props.id)

return props.link ? (
<Link className="text-sm" rel="noopener noreferrer" target={'_blank'} href={teamKatTeamLink(props.id)}>
<Link className={props.big ? '' : 'text-sm'} rel="noopener noreferrer" target={'_blank'} href={teamKatTeamLink(props.id)}>
{name} (åpnes i ny fane)
</Link>
) : (
Expand Down
Loading

0 comments on commit 1c6a474

Please sign in to comment.