Revert "Export system"

This reverts commit a79c4ec5ee.
This commit is contained in:
Darko Gjorgjijoski
2026-06-11 08:36:05 +02:00
parent ed5103e54d
commit c9d623a0dd
59 changed files with 715 additions and 4883 deletions

View File

@@ -1,49 +0,0 @@
<template>
<BaseButton
v-if="show"
variant="primary-outline"
:disabled="loading"
@click="onExport"
>
<template #left="slotProps">
<BaseIcon name="ArrowDownTrayIcon" :class="slotProps.class" />
</template>
{{ label ?? $t('general.export_csv') }}
</BaseButton>
</template>
<script setup>
import { ref } from 'vue'
import { downloadCsvExport } from '@/scripts/helpers/csv-export'
const props = defineProps({
url: {
type: String,
required: true,
},
params: {
type: Object,
default: () => ({}),
},
show: {
type: Boolean,
default: true,
},
label: {
type: String,
default: null,
},
})
const loading = ref(false)
async function onExport() {
loading.value = true
try {
await downloadCsvExport(props.url, props.params)
} finally {
loading.value = false
}
}
</script>

View File

@@ -1,90 +0,0 @@
<template>
<BaseDropdown v-if="show" width-class="w-64">
<template #activator>
<BaseButton variant="primary-outline" :disabled="loading">
<template #left="slotProps">
<BaseIcon name="ArrowDownTrayIcon" :class="slotProps.class" />
</template>
{{ $t('general.export') }}
<template #right="slotProps">
<BaseIcon name="ChevronDownIcon" :class="slotProps.class" />
</template>
</BaseButton>
</template>
<BaseDropdownItem @click.prevent="exportDocument">
<BaseIcon
name="DocumentTextIcon"
class="w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"
/>
{{ documentOptionLabel }}
</BaseDropdownItem>
<BaseDropdownItem @click.prevent="exportLines">
<BaseIcon
name="QueueListIcon"
class="w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"
/>
{{ linesOptionLabel }}
</BaseDropdownItem>
</BaseDropdown>
</template>
<script setup>
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { downloadCsvExport } from '@/scripts/helpers/csv-export'
const props = defineProps({
url: {
type: String,
required: true,
},
params: {
type: Object,
default: () => ({}),
},
show: {
type: Boolean,
default: true,
},
documentType: {
type: String,
required: true,
validator: (value) => ['invoice', 'estimate'].includes(value),
},
})
const { t } = useI18n()
const loading = ref(false)
const documentOptionLabel = computed(() =>
props.documentType === 'estimate'
? t('general.export_one_line_per_estimate')
: t('general.export_one_line_per_invoice'),
)
const linesOptionLabel = computed(() =>
props.documentType === 'estimate'
? t('general.export_one_line_per_estimate_item')
: t('general.export_one_line_per_invoice_item'),
)
async function exportDocument() {
await runExport(props.params)
}
async function exportLines() {
await runExport({ ...props.params, format: 'lines' })
}
async function runExport(params) {
loading.value = true
try {
await downloadCsvExport(props.url, params)
} finally {
loading.value = false
}
}
</script>