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> <script setup>
import { ref } from 'vue'; import { computed, onBeforeMount, 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 FormModel from 'components/FormModel.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
); );
return result[0].name || ''; return result[0]?.name || '';
}; };
const toCustomerConsigneeCreate = () => { const toCustomerConsigneeCreate = () => {
@ -35,13 +49,8 @@ const toCustomerConsigneeEdit = () => {
url="Provinces/location" url="Provinces/location"
/> />
<FormModel <QCard class="q-pa-sm">
:observe-form-changes="false" <QCardSection>
:url="`Clients/${route.params.id}/addresses`"
auto-load
model="customer"
>
<template #form="{ data }">
<div v-if="data?.length"> <div v-if="data?.length">
<div v-for="(item, index) in data" :key="index"> <div v-for="(item, index) in data" :key="index">
<div <div
@ -81,14 +90,20 @@ const toCustomerConsigneeEdit = () => {
</div> </div>
</div> </div>
</div> </div>
</template> </QCardSection>
</FormModel>
<QPageSticky :offset="[18, 18]"> <QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerConsigneeCreate()" color="primary" fab icon="add" /> <QBtn
@click.stop="toCustomerConsigneeCreate()"
color="primary"
fab
icon="add"
/>
<QTooltip> <QTooltip>
{{ t('New consignee') }} {{ t('New consignee') }}
</QTooltip> </QTooltip>
</QPageSticky> </QPageSticky>
</QCard>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>