Merge branch 'test' into warmfix_8556_excludeDates
gitea/salix-front/pipeline/pr-test This commit is unstable
Details
gitea/salix-front/pipeline/pr-test This commit is unstable
Details
This commit is contained in:
commit
e1be86774b
|
@ -54,7 +54,7 @@ const detailsColumns = ref([
|
||||||
{
|
{
|
||||||
name: 'item',
|
name: 'item',
|
||||||
label: 'claim.item',
|
label: 'claim.item',
|
||||||
field: (row) => row.sale.itemFk,
|
field: (row) => dashIfEmpty(row.sale.itemFk),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -67,13 +67,13 @@ const detailsColumns = ref([
|
||||||
{
|
{
|
||||||
name: 'quantity',
|
name: 'quantity',
|
||||||
label: 'claim.quantity',
|
label: 'claim.quantity',
|
||||||
field: (row) => row.sale.quantity,
|
field: (row) => dashIfEmpty(row.sale.quantity),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'claimed',
|
name: 'claimed',
|
||||||
label: 'claim.claimed',
|
label: 'claim.claimed',
|
||||||
field: (row) => row.quantity,
|
field: (row) => dashIfEmpty(row.quantity),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ const detailsColumns = ref([
|
||||||
{
|
{
|
||||||
name: 'price',
|
name: 'price',
|
||||||
label: 'claim.price',
|
label: 'claim.price',
|
||||||
field: (row) => row.sale.price,
|
field: (row) => dashIfEmpty(row.sale.price),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -337,23 +337,16 @@ function claimUrl(section) {
|
||||||
</QTh>
|
</QTh>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
<template #body="props">
|
<template #body-cell-description="props">
|
||||||
<QTr :props="props">
|
<QTd :props="props">
|
||||||
<QTd v-for="col in props.cols" :key="col.name" :props="props">
|
<span class="link">
|
||||||
<template v-if="col.name === 'description'">
|
{{ props.value }}
|
||||||
<span class="link">{{
|
</span>
|
||||||
dashIfEmpty(col.field(props.row))
|
|
||||||
}}</span>
|
|
||||||
<ItemDescriptorProxy
|
<ItemDescriptorProxy
|
||||||
:id="props.row.sale.itemFk"
|
:id="props.row.sale.itemFk"
|
||||||
:sale-fk="props.row.saleFk"
|
:sale-fk="props.row.saleFk"
|
||||||
/>
|
/>
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ dashIfEmpty(col.field(props.row)) }}
|
|
||||||
</template>
|
|
||||||
</QTd>
|
</QTd>
|
||||||
</QTr>
|
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -58,7 +58,7 @@ const getBankEntities = (data, formData) => {
|
||||||
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
|
||||||
:rules="validate('Worker.bankEntity')"
|
:rules="validate('Worker.bankEntity')"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="bic"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="data.bankEntityFk"
|
v-model="data.bankEntityFk"
|
||||||
>
|
>
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
import { 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 { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import ModalCloseContract from 'src/pages/Customer/components/ModalCloseContract.vue';
|
import ModalCloseContract from 'src/pages/Customer/components/ModalCloseContract.vue';
|
||||||
import { toDate } from 'src/filters';
|
import CustomerCreditContractsCreate from '../components/CustomerCreditContractsCreate.vue';
|
||||||
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -16,6 +17,7 @@ const quasar = useQuasar();
|
||||||
|
|
||||||
const vnPaginateRef = ref(null);
|
const vnPaginateRef = ref(null);
|
||||||
const showQPageSticky = ref(true);
|
const showQPageSticky = ref(true);
|
||||||
|
const showForm = ref();
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
order: 'finished ASC, started DESC',
|
order: 'finished ASC, started DESC',
|
||||||
|
@ -36,25 +38,21 @@ const fetch = (data) => {
|
||||||
data.forEach((element) => {
|
data.forEach((element) => {
|
||||||
if (!element.finished) {
|
if (!element.finished) {
|
||||||
showQPageSticky.value = false;
|
showQPageSticky.value = false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const toCustomerCreditContractsCreate = () => {
|
|
||||||
router.push({ name: 'CustomerCreditContractsCreate' });
|
|
||||||
};
|
|
||||||
|
|
||||||
const openDialog = (item) => {
|
const openDialog = (item) => {
|
||||||
quasar.dialog({
|
quasar.dialog({
|
||||||
component: ModalCloseContract,
|
component: ModalCloseContract,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
promise: updateData,
|
promise: async () => {
|
||||||
|
await updateData();
|
||||||
|
showQPageSticky.value = true;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
updateData();
|
|
||||||
showQPageSticky.value = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const openViewCredit = (credit) => {
|
const openViewCredit = (credit) => {
|
||||||
|
@ -66,14 +64,14 @@ const openViewCredit = (credit) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateData = () => {
|
const updateData = async () => {
|
||||||
vnPaginateRef.value?.fetch();
|
await vnPaginateRef.value?.fetch();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="full-width flex justify-center">
|
<section class="row justify-center">
|
||||||
<QCard class="card-width q-pa-lg">
|
<QCard class="q-pa-lg" style="width: 70%">
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
:user-filter="filter"
|
:user-filter="filter"
|
||||||
@on-fetch="fetch"
|
@on-fetch="fetch"
|
||||||
|
@ -84,100 +82,84 @@ const updateData = () => {
|
||||||
url="CreditClassifications"
|
url="CreditClassifications"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<div v-if="rows.length">
|
<div v-if="rows.length" class="q-gutter-y-md">
|
||||||
<QCard
|
<QCard
|
||||||
v-for="(item, index) in rows"
|
v-for="(item, index) in rows"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{
|
:class="{ disabled: item.finished }"
|
||||||
'customer-card': true,
|
|
||||||
'q-mb-md': index < rows.length - 1,
|
|
||||||
'is-active': !item.finished,
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
<QCardSection
|
<QCardSection
|
||||||
class="full-width flex justify-between q-py-none"
|
class="full-width"
|
||||||
>
|
:class="{ 'row justify-between': $q.screen.gt.md }"
|
||||||
<div class="width-state flex">
|
|
||||||
<div
|
|
||||||
class="flex items-center cursor-pointer q-mr-md"
|
|
||||||
v-if="!item.finished"
|
|
||||||
>
|
>
|
||||||
|
<div class="width-state row no-wrap">
|
||||||
<QIcon
|
<QIcon
|
||||||
|
:style="{
|
||||||
|
visibility: item.finished
|
||||||
|
? 'hidden'
|
||||||
|
: 'visible',
|
||||||
|
}"
|
||||||
@click.stop="openDialog(item)"
|
@click.stop="openDialog(item)"
|
||||||
color="primary"
|
color="primary"
|
||||||
name="lock"
|
name="lock"
|
||||||
|
data-cy="closeBtn"
|
||||||
size="md"
|
size="md"
|
||||||
class="fill-icon"
|
class="fill-icon q-px-md"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('Close contract') }}</QTooltip>
|
<QTooltip>{{ t('Close contract') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div class="column">
|
||||||
<div class="flex q-mb-xs">
|
<VnLv
|
||||||
<div class="q-mr-sm color-vn-label">
|
:label="t('Since')"
|
||||||
{{ t('Since') }}:
|
:value="toDate(item.started)"
|
||||||
</div>
|
/>
|
||||||
<div class="text-weight-bold">
|
<VnLv
|
||||||
{{ toDate(item.started) }}
|
:label="t('To')"
|
||||||
</div>
|
:value="toDate(item.finished)"
|
||||||
</div>
|
/>
|
||||||
<div class="flex">
|
|
||||||
<div class="q-mr-sm color-vn-label">
|
|
||||||
{{ t('To') }}:
|
|
||||||
</div>
|
|
||||||
<div class="text-weight-bold">
|
|
||||||
{{ toDate(item.finished) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<QSeparator vertical />
|
<QSeparator vertical />
|
||||||
|
|
||||||
<div class="width-data flex">
|
<div class="column width-data">
|
||||||
<div
|
<div
|
||||||
class="full-width flex justify-between items-center"
|
class="column"
|
||||||
v-if="item?.insurances.length"
|
v-if="item?.insurances.length"
|
||||||
|
v-for="insurance in item.insurances"
|
||||||
|
:key="insurance.id"
|
||||||
>
|
>
|
||||||
<div class="flex">
|
<div
|
||||||
<div class="color-vn-label q-mr-xs">
|
:class="{
|
||||||
{{ t('Credit') }}:
|
'row q-gutter-x-md': $q.screen.gt.sm,
|
||||||
</div>
|
}"
|
||||||
<div class="text-weight-bold">
|
class="q-mb-sm"
|
||||||
{{ item.insurances[0].credit }}
|
>
|
||||||
|
<VnLv
|
||||||
|
:label="t('Credit')"
|
||||||
|
:value="toCurrency(insurance.credit)"
|
||||||
|
/>
|
||||||
|
<VnLv
|
||||||
|
:label="t('Grade')"
|
||||||
|
:value="dashIfEmpty(insurance.grade)"
|
||||||
|
/>
|
||||||
|
<VnLv
|
||||||
|
:label="t('Date')"
|
||||||
|
:value="toDate(insurance.created)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex">
|
|
||||||
<div class="color-vn-label q-mr-xs">
|
|
||||||
{{ t('Grade') }}:
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-weight-bold">
|
<QBtn
|
||||||
{{ item.insurances[0].grade || '-' }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex">
|
|
||||||
<div class="color-vn-label q-mr-xs">
|
|
||||||
{{ t('Date') }}:
|
|
||||||
</div>
|
|
||||||
<div class="text-weight-bold">
|
|
||||||
{{ toDate(item.insurances[0].created) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center cursor-pointer">
|
|
||||||
<QIcon
|
|
||||||
@click.stop="openViewCredit(item)"
|
@click.stop="openViewCredit(item)"
|
||||||
color="primary"
|
icon="preview"
|
||||||
name="preview"
|
|
||||||
size="md"
|
size="md"
|
||||||
>
|
:title="t('View credits')"
|
||||||
<QTooltip>{{
|
data-cy="viewBtn"
|
||||||
t('View credits')
|
color="primary"
|
||||||
}}</QTooltip>
|
flat
|
||||||
</QIcon>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
</QCard>
|
</QCard>
|
||||||
</div>
|
</div>
|
||||||
|
@ -187,11 +169,12 @@ const updateData = () => {
|
||||||
</template>
|
</template>
|
||||||
</VnPaginate>
|
</VnPaginate>
|
||||||
</QCard>
|
</QCard>
|
||||||
</div>
|
</section>
|
||||||
|
|
||||||
<QPageSticky :offset="[18, 18]" v-if="showQPageSticky">
|
<QPageSticky :offset="[18, 18]" v-if="showQPageSticky">
|
||||||
<QBtn
|
<QBtn
|
||||||
@click.stop="toCustomerCreditContractsCreate()"
|
data-cy="createBtn"
|
||||||
|
@click.stop="showForm = !showForm"
|
||||||
color="primary"
|
color="primary"
|
||||||
fab
|
fab
|
||||||
icon="add"
|
icon="add"
|
||||||
|
@ -201,24 +184,25 @@ const updateData = () => {
|
||||||
{{ t('New contract') }}
|
{{ t('New contract') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
|
|
||||||
|
<QDialog v-model="showForm">
|
||||||
|
<CustomerCreditContractsCreate @on-data-saved="updateData()" />
|
||||||
|
</QDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.customer-card {
|
|
||||||
border: 2px solid var(--vn-light-gray);
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 10px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
.is-active {
|
|
||||||
background-color: var(--vn-light-gray);
|
|
||||||
}
|
|
||||||
.width-state {
|
.width-state {
|
||||||
width: 30%;
|
width: 30%;
|
||||||
}
|
}
|
||||||
.width-data {
|
.width-data {
|
||||||
width: 65%;
|
width: 50%;
|
||||||
|
}
|
||||||
|
::v-deep(.label) {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
::v-deep(.label)::after {
|
||||||
|
content: ':';
|
||||||
|
color: var(--vn-label-color);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
<script setup>
|
||||||
|
import { computed, onBeforeMount, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
|
import { toCurrency, toDate } from 'src/filters';
|
||||||
|
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const route = useRoute();
|
||||||
|
const create = ref(null);
|
||||||
|
const tableRef = ref();
|
||||||
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
field: 'created',
|
||||||
|
format: ({ created }) => toDate(created),
|
||||||
|
label: t('Created'),
|
||||||
|
name: 'created',
|
||||||
|
create: true,
|
||||||
|
columnCreate: {
|
||||||
|
component: 'date',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
field: 'grade',
|
||||||
|
label: t('Grade'),
|
||||||
|
name: 'grade',
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
format: ({ credit }) => toCurrency(credit),
|
||||||
|
label: t('Credit'),
|
||||||
|
name: 'credit',
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const query = `CreditClassifications/findOne?filter=${encodeURIComponent(
|
||||||
|
JSON.stringify({
|
||||||
|
fields: ['finished'],
|
||||||
|
where: { id: route.params.creditId },
|
||||||
|
}),
|
||||||
|
)}`;
|
||||||
|
const { data } = await axios(query);
|
||||||
|
create.value = data.finished
|
||||||
|
? false
|
||||||
|
: {
|
||||||
|
urlCreate: 'CreditInsurances',
|
||||||
|
title: t('Create Insurance'),
|
||||||
|
onDataSaved: () => tableRef.value.reload(),
|
||||||
|
formInitialData: {
|
||||||
|
created: Date.vnNew(),
|
||||||
|
creditClassificationFk: route.params.creditId,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VnTable
|
||||||
|
v-if="create != null"
|
||||||
|
url="CreditInsurances"
|
||||||
|
ref="tableRef"
|
||||||
|
data-key="creditInsurances"
|
||||||
|
:filter="{
|
||||||
|
where: {
|
||||||
|
creditClassificationFk: `${route.params.creditId}`,
|
||||||
|
},
|
||||||
|
order: 'created DESC',
|
||||||
|
}"
|
||||||
|
:columns="columns"
|
||||||
|
:right-search="false"
|
||||||
|
:is-editable="false"
|
||||||
|
:use-model="true"
|
||||||
|
:column-search="false"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
|
:create
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Created: Fecha creación
|
||||||
|
Grade: Grade
|
||||||
|
Credit: Crédito
|
||||||
|
</i18n>
|
|
@ -99,7 +99,13 @@ async function acceptPropagate({ isEqualizated }) {
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput :label="t('Street')" clearable v-model="data.street" required />
|
<VnInput
|
||||||
|
:label="t('Street')"
|
||||||
|
clearable
|
||||||
|
v-model="data.street"
|
||||||
|
:uppercase="true"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
|
|
|
@ -26,6 +26,7 @@ const columns = computed(() => [
|
||||||
url: 'Clients',
|
url: 'Clients',
|
||||||
fields: ['id', 'socialName'],
|
fields: ['id', 'socialName'],
|
||||||
optionLabel: 'socialName',
|
optionLabel: 'socialName',
|
||||||
|
optionValue: 'socialName',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
columnClass: 'expand',
|
columnClass: 'expand',
|
||||||
|
@ -37,8 +38,11 @@ const columns = computed(() => [
|
||||||
name: 'city',
|
name: 'city',
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'select',
|
component: 'select',
|
||||||
|
inWhere: true,
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'Towns',
|
url: 'Towns',
|
||||||
|
optionValue: 'name',
|
||||||
|
optionLabel: 'name',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
|
@ -95,7 +99,7 @@ const columns = computed(() => [
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<VnTable
|
<VnTable
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
url="Clients/filter"
|
url="Clients/extendedListFilter"
|
||||||
:table="{
|
:table="{
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
|
|
|
@ -3,44 +3,29 @@ import { reactive, computed } 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 FormModel from 'components/FormModel.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
import FormModelPopup from 'src/components/FormModelPopup.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const routeId = computed(() => route.params.id);
|
const routeId = computed(() => route.params.id);
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const initialData = reactive({
|
const initialData = reactive({
|
||||||
started: Date.vnNew(),
|
started: Date.vnNew(),
|
||||||
clientFk: routeId.value,
|
clientFk: routeId.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
const toCustomerCreditContracts = () => {
|
|
||||||
router.push({ name: 'CustomerCreditContracts' });
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FormModel
|
<FormModelPopup
|
||||||
|
v-on="$attrs"
|
||||||
:form-initial-data="initialData"
|
:form-initial-data="initialData"
|
||||||
:observe-form-changes="false"
|
:observe-form-changes="false"
|
||||||
url-create="creditClassifications/createWithInsurance"
|
url-create="creditClassifications/createWithInsurance"
|
||||||
@on-data-saved="toCustomerCreditContracts()"
|
|
||||||
>
|
>
|
||||||
<template #moreActions>
|
<template #form-inputs="{ data }">
|
||||||
<QBtn
|
|
||||||
:label="t('globals.cancel')"
|
|
||||||
@click="toCustomerCreditContracts"
|
|
||||||
color="primary"
|
|
||||||
flat
|
|
||||||
icon="close"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #form="{ data }">
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -63,7 +48,7 @@ const toCustomerCreditContracts = () => {
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModelPopup>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
import { toCurrency, toDate } from 'src/filters';
|
|
||||||
|
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const filter = {
|
|
||||||
where: {
|
|
||||||
creditClassificationFk: `${route.params.creditId}`,
|
|
||||||
},
|
|
||||||
limit: 20,
|
|
||||||
};
|
|
||||||
const columns = computed(() => [
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
field: 'created',
|
|
||||||
format: ({ created }) => toDate(created),
|
|
||||||
label: t('Created'),
|
|
||||||
name: 'created',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
field: 'grade',
|
|
||||||
label: t('Grade'),
|
|
||||||
name: 'grade',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
format: ({ credit }) => toCurrency(credit),
|
|
||||||
label: t('Credit'),
|
|
||||||
name: 'credit',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<VnTable
|
|
||||||
url="CreditInsurances"
|
|
||||||
ref="tableRef"
|
|
||||||
data-key="creditInsurances"
|
|
||||||
:filter="filter"
|
|
||||||
:columns="columns"
|
|
||||||
:right-search="false"
|
|
||||||
:is-editable="false"
|
|
||||||
:use-model="true"
|
|
||||||
:column-search="false"
|
|
||||||
:disable-option="{ card: true }"
|
|
||||||
auto-load
|
|
||||||
></VnTable>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<i18n>
|
|
||||||
es:
|
|
||||||
Created: Fecha creación
|
|
||||||
Grade: Grade
|
|
||||||
Credit: Crédito
|
|
||||||
</i18n>
|
|
|
@ -15,7 +15,7 @@ import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescripto
|
||||||
import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue';
|
import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
|
||||||
|
import { getItemPackagingType } from '../composables/getItemPackagingType.js';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -161,23 +161,6 @@ const setShippedColor = (date) => {
|
||||||
};
|
};
|
||||||
const rowClick = ({ id }) =>
|
const rowClick = ({ id }) =>
|
||||||
window.open(router.resolve({ params: { id }, name: 'TicketSummary' }).href, '_blank');
|
window.open(router.resolve({ params: { id }, name: 'TicketSummary' }).href, '_blank');
|
||||||
|
|
||||||
const getItemPackagingType = (ticketSales) => {
|
|
||||||
if (!ticketSales?.length) return '-';
|
|
||||||
|
|
||||||
const packagingTypes = ticketSales.reduce((types, sale) => {
|
|
||||||
const { itemPackingTypeFk } = sale.item;
|
|
||||||
if (
|
|
||||||
!types.includes(itemPackingTypeFk) &&
|
|
||||||
(itemPackingTypeFk === 'H' || itemPackingTypeFk === 'V')
|
|
||||||
) {
|
|
||||||
types.push(itemPackingTypeFk);
|
|
||||||
}
|
|
||||||
return types;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return dashIfEmpty(packagingTypes.join(', ') || '-');
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import { getItemPackagingType } from '../getItemPackagingType';
|
||||||
|
|
||||||
|
describe('getItemPackagingType', () => {
|
||||||
|
it('should return "-" if ticketSales is null or undefined', () => {
|
||||||
|
expect(getItemPackagingType(null)).toBe('-');
|
||||||
|
expect(getItemPackagingType(undefined)).toBe('-');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return "-" if ticketSales does not have a length property', () => {
|
||||||
|
const ticketSales = { someKey: 'someValue' }; // No tiene propiedad length
|
||||||
|
expect(getItemPackagingType(ticketSales)).toBe('-');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return unique packaging types as a comma-separated string', () => {
|
||||||
|
const ticketSales = [
|
||||||
|
{ item: { itemPackingTypeFk: 'H' } },
|
||||||
|
{ item: { itemPackingTypeFk: 'V' } },
|
||||||
|
{ item: { itemPackingTypeFk: 'H' } },
|
||||||
|
];
|
||||||
|
expect(getItemPackagingType(ticketSales)).toBe('H, V');
|
||||||
|
});
|
||||||
|
it('should return unique packaging types as a comma-separated string', () => {
|
||||||
|
const ticketSales = [
|
||||||
|
{ item: { itemPackingTypeFk: 'H' } },
|
||||||
|
{ item: { itemPackingTypeFk: 'V' } },
|
||||||
|
{ item: { itemPackingTypeFk: 'H' } },
|
||||||
|
{ item: { itemPackingTypeFk: 'A' } },
|
||||||
|
];
|
||||||
|
expect(getItemPackagingType(ticketSales)).toBe('H, V, A');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return "-" if ticketSales is an empty array', () => {
|
||||||
|
expect(getItemPackagingType([])).toBe('-');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { dashIfEmpty } from 'src/filters';
|
||||||
|
|
||||||
|
export function getItemPackagingType(ticketSales) {
|
||||||
|
if (!ticketSales?.length) return '-';
|
||||||
|
|
||||||
|
const packagingTypes = Array.from(
|
||||||
|
new Set(ticketSales.map(({ item: { itemPackingTypeFk } }) => itemPackingTypeFk)),
|
||||||
|
);
|
||||||
|
|
||||||
|
return dashIfEmpty(packagingTypes.join(', '));
|
||||||
|
}
|
|
@ -13,6 +13,8 @@ export default {
|
||||||
'daysInForward',
|
'daysInForward',
|
||||||
'availabled',
|
'availabled',
|
||||||
'awbFk',
|
'awbFk',
|
||||||
|
'isDelivered',
|
||||||
|
'isReceived',
|
||||||
],
|
],
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,6 +182,7 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
showValue: false,
|
showValue: false,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
style: 'max-width: 200px;',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('globals.packages'),
|
label: t('globals.packages'),
|
||||||
|
@ -206,6 +207,7 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
showValue: false,
|
showValue: false,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
style: 'max-width: 75px;',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('extraCommunity.physicKg'),
|
label: t('extraCommunity.physicKg'),
|
||||||
|
|
|
@ -408,7 +408,7 @@ const isUnsatisfied = async (reason) => {
|
||||||
|
|
||||||
const resendEmail = async () => {
|
const resendEmail = async () => {
|
||||||
const params = {
|
const params = {
|
||||||
recipient: worker.value[0]?.user?.emailUser?.email,
|
recipient: worker.value?.user?.emailUser?.email,
|
||||||
week: selectedWeekNumber.value,
|
week: selectedWeekNumber.value,
|
||||||
year: selectedDateYear.value,
|
year: selectedDateYear.value,
|
||||||
workerId: Number(route.params.id),
|
workerId: Number(route.params.id),
|
||||||
|
|
|
@ -225,7 +225,7 @@ const customerCard = {
|
||||||
name: 'CustomerCreditContractsInsurance',
|
name: 'CustomerCreditContractsInsurance',
|
||||||
component: () =>
|
component: () =>
|
||||||
import(
|
import(
|
||||||
'src/pages/Customer/components/CustomerCreditContractsInsurance.vue'
|
'src/pages/Customer/Card/CustomerCreditContractsInsurance.vue'
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -7,7 +7,28 @@ describe('Client credit contracts', () => {
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('Should load layout', () => {
|
it('Should add a new contract and an additional credit', () => {
|
||||||
cy.get('.q-page').should('be.visible');
|
cy.dataCy('createBtn').click();
|
||||||
|
cy.dataCy('Credit_input').type(123);
|
||||||
|
cy.dataCy('Grade_input').type(9);
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
cy.dataCy('createBtn').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should add an additional credit', () => {
|
||||||
|
cy.dataCy('viewBtn').eq(0).click();
|
||||||
|
cy.get('.q-page-sticky > div').click();
|
||||||
|
cy.dataCy('Credit_input').type(321);
|
||||||
|
cy.dataCy('Grade_input').type(89);
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should close a contract', () => {
|
||||||
|
cy.dataCy('closeBtn').eq(0).click();
|
||||||
|
cy.get('.q-btn--unelevated').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
cy.dataCy('createBtn').should('exist');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue