0
0
Fork 0

reafactor: refs #6942 use meta moduleName

This commit is contained in:
Jorge Penadés 2024-05-27 14:51:23 +02:00
parent 332e96f184
commit 90cebb85fe
6 changed files with 19 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<script setup>
import { ref, computed } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useArrayData } from 'src/composables/useArrayData';
import { useCapitalize } from 'src/composables/useCapitalize';
@ -8,12 +8,11 @@ import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const router = useRouter();
const route = useRoute();
const { push, currentRoute } = useRouter();
const { t } = useI18n();
const invoiceId = route.params.id;
const arrayData = useArrayData('InvoiceIn');
const invoiceId = +currentRoute.value.params.id;
const arrayData = useArrayData(currentRoute.value.meta.moduleName);
const invoiceIn = computed(() => arrayData.store.data);
const invoiceInCorrectionRef = ref();
const filter = {
@ -74,7 +73,7 @@ const rowsSelected = ref([]);
const requiredFieldRule = (val) => val || t('globals.requiredField');
const onSave = (data) => data.deletes && router.push(`/invoice-in/${invoiceId}/summary`);
const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`);
</script>
<template>
<FetchData

View File

@ -13,13 +13,13 @@ import { toCurrency } from 'src/filters';
const route = useRoute();
const { t } = useI18n();
const arrayData = useArrayData('InvoiceIn');
const arrayData = useArrayData(route.meta.moduleName);
const invoiceIn = computed(() => arrayData.store.data);
const rowsSelected = ref([]);
const banks = ref([]);
const invoiceInFormRef = ref();
const invoiceId = route.params.id;
const invoiceId = +route.params.id;
const placeholder = 'yyyy/mm/dd';

View File

@ -10,13 +10,16 @@ import { useArrayData } from 'src/composables/useArrayData';
const { t } = useI18n();
const currency = computed(() => useArrayData('invoiceIn').store.data?.currency?.code);
const route = useRoute();
const currency = computed(
() => useArrayData(route.meta.moduleName).store.data?.currency?.code
);
const invoceInIntrastat = ref([]);
const rowsSelected = ref([]);
const countries = ref([]);
const intrastats = ref([]);
const invoiceInFormRef = ref();
const invoiceInId = computed(() => +useRoute().params.id);
const invoiceInId = computed(() => +route.params.id);
const filter = { where: { invoiceInFk: invoiceInId.value } };
const columns = computed(() => [
{

View File

@ -13,9 +13,10 @@ import VnTitle from 'src/components/common/VnTitle.vue';
const props = defineProps({ id: { type: [Number, String], default: 0 } });
const { t } = useI18n();
const route = useRoute();
const entityId = computed(() => props.id || useRoute().params.id);
const invoiceIn = computed(() => useArrayData('InvoiceIn').store.data);
const entityId = computed(() => props.id || +route.params.id);
const invoiceIn = computed(() => useArrayData(route.meta.moduleName).store.data);
const currency = computed(() => invoiceIn.value?.currency?.code);
const invoiceInUrl = ref();
const amountsNotMatch = ref(null);

View File

@ -15,7 +15,7 @@ const { currentRoute } = useRouter();
const { t } = useI18n();
const quasar = useQuasar();
const arrayData = useArrayData('InvoiceIn');
const arrayData = useArrayData(currentRoute.value.meta.moduleName);
const invoiceIn = computed(() => arrayData.store.data);
const invoiceId = +currentRoute.value.params.id;
const currency = computed(() => invoiceIn.value?.currency?.code);

View File

@ -1,15 +1,16 @@
<script setup>
import useRoute from 'src/composables/useRoute';
import axios from 'axios';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import { useArrayData } from 'src/composables/useArrayData';
const { notify, dialog } = useQuasar();
const { t } = useI18n();
defineExpose({ checkToBook });
const { store } = useArrayData('InvoiceIn');
const { store } = useArrayData(useRoute().meta.moduleName);
async function checkToBook(id) {
let directBooking = true;