0
0
Fork 0

Se corrige el componente por comentario en pr

This commit is contained in:
carlosfonseca 2024-01-11 13:12:44 -05:00
parent d2ee8a98eb
commit f9cbf03991
1 changed files with 33 additions and 18 deletions

View File

@ -1,22 +1,36 @@
<script setup>
import { ref } from 'vue';
import { computed, onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { useArrayData } from 'composables/useArrayData';
import { useStateStore } from 'stores/useStateStore';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const stateStore = useStateStore();
const arrayData = ref(null);
const provincesLocation = ref([]);
onBeforeMount(async () => {
arrayData.value = useArrayData('CustomerConsignees', {
url: `Clients/${route.params.id}/addresses`,
limit: 0,
});
await arrayData.value.fetch({ append: false });
stateStore.rightDrawer = true;
});
const data = computed(() => arrayData.value.store.data);
const setProvince = (provinceFk) => {
const result = provincesLocation.value.filter(
(province) => province.id === provinceFk
);
return result[0].name || '';
return result[0]?.name || '';
};
const toCustomerConsigneeCreate = () => {
@ -35,13 +49,8 @@ const toCustomerConsigneeEdit = () => {
url="Provinces/location"
/>
<FormModel
:observe-form-changes="false"
:url="`Clients/${route.params.id}/addresses`"
auto-load
model="customer"
>
<template #form="{ data }">
<QCard class="q-pa-sm">
<QCardSection>
<div v-if="data?.length">
<div v-for="(item, index) in data" :key="index">
<div
@ -81,14 +90,20 @@ const toCustomerConsigneeEdit = () => {
</div>
</div>
</div>
</template>
</FormModel>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerConsigneeCreate()" color="primary" fab icon="add" />
<QTooltip>
{{ t('New consignee') }}
</QTooltip>
</QPageSticky>
</QCardSection>
<QPageSticky :offset="[18, 18]">
<QBtn
@click.stop="toCustomerConsigneeCreate()"
color="primary"
fab
icon="add"
/>
<QTooltip>
{{ t('New consignee') }}
</QTooltip>
</QPageSticky>
</QCard>
</template>
<style lang="scss" scoped>