0
0
Fork 0

Merge branch 'dev' into 6259-ticketSmsToClientSms

This commit is contained in:
Pablo Natek 2024-01-04 14:47:46 +00:00
commit 11a37b7716
23 changed files with 135 additions and 125 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "salix-front",
"version": "23.52.01",
"version": "24.02.01",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "salix-front",
"version": "23.52.01",
"version": "24.02.01",
"dependencies": {
"@quasar/cli": "^2.3.0",
"@quasar/extras": "^1.16.4",

View File

@ -1,6 +1,6 @@
{
"name": "salix-front",
"version": "24.00.01",
"version": "24.02.01",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",

View File

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

View File

@ -1,17 +1,18 @@
<script setup>
import { onMounted, computed } from 'vue';
import { Dark, Quasar } from 'quasar';
import { Dark, Quasar, useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import axios from 'axios';
import { useState } from 'src/composables/useState';
import { useSession } from 'src/composables/useSession';
import { localeEquivalence } from "src/i18n/index";
const state = useState();
const session = useSession();
const router = useRouter();
const { t, locale } = useI18n();
const quasar = useQuasar();
const userLocale = computed({
get() {
@ -20,16 +21,14 @@ const userLocale = computed({
set(value) {
locale.value = value;
if (value === 'en') value = 'en-GB';
value = localeEquivalence[value] ?? value
// FIXME: Dynamic imports from absolute paths are not compatible with vite:
// https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations
try {
const langList = import.meta.glob('../../node_modules/quasar/lang/*.mjs');
langList[`../../node_modules/quasar/lang/${value}.mjs`]().then((lang) => {
/* @vite-ignore */
import(`../../node_modules/quasar/lang/${value}.mjs`).then((lang) => {
Quasar.lang.set(lang.default);
});
} catch (error) {
} catch (error) {
//
}
},
@ -84,6 +83,10 @@ function logout() {
function copyUserToken(){
navigator.clipboard.writeText(session.getToken());
quasar.notify({
type: 'positive',
message: t('components.userPanel.copyToken'),
});
}
</script>

View File

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

View File

@ -97,7 +97,7 @@ watch(props, async () => {
flex: 2;
}
> .q-card.vn-three {
flex: 3;
flex: 4;
}
> .q-card.vn-max {
width: 100%;
@ -116,17 +116,17 @@ watch(props, async () => {
margin-top: 5px;
.label {
color: var(--vn-label);
width: 10em;
width: 8em;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-right: 10px;
flex-grow: 0;
flex-shrink: 0;
}
.value {
color: var(--vn-text);
width: max-content;
overflow: hidden;
white-space: nowrap;
}
}
.header {

View File

@ -5,7 +5,7 @@ import { dashIfEmpty } from 'src/filters';
const $props = defineProps({
label: { type: String, default: null },
value: {
type: [String, Boolean],
type: [String, Boolean, Number],
default: null,
},
info: { type: String, default: null },
@ -13,6 +13,13 @@ const $props = defineProps({
});
const isBooleanValue = computed(() => typeof $props.value === 'boolean');
</script>
<style scoped>
.label,
.value {
white-space: pre-line;
word-wrap: break-word;
}
</style>
<template>
<div class="vn-label-value">
<div v-if="$props.label || $slots.label" class="label">

View File

@ -0,0 +1,21 @@
<script setup>
import { onMounted, onUnmounted, ref } from 'vue';
import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore();
onMounted(() => {
stateStore.toggleSubToolbar();
});
onUnmounted(() => {
stateStore.toggleSubToolbar();
});
</script>
<template>
<QToolbar class="bg-vn-dark justify-end">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
</template>

View File

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

View File

@ -742,6 +742,7 @@ export default {
components: {
topbar: {},
userPanel: {
copyToken: 'Token copied to clipboard',
settings: 'Settings',
logOut: 'Log Out',
},

View File

@ -372,7 +372,7 @@ export default {
},
invoiceOut: {
pageTitles: {
invoiceOuts: 'Fact. emitidas',
invoiceOuts: 'Crear factura',
list: 'Listado',
negativeBases: 'Bases Negativas',
globalInvoicing: 'Facturación global',
@ -741,6 +741,7 @@ export default {
components: {
topbar: {},
userPanel: {
copyToken: 'Token copiado al portapapeles',
settings: 'Configuración',
logOut: 'Cerrar sesión',
},

View File

@ -1,6 +1,8 @@
import en from './en';
import es from './es';
export const localeEquivalence = {
'en':'en-GB'
}
export default {
en: en,
es: es,

View File

@ -127,11 +127,14 @@ async function updateDestination(claimDestinationFk, row, options = {}) {
}
async function regularizeClaim() {
const query = `Claims/${claimId}/regularizeClaim`;
await axios.post(query);
await axios.post(`Claims/${claimId}/regularizeClaim`);
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) {
await claimRef.value.fetch();
quasar
.dialog({
component: VnConfirm,
@ -141,29 +144,19 @@ async function regularizeClaim() {
},
})
.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() {
const greugeTypeFreightId = await getGreugeTypeId();
const freightPickUpPrice = await getGreugeConfig();
const greugeTypeFreightId = (
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,
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
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) {
const query = `Claims/${claimId}/updateClaimAction`;
await axios.patch(query, data);

View File

@ -7,8 +7,8 @@ import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import ClaimDescriptor from './ClaimDescriptor.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { onMounted } from 'vue';
const stateStore = useStateStore();
const { t } = useI18n();
const route = useRoute();
@ -41,11 +41,7 @@ const entityId = computed(() => {
</QDrawer>
<QPageContainer>
<QPage>
<QToolbar class="bg-vn-dark justify-end">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<VnSubToolbar />
<div class="q-pa-md"><RouterView></RouterView></div>
</QPage>
</QPageContainer>

View File

@ -43,17 +43,20 @@ async function onFetchClaim(data) {
fetchMana();
}
const amount = ref(0);
const amountClaimed = ref(0);
const amount = ref();
const amountClaimed = ref();
async function onFetch(rows) {
amount.value = 0;
amountClaimed.value = 0;
if (!rows || !rows.length) return;
amount.value = rows.reduce(
(acumulator, { sale }) => acumulator + sale.price * sale.quantity,
(accumulator, { sale }) => accumulator + sale.price * sale.quantity,
0
);
amountClaimed.value = rows.reduce(
(acumulator, line) => acumulator + line.sale.price * line.quantity,
(accumulator, line) => accumulator + line.sale.price * line.quantity,
0
);
}
@ -189,6 +192,7 @@ function showImportDialog() {
save-url="ClaimBeginnings/crud"
:filter="linesFilter"
@on-fetch="onFetch"
@save-changes="onFetch"
v-model:selected="selected"
:default-save="false"
:default-reset="false"

View File

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

View File

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

View File

@ -4,6 +4,7 @@ import { useStateStore } from 'stores/useStateStore';
import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore();
const { t } = useI18n();
@ -26,11 +27,7 @@ const { t } = useI18n();
</QDrawer>
<QPageContainer>
<QPage>
<QToolbar class="bg-vn-dark justify-end">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<VnSubToolbar />
<div class="q-pa-md"><RouterView></RouterView></div>
</QPage>
</QPageContainer>

View File

@ -5,6 +5,7 @@ import { useRoute } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n();
const route = useRoute();
@ -15,7 +16,7 @@ const defaultInitialData = {
priority: 0,
code: null,
isRecyclable: false,
}
};
const parkingFilter = { fields: ['id', 'code'] };
const parkingList = ref([]);
@ -58,11 +59,7 @@ const shelvingFilter = {
};
</script>
<template>
<QToolbar class="bg-vn-dark justify-end">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<VnSubToolbar />
<FetchData
url="Parkings"
:filter="parkingFilter"

View File

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

View File

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

View File

@ -5,6 +5,7 @@ export const useStateStore = defineStore('stateStore', () => {
const isMounted = ref(false);
const leftDrawer = ref(false);
const rightDrawer = ref(false);
const subToolbar = ref(false);
function toggleLeftDrawer() {
leftDrawer.value = !leftDrawer.value;
@ -14,6 +15,10 @@ export const useStateStore = defineStore('stateStore', () => {
rightDrawer.value = !rightDrawer.value;
}
function toggleSubToolbar() {
subToolbar.value = !subToolbar.value;
}
function setMounted() {
isMounted.value = true;
}
@ -31,10 +36,7 @@ export const useStateStore = defineStore('stateStore', () => {
}
function isSubToolbarShown() {
return (
!!document.querySelector('#st-data') &&
!!document.querySelector('#st-actions')
);
return subToolbar.value;
}
return {
@ -47,5 +49,6 @@ export const useStateStore = defineStore('stateStore', () => {
isLeftDrawerShown,
isRightDrawerShown,
isSubToolbarShown,
toggleSubToolbar,
};
});

View File

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