0
0
Fork 0

Nueva correccion por comentario

This commit is contained in:
carlosfonseca 2024-01-12 05:28:58 -05:00
parent f9cbf03991
commit bf19ce630d
1 changed files with 25 additions and 35 deletions

View File

@ -1,31 +1,17 @@
<script setup> <script setup>
import { computed, onBeforeMount, ref } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useArrayData } from 'composables/useArrayData';
import { useStateStore } from 'stores/useStateStore';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const stateStore = useStateStore();
const arrayData = ref(null);
const provincesLocation = ref([]); 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 setProvince = (provinceFk) => {
const result = provincesLocation.value.filter( const result = provincesLocation.value.filter(
(province) => province.id === provinceFk (province) => province.id === provinceFk
@ -49,14 +35,19 @@ const toCustomerConsigneeEdit = () => {
url="Provinces/location" url="Provinces/location"
/> />
<QCard class="q-pa-sm"> <QCard class="q-pa-lg">
<QCardSection> <VnPaginate
<div v-if="data?.length"> data-key="CustomerConsignees"
<div v-for="(item, index) in data" :key="index"> :url="`Clients/${route.params.id}/addresses`"
order="id"
auto-load
>
<template #body="{ rows }">
<div v-for="(item, index) in rows" :key="index">
<div <div
:class="{ :class="{
'consignees-card': true, 'consignees-card': true,
'q-mb-md': index + 1 === data.length ? false : true, 'q-mb-md': index + 1 === rows.length ? false : true,
}" }"
> >
<div class="consignees-card-icon"> <div class="consignees-card-icon">
@ -89,9 +80,6 @@ const toCustomerConsigneeEdit = () => {
</div> </div>
</div> </div>
</div> </div>
</div>
</QCardSection>
<QPageSticky :offset="[18, 18]"> <QPageSticky :offset="[18, 18]">
<QBtn <QBtn
@click.stop="toCustomerConsigneeCreate()" @click.stop="toCustomerConsigneeCreate()"
@ -103,6 +91,8 @@ const toCustomerConsigneeEdit = () => {
{{ t('New consignee') }} {{ t('New consignee') }}
</QTooltip> </QTooltip>
</QPageSticky> </QPageSticky>
</template>
</VnPaginate>
</QCard> </QCard>
</template> </template>