Clone estimates (#97)

* Clone estimates

* Clone estimate test feature

* Resolve namespace

* Fix string to int for Carbon

* Fix homes routes and default queue key

* Move dropdown item below View and use the propper translation key
This commit is contained in:
mchev
2024-06-06 12:16:41 +02:00
committed by GitHub
parent 14c599ed4f
commit bb8258036a
25 changed files with 262 additions and 2 deletions

View File

@@ -62,6 +62,18 @@
</BaseDropdownItem>
</router-link>
<!-- Clone Estimate into new estimate -->
<BaseDropdownItem
v-if="userStore.hasAbilities(abilities.CREATE_ESTIMATE)"
@click="cloneEstimateData(row)"
>
<BaseIcon
name="DocumentTextIcon"
class="w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"
/>
{{ $t('estimates.clone_estimate') }}
</BaseDropdownItem>
<!-- Convert into Invoice -->
<BaseDropdownItem
v-if="userStore.hasAbilities(abilities.CREATE_INVOICE)"
@@ -334,4 +346,24 @@ function copyPdfUrl() {
message: t('general.copied_pdf_url_clipboard'),
})
}
async function cloneEstimateData(data) {
dialogStore
.openDialog({
title: t('general.are_you_sure'),
message: t('estimates.confirm_clone'),
yesLabel: t('general.ok'),
noLabel: t('general.cancel'),
variant: 'primary',
hideNoButton: false,
size: 'lg',
})
.then((res) => {
if (res) {
estimateStore.cloneEstimate(data).then((res) => {
router.push(`/admin/estimates/${res.data.data.id}/edit`)
})
}
})
}
</script>