Merge branch 'dev' into 8449-vnLogFilter
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2025-03-26 10:53:48 +00:00
commit 7a273fb35f
17 changed files with 160 additions and 87 deletions

View File

@ -35,6 +35,10 @@ const $props = defineProps({
type: String,
default: null,
},
hasFile: {
type: Boolean,
default: false,
},
});
const warehouses = ref();
@ -90,6 +94,7 @@ function defaultData() {
if ($props.formInitialData) return (dms.value = $props.formInitialData);
return addDefaultData({
reference: route.params.id,
hasFile: $props.hasFile,
});
}

View File

@ -0,0 +1,53 @@
<script setup>
import { ref } from 'vue';
import VnSelect from './VnSelect.vue';
const stateBtnDropdownRef = ref();
const emit = defineEmits(['changeState']);
const $props = defineProps({
disable: {
type: Boolean,
default: null,
},
options: {
type: Array,
default: null,
},
optionLabel: {
type: String,
default: 'name',
},
optionValue: {
type: String,
default: 'id',
},
});
async function changeState(value) {
stateBtnDropdownRef.value?.hide();
emit('changeState', value);
}
</script>
<template>
<QBtnDropdown
ref="stateBtnDropdownRef"
color="black"
text-color="white"
:label="$t('globals.changeState')"
:disable="$props.disable"
>
<VnSelect
:options="$props.options"
:option-label="$props.optionLabel"
:option-value="$props.optionValue"
hide-selected
hide-dropdown-icon
focus-on-mount
@update:model-value="changeState"
>
</VnSelect>
</QBtnDropdown>
</template>

View File

@ -458,9 +458,7 @@ watch(
}}:
</span>
<VnLogValue
:value="
value.val.val
"
:value="value.val"
:name="value.name"
/>
</QItem>
@ -514,7 +512,7 @@ watch(
{{ prop.nameI18n }}:
</span>
<VnLogValue
:value="prop.val.val"
:value="prop.val"
:name="prop.name"
/>
<span
@ -545,7 +543,7 @@ watch(
</span>
<span v-if="log.action == 'update'">
<VnLogValue
:value="prop.old.val"
:value="prop.old"
:name="prop.name"
/>
<span
@ -556,7 +554,7 @@ watch(
</span>
<VnLogValue
:value="prop.val.val"
:value="prop.val"
:name="prop.name"
/>
<span
@ -568,7 +566,7 @@ watch(
</span>
<span v-else="prop.old.val">
<VnLogValue
:value="prop.val.val"
:value="prop.val"
:name="prop.name"
/>
<span

View File

@ -5,18 +5,24 @@ import { computed } from 'vue';
const descriptorStore = useDescriptorStore();
const $props = defineProps({
name: { type: [String], default: undefined },
value: { type: Object, default: () => {} },
name: { type: String, default: undefined },
});
const descriptor = computed(() => descriptorStore.has($props.name));
</script>
<template>
<VnJsonValue v-bind="$attrs" />
<QIcon
name="launch"
class="link"
v-if="$attrs.value && descriptor"
:data-cy="'iconLaunch-' + $props.name"
/>
<component :is="descriptor" :id="$attrs.value" v-if="$attrs.value && descriptor" />
<VnJsonValue :value="value.val" />
<span
v-if="(value.id || typeof value.val == 'number') && descriptor"
style="margin-left: 2px"
>
<QIcon
name="launch"
class="link"
:data-cy="'iconLaunch-' + $props.name"
style="padding-bottom: 2px"
/>
<component :is="descriptor" :id="value.id ?? value.val" />
</span>
</template>

View File

@ -889,7 +889,7 @@ components:
openCard: View
openSummary: Summary
viewSummary: Summary
cardDescriptor:
vnDescriptor:
mainList: Main list
summary: Summary
moreOptions: More options

View File

@ -973,7 +973,7 @@ components:
openCard: Ficha
openSummary: Detalles
viewSummary: Vista previa
cardDescriptor:
vnDescriptor:
mainList: Listado principal
summary: Resumen
moreOptions: Más opciones

View File

@ -21,6 +21,7 @@ import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorP
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
import ClaimDescriptorMenu from './ClaimDescriptorMenu.vue';
import VnDropdown from 'src/components/common/VnDropdown.vue';
const route = useRoute();
const router = useRouter();
@ -36,7 +37,7 @@ const $props = defineProps({
});
const entityId = computed(() => $props.id || route.params.id);
const ClaimStates = ref([]);
const claimStates = ref([]);
const claimDmsRef = ref();
const claimDms = ref([]);
const multimediaDialog = ref();
@ -173,7 +174,9 @@ function openDialog(dmsId) {
}
async function changeState(value) {
await axios.patch(`Claims/updateClaim/${entityId.value}`, { claimStateFk: value });
await axios.patch(`Claims/updateClaim/${entityId.value}`, {
claimStateFk: value,
});
router.go(route.fullPath);
}
@ -183,13 +186,18 @@ function claimUrl(section) {
</script>
<template>
<FetchData
url="ClaimStates"
:filter="{ fields: ['id', 'description'] }"
@on-fetch="(data) => (claimStates = data)"
auto-load
/>
<FetchData
url="ClaimDms"
:filter="claimDmsFilter"
@on-fetch="(data) => setClaimDms(data)"
ref="claimDmsRef"
/>
<FetchData url="ClaimStates" @on-fetch="(data) => (ClaimStates = data)" auto-load />
<CardSummary
ref="summary"
:url="`Claims/${entityId}/getSummary`"
@ -201,34 +209,11 @@ function claimUrl(section) {
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
</template>
<template #header-right>
<QBtnDropdown
side
top
color="black"
text-color="white"
:label="t('globals.changeState')"
>
<QList>
<QVirtualScroll
class="max-container-height"
:items="ClaimStates"
separator
v-slot="{ item, index }"
>
<QItem
:key="index"
dense
clickable
v-close-popup
@click="changeState(item.id)"
>
<QItemSection>
<QItemLabel>{{ item.description }}</QItemLabel>
</QItemSection>
</QItem>
</QVirtualScroll>
</QList>
</QBtnDropdown>
<VnDropdown
:options="claimStates"
option-label="description"
@change-state="changeState"
/>
</template>
<template #menu="{ entity }">
<ClaimDescriptorMenu :claim="entity.claim" />

View File

@ -25,7 +25,8 @@ const invoiceInFormRef = ref();
const invoiceId = +route.params.id;
const filter = { where: { invoiceInFk: invoiceId } };
const areRows = ref(false);
const totals = ref();
const totalTaxableBase = ref();
const noMatch = computed(() => totalAmount.value != totalTaxableBase.value);
const columns = computed(() => [
{
name: 'duedate',
@ -74,9 +75,12 @@ async function insert() {
notify(t('globals.dataSaved'), 'positive');
}
onBeforeMount(async () => {
totals.value = (await axios.get(`InvoiceIns/${invoiceId}/getTotals`)).data;
});
async function setTaxableBase() {
const { data } = await axios.get(`InvoiceIns/${invoiceId}/getTotals`);
totalTaxableBase.value = data.totalTaxableBase;
}
onBeforeMount(async () => await setTaxableBase());
</script>
<template>
<CrudModel
@ -89,13 +93,14 @@ onBeforeMount(async () => {
:data-required="{ invoiceInFk: invoiceId }"
v-model:selected="rowsSelected"
@on-fetch="(data) => (areRows = !!data.length)"
@save-changes="setTaxableBase"
>
<template #body="{ rows }">
<QTable
v-model:selected="rowsSelected"
selection="multiple"
:columns="columns"
:rows="rows"
:columns
:rows
row-key="$index"
:grid="$q.screen.lt.sm"
>
@ -151,7 +156,18 @@ onBeforeMount(async () => {
<QTd />
<QTd />
<QTd>
{{ toCurrency(totalAmount) }}
<QChip
dense
:color="noMatch ? 'negative' : 'transparent'"
class="q-pa-xs"
:title="
noMatch
? t('invoiceIn.noMatch', { totalTaxableBase })
: ''
"
>
{{ toCurrency(totalAmount) }}
</QChip>
</QTd>
<QTd>
<template v-if="isNotEuro(invoiceIn.currency.code)">
@ -237,7 +253,7 @@ onBeforeMount(async () => {
if (!areRows) insert();
else
invoiceInFormRef.insert({
amount: (totals.totalTaxableBase - totalAmount).toFixed(2),
amount: (totalTaxableBase - totalAmount).toFixed(2),
invoiceInFk: invoiceId,
});
}
@ -249,6 +265,10 @@ onBeforeMount(async () => {
.bg {
background-color: var(--vn-light-gray);
}
.q-chip {
color: var(--vn-text-color);
}
</style>
<i18n>
es:

View File

@ -304,7 +304,10 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
:color="amountsNotMatch ? 'negative' : 'transparent'"
:title="
amountsNotMatch
? t('invoiceIn.summary.noMatch')
? t('invoiceIn.noMatch', {
totalTaxableBase:
entity.totals.totalTaxableBase,
})
: t('invoiceIn.summary.dueTotal')
"
>

View File

@ -156,7 +156,7 @@ const cols = computed(() => [
:create="{
urlCreate: 'InvoiceIns',
title: t('globals.createInvoiceIn'),
onDataSaved: ({ id }) => tableRef.redirect(id),
onDataSaved: ({ id }) => tableRef.redirect(`${id}/basic-data`),
formInitialData: { companyFk: user.companyFk, issued: Date.vnNew() },
}"
redirect="invoice-in"

View File

@ -56,8 +56,9 @@ async function checkToBook(id) {
componentProps: {
title: t('Are you sure you want to book this invoice?'),
message: messages.reduce((acc, msg) => `${acc}<p>${msg}</p>`, ''),
promise: () => toBook(id),
},
}).onOk(() => toBook(id));
});
}
async function toBook(id) {

View File

@ -58,7 +58,6 @@ invoiceIn:
bank: Bank
foreignValue: Foreign value
dueTotal: Due day
noMatch: Do not match
code: Code
net: Net
stems: Stems
@ -69,3 +68,4 @@ invoiceIn:
isBooked: Is booked
account: Ledger account
correctingFk: Rectificative
noMatch: No match with the vat({totalTaxableBase})

View File

@ -67,3 +67,4 @@ invoiceIn:
isBooked: Contabilizada
account: Cuenta contable
correctingFk: Rectificativa
noMatch: No cuadra con el iva({totalTaxableBase})

View File

@ -0,0 +1,14 @@
<script setup>
import ParkingDescriptor from './ParkingDescriptor.vue';
import ParkingSummary from './ParkingSummary.vue';
</script>
<template>
<QPopupProxy style="max-width: 10px">
<ParkingDescriptor
v-if="$attrs.id"
v-bind="$attrs.id"
:summary="ParkingSummary"
:proxy-render="true"
/>
</QPopupProxy>
</template>

View File

@ -21,6 +21,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue';
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
import TicketProblems from 'src/components/TicketProblems.vue';
import VnDropdown from 'src/components/common/VnDropdown.vue';
const route = useRoute();
const { notify } = useNotify();
@ -40,7 +41,7 @@ const ticket = computed(() => summary.value?.entity);
const editableStates = ref([]);
const ticketUrl = ref();
const grafanaUrl = 'https://grafana.verdnatura.es';
const stateBtnDropdownRef = ref();
const descriptorData = useArrayData('Ticket');
onMounted(async () => {
@ -67,7 +68,6 @@ function isEditable() {
}
async function changeState(value) {
stateBtnDropdownRef.value?.hide();
const formData = {
ticketFk: entityId.value,
code: value,
@ -113,25 +113,12 @@ onMounted(async () => {
</div>
</template>
<template #header-right>
<div>
<QBtnDropdown
ref="stateBtnDropdownRef"
color="black"
text-color="white"
:label="t('globals.changeState')"
:disable="!isEditable()"
>
<VnSelect
:options="editableStates"
hide-selected
option-label="name"
option-value="code"
hide-dropdown-icon
focus-on-mount
@update:model-value="changeState"
/>
</QBtnDropdown>
</div>
<VnDropdown
:disable="!isEditable()"
:options="editableStates"
option-value="code"
@change-state="changeState"
/>
</template>
<template #menu="{ entity }">
<TicketDescriptorMenu :ticket="entity" />

View File

@ -11,7 +11,7 @@ export const useDescriptorStore = defineStore('descriptorStore', () => {
const files = import.meta.glob(`/src/**/*DescriptorProxy.vue`);
const moduleParser = {
account: 'user',
client: 'customer',
customer: 'client',
};
for (const file in files) {
const name = file.split('/').at(-1).slice(0, -19).toLowerCase();

View File

@ -41,12 +41,12 @@ describe('InvoiceInList', () => {
cy.fillInForm({ ...mock }, { attr: 'data-cy' });
cy.dataCy('FormModelPopup_save').click();
cy.intercept('GET', /\/api\/InvoiceIns\/\d+\/getTotals$/).as('invoice');
cy.wait('@invoice').then(() =>
cy.wait('@invoice').then(() => {
cy.validateDescriptor({
title: mockInvoiceRef,
listBox: { 0: '11/16/2001', 3: 'The farmer' },
}),
);
cy.get('[data-cy="vnLvCompany"]').should('contain.text', 'ORN');
});
cy.dataCy('invoiceInBasicDataCompanyFk').should('have.value', 'ORN');
});
});
});