Skip to content

Commit

Permalink
finished widget make zaak modal
Browse files Browse the repository at this point in the history
  • Loading branch information
RalkeyOfficial committed Nov 13, 2024
1 parent 2993878 commit a6913c6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
17 changes: 17 additions & 0 deletions src/modals/zaken/ZaakForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ export default {
NcSelect,
NcTextArea,
},
props: {
dashboardWidget: {
type: Boolean,
default: false,
required: false,
},
},
data() {
return {
zaak: {
Expand Down Expand Up @@ -164,6 +171,7 @@ export default {
methods: {
closeModal() {
navigationStore.setModal(null)
this?.dashboardWidget && this.$emit('close')
this.success = null
this.loading = false
this.zaak = {
Expand Down Expand Up @@ -228,6 +236,8 @@ export default {
.then(({ response }) => {
this.success = response.ok
setTimeout(this.closeModal, 2500)
this?.dashboardWidget && this.$emit('save-success')
})
.catch((err) => {
console.error(err)
Expand All @@ -239,3 +249,10 @@ export default {
},
}
</script>
<style scoped>
.modalContent {
margin: var(--zaa-margin-50, 12px);
text-align: center;
}
</style>
35 changes: 20 additions & 15 deletions src/views/widgets/ZakenWidget.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { zaakStore } from '../../store/store.js'
import { navigationStore, zaakStore } from '../../store/store.js'
</script>

<template>
Expand All @@ -18,12 +18,17 @@ import { zaakStore } from '../../store/store.js'
</NcDashboardWidget>
</div>

<NcButton type="primary" @click="search">
<NcButton type="primary" @click="openModal">
<template #icon>
<Plus :size="20" />
</template>
Zaak aanmaken
</NcButton>

<ZaakForm v-if="isModalOpen"
:dashboard-widget="true"
@save-success="fetchZaakItems"
@close="closeModal" />
</div>
</template>

Expand All @@ -33,34 +38,32 @@ import { NcDashboardWidget, NcEmptyContent, NcButton } from '@nextcloud/vue'
import Plus from 'vue-material-design-icons/Plus.vue'
import Folder from 'vue-material-design-icons/Folder.vue'
import ZaakForm from '../../modals/zaken/ZaakForm.vue'
export default {
name: 'ZakenWidget',
components: {
NcDashboardWidget,
NcEmptyContent,
NcButton,
Plus,
Folder,
},
data() {
return {
loading: false,
isModalOpen: false,
zaakItems: [],
}
},
computed: {
items() {
return this.zaakItems
},
},
mounted() {
this.fetchZaakItems()
},
methods: {
fetchZaakItems() {
this.loading = true
Expand All @@ -76,16 +79,25 @@ export default {
this.loading = false
})
},
openModal() {
this.isModalOpen = true
zaakStore.setZaakItem(null)
navigationStore.setModal('zaakForm')
},
closeModal() {
this.isModalOpen = false
navigationStore.setModal(null)
},
search() {
console.info('click')
},
onShow() {
window.open('/apps/opencatalogi/catalogi', '_self')
},
},
}
</script>

<style scoped>
.zakenContainer{
display: flex;
Expand All @@ -98,10 +110,3 @@ export default {
margin-block-end: var(--zaa-margin-10);
}
</style>
<style>
:root {
--zaa-margin-10: 10px;
--zaa-margin-20: 20px;
--zaa-margin-50: 50px;
}
</style>

0 comments on commit a6913c6

Please sign in to comment.