0
0
Fork 0

Merge branch 'dev' into 6256-breakWord

This commit is contained in:
Carlos Satorres 2024-01-03 08:16:56 +00:00
commit be02a1f47a
18 changed files with 121 additions and 102 deletions

View File

@ -24,11 +24,8 @@ const pinnedModulesRef = ref();
</script> </script>
<template> <template>
<QHeader class="bg-dark" color="white" elevated> <QHeader color="white" elevated>
<QToolbar <QToolbar class="q-py-sm q-px-md">
class="q-py-sm q-px-md"
:class="{ 'q-gutter-x-sm': !quasar.platform.is.mobile }"
>
<QBtn @click="stateStore.toggleLeftDrawer()" icon="menu" round dense flat> <QBtn @click="stateStore.toggleLeftDrawer()" icon="menu" round dense flat>
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }} {{ t('globals.collapseMenu') }}
@ -108,6 +105,9 @@ const pinnedModulesRef = ref();
.searchbar { .searchbar {
width: max-content; width: max-content;
} }
.q-header {
background-color: var(--vn-dark);
}
</style> </style>
<i18n> <i18n>
en: en:

View File

@ -81,6 +81,10 @@ function logout() {
session.destroy(); session.destroy();
router.push('/login'); router.push('/login');
} }
function copyUserToken(){
navigator.clipboard.writeText(session.getToken());
}
</script> </script>
<template> <template>
@ -122,7 +126,8 @@ function logout() {
<div class="text-subtitle1 q-mt-md"> <div class="text-subtitle1 q-mt-md">
<strong>{{ user.nickname }}</strong> <strong>{{ user.nickname }}</strong>
</div> </div>
<div class="text-subtitle3 text-grey-7 q-mb-xs">@{{ user.name }}</div> <div class="text-subtitle3 text-grey-7 q-mb-xs copyUserToken" @click="copyUserToken()" >@{{ user.name }}
</div>
<QBtn <QBtn
id="logout" id="logout"
@ -143,4 +148,10 @@ function logout() {
.panel { .panel {
width: 150px; width: 150px;
} }
.copyUserToken {
&:hover{
cursor: alias;
}
}
</style> </style>

View File

@ -69,6 +69,10 @@ function getBreadcrumb(param) {
> div { > div {
flex-wrap: nowrap; flex-wrap: nowrap;
} }
&--last,
&__separator {
color: var(--vn-label);
}
} }
@media (max-width: $breakpoint-md) { @media (max-width: $breakpoint-md) {
.q-breadcrumbs { .q-breadcrumbs {

View File

@ -5,7 +5,7 @@ import { dashIfEmpty } from 'src/filters';
const $props = defineProps({ const $props = defineProps({
label: { type: String, default: null }, label: { type: String, default: null },
value: { value: {
type: [String, Boolean], type: [String, Boolean, Number],
default: null, default: null,
}, },
info: { type: String, default: null }, info: { type: String, default: null },

View File

@ -16,7 +16,7 @@ export function useUserConfig() {
return data; return data;
} catch (error) { } catch (error) {
notify('globals.errors.userConfig', 'negative'); notify('errors.userConfig', 'negative');
console.error('Error fetching user config:', error); console.error('Error fetching user config:', error);
} }
} }

View File

@ -17,9 +17,9 @@ a {
// Removes chrome autofill background // Removes chrome autofill background
input:-webkit-autofill, input:-webkit-autofill,
select:-webkit-autofill { select:-webkit-autofill {
color: $input-text-color !important; color: var(--vn-text) ;
font-family: $typography-font-family; font-family: $typography-font-family;
-webkit-text-fill-color: $input-text-color !important; -webkit-text-fill-color: var(--vn-text) ;
-webkit-background-clip: text !important; -webkit-background-clip: text !important;
background-clip: text !important; background-clip: text !important;
} }

View File

@ -371,7 +371,7 @@ export default {
}, },
invoiceOut: { invoiceOut: {
pageTitles: { pageTitles: {
invoiceOuts: 'Fact. emitidas', invoiceOuts: 'Crear factura',
list: 'Listado', list: 'Listado',
negativeBases: 'Bases Negativas', negativeBases: 'Bases Negativas',
globalInvoicing: 'Facturación global', globalInvoicing: 'Facturación global',

View File

@ -127,11 +127,14 @@ async function updateDestination(claimDestinationFk, row, options = {}) {
} }
async function regularizeClaim() { async function regularizeClaim() {
const query = `Claims/${claimId}/regularizeClaim`; await axios.post(`Claims/${claimId}/regularizeClaim`);
await axios.post(query);
if (claim.value.responsibility >= Math.ceil(DEFAULT_MAX_RESPONSABILITY) / 2) {
await claimRef.value.fetch(); await claimRef.value.fetch();
await arrayData.fetch({ append: false });
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
if (claim.value.responsibility >= Math.ceil(DEFAULT_MAX_RESPONSABILITY) / 2) {
quasar quasar
.dialog({ .dialog({
component: VnConfirm, component: VnConfirm,
@ -141,29 +144,19 @@ async function regularizeClaim() {
}, },
}) })
.onOk(async () => await onUpdateGreugeAccept()); .onOk(async () => await onUpdateGreugeAccept());
} else {
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
} }
await arrayData.fetch({ append: false });
}
async function updateGreuge(greuges) {
const { data } = await axios.post(`Greuges`, greuges);
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
return data;
} }
async function onUpdateGreugeAccept() { async function onUpdateGreugeAccept() {
const greugeTypeFreightId = await getGreugeTypeId(); const greugeTypeFreightId = (
const freightPickUpPrice = await getGreugeConfig(); await axios.get(`GreugeTypes/findOne`, {
filter: { where: { code: 'freightPickUp' } },
})
).data.id;
const freightPickUpPrice = (await axios.get(`GreugeConfigs/findOne`)).data
.freightPickUpPrice;
await updateGreuge({ await axios.post(`Greuges`, {
clientFk: claim.value.clientFk, clientFk: claim.value.clientFk,
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(), description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
amount: freightPickUpPrice, amount: freightPickUpPrice,
@ -176,19 +169,6 @@ async function onUpdateGreugeAccept() {
}); });
} }
async function getGreugeTypeId() {
const params = { filter: { where: { code: 'freightPickUp' } } };
const query = `GreugeTypes/findOne`;
const { data } = await axios.get(query, { params });
return data.id;
}
async function getGreugeConfig() {
const query = `GreugeConfigs/findOne`;
const { data } = await axios.get(query);
return data.freightPickUpPrice;
}
async function save(data) { async function save(data) {
const query = `Claims/${claimId}/updateClaimAction`; const query = `Claims/${claimId}/updateClaimAction`;
await axios.patch(query, data); await axios.patch(query, data);

View File

@ -84,7 +84,7 @@ function viewDescriptor(id) {
<VnPaginate <VnPaginate
data-key="ClaimList" data-key="ClaimList"
url="Claims/filter" url="Claims/filter"
order="id DESC" order="claimStateFk"
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">

View File

@ -0,0 +1,6 @@
<script setup>
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="InvoiceIn" />
</template>

View File

@ -203,7 +203,7 @@ function getLink(param) {
@on-fetch="(data) => setData(data)" @on-fetch="(data) => setData(data)"
> >
<template #header="{ entity: invoiceIn }"> <template #header="{ entity: invoiceIn }">
<div>{{ invoiceIn.id }} - {{ invoiceIn.supplier.name }}</div> <div>{{ invoiceIn.id }} - {{ invoiceIn.supplier?.name }}</div>
</template> </template>
<template #body="{ entity: invoiceIn }"> <template #body="{ entity: invoiceIn }">
<!--Basic Data--> <!--Basic Data-->
@ -216,7 +216,7 @@ function getLink(param) {
</QCardSection> </QCardSection>
<VnLv <VnLv
:label="t('invoiceIn.summary.supplier')" :label="t('invoiceIn.summary.supplier')"
:value="invoiceIn.supplier.name" :value="invoiceIn.supplier?.name"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.supplierRef')" :label="t('invoiceIn.summary.supplierRef')"
@ -224,7 +224,7 @@ function getLink(param) {
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.currency')" :label="t('invoiceIn.summary.currency')"
:value="invoiceIn.currency.code" :value="invoiceIn.currency?.code"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.docNumber')" :label="t('invoiceIn.summary.docNumber')"
@ -265,7 +265,7 @@ function getLink(param) {
</QCardSection> </QCardSection>
<VnLv <VnLv
:label="t('invoiceIn.summary.sage')" :label="t('invoiceIn.summary.sage')"
:value="invoiceIn.sageWithholding.withholding" :value="invoiceIn.sageWithholding?.withholding"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.vat')" :label="t('invoiceIn.summary.vat')"
@ -273,7 +273,7 @@ function getLink(param) {
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.company')" :label="t('invoiceIn.summary.company')"
:value="invoiceIn.company.code" :value="invoiceIn.company?.code"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.booked')" :label="t('invoiceIn.summary.booked')"

View File

@ -84,9 +84,9 @@ function viewSummary(id) {
:key="row.id" :key="row.id"
:title="row.supplierRef" :title="row.supplierRef"
@click="navigate(row.id)" @click="navigate(row.id)"
:id="row.id"
> >
<template #list-items> <template #list-items>
<VnLv label="ID" :value="row.id" />
<VnLv <VnLv
:label="t('invoiceIn.list.supplierRef')" :label="t('invoiceIn.list.supplierRef')"
:value="row.supplierRef" :value="row.supplierRef"
@ -112,42 +112,34 @@ function viewSummary(id) {
:label="t('invoiceIn.list.amount')" :label="t('invoiceIn.list.amount')"
:value="toCurrency(row.amount)" :value="toCurrency(row.amount)"
/> />
<VnLv :label="t('invoiceIn.list.isBooked')"> <VnLv
<template #value> :label="t('invoiceIn.list.isBooked')"
<QCheckbox :value="!!row.isBooked"
class="no-pointer-events"
v-model="row.isBooked"
size="xs"
:true-value="1"
:false-value="0"
/> />
</template> </template>
</VnLv>
</template>
<template #actions> <template #actions>
<QBtn <QBtn
flat :label="t('components.smartCard.openCard')"
icon="arrow_circle_right"
@click.stop="navigate(row.id)" @click.stop="navigate(row.id)"
> class="bg-vn-dark"
<QTooltip> outline
{{ t('components.smartCard.openCard') }} type="reset"
</QTooltip> />
</QBtn>
<QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
<QTooltip>
{{ t('components.smartCard.openSummary') }}
</QTooltip>
</QBtn>
<QBtn <QBtn
flat :label="t('components.smartCard.openSummary')"
icon="cloud_download" @click.stop="viewSummary(row.id)"
color="primary"
type="submit"
class="q-mt-sm"
/>
<QBtn
:label="t('Download')"
class="q-mt-sm"
@click.stop="downloadFile(row.dmsFk)" @click.stop="downloadFile(row.dmsFk)"
> type="submit"
<QTooltip> color="primary"
{{ t('components.smartCard.downloadFile') }} />
</QTooltip>
</QBtn>
</template> </template>
</CardList> </CardList>
</template> </template>
@ -176,4 +168,5 @@ function viewSummary(id) {
es: es:
Search invoice: Buscar factura emitida Search invoice: Buscar factura emitida
You can search by invoice reference: Puedes buscar por referencia de la factura You can search by invoice reference: Puedes buscar por referencia de la factura
Download: Descargar
</i18n> </i18n>

View File

@ -174,7 +174,23 @@ const columns = ref([
]); ]);
const downloadCSV = async () => { const downloadCSV = async () => {
await invoiceOutGlobalStore.getNegativeBasesCsv(dateRange.from, dateRange.to); const params = filter.value;
const filterParams = {
limit: 20,
where: {
and: [],
},
};
for (const param in params) {
if (params[param]) filterParams.where.and.push({ [param]: params[param] });
}
await invoiceOutGlobalStore.getNegativeBasesCsv(
dateRange.from,
dateRange.to,
JSON.stringify(filterParams)
);
}; };
const search = async () => { const search = async () => {
@ -187,13 +203,13 @@ const search = async () => {
} }
}); });
const searchFilter = { const searchFilter = {
limit: 20 limit: 20,
} };
if (and.length) { if (and.length) {
searchFilter.where = { searchFilter.where = {
and and,
} };
} }
const params = { const params = {
@ -230,9 +246,7 @@ const selectWorkerId = (id) => {
selectedWorkerId.value = id; selectedWorkerId.value = id;
}; };
onMounted(async () => { onMounted(() => refresh());
refresh();
});
</script> </script>
<template> <template>

View File

@ -49,7 +49,7 @@ async function setData(data) {
function formattedAddress() { function formattedAddress() {
if (!ticket.value) return ''; if (!ticket.value) return '';
const address = this.ticket.address; const address = ticket.value.address;
const postcode = address.postalCode; const postcode = address.postalCode;
const province = address.province ? `(${address.province.name})` : ''; const province = address.province ? `(${address.province.name})` : '';
@ -58,7 +58,7 @@ function formattedAddress() {
function isEditable() { function isEditable() {
try { try {
return !this.ticket.ticketState.state.alertLevel; return !ticket.value.ticketState.state.alertLevel;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
@ -67,10 +67,10 @@ function isEditable() {
} }
async function changeState(value) { async function changeState(value) {
if (!this.ticket.id) return; if (!ticket.value.id) return;
const formData = { const formData = {
ticketFk: this.ticket.id, ticketFk: ticket.value.id,
code: value, code: value,
}; };

View File

@ -16,6 +16,7 @@ export default {
'InvoiceInVat', 'InvoiceInVat',
'InvoiceInDueDay', 'InvoiceInDueDay',
'InvoiceInIntrastat', 'InvoiceInIntrastat',
'InvoiceInLog',
], ],
}, },
children: [ children: [
@ -92,6 +93,15 @@ export default {
component: () => component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'), import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'),
}, },
{
name: 'InvoiceInLog',
path: 'log',
meta: {
title: 'log',
icon: 'history',
},
component: () => import('src/pages/InvoiceIn/Card/InvoiceInLog.vue'),
},
], ],
}, },
], ],

View File

@ -219,9 +219,9 @@ export const useInvoiceOutGlobalStore = defineStore({
throw err; throw err;
}, },
async getNegativeBasesCsv(from, to) { async getNegativeBasesCsv(from, to, filter = {}) {
try { try {
const params = { from: from, to: to }; const params = { from: from, to: to, filter };
const CSVResponse = await invoiceOutService.getNegativeBasesCsv(params); const CSVResponse = await invoiceOutService.getNegativeBasesCsv(params);
if (CSVResponse.data && CSVResponse.data.error) throw new Error(); if (CSVResponse.data && CSVResponse.data.error) throw new Error();

View File

@ -11,13 +11,13 @@ export const useNavigationStore = defineStore('navigationStore', () => {
'claim', 'claim',
'ticket', 'ticket',
'invoiceOut', 'invoiceOut',
'invoiceIn',
'worker', 'worker',
'shelving', 'shelving',
'wagon', 'wagon',
'route', 'route',
'supplier', 'supplier',
'travel', 'travel',
'invoiceIn',
]; ];
const pinnedModules = ref([]); const pinnedModules = ref([]);
const role = useRole(); const role = useRole();

View File

@ -1,8 +1,8 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('InvoiceInList', () => { describe('InvoiceInList', () => {
const firstCard = '.q-card:nth-child(1)'; const firstCard = '.q-card:nth-child(1)';
const firstId = const firstChipId =
'.q-card:nth-child(1) .list-items > .vn-label-value:first-child > .value > span'; ':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)'; const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)';
const summaryHeaders = '.summaryBody .header'; const summaryHeaders = '.summaryBody .header';
@ -12,9 +12,10 @@ describe('InvoiceInList', () => {
}); });
it('should redirect on clicking a invoice', () => { it('should redirect on clicking a invoice', () => {
cy.get(firstId) cy.get(firstChipId)
.invoke('text') .invoke('text')
.then((id) => { .then((content) => {
const id = content.substring(4);
cy.get(firstCard).click(); cy.get(firstCard).click();
cy.url().should('include', `/invoice-in/${id}/summary`); cy.url().should('include', `/invoice-in/${id}/summary`);
}); });