forked from OpenCatalogi/opencatalogi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e49a3cf
commit 82a8c3c
Showing
4 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<script setup> | ||
import { navigationStore, menuStore } from '../../store/store.js' | ||
</script> | ||
|
||
<template> | ||
<NcDialog name="Menu kopieren" | ||
:can-close="false"> | ||
<div v-if="success !== null || error"> | ||
<NcNoteCard v-if="success" type="success"> | ||
<p>Menu succesvol gekopieerd</p> | ||
</NcNoteCard> | ||
<NcNoteCard v-if="!success" type="error"> | ||
<p>Er is iets fout gegaan bij het kopiëren van Menu</p> | ||
</NcNoteCard> | ||
<NcNoteCard v-if="error" type="error"> | ||
<p>{{ error }}</p> | ||
</NcNoteCard> | ||
</div> | ||
|
||
<p v-if="success === null"> | ||
Wil je <b>{{ menuStore.menuItem?.name }}</b> kopiëren? | ||
</p> | ||
|
||
<template #actions> | ||
<NcButton :disabled="loading" icon="" @click="navigationStore.setDialog(false)"> | ||
<template #icon> | ||
<Cancel :size="20" /> | ||
</template> | ||
{{ success !== null ? 'Sluiten' : 'Annuleer' }} | ||
</NcButton> | ||
<NcButton v-if="success === null" | ||
:disabled="loading" | ||
type="primary" | ||
@click="copyMenu()"> | ||
<template #icon> | ||
<NcLoadingIcon v-if="loading" :size="20" /> | ||
<ContentCopy v-if="!loading" :size="20" /> | ||
</template> | ||
Kopiëren | ||
</NcButton> | ||
</template> | ||
</NcDialog> | ||
</template> | ||
|
||
<script> | ||
import { NcButton, NcDialog, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue' | ||
import _ from 'lodash' | ||
import Cancel from 'vue-material-design-icons/Cancel.vue' | ||
import ContentCopy from 'vue-material-design-icons/ContentCopy.vue' | ||
import { Menu } from '../../entities/index.js' | ||
export default { | ||
name: 'CopyMenuDialog', | ||
components: { | ||
NcDialog, | ||
NcButton, | ||
NcNoteCard, | ||
NcLoadingIcon, | ||
// Icons | ||
Cancel, | ||
ContentCopy, | ||
}, | ||
data() { | ||
return { | ||
loading: false, | ||
success: null, | ||
error: false, | ||
} | ||
}, | ||
methods: { | ||
copyMenu() { | ||
this.loading = true | ||
const menuClone = _.cloneDeep(menuStore.menuItem) | ||
menuClone.name = 'KOPIE: ' + menuClone.name | ||
delete menuClone.id | ||
delete menuClone.uuid | ||
const menuItem = new Menu(menuClone) | ||
menuStore.saveMenu(menuItem) | ||
.then(({ response }) => { | ||
this.loading = false | ||
this.success = response.ok | ||
navigationStore.setSelected('menus') | ||
// Wait for the user to read the feedback then close the model | ||
setTimeout(() => { | ||
navigationStore.setDialog(false) | ||
}, 2000) | ||
}) | ||
.catch((err) => { | ||
this.error = err | ||
this.loading = false | ||
}) | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style> | ||
.modal__content { | ||
margin: var(--OC-margin-50); | ||
text-align: center; | ||
} | ||
.zaakDetailsContainer { | ||
margin-block-start: var(--OC-margin-20); | ||
margin-inline-start: var(--OC-margin-20); | ||
margin-inline-end: var(--OC-margin-20); | ||
} | ||
.success { | ||
color: green; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters