Skip to content

Commit

Permalink
Merge pull request #60 from ConductionNL/feature/PC108-97/contact-mom…
Browse files Browse the repository at this point in the history
…ent-klant

feature/PC108-97/contact-moment-klant
  • Loading branch information
remko48 authored Dec 2, 2024
2 parents 55e362f + 121a192 commit 0ba6e69
Show file tree
Hide file tree
Showing 18 changed files with 397 additions and 303 deletions.
1 change: 1 addition & 0 deletions src/entities/rol/rol.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { TRol } from './rol.types'

export const mockRolData = (): TRol[] => [
{
id: '1',
uuid: '15551d6f-44e3-43f3-a9d2-59e583c91eb0',
omschrijving: 'Zaak 3',
omschrijvingGeneriek: 'Zaak 3',
Expand Down
3 changes: 3 additions & 0 deletions src/entities/rol/rol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { TRol } from './rol.types'

export class Rol implements TRol {

public id: string
public uuid: string
public omschrijving: string
public omschrijvingGeneriek: string
Expand Down Expand Up @@ -37,6 +38,7 @@ export class Rol implements TRol {
}

constructor(source: TRol) {
this.id = source.id || null
this.uuid = source.uuid || ''
this.omschrijving = source.omschrijving || ''
this.omschrijvingGeneriek = source.omschrijvingGeneriek || ''
Expand All @@ -57,6 +59,7 @@ export class Rol implements TRol {

public validate(): SafeParseReturnType<TRol, unknown> {
const schema = z.object({
id: z.string().optional(),
uuid: z.string().optional(),
omschrijving: z.string().min(1),
omschrijvingGeneriek: z.string(),
Expand Down
1 change: 1 addition & 0 deletions src/entities/rol/rol.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export type TRol = {
id?: string;
uuid: string;
omschrijving: string;
omschrijvingGeneriek: string;
Expand Down
2 changes: 1 addition & 1 deletion src/entities/taak/taak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Taak implements TTaak {
this.zaak = source.zaak || ''
this.type = source.type || ''
this.status = source.status || ''
this.deadline = getValidISOstring(source.deadline)
this.deadline = source.deadline ? getValidISOstring(source.deadline) : null
this.onderwerp = source.onderwerp || ''
this.toelichting = source.toelichting || ''
this.actie = source.actie || ''
Expand Down
8 changes: 4 additions & 4 deletions src/modals/taken/EditTaak.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import { taakStore, navigationStore, klantStore } from '../../store/store.js'
<p>Deadline</p>
<NcDateTimePicker
v-model="taakItem.deadline"
:clearable="true"
:disabled="loading" />
:disabled="loading"
required />
</div>

<NcTextField
Expand Down Expand Up @@ -76,7 +76,7 @@ import { taakStore, navigationStore, klantStore } from '../../store/store.js'
Help
</NcButton>
<NcButton v-if="!success"
:disabled="loading || klantenLoading || !taakItem.title"
:disabled="loading || klantenLoading || !taakItem.title || !taakItem.deadline"
type="primary"
@click="editTaak()">
<template #icon>
Expand Down Expand Up @@ -243,7 +243,7 @@ export default {
...this.taakItem,
klant: this.klanten.value?.id ?? '',
status: this.taakItem.status?.id ?? null,
deadline: this.taakItem.deadline.toISOString(),
deadline: this.taakItem.deadline ? this.taakItem.deadline.toISOString() : null,
}, this.dashboardWidget)
this.success = true
this.loading = false
Expand Down
125 changes: 0 additions & 125 deletions src/store/modules/rol.js

This file was deleted.

72 changes: 36 additions & 36 deletions src/store/modules/rol.spec.js → src/store/modules/rol.spec.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
/* eslint-disable no-console */
import { setActivePinia, createPinia } from 'pinia'

import { useZaakStore } from './zaken.js'
import { Zaak, mockZaak } from '../../entities/index.js'

describe('Zaak Store', () => {
beforeEach(() => {
setActivePinia(createPinia())
})

it('sets zaak item correctly', () => {
const store = useZaakStore()

store.setZaakItem(mockZaak()[0])

expect(store.zaakItem).toBeInstanceOf(Zaak)
expect(store.zaakItem).toEqual(mockZaak()[0])

expect(store.zaakItem.validate().success).toBe(true)
})

it('sets zaken list correctly', () => {
const store = useZaakStore()

store.setZakenList(mockZaak())

expect(store.zakenList).toHaveLength(mockZaak().length)

store.zakenList.forEach((item, index) => {
expect(item).toBeInstanceOf(Zaak)
expect(item).toEqual(mockZaak()[index])
expect(item.validate().success).toBe(true)
})
})
})
/* eslint-disable no-console */
import { setActivePinia, createPinia } from 'pinia'

import { useZaakStore } from './zaken.js'
import { Zaak, mockZaak } from '../../entities/index.js'

describe('Zaak Store', () => {
beforeEach(() => {
setActivePinia(createPinia())
})

it('sets zaak item correctly', () => {
const store = useZaakStore()

store.setZaakItem(mockZaak()[0])

expect(store.zaakItem).toBeInstanceOf(Zaak)
expect(store.zaakItem).toEqual(mockZaak()[0])

expect(store.zaakItem.validate().success).toBe(true)
})

it('sets zaken list correctly', () => {
const store = useZaakStore()

store.setZakenList(mockZaak())

expect(store.zakenList).toHaveLength(mockZaak().length)

store.zakenList.forEach((item, index) => {
expect(item).toBeInstanceOf(Zaak)
expect(item).toEqual(mockZaak()[index])
expect(item.validate().success).toBe(true)
})
})
})
Loading

0 comments on commit 0ba6e69

Please sign in to comment.