Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8120-CompactSummaryPopup

This commit is contained in:
Jon Elias 2025-01-15 12:55:20 +01:00
commit d1be809b76
38 changed files with 758 additions and 464 deletions

View File

@ -1,3 +1,82 @@
# Version 25.00 - 2025-01-14
### Added 🆕
- chore: refs #7056 move test by:jorgep
- feat: refs #7050 7050 add object check by:Jtubau
- feat: refs #7050 7050 add test to isEmpty() by:Jtubau
- feat: refs #7056 add tests in FormModel by:jorgep
- feat: refs #7056 update route meta information and add FormModel tests by:jorgep
- feat: refs #7074 tests for fns setData(), parseDms() and showFormDialog() (7074-makeFrontTestToVnDmsList) by:Jtubau
- feat: refs #7079 created VnLocation front test by:provira
- feat: refs #7189 add Accept-Language header to axios requests by:jorgep
- feat: refs #7924 add custom inspection checkbox and localization support by:jgallego
- feat: refs #7924 update custom inspection label for clarity in English and Spanish locales by:jgallego
- feat: refs #8004 enhance FetchedTags component with column support and styling updates by:pablone
- feat: refs #8004 hide rightFilter by:pablone
- feat: refs #8246 added new field in list by:Jon
- feat: refs #8266 added descriptor to item name by:jtubau
- feat: refs #8293 add zone filter by:Jtubau
- feat: refs #8293 include zone data in each record by:Jtubau
- fix: refs #8004 more list style issues by:pablone
- fix: refs #8004 some style issues on all list by:pablone
- style: refs #8004 update layout and styling in FetchedTags and ItemList components by:pablone
- style: update CustomerBalance.vue to set label color by:jgallego
### Changed 📦
- perf: order by:alexm
- perf: redirect transition list to card by:alexm
- perf: refs #8201 onDataSaved fetch by:Jon
- perf: revert processData by:alexm
- perf: simplify if by:alexm
- perf: simplify if (perf_redirectTransition) by:alexm
- refactor: item fixedPrice by:Jon
- refactor: refs #7050 refactorize by:jtubau
- refactor: refs #7050 removed blank spaces by:jtubau
- refactor: refs #7052 move EditTableCellValueForm tests to a new location and enhance test coverage by:jgallego
- refactor: refs #7052 remove unnecessary console logs from EditTableCellValueForm tests by:jgallego
- refactor: refs #7074 move dms constant to global scope by:Jtubau
- refactor: refs #7079 removed useless code by:provira
- refactor: refs #7924 simplify custom inspection icon rendering in ExtraCommunity.vue by:jgallego
- refactor: refs #8004 remove console log from CardSummary component on mount by:pablone
- refactor: refs #8004 remove consoleLogs by:pablone
- refactor: refs #8004 remove unused stateStore import in InvoiceInList.vue by:pablone
- refactor: refs #8004 remove unused travelFilterRef and chip definition in TravelList.vue by:pablone
- refactor: refs #8004 replace VnSelect with VnSelectWorker in CustomerList component by:pablone
- refactor: refs #8201 added onMounted to stablish the value to show icons by:Jon
- refactor: refs #8201 deleted condition by:Jon
- refactor: refs #8201 deleted log by:Jon
- refactor: refs #8201 deleted logs by:Jon
- refactor: refs #8266 8266 change expedition item name by:Jtubau
- refactor: refs #8266 change expedition label by:Jtubau
- refactor: refs #8293 remove redundant attributes by:Jtubau
- refactor: refs #8320 changed folder names from "specs" to "**tests**" by:provira
- refactor: refs #8320 moved front tests to their respective sections by:provira
- refactor: refs #8813 removed unused class property by:provira
### Fixed 🛠️
- fix: discount class by:PAU ROVIRA ROSALENY
- fix: duplicate transalation after test to dev by:alexm
- fix: fix translations by:carlossa
- fix: redirect to sales when confirming lines by:Jon
- fix: refs #7050 delete import added by mistake by:Jtubau
- fix: refs #7133 handleSalesModelValue function to handle empty input by:jorgep
- fix: refs #7189 update user language on sessionStorage by:jorgep
- fix: refs #7935 remove unused 'companyFk' column from InvoiceInList component by:jorgep
- fix: refs #8004 more list style issues by:pablone
- fix: refs #8004 some style issues on all list by:pablone
- fix: refs #8004 update label for daysOnward in TravelFilter component and add translations by:pablone
- fix: refs #8004 vnTable card with and add permanent labels by:pablone
- fix: refs #8201 added onDataSaved emi to refetch when cahnges are made by:Jon
- fix: refs #8201 use arrayData to fix the error by:Jon
- fix: refs #8314 space between label and value by:jtubau
- fix: refs #8813 fixed ClaimLines format by:provira
- fix: update button sizes in ExtraCommunity.vue for better visibility by:jgallego
- perf: revert processData by:alexm
- refactor: item fixedPrice by:Jon
# Version 24.52 - 2024-01-07
### Added 🆕

View File

