0
0
Fork 0

Change dms import form ubication

This commit is contained in:
William Buezas 2024-07-01 09:48:27 -03:00
parent 0e8106af17
commit c3a064eeda
3 changed files with 19 additions and 13 deletions

View File

@ -3,7 +3,6 @@ import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar'; import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
import VnDmsImportForm from 'src/components/common/VnDmsImportForm.vue';
import axios from 'axios'; import axios from 'axios';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
@ -19,7 +18,6 @@ const { t } = useI18n();
const rows = ref(); const rows = ref();
const dmsRef = ref(); const dmsRef = ref();
const formDialog = ref({}); const formDialog = ref({});
const showImportDialog = ref(false);
const $props = defineProps({ const $props = defineProps({
model: { model: {
@ -47,10 +45,6 @@ const $props = defineProps({
type: String, type: String,
required: true, required: true,
}, },
allowImport: {
type: Boolean,
default: false,
},
}); });
const dmsFilter = { const dmsFilter = {
@ -279,6 +273,10 @@ function shouldRenderButton(button, isExternal = false) {
if (button.name == 'download') return true; if (button.name == 'download') return true;
return button.external === isExternal; return button.external === isExternal;
} }
defineExpose({
dmsRef,
});
</script> </script>
<template> <template>
<VnPaginate <VnPaginate
@ -379,15 +377,9 @@ function shouldRenderButton(button, isExternal = false) {
:description="$props.description" :description="$props.description"
/> />
</QDialog> </QDialog>
<QDialog v-model="showImportDialog">
<VnDmsImportForm @on-data-saved="dmsRef.fetch()" />
</QDialog>
<QPageSticky position="bottom-right" :offset="[25, 25]"> <QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn fab color="primary" icon="add" @click="showFormDialog()" /> <QBtn fab color="primary" icon="add" @click="showFormDialog()" />
</QPageSticky> </QPageSticky>
<QPageSticky v-if="allowImport" position="bottom-right" :offset="[25, 90]">
<QBtn fab color="primary" icon="file_copy" @click="showImportDialog = true" />
</QPageSticky>
</template> </template>
<style scoped> <style scoped>
.q-gutter-y-ms { .q-gutter-y-ms {

View File

@ -1,8 +1,16 @@
<script setup> <script setup>
import { ref } from 'vue';
import VnDmsList from 'src/components/common/VnDmsList.vue'; import VnDmsList from 'src/components/common/VnDmsList.vue';
import TicketDmsImportForm from 'src/pages/Ticket/Card/TicketDmsImportForm.vue';
const dmsListRef = ref(null);
const showImportDialog = ref(false);
const onDataSaved = () => dmsListRef.value.dmsRef.fetch();
</script> </script>
<template> <template>
<VnDmsList <VnDmsList
ref="dmsListRef"
model="TicketDms" model="TicketDms"
update-model="tickets" update-model="tickets"
delete-model="TicketDms" delete-model="TicketDms"
@ -11,4 +19,10 @@ import VnDmsList from 'src/components/common/VnDmsList.vue';
filter="ticketFk" filter="ticketFk"
allow-import allow-import
/> />
<QDialog v-model="showImportDialog">
<TicketDmsImportForm @on-data-saved="onDataSaved()" />
</QDialog>
<QPageSticky position="bottom-right" :offset="[25, 90]">
<QBtn fab color="primary" icon="file_copy" @click="showImportDialog = true" />
</QPageSticky>
</template> </template>

View File

@ -26,7 +26,7 @@ const onDataSaved = (formData, requestResponse) => {
const importDms = async () => { const importDms = async () => {
try { try {
if (!dmsId.value) throw new Error(t(`The document indentifier can't be empty`)); if (!dmsId.value) throw new Error(t(`The document identifier can't be empty`));
const data = { const data = {
ticketFk: route.params.id, ticketFk: route.params.id,