Skip to content

Commit

Permalink
Merge pull request #75 from ConductionNL/feature/PC108-82/Contactmome…
Browse files Browse the repository at this point in the history
…nt-detail-page

cleanup
  • Loading branch information
remko48 authored Dec 2, 2024
2 parents b6a716e + 0149a49 commit 8d1f195
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 38 deletions.
1 change: 0 additions & 1 deletion src/entities/contactmoment/contactmoment.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const mockContactMomentData = (): TContactMoment[] => [
{
id: '15551d6f-44e3-43f3-a9d2-59e583c91eb0',
uuid: '15551d6f-44e3-43f3-a9d2-59e583c91eb0',
titel: 'Zaak 3',
notitie: 'Zaak 3',
klant: 'Klant 3',
zaak: 'Zaak 3',
Expand Down
3 changes: 0 additions & 3 deletions src/entities/contactmoment/contactmoment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export class ContactMoment implements TContactMoment {

public id: string
public uuid: string
public titel: string
public notitie: string
public klant: string
public zaak: string
Expand All @@ -17,7 +16,6 @@ export class ContactMoment implements TContactMoment {
constructor(source: TContactMoment) {
this.id = source.id || ''
this.uuid = source.uuid || ''
this.titel = source.titel || ''
this.notitie = source.notitie || ''
this.klant = source.klant || ''
this.zaak = source.zaak || ''
Expand All @@ -31,7 +29,6 @@ export class ContactMoment implements TContactMoment {
const schema = z.object({
id: z.string().optional(),
uuid: z.string().optional(),
titel: z.string().min(1),
notitie: z.string().min(1),
klant: z.string().min(1),
zaak: z.string().min(1),
Expand Down
1 change: 0 additions & 1 deletion src/entities/contactmoment/contactmoment.types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export type TContactMoment = {
id: string;
uuid: string;
titel: string;
notitie: string;
klant: string;
zaak: string;
Expand Down
18 changes: 8 additions & 10 deletions src/modals/contactMomenten/ContactMomentenForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import { navigationStore, taakStore, zaakStore } from '../../store/store.js'
</div>
</div>

<div v-if="klant" class="buttonsContainer">
<div v-if="klant && !contactMomentId" class="buttonsContainer">
<div>
<NcButton
:disabled="loading"
Expand All @@ -85,10 +85,6 @@ import { navigationStore, taakStore, zaakStore } from '../../store/store.js'
label="Notitie"
:disabled="loading"
placeholder="Notitie" />
<NcTextField
:value.sync="titel"
label="Titel"
:disabled="loading" />
</div>
<div class="tabContainer">
<BTabs content-class="mt-3" justified>
Expand Down Expand Up @@ -184,7 +180,10 @@ import { navigationStore, taakStore, zaakStore } from '../../store/store.js'
</template>
Annuleer
</NcButton>
<NcActions :disabled="loading || success" :primary="true" menu-name="Acties">
<NcActions v-if="!contactMomentId"
:disabled="loading || success"
:primary="true"
menu-name="Acties">
<template #icon>
<DotsHorizontal :size="20" />
</template>
Expand All @@ -202,6 +201,7 @@ import { navigationStore, taakStore, zaakStore } from '../../store/store.js'
</NcActionButton>
</NcActions>
<NcButton
v-if="!contactMomentId"
type="primary"
:disabled="!klant || loading || success"
:loading="loading"
Expand All @@ -223,7 +223,7 @@ import { navigationStore, taakStore, zaakStore } from '../../store/store.js'
<script>
// Components
import { BTabs, BTab } from 'bootstrap-vue'
import { NcButton, NcActions, NcLoadingIcon, NcDialog, NcTextArea, NcNoteCard, NcListItem, NcActionButton, NcEmptyContent, NcTextField } from '@nextcloud/vue'
import { NcButton, NcActions, NcLoadingIcon, NcDialog, NcTextArea, NcNoteCard, NcListItem, NcActionButton, NcEmptyContent } from '@nextcloud/vue'
// Forms
import SearchKlantModal from '../../modals/klanten/SearchKlantModal.vue'
Expand All @@ -249,7 +249,6 @@ export default {
NcListItem,
NcActionButton,
NcEmptyContent,
NcTextField,
// Icons
Plus,
BriefcaseAccountOutline,
Expand Down Expand Up @@ -304,6 +303,7 @@ export default {
},
closeModal() {
navigationStore.setModal(false)
this.$emit('close-modal')
},
Expand All @@ -319,7 +319,6 @@ export default {
'Content-Type': 'application/json',
},
body: JSON.stringify({
titel: this.titel,
notitie: this.notitie,
klant: this.klant?.id ?? '',
zaak: this.selectedZaak ?? '',
Expand Down Expand Up @@ -370,7 +369,6 @@ export default {
fetch(`/index.php/apps/zaakafhandelapp/api/contactmomenten/${id}`)
.then(response => response.json())
.then(data => {
this.titel = data.titel
this.notitie = data.notitie
this.status = data.status
this.startDate = data.startDate
Expand Down
19 changes: 0 additions & 19 deletions src/modals/taken/EditTaak.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ import { taakStore, navigationStore, klantStore } from '../../store/store.js'
label="Type"
maxlength="255" />

<NcSelect
v-bind="statusOptions"
v-model="taakItem.status"
:disabled="loading"
input-label="Status"
required />

<div>
<p>Deadline</p>
<NcDateTimePicker
Expand Down Expand Up @@ -145,18 +138,6 @@ export default {
onderwerp: '',
toelichting: '',
},
statusOptions: {
options: [
{
id: 'open',
label: 'Open',
},
{
id: 'gesloten',
label: 'Gesloten',
},
],
},
}
},
mounted() {
Expand Down
6 changes: 5 additions & 1 deletion src/modals/taken/WidgetTaakForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ export default {
fetch(`/index.php/apps/zaakafhandelapp/api/taken/${id}`)
.then(response => response.json())
.then(data => {
this.taakItem = data
this.taakItem = {
...data,
deadline: new Date(data.deadline),
}
this.fetchMedewerkers()
})
},
Expand Down
17 changes: 15 additions & 2 deletions src/views/contactMomenten/ContactMomentenList.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { navigationStore, contactMomentStore } from '../../store/store.js'
import { navigationStore, contactMomentStore, klantStore } from '../../store/store.js'
</script>

<template>
Expand Down Expand Up @@ -33,7 +33,7 @@ import { navigationStore, contactMomentStore } from '../../store/store.js'
<div v-if="contactMomentStore.contactMomentenList?.length && !loading">
<NcListItem v-for="(contactMoment, i) in contactMomentStore.contactMomentenList"
:key="`${contactMoment}${i}`"
:name="contactMoment?.titel || 'onbekend'"
:name="getKlantName(contactMoment.klant) || 'onbekend'"
:active="contactMomentStore.contactMomentItem?.id === contactMoment?.id"
:force-display-actions="true"
@click="contactMomentStore.setContactMomentItem(contactMoment)">
Expand Down Expand Up @@ -115,6 +115,7 @@ export default {
contactMomentStore.refreshContactMomentenList().then(() => {
this.loading = false
})
klantStore.refreshKlantenList()
},
methods: {
editContactMoment(contactMoment) {
Expand All @@ -124,6 +125,17 @@ export default {
storeContactMoment(contactMoment) {
contactMomentStore.setContactMomentItem(contactMoment)
},
getKlantName(klantId) {
const klant = klantStore.klantenList.find(klant => klant.id === klantId)
if (klant.type === 'persoon') {
return `${klant.voornaam} ${klant.tussenvoegsel} ${klant.achternaam}` ?? 'onbekend'
}
if (klant.type === 'organisatie') {
return klant?.bedrijfsnaam ?? 'onbekend'
}
return 'onbekend'
},
fetchData(newPage) {
this.loading = true
fetch(
Expand All @@ -147,6 +159,7 @@ export default {
this.search = ''
},
},
}
</script>
<style>
Expand Down
2 changes: 1 addition & 1 deletion src/views/widgets/ContactMomentenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default {
},
openModal() {
this.isModalOpen = true
contactMomentStore.setWidgetContactMomentId(null)
this.contactMomentId = null
contactMomentStore.setContactMomentItem(null)
navigationStore.setModal('contactMomentenForm')
},
Expand Down
1 change: 1 addition & 0 deletions src/views/widgets/TakenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export default {
},
openModal() {
this.isModalOpen = true
this.taakId = null
taakStore.setTaakItem(null)
navigationStore.setModal('editTaak')
},
Expand Down

0 comments on commit 8d1f195

Please sign in to comment.