@ -31,7 +31,7 @@ export default {
console.error(error);
}
form.addEventListener('keyup', function (evt) {
if (evt.key === 'Enter') {
if (evt.key === 'Enter' && !that.$attrs['prevent-submit']) {
const input = evt.target;
if (input.type == 'textarea' && evt.shiftKey) {
evt.preventDefault();

View File

@ -0,0 +1,82 @@
import { createWrapper, axios } from 'app/test/vitest/helper';
import FilterItemForm from 'src/components/FilterItemForm.vue';
import { vi, beforeAll, describe, expect, it } from 'vitest';
describe('FilterItemForm', () => {
let vm;
let wrapper;
beforeAll(() => {
wrapper = createWrapper(FilterItemForm, {
props: {
url: 'Items/withName',
},
});
vm = wrapper.vm;
wrapper = wrapper.wrapper;
vi.spyOn(axios, 'get').mockResolvedValue({
data: [
{
id: 999996,
name: 'bolas de madera',
size: 2,
inkFk: null,
producerFk: null,
},
],
});
});
it('should filter data and populate tableRows for table display', async () => {
vm.itemFilterParams.name = 'bolas de madera';
await vm.onSubmit();
const expectedFilter = {
include: [
{ relation: 'producer', scope: { fields: ['name'] } },
{ relation: 'ink', scope: { fields: ['name'] } },
],
where: {"name":{"like":"%bolas de madera%"}},
};
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
params: { filter: JSON.stringify(expectedFilter) },
});
expect(vm.tableRows).toEqual([
{
id: 999996,
name: 'bolas de madera',
size: 2,
inkFk: null,
producerFk: null,
},
]);
});
it('should handle an empty itemFilterParams correctly', async () => {
vm.itemFilterParams.name = null;
vm.itemFilterParams = {};
await vm.onSubmit();
const expectedFilter = {
include: [
{ relation: 'producer', scope: { fields: ['name'] } },
{ relation: 'ink', scope: { fields: ['name'] } },
],
where: {},
};
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
params: { filter: JSON.stringify(expectedFilter) },
});
});
it('should emit "itemSelected" with the correct id and close the form', () => {
vm.selectItem({ id: 12345 });
expect(wrapper.emitted('itemSelected')[0]).toEqual([12345]);
});
});

View File

@ -1,29 +1,17 @@
<script setup>
import { ref, onMounted, useSlots } from 'vue';
import { onMounted, useSlots } from 'vue';
import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore';
import { useQuasar } from 'quasar';
import { useHasContent } from 'src/composables/useHasContent';
const { t } = useI18n();
const quasar = useQuasar();
const stateStore = useStateStore();
const slots = useSlots();
const hasContent = ref(false);
const rightPanel = ref(null);
const hasContent = useHasContent('#right-panel');
onMounted(() => {
rightPanel.value = document.querySelector('#right-panel');
if (!rightPanel.value) return;
const observer = new MutationObserver(() => {
hasContent.value = rightPanel.value.childNodes.length;
});
observer.observe(rightPanel.value, {
subtree: true,
childList: true,
attributes: true,
});
if ((!slots['right-panel'] && !hasContent.value) || quasar.platform.is.mobile)
stateStore.rightDrawer = false;
});

View File

@ -2,7 +2,7 @@
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
import { useI18n } from 'vue-i18n';
import { computed } from 'vue';
import { ref, watch } from 'vue';
import { useAttrs } from 'vue';
import { useRequired } from 'src/composables/useRequired';
const { t } = useI18n();
@ -16,6 +16,14 @@ const props = defineProps({
},
});
watch(
() => props.location,
(newValue) => {
if (!modelValue.value) return;
modelValue.value = formatLocation(newValue) ?? null;
}
);
const mixinRules = [requiredFieldRule];
const locationProperties = [
'postcode',
@ -43,9 +51,7 @@ const formatLocation = (obj, properties = locationProperties) => {
return filteredParts.join(', ');
};
const modelValue = computed(() =>
props.location ? formatLocation(props.location, locationProperties) : null
);
const modelValue = ref(props.location ? formatLocation(props.location) : null);
function showLabel(data) {
const dataProperties = [

View File

@ -2,9 +2,10 @@
import RightMenu from './RightMenu.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnTableFilter from '../VnTable/VnTableFilter.vue';
import { onBeforeMount, computed } from 'vue';
import { onBeforeMount, computed, ref } from 'vue';
import { useArrayData } from 'src/composables/useArrayData';
import { useRoute } from 'vue-router';
import { useHasContent } from 'src/composables/useHasContent';
const $props = defineProps({
section: {
@ -55,6 +56,8 @@ const isMainSection = computed(() => {
}
return isSame;
});
const searchbarId = 'section-searchbar';
const hasContent = useHasContent(`#${searchbarId}`);
onBeforeMount(() => {
if ($props.dataKey)
@ -69,14 +72,14 @@ onBeforeMount(() => {
<template>
<slot name="searchbar">
<VnSearchbar
v-if="searchBar"
v-if="searchBar && !hasContent"
v-bind="arrayDataProps"
:data-key="dataKey"
:label="$t(`${prefix}.search`)"
:info="$t(`${prefix}.searchInfo`)"
/>
<div :id="searchbarId"></div>
</slot>
<RightMenu>
<template #right-panel v-if="$slots['rightMenu'] || rightFilter">
<slot name="rightMenu">

View File

@ -0,0 +1,72 @@
import { createWrapper } from 'app/test/vitest/helper.js';
import { describe, it, expect } from 'vitest';
import VnInputDate from 'components/common/VnInputDate.vue';
let vm;
let wrapper;
function generateWrapper(date, outlined, required) {
wrapper = createWrapper(VnInputDate, {
props: {
modelValue: date,
},
attrs: {
isOutlined: outlined,
required: required
},
});
wrapper = wrapper.wrapper;
vm = wrapper.vm;
};
describe('VnInputDate', () => {
describe('formattedDate', () => {
it('formats a valid date correctly', async () => {
generateWrapper('2023-12-25', false, false);
await vm.$nextTick();
expect(vm.formattedDate).toBe('25/12/2023');
});
it('updates the model value when a new date is set', async () => {
const input = wrapper.find('input');
await input.setValue('31/12/2023');
expect(wrapper.emitted()['update:modelValue']).toBeTruthy();
expect(wrapper.emitted()['update:modelValue'][0][0]).toBe('2023-12-31T00:00:00.000Z');
});
it('should not update the model value when an invalid date is set', async () => {
const input = wrapper.find('input');
await input.setValue('invalid-date');
expect(wrapper.emitted()['update:modelValue'][0][0]).toBe('2023-12-31T00:00:00.000Z');
});
});
describe('styleAttrs', () => {
it('should return empty styleAttrs when isOutlined is false', async () => {
generateWrapper('2023-12-25', false, false);
await vm.$nextTick();
expect(vm.styleAttrs).toEqual({});
});
it('should set styleAttrs when isOutlined is true', async () => {
generateWrapper('2023-12-25', true, false);
await vm.$nextTick();
expect(vm.styleAttrs.outlined).toBe(true);
});
});
describe('required', () => {
it('should not applies required class when isRequired is false', async () => {
generateWrapper('2023-12-25', false, false);
await vm.$nextTick();
expect(wrapper.find('.vn-input-date').classes()).not.toContain('required');
});
it('should applies required class when isRequired is true', async () => {
generateWrapper('2023-12-25', false, true);
await vm.$nextTick();
expect(wrapper.find('.vn-input-date').classes()).toContain('required');
});
});
});

View File

@ -82,7 +82,7 @@ async function fetch() {
<span v-else></span>
</slot>
<slot name="header" :entity="entity" dense>
<VnLv :label="`${entity.id} -`" :value="entity.name" />
{{ entity.id + ' - ' + entity.name }}
</slot>
<span class="row no-wrap">
<slot name="header-right" :entity="entity" />

View File

@ -18,8 +18,7 @@ const $props = defineProps({
},
columns: {
type: Number,
required: false,
default: null,
default: 3,
},
});

View File

@ -30,7 +30,7 @@ onBeforeMount(async () => {
.data;
if (!channel) channel = defaultChannel;
phone.value = await parsePhone(props.phoneNumber, props.country.toLowerCase());
phone.value = await parsePhone(props.phoneNumber, props.country?.toLowerCase());
config[
type
].url = `${url}?customerIdentity=%2B${phone.value}&channelId=${channel}`;

View File

@ -0,0 +1,24 @@
import { onMounted, ref } from 'vue';
export function useHasContent(selector) {
const container = ref({});
const hasContent = ref();
onMounted(() => {
container.value = document.querySelector(selector);
if (!container.value) return;
const observer = new MutationObserver(() => {
if (document.querySelector(selector))
hasContent.value = !!container.value.childNodes.length;
});
observer.observe(container.value, {
subtree: true,
childList: true,
attributes: true,
});
});
return hasContent;
}

View File

@ -346,6 +346,7 @@ globals:
countryFk: Country
companyFk: Company
changePass: Change password
setPass: Set password
deleteConfirmTitle: Delete selected elements
changeState: Change state
raid: 'Raid {daysInForward} days'
@ -578,27 +579,6 @@ parking:
searchBar:
info: You can search by parking code
label: Search parking...
order:
field:
salesPersonFk: Sales Person
form:
clientFk: Client
addressFk: Address
agencyModeFk: Agency
list:
newOrder: New Order
summary:
basket: Basket
notConfirmed: Not confirmed
created: Created
createdFrom: Created From
address: Address
total: Total
items: Items
orderTicketList: Order Ticket List
amount: Amount
confirm: Confirm
confirmLines: Confirm lines
department:
chat: Chat
bossDepartment: Boss Department

View File

@ -348,6 +348,7 @@ globals:
countryFk: País
companyFk: Empresa
changePass: Cambiar contraseña
setPass: Establecer contraseña
deleteConfirmTitle: Eliminar los elementos seleccionados
changeState: Cambiar estado
raid: 'Redada {daysInForward} días'
@ -562,30 +563,6 @@ invoiceOut:
comercial: Comercial
errors:
downloadCsvFailed: Error al descargar CSV
order:
field:
salesPersonFk: Comercial
form:
clientFk: Cliente
addressFk: Dirección
agencyModeFk: Agencia
list:
newOrder: Nuevo Pedido
summary:
basket: Cesta
notConfirmed: No confirmada
created: Creado
createdFrom: Creado desde
address: Dirección
total: Total
vat: IVA
state: Estado
alias: Alias
items: Artículos
orderTicketList: Tickets del pedido
amount: Monto
confirm: Confirmar
confirmLines: Confirmar lineas
shelving:
list:
parking: Parking

View File

@ -1,48 +1,56 @@
<script setup>
import axios from 'axios';
import { computed, onMounted, ref } from 'vue';
import { computed, onMounted, ref, toRefs } from 'vue';
import { useI18n } from 'vue-i18n';
import { useVnConfirm } from 'composables/useVnConfirm';
import { useRoute } from 'vue-router';
import { useAcl } from 'src/composables/useAcl';
import { useArrayData } from 'src/composables/useArrayData';
import { useState } from 'src/composables/useState';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
import useNotify from 'src/composables/useNotify.js';
import useHasAccount from 'src/composables/useHasAccount.js';
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
import { useQuasar } from 'quasar';
import { useRouter } from 'vue-router';
const $props = defineProps({
entityId: {
type: Number,
hasAccount: {
type: Boolean,
default: false,
required: true,
},
});
const { t } = useI18n();
const { hasAccount } = toRefs($props);
const { openConfirmationModal } = useVnConfirm();
const { notify } = useNotify();
const route = useRoute();
const router = useRouter();
const state = useState();
const user = state.getUser();
const { notify } = useQuasar();
const account = computed(() => useArrayData('AccountId').store.data[0]);
onMounted(async () => {
account.value.hasAccount = await useHasAccount($props.entityId);
});
account.value.hasAccount = hasAccount.value;
const entityId = computed(() => +route.params.id);
const hasitManagementAccess = ref();
const hasSysadminAccess = ref();
async function updateStatusAccount(active) {
if (active) {
await axios.post(`Accounts`, { id: $props.entityId });
await axios.post(`Accounts`, { id: entityId.value });
} else {
await axios.delete(`Accounts/${$props.entityId}`);
await axios.delete(`Accounts/${entityId.value}`);
}
account.value.hasAccount = active;
const status = active ? 'enable' : 'disable';
notify({
message: t(`account.card.${status}Account.success`),
message: t(`account.card.actions.${status}Account.success`),
type: 'positive',
});
}
async function updateStatusUser(active) {
await axios.patch(`VnUsers/${$props.entityId}`, { active });
await axios.patch(`VnUsers/${entityId.value}`, { active });
account.value.active = active;
const status = active ? 'activate' : 'deactivate';
notify({
@ -50,6 +58,17 @@ async function updateStatusUser(active) {
type: 'positive',
});
}
async function deleteAccount() {
const { data } = await axios.delete(`VnUsers/${entityId.value}`);
if (data) {
notify({
message: t('account.card.actions.delete.success'),
type: 'positive',
});
router.push({ name: 'AccountList' });
}
}
const showSyncDialog = ref(false);
const syncPassword = ref(null);
const shouldSyncPassword = ref(false);
@ -64,11 +83,27 @@ async function sync() {
type: 'positive',
});
}
const askOldPass = ref(false);
const changePassRef = ref();
const onChangePass = (oldPass) => {
askOldPass.value = oldPass;
changePassRef.value.show();
};
onMounted(() => {
hasitManagementAccess.value = useAcl().hasAny([
{ model: 'VnUser', props: 'higherPrivileges', accessType: 'WRITE' },
]);
hasSysadminAccess.value = useAcl().hasAny([
{ model: 'VnUser', props: 'adminUser', accessType: 'WRITE' },
]);
});
</script>
<template>
<VnChangePassword
ref="changePassRef"
:ask-old-pass="true"
:ask-old-pass="askOldPass"
:submit-fn="
async (newPassword, oldPassword) => {
await axios.patch(`Accounts/change-password`, {
@ -110,18 +145,46 @@ async function sync() {
</template>
</VnConfirm>
<QItem
v-if="
entityId == account.id &&
useAcl().hasAny([{ model: 'Account', props: '*', accessType: 'WRITE' }])
"
v-if="hasitManagementAccess"
v-ripple
clickable
@click="$refs.changePassRef.show()"
@click="
openConfirmationModal(
t('account.card.actions.disableAccount.title'),
t('account.card.actions.disableAccount.subtitle'),
() => deleteAccount()
)
"
>
<QItemSection>{{ t('globals.changePass') }}</QItemSection>
<QItemSection>{{ t('globals.delete') }}</QItemSection>
</QItem>
<QItem
v-if="account.hasAccount"
v-if="hasSysadminAccess"
v-ripple
clickable
@click="user.id === account.id ? onChangePass(true) : onChangePass(false)"
>
<QItemSection v-if="user.id === account.id">
{{ t('globals.changePass') }}
</QItemSection>
<QItemSection v-else>{{ t('globals.setPass') }}</QItemSection>
</QItem>
<QItem
v-if="!account.hasAccount && hasSysadminAccess"
v-ripple
clickable
@click="
openConfirmationModal(
t('account.card.actions.enableAccount.title'),
t('account.card.actions.enableAccount.subtitle'),
() => updateStatusAccount(true)
)
"
>
<QItemSection>{{ t('account.card.actions.enableAccount.name') }}</QItemSection>
</QItem>
<QItem
v-if="account.hasAccount && hasSysadminAccess"
v-ripple
clickable
@click="
@ -136,7 +199,7 @@ async function sync() {
</QItem>
<QItem
v-if="!account.active"
v-if="!account.active && hasitManagementAccess"
v-ripple
clickable
@click="
@ -150,7 +213,7 @@ async function sync() {
<QItemSection>{{ t('account.card.actions.activateUser.name') }}</QItemSection>
</QItem>
<QItem
v-if="account.active"
v-if="account.active && hasitManagementAccess"
v-ripple
clickable
@click="
@ -163,7 +226,12 @@ async function sync() {
>
<QItemSection>{{ t('account.card.actions.deactivateUser.name') }}</QItemSection>
</QItem>
<QItem v-ripple clickable @click="showSyncDialog = true">
<QItem
v-if="useAcl().hasAny([{ model: 'VnRole', props: '*', accessType: 'WRITE' }])"
v-ripple
clickable
@click="showSyncDialog = true"
>
<QItemSection>{{ t('account.card.actions.sync.name') }}</QItemSection>
</QItem>
<QSeparator />

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -11,16 +11,9 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue';
import { useState } from 'src/composables/useState';
const state = useState();
const customer = ref();
onMounted(async () => {
customer.value = state.get('customer');
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
});
const customerDebt = ref();
const customerCredit = ref();
const $props = defineProps({
id: {
type: Number,
@ -42,10 +35,12 @@ const entityId = computed(() => {
const data = ref(useCardDescription());
const setData = (entity) => {
customerDebt.value = entity?.debt;
customerCredit.value = entity?.credit;
data.value = useCardDescription(entity?.name, entity?.id);
};
const debtWarning = computed(() => {
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
return customerDebt.value > customerCredit.value ? 'negative' : 'primary';
});
</script>
@ -98,26 +93,21 @@ const debtWarning = computed(() => {
:value="entity.businessType.description"
/>
</template>
<template #icons>
<QCardActions v-if="customer" class="q-gutter-x-md">
<template #icons="{ entity }">
<QCardActions class="q-gutter-x-md">
<QIcon
v-if="!customer.isActive"
v-if="!entity.isActive"
name="vn:disabled"
size="xs"
color="primary"
>
<QTooltip>{{ t('customer.card.isDisabled') }}</QTooltip>
</QIcon>
<QIcon
v-if="customer.isFreezed"
name="vn:frozen"
size="xs"
color="primary"
>
<QIcon v-if="entity.isFreezed" name="vn:frozen" size="xs" color="primary">
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
</QIcon>
<QIcon
v-if="!customer.account?.active"
v-if="!entity.account?.active"
color="primary"
name="vn:noweb"
size="xs"
@ -125,7 +115,7 @@ const debtWarning = computed(() => {
<QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip>
</QIcon>
<QIcon
v-if="customer.debt > customer.credit"
v-if="entity.debt > entity.credit"
name="vn:risk"
size="xs"
:color="debtWarning"
@ -133,7 +123,7 @@ const debtWarning = computed(() => {
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
</QIcon>
<QIcon
v-if="!customer.isTaxDataChecked"
v-if="!entity.isTaxDataChecked"
name="vn:no036"
size="xs"
color="primary"
@ -141,7 +131,7 @@ const debtWarning = computed(() => {
<QTooltip>{{ t('customer.card.notChecked') }}</QTooltip>
</QIcon>
<QBtn
v-if="customer.unpaid"
v-if="entity.unpaid"
flat
size="sm"
icon="vn:Client_unpaid"

View File

@ -248,12 +248,14 @@ function handleLocation(data, location) {
clearable
v-model="data.longitude"
:decimal-places="7"
:positive="false"
/>
<VnInputNumber
:label="t('Latitude')"
clearable
v-model="data.latitude"
:decimal-places="7"
:positive="false"
/>
</VnRow>
<h4 class="q-mb-xs">{{ t('Notes') }}</h4>

View File

@ -268,7 +268,7 @@ function deleteFile(dmsFk) {
</VnRow>
<VnRow>
<VnSelect
:label="t('InvoiceIn.summary.sage')"
:label="t('invoicein.summary.sage')"
v-model="data.withholdingSageFk"
:options="sageWithholdings"
option-value="id"

View File

@ -167,10 +167,10 @@ const createInvoiceInCorrection = async () => {
<InvoiceInDescriptorMenu :invoice="entity" />
</template>
<template #body="{ entity }">
<VnLv :label="t('invoiceIn.list.issued')" :value="toDate(entity.issued)" />
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" />
<VnLv :label="t('invoiceIn.list.amount')" :value="toCurrency(totalAmount)" />
<VnLv :label="t('invoiceIn.list.supplier')">
<VnLv :label="t('invoicein.list.issued')" :value="toDate(entity.issued)" />
<VnLv :label="t('invoicein.summary.bookedDate')" :value="toDate(entity.booked)" />
<VnLv :label="t('invoicein.list.amount')" :value="toCurrency(totalAmount)" />
<VnLv :label="t('invoicein.list.supplier')">
<template #value>
<span class="link">
{{ entity?.supplier?.nickname }}
@ -187,7 +187,7 @@ const createInvoiceInCorrection = async () => {
color="primary"
:to="routes.getSupplier(entity.supplierFk)"
>
<QTooltip>{{ t('invoiceIn.list.supplier') }}</QTooltip>
<QTooltip>{{ t('invoicein.list.supplier') }}</QTooltip>
</QBtn>
<QBtn
size="md"
@ -203,7 +203,7 @@ const createInvoiceInCorrection = async () => {
color="primary"
:to="routes.getTickets(entity.supplierFk)"
>
<QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip>
<QTooltip>{{ t('InvoiceOut.card.ticketList') }}</QTooltip>
</QBtn>
<QBtn
v-if="

View File

@ -33,15 +33,15 @@ const entityId = computed(() => $props.invoice.id || +currentRoute.value.params.
const invoiceIn = computed(() => arrayData.store.data);
const actions = {
unbook: {
title: t('assertAction', { action: t('InvoiceIn.descriptorMenu.unbook') }),
title: t('assertAction', { action: t('invoicein.descriptorMenu.unbook') }),
action: toUnbook,
},
delete: {
title: t('assertAction', { action: t('InvoiceIn.descriptorMenu.delete') }),
title: t('assertAction', { action: t('invoicein.descriptorMenu.delete') }),
action: deleteInvoice,
},
clone: {
title: t('assertAction', { action: t('InvoiceIn.descriptorMenu.clone') }),
title: t('assertAction', { action: t('invoicein.descriptorMenu.clone') }),
action: cloneInvoice,
},
showPdf: { cb: showPdfInvoice },
@ -84,7 +84,7 @@ async function deleteInvoice() {
await axios.delete(`InvoiceIns/${entityId.value}`);
quasar.notify({
type: 'positive',
message: t('InvoiceIn.descriptorMenu.invoiceDeleted'),
message: t('invoicein.descriptorMenu.invoiceDeleted'),
});
push({ path: '/invoice-in' });
}
@ -93,7 +93,7 @@ async function cloneInvoice() {
const { data } = await axios.post(`InvoiceIns/${entityId.value}/clone`);
quasar.notify({
type: 'positive',
message: t('InvoiceIn.descriptorMenu.invoiceCloned'),
message: t('invoicein.descriptorMenu.invoiceCloned'),
});
push({ path: `/invoice-in/${data.id}/summary` });
}
@ -144,7 +144,7 @@ function sendPdfInvoice({ address }) {
clickable
@click="book(entityId)"
>
<QItemSection>{{ t('InvoiceIn.descriptorMenu.toBook') }}</QItemSection>
<QItemSection>{{ t('invoicein.descriptorMenu.toBook') }}</QItemSection>
</QItem>
</template>
</InvoiceInToBook>
@ -155,28 +155,28 @@ function sendPdfInvoice({ address }) {
@click="triggerMenu('unbook')"
>
<QItemSection>
{{ t('InvoiceIn.descriptorMenu.toUnbook') }}
{{ t('invoicein.descriptorMenu.toUnbook') }}
</QItemSection>
</QItem>
<QItem
v-if="canEditProp('deleteById')"
v-ripple
clickable
@click="triggerMenu('InvoiceIn.descriptorMenu.delete')"
@click="triggerMenu('invoicein.descriptorMenu.delete')"
>
<QItemSection>{{ t('InvoiceIn.descriptorMenu.deleteInvoice') }}</QItemSection>
<QItemSection>{{ t('invoicein.descriptorMenu.deleteInvoice') }}</QItemSection>
</QItem>
<QItem v-if="canEditProp('clone')" v-ripple clickable @click="triggerMenu('clone')">
<QItemSection>{{ t('InvoiceIn.descriptorMenu.cloneInvoice') }}</QItemSection>
<QItemSection>{{ t('invoicein.descriptorMenu.cloneInvoice') }}</QItemSection>
</QItem>
<QItem v-if="isAgricultural()" v-ripple clickable @click="triggerMenu('showPdf')">
<QItemSection>{{
t('InvoiceIn.descriptorMenu.showAgriculturalPdf')
t('invoicein.descriptorMenu.showAgriculturalPdf')
}}</QItemSection>
</QItem>
<QItem v-if="isAgricultural()" v-ripple clickable @click="triggerMenu('sendPdf')">
<QItemSection
>{{ t('InvoiceIn.descriptorMenu.sendAgriculturalPdf') }}...</QItemSection
>{{ t('invoicein.descriptorMenu.sendAgriculturalPdf') }}...</QItemSection
>
</QItem>
<QItem
@ -186,7 +186,7 @@ function sendPdfInvoice({ address }) {
@click="triggerMenu('correct')"
>
<QItemSection
>{{ t('InvoiceIn.descriptorMenu.createCorrective') }}...</QItemSection
>{{ t('invoicein.descriptorMenu.createCorrective') }}...</QItemSection
>
</QItem>
<QItem v-if="invoice.dmsFk" v-ripple clickable @click="downloadFile(invoice.dmsFk)">

View File

@ -27,14 +27,14 @@ const intrastatTotals = ref({ amount: 0, net: 0, stems: 0 });
const vatColumns = ref([
{
name: 'expense',
label: 'InvoiceIn.summary.expense',
label: 'invoicein.summary.expense',
field: (row) => row.expenseFk,
sortable: true,
align: 'left',
},
{
name: 'landed',
label: 'InvoiceIn.summary.taxableBase',
label: 'invoicein.summary.taxableBase',
field: (row) => row.taxableBase,
format: (value) => toCurrency(value),
sortable: true,
@ -42,7 +42,7 @@ const vatColumns = ref([
},
{
name: 'vat',
label: 'InvoiceIn.summary.sageVat',
label: 'invoicein.summary.sageVat',
field: (row) => {
if (row.taxTypeSage) return `#${row.taxTypeSage.id} : ${row.taxTypeSage.vat}`;
},
@ -52,7 +52,7 @@ const vatColumns = ref([
},
{
name: 'transaction',
label: 'InvoiceIn.summary.sageTransaction',
label: 'invoicein.summary.sageTransaction',
field: (row) => {
if (row.transactionTypeSage)
return `#${row.transactionTypeSage.id} : ${row.transactionTypeSage?.transaction}`;
@ -63,7 +63,7 @@ const vatColumns = ref([
},
{
name: 'rate',
label: 'InvoiceIn.summary.rate',
label: 'invoicein.summary.rate',
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
format: (value) => toCurrency(value),
sortable: true,
@ -71,7 +71,7 @@ const vatColumns = ref([
},
{
name: 'currency',
label: 'InvoiceIn.summary.currency',
label: 'invoicein.summary.currency',
field: (row) => row.foreignValue,
format: (val) => val && toCurrency(val, currency.value),
sortable: true,
@ -82,21 +82,21 @@ const vatColumns = ref([
const dueDayColumns = ref([
{
name: 'date',
label: 'InvoiceIn.summary.dueDay',
label: 'invoicein.summary.dueDay',
field: (row) => toDate(row.dueDated),
sortable: true,
align: 'left',
},
{
name: 'bank',
label: 'InvoiceIn.summary.bank',
label: 'invoicein.summary.bank',
field: (row) => row.bank.bank,
sortable: true,
align: 'left',
},
{
name: 'amount',
label: 'InvoiceIn.list.amount',
label: 'invoicein.list.amount',
field: (row) => row.amount,
format: (value) => toCurrency(value),
sortable: true,
@ -104,7 +104,7 @@ const dueDayColumns = ref([
},
{
name: 'landed',
label: 'InvoiceIn.summary.foreignValue',
label: 'invoicein.summary.foreignValue',
field: (row) => row.foreignValue,
format: (val) => val && toCurrency(val, currency.value),
sortable: true,
@ -115,7 +115,7 @@ const dueDayColumns = ref([
const intrastatColumns = ref([
{
name: 'code',
label: 'InvoiceIn.summary.code',
label: 'invoicein.summary.code',
field: (row) => {
return `${row.intrastat.id}: ${row.intrastat?.description}`;
},
@ -124,21 +124,21 @@ const intrastatColumns = ref([
},
{
name: 'amount',
label: 'InvoiceIn.list.amount',
label: 'invoicein.list.amount',
field: (row) => toCurrency(row.amount),
sortable: true,
align: 'left',
},
{
name: 'net',
label: 'InvoiceIn.summary.net',
label: 'invoicein.summary.net',
field: (row) => row.net,
sortable: true,
align: 'left',
},
{
name: 'stems',
label: 'InvoiceIn.summary.stems',
label: 'invoicein.summary.stems',
field: (row) => row.stems,
format: (value) => value,
sortable: true,
@ -146,7 +146,7 @@ const intrastatColumns = ref([
},
{
name: 'landed',
label: 'InvoiceIn.summary.country',
label: 'invoicein.summary.country',
field: (row) => row.country?.code,
format: (value) => value,
sortable: true,
@ -214,7 +214,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
/>
</QCardSection>
<VnLv
:label="t('InvoiceIn.list.supplier')"
:label="t('invoicein.list.supplier')"
:value="entity.supplier?.name"
>
<template #value>
@ -225,14 +225,14 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</template>
</VnLv>
<VnLv
:label="t('InvoiceIn.list.supplierRef')"
:label="t('invoicein.list.supplierRef')"
:value="entity.supplierRef"
/>
<VnLv
:label="t('InvoiceIn.summary.currency')"
:label="t('invoicein.summary.currency')"
:value="entity.currency?.code"
/>
<VnLv :label="t('InvoiceIn.serial')" :value="`${entity.serial}`" />
<VnLv :label="t('invoicein.serial')" :value="`${entity.serial}`" />
<VnLv
:label="t('globals.country')"
:value="entity.supplier?.country?.code"
@ -247,19 +247,19 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QCardSection>
<VnLv
:ellipsis-value="false"
:label="t('InvoiceIn.summary.issued')"
:label="t('invoicein.summary.issued')"
:value="toDate(entity.issued)"
/>
<VnLv
:label="t('InvoiceIn.summary.operated')"
:label="t('invoicein.summary.operated')"
:value="toDate(entity.operated)"
/>
<VnLv
:label="t('InvoiceIn.summary.bookEntried')"
:label="t('invoicein.summary.bookEntried')"
:value="toDate(entity.bookEntried)"
/>
<VnLv
:label="t('InvoiceIn.summary.bookedDate')"
:label="t('invoicein.summary.bookedDate')"
:value="toDate(entity.booked)"
/>
<VnLv :label="t('globals.isVies')" :value="entity.supplier?.isVies" />
@ -272,18 +272,18 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
/>
</QCardSection>
<VnLv
:label="t('InvoiceIn.summary.sage')"
:label="t('invoicein.summary.sage')"
:value="entity.sageWithholding?.withholding"
/>
<VnLv
:label="t('InvoiceIn.summary.vat')"
:label="t('invoicein.summary.vat')"
:value="entity.expenseDeductible?.name"
/>
<VnLv
:label="t('InvoiceIn.card.company')"
:label="t('invoicein.card.company')"
:value="entity.company?.code"
/>
<VnLv :label="t('InvoiceIn.isBooked')" :value="invoiceIn?.isBooked" />
<VnLv :label="t('invoicein.isBooked')" :value="invoiceIn?.isBooked" />
</QCard>
<QCard class="vn-one">
<QCardSection class="q-pa-none">
@ -294,11 +294,11 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QCardSection>
<QCardSection class="q-pa-none">
<VnLv
:label="t('InvoiceIn.summary.taxableBase')"
:label="t('invoicein.summary.taxableBase')"
:value="toCurrency(entity.totals.totalTaxableBase)"
/>
<VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" />
<VnLv :label="t('InvoiceIn.summary.dueTotal')">
<VnLv :label="t('invoicein.summary.dueTotal')">
<template #value>
<QChip
dense
@ -306,8 +306,8 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
:color="amountsNotMatch ? 'negative' : 'transparent'"
:title="
amountsNotMatch
? t('InvoiceIn.summary.noMatch')
: t('InvoiceIn.summary.dueTotal')
? t('invoicein.summary.noMatch')
: t('invoicein.summary.dueTotal')
"
>
{{ toCurrency(entity.totals.totalDueDay) }}
@ -318,7 +318,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QCard>
<!--Vat-->
<QCard v-if="entity.invoiceInTax.length" class="vat">
<VnTitle :url="getLink('vat')" :text="t('InvoiceIn.card.vat')" />
<VnTitle :url="getLink('vat')" :text="t('invoicein.card.vat')" />
<QTable
:columns="vatColumns"
:rows="entity.invoiceInTax"
@ -366,7 +366,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QCard>
<!--Due Day-->
<QCard v-if="entity.invoiceInDueDay.length" class="due-day">
<VnTitle :url="getLink('due-day')" :text="t('InvoiceIn.card.dueDay')" />
<VnTitle :url="getLink('due-day')" :text="t('invoicein.card.dueDay')" />
<QTable :columns="dueDayColumns" :rows="entity.invoiceInDueDay" flat>
<template #header="dueDayProps">
<QTr :props="dueDayProps" class="bg">
@ -404,7 +404,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QCard v-if="entity.invoiceInIntrastat.length">
<VnTitle
:url="getLink('intrastat')"
:text="t('InvoiceIn.card.intrastat')"
:text="t('invoicein.card.intrastat')"
/>
<QTable
:columns="intrastatColumns"

View File

@ -83,7 +83,7 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
</template>
</VnSelect>
<VnInput
:label="t('InvoiceIn.list.supplierRef')"
:label="t('invoicein.list.supplierRef')"
v-model="data.supplierRef"
/>
</VnRow>
@ -97,10 +97,10 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
map-options
hide-selected
:required="true"
:rules="validate('InvoiceIn.companyFk')"
:rules="validate('invoicein.companyFk')"
/>
<VnInputDate
:label="t('InvoiceIn.summary.issued')"
:label="t('invoicein.summary.issued')"
v-model="data.issued"
/>
</VnRow>

View File

@ -164,7 +164,7 @@ function handleDaysAgo(params, daysAgo) {
<QItem>
<QItemSection>
<QCheckbox
:label="$t('InvoiceIn.isBooked')"
:label="$t('invoicein.isBooked')"
v-model="params.isBooked"
@update:model-value="searchFn()"
toggle-indeterminate

View File

@ -26,7 +26,7 @@ const cols = computed(() => [
{
align: 'left',
name: 'isBooked',
label: t('InvoiceIn.isBooked'),
label: t('invoicein.isBooked'),
columnFilter: false,
},
{
@ -41,7 +41,7 @@ const cols = computed(() => [
{
align: 'left',
name: 'supplierFk',
label: t('InvoiceIn.list.supplier'),
label: t('invoicein.list.supplier'),
columnFilter: {
component: 'select',
attrs: {
@ -55,16 +55,16 @@ const cols = computed(() => [
{
align: 'left',
name: 'supplierRef',
label: t('InvoiceIn.list.supplierRef'),
label: t('invoicein.list.supplierRef'),
},
{
align: 'left',
name: 'serial',
label: t('InvoiceIn.serial'),
label: t('invoicein.serial'),
},
{
align: 'left',
label: t('InvoiceIn.list.issued'),
label: t('invoicein.list.issued'),
name: 'issued',
component: null,
columnFilter: {
@ -74,7 +74,7 @@ const cols = computed(() => [
},
{
align: 'left',
label: t('InvoiceIn.list.dueDated'),
label: t('invoicein.list.dueDated'),
name: 'dueDated',
component: null,
columnFilter: {
@ -86,12 +86,12 @@ const cols = computed(() => [
{
align: 'left',
name: 'awbCode',
label: t('InvoiceIn.list.awb'),
label: t('invoicein.list.awb'),
},
{
align: 'left',
name: 'amount',
label: t('InvoiceIn.list.amount'),
label: t('invoicein.list.amount'),
format: ({ amount }) => toCurrency(amount),
cardVisible: true,
},
@ -182,7 +182,7 @@ const cols = computed(() => [
</template>
</VnSelect>
<VnInput
:label="t('InvoiceIn.list.supplierRef')"
:label="t('invoicein.list.supplierRef')"
v-model="data.supplierRef"
/>
<VnSelect
@ -194,7 +194,7 @@ const cols = computed(() => [
option-label="code"
:required="true"
/>
<VnInputDate :label="t('InvoiceIn.summary.issued')" v-model="data.issued" />
<VnInputDate :label="t('invoicein.summary.issued')" v-model="data.issued" />
</template>
</VnTable>
</template>

View File

@ -1,4 +1,4 @@
InvoiceIn:
invoicein:
serial: Serial
isBooked: Is booked
list:
@ -66,7 +66,6 @@ InvoiceIn:
search: Id or supplier name
correctedFk: Corrected
isBooked: Is booked
invoicein:
params:
account: Ledger account
correctingFk: Rectificative

View File

@ -1,4 +1,4 @@
InvoiceIn:
invoicein:
serial: Serie
isBooked: Contabilizada
list:
@ -63,7 +63,6 @@ InvoiceIn:
params:
search: Id o nombre proveedor
correctedFk: Rectificada
invoicein:
params:
account: Cuenta contable
correctingFk: Rectificativa

View File

@ -355,7 +355,7 @@ watchEffect(selectedRows);
<VnSelect
url="InvoiceOutSerials"
v-model="data.serial"
:label="t('InvoiceIn.serial')"
:label="t('invoicein.serial')"
:options="invoiceOutSerialsOptions"
option-label="description"
option-value="code"

View File

@ -391,7 +391,7 @@ onBeforeMount(async () => {
{{ row?.subName.toUpperCase() }}
</div>
</div>
<FetchedTags :item="row" :columns="3" />
<FetchedTags :item="row" />
</template>
<template #more-create-dialog="{ data }">
<VnInput

View File

@ -58,6 +58,7 @@ lastEntries:
pvp: PVP
label: Label
grouping: Grouping
packing: Packing
quantity: Quantity
cost: Cost
kg: Kg.

View File

@ -58,6 +58,7 @@ lastEntries:
pvp: PVP
label: Eti.
grouping: Grouping
packing: Packing
quantity: Cantidad
cost: Coste
kg: Kg.

View File

@ -1,38 +1,12 @@
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue';
import VnCardBeta from 'components/common/VnCardBeta.vue';
import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue';
import OrderFilter from './OrderFilter.vue';
import OrderSearchbar from './OrderSearchbar.vue';
import OrderCatalogFilter from './OrderCatalogFilter.vue';
const config = {
OrderCatalog: OrderCatalogFilter,
};
const route = useRoute();
const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => {
const route = config[routeName.value];
if (route) return null;
return 'OrderList';
});
const customFilterPanel = computed(() => {
const filterPanel = config[routeName.value] ?? OrderFilter;
return filterPanel;
});
</script>
<template>
<VnCard
<VnCardBeta
data-key="Order"
base-url="Orders"
:descriptor="OrderDescriptor"
:filter-panel="customFilterPanel"
:search-data-key="customRouteRedirectName"
>
<template #searchbar>
<OrderSearchbar />
</template>
</VnCard>
/>
</template>

View File

@ -15,15 +15,18 @@ const router = useRouter();
const stateStore = useStateStore();
const { t } = useI18n();
const dataKey = 'OrderCatalogList';
const arrayData = useArrayData(dataKey);
const store = arrayData.store;
const tags = ref([]);
const itemRefs = ref({});
let catalogParams = {
const catalogParams = {
orderFk: route.params.id,
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
};
const arrayData = useArrayData(dataKey, {
url: 'Orders/CatalogFilter',
limit: 50,
userParams: catalogParams,
});
const store = arrayData.store;
const tags = ref([]);
const itemRefs = ref({});
onMounted(() => {
stateStore.rightDrawer = true;
@ -66,7 +69,6 @@ function extractValueTags(items) {
);
tagValue.value = resultValueTags;
}
const autoLoad = computed(() => !!JSON.parse(route?.query.table ?? '{}')?.categoryFk);
watch(
() => store.data,
@ -78,16 +80,15 @@ watch(
</script>
<template>
<VnSearchbar
:data-key="dataKey"
:user-params="catalogParams"
:static-params="['orderFk', 'orderBy']"
:redirect="false"
url="Orders/CatalogFilter"
:label="t('Search items')"
:info="t('You can search items by name or id')"
:search-remove-params="false"
/>
<Teleport to="#section-searchbar" v-if="stateStore.isHeaderMounted()">
<VnSearchbar
:data-key="dataKey"
:redirect="false"
:label="t('Search items')"
:info="t('You can search items by name or id')"
:search-remove-params="false"
/>
</Teleport>
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
<OrderCatalogFilter
:data-key="dataKey"
@ -98,13 +99,7 @@ watch(
</Teleport>
<QPage class="column items-center q-pa-md" data-cy="orderCatalogPage">
<div class="full-width">
<VnPaginate
:data-key="dataKey"
url="Orders/CatalogFilter"
:limit="50"
:user-params="catalogParams"
:auto-load="autoLoad"
>
<VnPaginate :data-key="dataKey">
<template #body="{ rows }">
<div class="catalog-list">
<div v-if="rows && !rows?.length" class="no-result">

View File

@ -213,9 +213,9 @@ async function handleConfirm() {
type: 'positive',
});
router.push({
name: 'TicketList',
name: 'TicketSale',
query: {
table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }),
table: JSON.stringify({ id: route.params.id }),
},
});
}

View File

@ -1,22 +0,0 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
const { t } = useI18n();
</script>
<template>
<VnSearchbar
data-key="OrderList"
url="Orders/filter"
:label="t('Search order')"
:info="t('Search orders by ticket id')"
/>
</template>
<style scoped lang="scss"></style>
<i18n>
es:
Search order: Buscar orden
Search orders by ticket id: Buscar pedido por id ticket
</i18n>

View File

@ -8,15 +8,14 @@ import { useRoute } from 'vue-router';
import axios from 'axios';
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
import OrderSearchbar from './Card/OrderSearchbar.vue';
import OrderFilter from './Card/OrderFilter.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSection from 'src/components/common/VnSection.vue';
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
@ -24,6 +23,8 @@ const tableRef = ref();
const agencyList = ref([]);
const route = useRoute();
const addressOptions = ref([]);
const dataKey = 'OrderList';
const columns = computed(() => [
{
align: 'left',
@ -178,117 +179,126 @@ const getDateColor = (date) => {
if (difference < 0) return 'bg-success';
};
</script>
<template>
<OrderSearchbar />
<RightMenu>
<template #right-panel>
<VnSection
:data-key="dataKey"
:columns="columns"
prefix="order"
:array-data-props="{
url: 'Orders/filter',
order: ['landed DESC', 'clientFk ASC', 'id DESC'],
}"
>
<template #rightMenu>
<OrderFilter data-key="OrderList" />
</template>
</RightMenu>
<VnTable
ref="tableRef"
data-key="OrderList"
url="Orders/filter"
:order="['landed DESC', 'clientFk ASC', 'id DESC']"
:create="{
urlCreate: 'Orders/new',
title: t('module.cerateOrder'),
onDataSaved: (url) => {
tableRef.redirect(`${url}/catalog`);
},
formInitialData: {
active: true,
addressId: null,
clientFk: null,
},
}"
:user-params="{ showEmpty: false }"
:columns="columns"
:right-search="false"
redirect="order"
>
<template #column-clientFk="{ row }">
<span class="link" @click.stop>
{{ row?.clientName }}
<CustomerDescriptorProxy :id="row?.clientFk" />
</span>
</template>
<template #column-salesPersonFk="{ row }">
<span class="link" @click.stop>
{{ row?.name }}
<WorkerDescriptorProxy :id="row?.salesPersonFk" />
</span>
</template>
<template #column-landed="{ row }">
<span v-if="getDateColor(row.landed)">
<QChip :class="getDateColor(row.landed)" dense square>
{{ toDate(row?.landed) }}
</QChip>
</span>
</template>
<template #more-create-dialog="{ data }">
<VnSelect
url="Clients"
:include="{ relation: 'addresses' }"
v-model="data.clientFk"
:label="t('module.customer')"
@update:model-value="(id) => fetchClientAddress(id, data)"
<template #body>
<VnTable
ref="tableRef"
:data-key="dataKey"
:create="{
urlCreate: 'Orders/new',
title: t('module.cerateOrder'),
onDataSaved: (url) => {
tableRef.redirect(`${url}/catalog`);
},
formInitialData: {
active: true,
addressId: null,
clientFk: null,
},
}"
:user-params="{ showEmpty: false }"
:columns="columns"
:right-search="false"
redirect="order"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt.name }}
</QItemLabel>
<QItemLabel caption>
{{ `#${scope.opt.id}` }}
</QItemLabel>
</QItemSection>
</QItem>
<template #column-clientFk="{ row }">
<span class="link" @click.stop>
{{ row?.clientName }}
<CustomerDescriptorProxy :id="row?.clientFk" />
</span>
</template>
</VnSelect>
<VnSelect
v-model="data.addressId"
:options="addressOptions"
:label="t('module.address')"
option-value="id"
option-label="nickname"
@update:model-value="() => fetchAgencies(data)"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel
:class="{
'color-vn-label': !scope.opt?.isActive,
}"
>
{{
`${
!scope.opt?.isActive
? t('basicData.inactive')
: ''
} `
}}
{{ scope.opt?.nickname }}: {{ scope.opt?.street }},
{{ scope.opt?.city }}
</QItemLabel>
</QItemSection>
</QItem>
<template #column-salesPersonFk="{ row }">
<span class="link" @click.stop>
{{ row?.name }}
<WorkerDescriptorProxy :id="row?.salesPersonFk" />
</span>
</template>
</VnSelect>
<VnInputDate
v-model="data.landed"
:label="t('module.landed')"
@update:model-value="() => fetchAgencies(data)"
/>
<VnSelect
v-model="data.agencyModeId"
:label="t('module.agency')"
:options="agencyList"
option-value="agencyModeFk"
option-label="agencyMode"
/>
<template #column-landed="{ row }">
<span v-if="getDateColor(row.landed)">
<QChip :class="getDateColor(row.landed)" dense square>
{{ toDate(row?.landed) }}
</QChip>
</span>
</template>
<template #more-create-dialog="{ data }">
<VnSelect
url="Clients"
:include="{ relation: 'addresses' }"
v-model="data.clientFk"
:label="t('module.customer')"
@update:model-value="(id) => fetchClientAddress(id, data)"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt.name }}
</QItemLabel>
<QItemLabel caption>
{{ `#${scope.opt.id}` }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnSelect
v-model="data.addressId"
:options="addressOptions"
:label="t('module.address')"
option-value="id"
option-label="nickname"
@update:model-value="() => fetchAgencies(data)"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel
:class="{
'color-vn-label': !scope.opt?.isActive,
}"
>
{{
`${
!scope.opt?.isActive
? t('basicData.inactive')
: ''
} `
}}
{{ scope.opt?.nickname }}:
{{ scope.opt?.street }},
{{ scope.opt?.city }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnInputDate
v-model="data.landed"
:label="t('module.landed')"
@update:model-value="() => fetchAgencies(data)"
/>
<VnSelect
v-model="data.agencyModeId"
:label="t('module.agency')"
:options="agencyList"
option-value="agencyModeFk"
option-label="agencyMode"
/>
</template>
</VnTable>
</template>
</VnTable>
</VnSection>
</template>

View File

@ -21,3 +21,26 @@ lines:
image: Image
params:
tagGroups: Tags
order:
field:
salesPersonFk: Sales Person
form:
clientFk: Client
addressFk: Address
agencyModeFk: Agency
list:
newOrder: New Order
summary:
basket: Basket
notConfirmed: Not confirmed
created: Created
createdFrom: Created From
address: Address
total: Total
items: Items
orderTicketList: Order Ticket List
amount: Amount
confirm: Confirm
confirmLines: Confirm lines
search: Search orders
searchInfo: You can search orders by ticket id

View File

@ -21,3 +21,29 @@ lines:
image: Imagen
params:
tagGroups: Tags
order:
field:
salesPersonFk: Comercial
form:
clientFk: Cliente
addressFk: Dirección
agencyModeFk: Agencia
list:
newOrder: Nuevo Pedido
summary:
basket: Cesta
notConfirmed: No confirmada
created: Creado
createdFrom: Creado desde
address: Dirección
total: Total
vat: IVA
state: Estado
alias: Alias
items: Artículos
orderTicketList: Tickets del pedido
amount: Monto
confirm: Confirmar
confirmLines: Confirmar lineas
search: Buscar pedido
searchInfo: Buscar pedidos por el número de ticket

View File

@ -1,35 +1,102 @@
import { RouterView } from 'vue-router';
const orderCard = {
name: 'OrderCard',
path: ':id',
component: () => import('src/pages/Order/Card/OrderCard.vue'),
redirect: { name: 'OrderSummary' },
meta: {
menu: [
'OrderBasicData',
'OrderCatalog',
'OrderVolume',
'OrderLines',
],
},
children: [
{
path: 'summary',
name: 'OrderSummary',
meta: {
title: 'summary',
icon: 'launch',
},
component: () => import('src/pages/Order/Card/OrderSummary.vue'),
},
{
path: 'basic-data',
name: 'OrderBasicData',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('src/pages/Order/Card/OrderBasicData.vue'),
},
{
path: 'catalog',
name: 'OrderCatalog',
meta: {
title: 'catalog',
icon: 'vn:basket',
},
component: () => import('src/pages/Order/Card/OrderCatalog.vue'),
},
{
path: 'volume',
name: 'OrderVolume',
meta: {
title: 'volume',
icon: 'vn:volume',
},
component: () => import('src/pages/Order/Card/OrderVolume.vue'),
},
{
path: 'line',
name: 'OrderLines',
meta: {
title: 'lines',
icon: 'vn:lines',
},
component: () => import('src/pages/Order/Card/OrderLines.vue'),
},
],
};
export default {
path: '/order',
name: 'Order',
path: '/order',
meta: {
title: 'order',
icon: 'vn:basket',
moduleName: 'Order',
keyBinding: 'o',
menu: ['OrderList'],
},
component: RouterView,
redirect: { name: 'OrderMain' },
menus: {
main: ['OrderList'],
card: ['OrderBasicData', 'OrderCatalog', 'OrderVolume', 'OrderLines'],
},
children: [
{
path: '',
name: 'OrderMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'OrderList' },
redirect: { name: 'OrderIndexMain' },
children: [
{
path: 'list',
name: 'OrderList',
meta: {
title: 'orderList',
icon: 'view_list',
},
path: '',
name: 'OrderIndexMain',
redirect: { name: 'OrderList' },
component: () => import('src/pages/Order/OrderList.vue'),
children: [
{
name: 'OrderList',
path: 'list',
meta: {
title: 'orderList',
icon: 'view_list',
},
},
orderCard,
],
},
{
path: 'create',
@ -42,58 +109,5 @@ export default {
},
],
},
{
name: 'OrderCard',
path: ':id',
component: () => import('src/pages/Order/Card/OrderCard.vue'),
redirect: { name: 'OrderSummary' },
children: [
{
name: 'OrderSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'launch',
},
component: () => import('src/pages/Order/Card/OrderSummary.vue'),
},
{
name: 'OrderBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('src/pages/Order/Card/OrderBasicData.vue'),
},
{
name: 'OrderCatalog',
path: 'catalog',
meta: {
title: 'catalog',
icon: 'vn:basket',
},
component: () => import('src/pages/Order/Card/OrderCatalog.vue'),
},
{
name: 'OrderVolume',
path: 'volume',
meta: {
title: 'volume',
icon: 'vn:volume',
},
component: () => import('src/pages/Order/Card/OrderVolume.vue'),
},
{
name: 'OrderLines',
path: 'line',
meta: {
title: 'lines',
icon: 'vn:lines',
},
component: () => import('src/pages/Order/Card/OrderLines.vue'),
},
],
},
],
};
};

View File

@ -7,7 +7,14 @@ import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
const { notify } = useNotify();
const initInvoicing = {
invoicing: false,
nRequests: 0,
nPdfs: 0,
totalPdfs: 0,
addressIndex: 0,
errors: [],
};
export const useInvoiceOutGlobalStore = defineStore({
id: 'invoiceOutGlobal',
state: () => ({
@ -23,16 +30,11 @@ export const useInvoiceOutGlobalStore = defineStore({
addresses: [],
minInvoicingDate: null,
parallelism: null,
invoicing: false,
isInvoicing: false,
status: null,
addressIndex: 0,
errors: [],
printer: null,
nRequests: 0,
nPdfs: 0,
totalPdfs: 0,
formData: null,
...initInvoicing,
}),
actions: {
async init() {
@ -117,12 +119,13 @@ export const useInvoiceOutGlobalStore = defineStore({
);
throw new Error("There aren't addresses to invoice");
}
this.invoicing = false;
this.status = 'invoicing';
this.formData = formData;
this.addressIndex = 0;
this.errors = [];
await this.invoiceClient();
this.status = 'invoicing';
//reset data
for (const key in initInvoicing) {
this[key] = initInvoicing[key];
}
this.invoiceClient();
} catch (err) {
this.handleError(err);
}
@ -184,7 +187,6 @@ export const useInvoiceOutGlobalStore = defineStore({
async invoiceClient() {
if (this.invoicing || this.nRequests >= this.parallelism) return;
const address = this.addresses[this.addressIndex];
if (!address || !this.status || this.status == 'stopping') {
this.status = 'stopping';
this.invoicing = false;
@ -192,6 +194,7 @@ export const useInvoiceOutGlobalStore = defineStore({
}
try {
this.invoicing = true;
this.nRequests++;
const params = {
clientId: address.clientId,
addressId: address.id,
@ -215,6 +218,7 @@ export const useInvoiceOutGlobalStore = defineStore({
}
} finally {
this.invoicing = false;
this.nRequests--;
this.addressIndex++;
this.invoiceClient();
}