Skip to content

Commit

Permalink
Updated klant search
Browse files Browse the repository at this point in the history
  • Loading branch information
remko48 committed Nov 26, 2024
1 parent 167c499 commit fb07c6b
Show file tree
Hide file tree
Showing 9 changed files with 1,083 additions and 104 deletions.
782 changes: 782 additions & 0 deletions src/data/countries.js

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/entities/klanten/klanten.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@ export const mockKlantData = (): TKlant[] => [
voornaam: 'John',
tussenvoegsel: 'de',
achternaam: 'Doe',
bsn: '1234567890',
geboortedatum: '1990-01-01',
land: 'Nederland',
telefoonnummer: '0612345678',
emailadres: '[email protected]',
straatnaam: 'Example Street',
plaats: 'Example City',
postcode: '1234AB',
huisnummer: '123',
functie: 'Software Developer',
aanmaakkanaal: 'email',
bronorganisatie: 'Example Corp',
kvkNummer: '1234567890',
bedrijfsnaam: 'Example Corp',
websiteUrl: 'http://example.com',
url: 'http://example.com',
geverifieerd: 'true',
subject: 'John Doe',
subjectIdentificatie: '1234567890',
subjectType: 'person',
bsn: '1234567890',
},
]

Expand Down
31 changes: 28 additions & 3 deletions src/entities/klanten/klanten.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,60 @@ export class Klant implements TKlant {

public id: string
public type: TKlantType

public voornaam: string
public tussenvoegsel: string
public achternaam: string
public bsn: string
public geboortedatum: string
public land: string

public telefoonnummer: string
public emailadres: string

public straatnaam: string
public plaats: string
public postcode: string
public huisnummer: string

public functie: string
public aanmaakkanaal: string
public bronorganisatie: string
public bedrijfsnaam: string
public kvkNummer: string
public websiteUrl: string
public url: string
public geverifieerd: string
public subject: string
public subjectIdentificatie: string
public subjectType: string
public bsn: string

constructor(source: TKlant) {
this.id = source.id || ''
this.type = source.type || 'persoon'
this.voornaam = source.voornaam || ''
this.tussenvoegsel = source.tussenvoegsel || ''
this.achternaam = source.achternaam || ''
this.bsn = source.bsn || ''
this.geboortedatum = source.geboortedatum || ''
this.land = source.land || ''
this.telefoonnummer = source.telefoonnummer || ''
this.emailadres = source.emailadres || ''
this.straatnaam = source.straatnaam || ''
this.plaats = source.plaats || ''
this.postcode = source.postcode || ''
this.huisnummer = source.huisnummer || ''
this.functie = source.functie || ''
this.aanmaakkanaal = source.aanmaakkanaal || ''
this.bronorganisatie = source.bronorganisatie || ''
this.bedrijfsnaam = source.bedrijfsnaam || ''
this.kvkNummer = source.kvkNummer || ''
this.websiteUrl = source.websiteUrl || ''
this.url = source.url || ''
this.geverifieerd = source.geverifieerd || ''
this.subject = source.subject || ''
this.subjectIdentificatie = source.subjectIdentificatie || ''
this.subjectType = source.subjectType || ''
this.bsn = source.bsn || ''
}

public validate(): SafeParseReturnType<TKlant, unknown> {
Expand All @@ -49,19 +67,26 @@ export class Klant implements TKlant {
voornaam: z.string().min(1),
tussenvoegsel: z.string(),
achternaam: z.string(),
bsn: z.string(),
geboortedatum: z.string(),
land: z.string(),
telefoonnummer: z.string(),
emailadres: z.string().email(),
straatnaam: z.string(),
plaats: z.string(),
postcode: z.string(),
huisnummer: z.string(),
functie: z.string(),
aanmaakkanaal: z.string(),
bronorganisatie: z.string(),
bedrijfsnaam: z.string(),
kvkNummer: z.string(),
websiteUrl: z.string().url(),
url: z.string().url(),
geverifieerd: z.string(),
subject: z.string(),
subjectIdentificatie: z.string(),
subjectType: z.string(),
bsn: z.string(),
})

return schema.safeParse(this)
Expand Down
9 changes: 8 additions & 1 deletion src/entities/klanten/klanten.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,24 @@ export type TKlant = {
voornaam: string;
tussenvoegsel: string;
achternaam: string;
bsn: string;
geboortedatum: string;
land: string;
telefoonnummer: string;
emailadres: string;
straatnaam: string;
plaats: string;
postcode: string;
huisnummer: string;
functie: string;
aanmaakkanaal: string;
bronorganisatie: string;
bedrijfsnaam: string;
kvkNummer: string;
websiteUrl: string;
url: string;
geverifieerd: string;
subject: string;
subjectIdentificatie: string;
subjectType: string;
bsn: string;
}
12 changes: 10 additions & 2 deletions src/modals/contactMomenten/ContactMomentenForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { navigationStore } from '../../store/store.js'
<NcButton
:disabled="loading"
type="primary"
@click="searchKlantModalOpen = true">
@click="openSearchKlantModal('persoon')">
<template #icon>
<Plus :size="20" />
</template>
Expand All @@ -48,7 +48,7 @@ import { navigationStore } from '../../store/store.js'
<NcButton
:disabled="loading"
type="primary"
@click="searchKlantModalOpen = true">
@click="openSearchKlantModal('organisatie')">
<template #icon>
<Plus :size="20" />
</template>
Expand Down Expand Up @@ -147,6 +147,7 @@ import { navigationStore } from '../../store/store.js'

<SearchKlantModal v-if="searchKlantModalOpen"
:dashboard-widget="true"
:starting-type="startingType"
@selected-klant="fetchKlantData($event)"
@close-modal="closeSearchKlantModal" />
</div>
Expand Down Expand Up @@ -250,6 +251,7 @@ export default {
selectedZaak: null,
selectedTaak: null,
selectedProduct: null,
startingType: 'all',
}
},
mounted() {
Expand Down Expand Up @@ -304,6 +306,12 @@ export default {
})
},
// Search functions
openSearchKlantModal(type) {
this.searchKlantModalOpen = true
this.startingType = type
},
// Klant functions
closeSearchKlantModal() {
this.searchKlantModalOpen = false
Expand Down
Loading

0 comments on commit fb07c6b

Please sign in to comment.