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

This commit is contained in:
Jon Elias 2025-05-05 07:41:12 +00:00
commit 35b31adff6
69 changed files with 1373 additions and 738 deletions

2
Jenkinsfile vendored
View File

@ -125,7 +125,7 @@ pipeline {
sh "docker-compose ${env.COMPOSE_PARAMS} pull db"
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
def modules = sh(script: 'node test/cypress/docker/find/find.js', returnStdout: true).trim()
def modules = sh(script: "node test/cypress/docker/find/find.js ${env.COMPOSE_TAG}", returnStdout: true).trim()
echo "E2E MODULES: ${modules}"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
sh "sh test/cypress/docker/cypressParallel.sh 1 '${modules}'"

View File

@ -156,6 +156,9 @@ const selectTravel = ({ id }) => {
option-label="name"
option-value="id"
v-model="travelFilterParams.warehouseOutFk"
:where="{
isOrigin: true,
}"
/>
<VnSelect
:label="t('globals.warehouseIn')"
@ -164,6 +167,9 @@ const selectTravel = ({ id }) => {
option-label="name"
option-value="id"
v-model="travelFilterParams.warehouseInFk"
:where="{
isDestiny: true,
}"
/>
<VnInputDate
:label="t('globals.shipped')"

View File

@ -100,7 +100,7 @@ const $props = defineProps({
},
preventSubmit: {
type: Boolean,
default: true,
default: false,
},
});
const emit = defineEmits(['onFetch', 'onDataSaved', 'submit']);
@ -287,7 +287,7 @@ function updateAndEmit(evt, { val, res, old } = { val: null, res: null, old: nul
state.set(modelValue, val);
if (!$props.url) arrayData.store.data = val;
emit(evt, state.get(modelValue), res, old);
emit(evt, state.get(modelValue), res, old, formData);
}
function trimData(data) {

View File

@ -40,6 +40,9 @@ const onDataSaved = (data) => {
url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)"
auto-load
:where="{
isInventory: true,
}"
/>
<FormModelPopup
url-create="Items/regularize"

View File

@ -33,7 +33,8 @@ import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
import VnTableFilter from './VnTableFilter.vue';
import { getColAlign } from 'src/composables/getColAlign';
import RightMenu from '../common/RightMenu.vue';
import VnScroll from '../common/VnScroll.vue'
import VnScroll from '../common/VnScroll.vue';
import VnCheckboxMenu from '../common/VnCheckboxMenu.vue';
const arrayData = useArrayData(useAttrs()['data-key']);
const $props = defineProps({
@ -113,6 +114,10 @@ const $props = defineProps({
type: Object,
default: () => ({}),
},
multiCheck: {
type: Object,
default: () => ({}),
},
crudModel: {
type: Object,
default: () => ({}),
@ -157,6 +162,7 @@ const CARD_MODE = 'card';
const TABLE_MODE = 'table';
const mode = ref(CARD_MODE);
const selected = ref([]);
const selectAll = ref(false);
const hasParams = ref(false);
const CrudModelRef = ref({});
const showForm = ref(false);
@ -638,6 +644,17 @@ const rowCtrlClickFunction = computed(() => {
};
return () => {};
});
const handleHeaderSelection = (evt, data) => {
if (evt === 'selected' && data) {
selected.value = tableRef.value.rows;
} else if (evt === 'selectAll') {
selected.value = data;
} else {
selected.value = [];
}
emit('update:selected', selected.value);
};
</script>
<template>
<RightMenu v-if="$props.rightSearch" :overlay="overlay">
@ -700,6 +717,17 @@ const rowCtrlClickFunction = computed(() => {
:hide-selected-banner="true"
:data-cy
>
<template #header-selection>
<VnCheckboxMenu
:searchUrl="searchUrl"
:expand="$props.multiCheck.expand"
v-model="selectAll"
:url="$attrs['url']"
@update:selected="handleHeaderSelection('selected', $event)"
@select:all="handleHeaderSelection('selectAll', $event)"
/>
</template>
<template #top-left v-if="!$props.withoutHeader">
<slot name="top-left"> </slot>
</template>

View File

@ -0,0 +1,93 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnInput from 'src/components/common/VnInput.vue';
import FetchData from '../FetchData.vue';
import VnSelectDialog from './VnSelectDialog.vue';
import CreateBankEntityForm from '../CreateBankEntityForm.vue';
const $props = defineProps({
iban: {
type: String,
default: null,
},
bankEntityFk: {
type: Number,
default: null,
},
disableElement: {
type: Boolean,
default: false,
},
});
const filter = {
fields: ['id', 'bic', 'name'],
order: 'bic ASC',
};
const { t } = useI18n();
const emit = defineEmits(['updateBic']);
const iban = ref($props.iban);
const bankEntityFk = ref($props.bankEntityFk);
const bankEntities = ref([]);
const autofillBic = async (bic) => {
if (!bic) return;
const bankEntityId = parseInt(bic.substr(4, 4));
const ibanCountry = bic.substr(0, 2);
if (ibanCountry != 'ES') return;
const existBank = bankEntities.value.find((b) => b.id === bankEntityId);
bankEntityFk.value = existBank ? bankEntityId : null;
emit('updateBic', { iban: iban.value, bankEntityFk: bankEntityFk.value });
};
const getBankEntities = (data) => {
bankEntityFk.value = data.id;
};
</script>
<template>
<FetchData
url="BankEntities"
:filter="filter"
auto-load
@on-fetch="(data) => (bankEntities = data)"
/>
<VnInput
:label="t('IBAN')"
clearable
v-model="iban"
@update:model-value="autofillBic($event)"
:disable="disableElement"
>
<template #append>
<QIcon name="info" class="cursor-info">
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
</QIcon>
</template>
</VnInput>
<VnSelectDialog
:label="t('Swift / BIC')"
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
:options="bankEntities"
hide-selected
option-label="name"
option-value="id"
v-model="bankEntityFk"
@update:model-value="$emit('updateBic', { iban, bankEntityFk })"
:disable="disableElement"
>
<template #form>
<CreateBankEntityForm @on-data-saved="getBankEntities($event)" />
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel>{{ scope.opt.bic }} </QItemLabel>
<QItemLabel caption> {{ scope.opt.name }}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectDialog>
</template>

View File

@ -33,7 +33,7 @@ onBeforeRouteLeave(() => {
});
onBeforeMount(async () => {
stateStore.cardDescriptorChangeValue(markRaw(props.descriptor));
if (props.visual) stateStore.cardDescriptorChangeValue(markRaw(props.descriptor));
const route = router.currentRoute.value;
try {

View File

@ -0,0 +1,115 @@
<script setup>
import { ref } from 'vue';
import VnCheckbox from './VnCheckbox.vue';
import axios from 'axios';
import { toRaw } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
const route = useRoute();
const { t } = useI18n();
const model = defineModel({ type: [Boolean] });
const props = defineProps({
expand: {
type: Boolean,
default: false,
},
url: {
type: String,
required: true,
},
searchUrl: {
type: [String, Boolean],
default: 'table',
},
});
const value = ref(false);
const menuRef = ref(null);
const errorMessage = ref(null);
const rows = ref(0);
const onClick = async () => {
errorMessage.value = null;
if (value.value) {
const { filter } = JSON.parse(route.query[props.searchUrl]);
filter.limit = 0;
const params = {
params: { filter: JSON.stringify(filter) },
};
try {
const { data } = await axios.get(props.url, params);
rows.value = data;
} catch (error) {
const response = error.response;
if (response.data.error.name === 'UserError') {
errorMessage.value = t('tooManyResults');
} else {
errorMessage.value = response.data.error.message;
}
}
}
};
defineEmits(['update:selected', 'select:all']);
</script>
<template>
<div class="flex items-center no-wrap" style="display: flex">
<VnCheckbox v-model="value" @click="$emit('update:selected', value)" />
<QIcon
style="margin-left: -10px"
data-cy="btnMultiCheck"
v-if="value && $props.expand"
name="expand_more"
@click="onClick"
class="cursor-pointer"
color="primary"
size="xs"
>
<QMenu
fit
anchor="bottom start"
self="top left"
ref="menuRef"
data-cy="menuMultiCheck"
>
<QList separator>
<QItem
data-cy="selectAll"
v-ripple
clickable
@click="
$refs.menuRef.hide();
$emit('select:all', toRaw(rows));
"
>
<QItemSection>
<QItemLabel>
<span v-text="t('Select all')" />
</QItemLabel>
<QItemLabel overline caption>
<span
v-if="errorMessage"
class="text-negative"
v-text="errorMessage"
/>
<span
v-else
v-text="t('records', { rows: rows.length })"
/>
</QItemLabel>
</QItemSection>
</QItem>
<slot name="more-options"></slot>
</QList>
</QMenu>
</QIcon>
</div>
</template>
<i18n lang="yml">
en:
tooManyResults: Too many results. Please narrow down your search.
records: '{rows} records'
es:
Select all: Seleccionar todo
tooManyResults: Demasiados registros. Restringe la búsqueda.
records: '{rows} registros'
</i18n>

View File

@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
import axios from 'axios';
import { usePrintService } from 'composables/usePrintService';
import VnUserLink from '../ui/VnUserLink.vue';
import { downloadFile } from 'src/composables/downloadFile';
@ -23,6 +24,7 @@ const rows = ref([]);
const dmsRef = ref();
const formDialog = ref({});
const token = useSession().getTokenMultimedia();
const { openReport } = usePrintService();
const $props = defineProps({
model: {
@ -199,12 +201,7 @@ const columns = computed(() => [
color: 'primary',
}),
click: (prop) =>
downloadFile(
prop.row.id,
$props.downloadModel,
undefined,
prop.row.download,
),
openReport(`dms/${prop.row.id}/downloadFile`, {}, '_blank'),
},
{
component: QBtn,

View File

@ -1,44 +0,0 @@
<script setup>
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
const model = defineModel({ type: [Number, String] });
const emit = defineEmits(['updateBic']);
const getIbanCountry = (bank) => {
return bank.substr(0, 2);
};
const autofillBic = async (iban) => {
if (!iban) return;
const bankEntityId = parseInt(iban.substr(4, 4));
const ibanCountry = getIbanCountry(iban);
if (ibanCountry != 'ES') return;
const filter = { where: { id: bankEntityId } };
const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get(`BankEntities`, { params });
emit('updateBic', data[0]?.id);
};
</script>
<template>
<VnInput
:label="t('IBAN')"
clearable
v-model="model"
@update:model-value="autofillBic($event)"
>
<template #append>
<QIcon name="info" class="cursor-info">
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
</QIcon>
</template>
</VnInput>
</template>

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted, watch, computed } from 'vue';
import { ref, onMounted, onUnmounted, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import axios from 'axios';

View File

@ -161,7 +161,7 @@ const arrayData = useArrayData(arrayDataKey, {
searchUrl: false,
mapKey: $attrs['map-key'],
});
const isMenuOpened = ref(false);
const computedSortBy = computed(() => {
return $props.sortBy || $props.optionLabel + ' ASC';
});
@ -186,7 +186,9 @@ onMounted(() => {
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
});
const someIsLoading = computed(() => isLoading.value || !!arrayData?.isLoading?.value);
const someIsLoading = computed(
() => (isLoading.value || !!arrayData?.isLoading?.value) && !isMenuOpened.value,
);
function findKeyInOptions() {
if (!$props.options) return;
return filter($props.modelValue, $props.options)?.length;
@ -368,8 +370,9 @@ function getCaption(opt) {
hide-bottom-space
:input-debounce="useURL ? '300' : '0'"
:loading="someIsLoading"
:disable="someIsLoading"
@virtual-scroll="onScroll"
@popup-hide="isMenuOpened = false"
@popup-show="isMenuOpened = true"
@keydown="handleKeyDown"
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
:data-url="url"

View File

@ -0,0 +1,43 @@
import { createWrapper } from 'app/test/vitest/helper';
import VnBankDetailsForm from 'components/common/VnBankDetailsForm.vue';
import { vi, afterEach, expect, it, beforeEach, describe } from 'vitest';
describe('VnBankDetail Component', () => {
let vm;
let wrapper;
const bankEntities = [
{ id: 2100, bic: 'CAIXESBBXXX', name: 'CaixaBank' },
{ id: 1234, bic: 'TESTBIC', name: 'Test Bank' },
];
const correctIban = 'ES6621000418401234567891';
beforeAll(() => {
wrapper = createWrapper(VnBankDetailsForm, {
$props: {
iban: null,
bankEntityFk: null,
disableElement: false,
},
});
vm = wrapper.vm;
wrapper = wrapper.wrapper;
});
afterEach(() => {
vi.clearAllMocks();
});
it('should update bankEntityFk when IBAN exists in bankEntities', async () => {
vm.bankEntities = bankEntities;
await vm.autofillBic(correctIban);
expect(vm.bankEntityFk).toBe(2100);
});
it('should set bankEntityFk to null when IBAN bank code is not found', async () => {
vm.bankEntities = bankEntities;
await vm.autofillBic('ES1234567891324567891234');
expect(vm.bankEntityFk).toBe(null);
});
});

View File

@ -1,8 +1,6 @@
<script setup>
import { onBeforeMount, watch, computed, ref } from 'vue';
import { watch, ref, onMounted } from 'vue';
import { useArrayData } from 'composables/useArrayData';
import { useState } from 'src/composables/useState';
import { useRoute } from 'vue-router';
import VnDescriptor from './VnDescriptor.vue';
const $props = defineProps({
@ -20,39 +18,50 @@ const $props = defineProps({
},
});
const state = useState();
const route = useRoute();
let arrayData;
let store;
let entity;
const entity = ref();
const isLoading = ref(false);
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
defineExpose({ getData });
const containerRef = ref(null);
onBeforeMount(async () => {
arrayData = useArrayData($props.dataKey, {
onMounted(async () => {
let isPopup;
let el = containerRef.value.$el;
while (el) {
if (el.classList?.contains('q-menu')) {
isPopup = true;
break;
}
el = el.parentElement;
}
arrayData = useArrayData($props.dataKey + (isPopup ? 'Proxy' : ''), {
url: $props.url,
userFilter: $props.filter,
skip: 0,
oneRecord: true,
});
store = arrayData.store;
entity = computed(() => {
const data = store.data ?? {};
if (data) emit('onFetch', data);
return data;
});
// It enables to load data only once if the module is the same as the dataKey
if (!isSameDataKey.value || !route.params.id) await getData();
watch(
() => [$props.url, $props.filter],
async () => {
if (!isSameDataKey.value) await getData();
await getData();
},
{ immediate: true },
);
watch(
() => arrayData.store.data,
(newValue) => {
entity.value = newValue;
},
);
});
defineExpose({ getData });
const emit = defineEmits(['onFetch']);
async function getData() {
store.url = $props.url;
store.filter = $props.filter ?? {};
@ -60,18 +69,15 @@ async function getData() {
try {
await arrayData.fetch({ append: false, updateRouter: false });
const { data } = store;
state.set($props.dataKey, data);
emit('onFetch', data);
} finally {
isLoading.value = false;
}
}
const emit = defineEmits(['onFetch']);
</script>
<template>
<VnDescriptor v-model="entity" v-bind="$attrs" :module="dataKey">
<VnDescriptor v-model="entity" v-bind="$attrs" :module="dataKey" ref="containerRef">
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template>

View File

@ -146,14 +146,14 @@ const addFilter = async (filter, params) => {
};
async function fetch(params) {
useArrayData(props.dataKey, params);
arrayData.setOptions(params);
arrayData.resetPagination();
await arrayData.fetch({ append: false });
return emitStoreData();
}
async function update(params) {
useArrayData(props.dataKey, params);
arrayData.setOptions(params);
const { limit, skip } = store;
store.limit = limit + skip;
store.skip = 0;
@ -222,7 +222,7 @@ defineExpose({
</script>
<template>
<div class="full-width" v-bind="attrs">
<div class="full-width">
<div
v-if="!store.data && !store.data?.length && !isLoading"
class="info-row q-pa-md text-center"

View File

@ -19,7 +19,7 @@ export function useArrayData(key, userOptions) {
let canceller = null;
onMounted(() => {
setOptions();
setOptions(userOptions ?? {});
reset(['skip']);
const query = route.query;
@ -39,9 +39,10 @@ export function useArrayData(key, userOptions) {
setCurrentFilter();
});
if (key && userOptions) setOptions();
if (userOptions) setOptions(userOptions);
function setOptions() {
function setOptions(params) {
if (!params) return;
const allowedOptions = [
'url',
'filter',
@ -57,14 +58,14 @@ export function useArrayData(key, userOptions) {
'mapKey',
'oneRecord',
];
if (typeof userOptions === 'object') {
for (const option in userOptions) {
const isEmpty = userOptions[option] == null || userOptions[option] === '';
if (typeof params === 'object') {
for (const option in params) {
const isEmpty = params[option] == null || params[option] === '';
if (isEmpty || !allowedOptions.includes(option)) continue;
if (Object.hasOwn(store, option)) {
const defaultOpts = userOptions[option];
store[option] = userOptions.keepOpts?.includes(option)
const defaultOpts = params[option];
store[option] = params.keepOpts?.includes(option)
? Object.assign(defaultOpts, store[option])
: defaultOpts;
if (option === 'userParams') store.defaultParams = store[option];
@ -367,5 +368,6 @@ export function useArrayData(key, userOptions) {
deleteOption,
reset,
resetPagination,
setOptions,
};
}

View File

@ -6,6 +6,7 @@ import toDateHourMinSec from './toDateHourMinSec';
import toRelativeDate from './toRelativeDate';
import toCurrency from './toCurrency';
import toPercentage from './toPercentage';
import toNumber from './toNumber';
import toLowerCamel from './toLowerCamel';
import dashIfEmpty from './dashIfEmpty';
import dateRange from './dateRange';
@ -34,6 +35,7 @@ export {
toRelativeDate,
toCurrency,
toPercentage,
toNumber,
dashIfEmpty,
dateRange,
getParamWhere,

8
src/filters/toNumber.js Normal file
View File

@ -0,0 +1,8 @@
export default function (value, fractionSize = 2) {
if (isNaN(value)) return value;
return new Intl.NumberFormat('es-ES', {
style: 'decimal',
minimumFractionDigits: 0,
maximumFractionDigits: fractionSize,
}).format(value);
}

View File

@ -122,6 +122,7 @@ globals:
producer: Producer
origin: Origin
state: State
total: Total
subtotal: Subtotal
visible: Visible
price: Price

View File

@ -126,6 +126,7 @@ globals:
producer: Productor
origin: Origen
state: Estado
total: Total
subtotal: Subtotal
visible: Visible
price: Precio

View File

@ -4,11 +4,6 @@ import AccountSummary from './AccountSummary.vue';
</script>
<template>
<QPopupProxy style="max-width: 10px">
<AccountDescriptor
v-if="$attrs.id"
v-bind="$attrs"
:summary="AccountSummary"
:proxy-render="true"
/>
<AccountDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="AccountSummary" />
</QPopupProxy>
</template>

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { toDateHourMinSec, toPercentage } from 'src/filters';
@ -9,7 +9,6 @@ import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/Departme
import EntityDescriptor from 'components/ui/EntityDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
import { getUrl } from 'src/composables/getUrl';
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import filter from './ClaimFilter.js';
@ -23,7 +22,6 @@ const $props = defineProps({
const route = useRoute();
const { t } = useI18n();
const salixUrl = ref();
const entityId = computed(() => {
return $props.id || route.params.id;
});
@ -31,10 +29,6 @@ const entityId = computed(() => {
function stateColor(entity) {
return entity?.claimState?.classColor;
}
onMounted(async () => {
salixUrl.value = await getUrl('');
});
</script>
<template>
@ -126,7 +120,7 @@ onMounted(async () => {
size="md"
icon="assignment"
color="primary"
:href="salixUrl + 'ticket/' + entity.ticketFk + '/sale-tracking'"
:to="{ name: 'TicketSaleTracking', params: { id: entity.ticketFk } }"
>
<QTooltip>{{ t('claim.saleTracking') }}</QTooltip>
</QBtn>
@ -134,7 +128,7 @@ onMounted(async () => {
size="md"
icon="visibility"
color="primary"
:href="salixUrl + 'ticket/' + entity.ticketFk + '/tracking/index'"
:to="{ name: 'TicketTracking', params: { id: entity.ticketFk } }"
>
<QTooltip>{{ t('claim.ticketTracking') }}</QTooltip>
</QBtn>

View File

@ -4,11 +4,6 @@ import ClaimSummary from './ClaimSummary.vue';
</script>
<template>
<QPopupProxy style="max-width: 10px">
<ClaimDescriptor
v-if="$attrs.id"
v-bind="$attrs.id"
:summary="ClaimSummary"
:proxy-render="true"
/>
<ClaimDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="ClaimSummary" />
</QPopupProxy>
</template>

View File

@ -77,10 +77,10 @@ const isDefaultAddress = (address) => {
return client?.value?.defaultAddressFk === address.id ? 1 : 0;
};
const setDefault = (address) => {
const setDefault = async (address) => {
const url = `Clients/${route.params.id}`;
const payload = { defaultAddressFk: address.id };
axios.patch(url, payload).then((res) => {
await axios.patch(url, payload).then((res) => {
if (res.data) {
client.value.defaultAddressFk = res.data.defaultAddressFk;
sortAddresses();

View File

@ -1,5 +1,4 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
@ -7,29 +6,15 @@ import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import VnInputBic from 'src/components/common/VnInputBic.vue';
import VnBankDetailsForm from 'src/components/common/VnBankDetailsForm.vue';
const { t } = useI18n();
const route = useRoute();
const bankEntitiesRef = ref(null);
const filter = {
fields: ['id', 'bic', 'name'],
order: 'bic ASC',
};
const getBankEntities = (data, formData) => {
bankEntitiesRef.value.fetch();
formData.bankEntityFk = Number(data.id);
};
</script>
<template>
<FormModel :url-update="`Clients/${route.params.id}`" auto-load model="Customer">
<template #form="{ data, validate }">
<template #form="{ data }">
<VnRow>
<VnSelect
auto-load
@ -42,42 +27,19 @@ const getBankEntities = (data, formData) => {
/>
<VnInput :label="t('Due day')" clearable v-model="data.dueDay" />
</VnRow>
<VnRow>
<VnInputBic
:label="t('IBAN')"
v-model="data.iban"
@update-bic="(bankEntityFk) => (data.bankEntityFk = bankEntityFk)"
<VnBankDetailsForm
v-model:iban="data.iban"
v-model:bankEntityFk="data.bankEntityFk"
@update-bic="
({ iban, bankEntityFk }) => {
if (!iban || !bankEntityFk) return;
data.iban = iban;
data.bankEntityFk = bankEntityFk;
}
"
/>
<VnSelectDialog
:label="t('Swift / BIC')"
ref="bankEntitiesRef"
:filter="filter"
auto-load
url="BankEntities"
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
:rules="validate('Worker.bankEntity')"
hide-selected
option-label="name"
option-value="id"
v-model="data.bankEntityFk"
>
<template #form>
<CreateBankEntityForm
@on-data-saved="getBankEntities($event, data)"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel>{{ scope.opt.bic }} </QItemLabel>
<QItemLabel caption> {{ scope.opt.name }}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectDialog>
</VnRow>
<VnRow>
<QCheckbox :label="t('Received LCR')" v-model="data.hasLcr" />
<QCheckbox :label="t('VNL core received')" v-model="data.hasCoreVnl" />

View File

@ -89,7 +89,6 @@ const columns = computed(() => [
<CustomerNotificationsCampaignConsumption
:selected-rows="selected.length > 0"
:clients="selected"
:promise="refreshData"
/>
</template>
</VnSubToolbar>
@ -100,6 +99,9 @@ const columns = computed(() => [
'row-key': 'id',
selection: 'multiple',
}"
:multi-check="{
expand: true,
}"
v-model:selected="selected"
:right-search="true"
:columns="columns"

View File

@ -98,7 +98,9 @@ onMounted(async () => {
<QBtn color="primary" icon="show_chart" :disable="!selectedRows">
<QPopupProxy ref="popupProxyRef">
<QCard class="column q-pa-md">
<span class="text-body1 q-mb-sm">{{ t('Campaign consumption') }}</span>
<span class="text-body1 q-mb-sm">{{
t('Campaign consumption', { rows: $props.clients.length })
}}</span>
<VnRow>
<VnSelect
:options="moreFields"
@ -140,12 +142,13 @@ onMounted(async () => {
valentinesDay: Valentine's Day
mothersDay: Mother's Day
allSaints: All Saints' Day
Campaign consumption: Campaign consumption - {rows} records
es:
params:
valentinesDay: Día de San Valentín
mothersDay: Día de la Madre
allSaints: Día de Todos los Santos
Campaign consumption: Consumo campaña
Campaign consumption: Consumo campaña - {rows} registros
Campaign: Campaña
From: Desde
To: Hasta

View File

@ -1,9 +1,9 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { useQuasar } from 'quasar';
import { usePrintService } from 'composables/usePrintService';
import { downloadFile } from 'src/composables/downloadFile';
import CustomerFileManagementDelete from 'src/pages/Customer/components/CustomerFileManagementDelete.vue';
@ -12,7 +12,7 @@ const { t } = useI18n();
const quasar = useQuasar();
const route = useRoute();
const router = useRouter();
const { openReport } = usePrintService();
const $props = defineProps({
id: {
type: Number,
@ -24,7 +24,7 @@ const $props = defineProps({
},
});
const setDownloadFile = () => downloadFile($props.id);
const setDownloadFile = () => openReport(`dms/${$props.id}/downloadFile`, {}, '_blank');
const toCustomerFileManagementEdit = () => {
router.push({

View File

@ -162,6 +162,9 @@ const entryFilterPanel = ref();
v-model="params.warehouseOutFk"
@update:model-value="searchFn()"
url="Warehouses"
:where="{
isOrigin: true,
}"
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected
@ -177,6 +180,9 @@ const entryFilterPanel = ref();
v-model="params.warehouseInFk"
@update:model-value="searchFn()"
url="Warehouses"
:where="{
isDestiny: true,
}"
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected

View File

@ -6,13 +6,18 @@ import { useRoute } from 'vue-router';
import { useSession } from 'src/composables/useSession';
import { toDateHourMin } from 'filters/index';
import { useStateStore } from 'src/stores/useStateStore';
import { dashIfEmpty } from 'src/filters';
import AgencyDescriptorProxy from '../Agency/Card/AgencyDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import RouteDescriptorProxy from '../Card/RouteDescriptorProxy.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnInput from 'src/components/common/VnInput.vue';
const route = useRoute();
const { t } = useI18n();
@ -30,39 +35,117 @@ const userParams = {
const columns = computed(() => [
{
align: 'left',
align: 'right',
name: 'cmrFk',
label: t('route.cmr.params.cmrFk'),
label: t('cmr.params.cmrFk'),
chip: {
condition: () => true,
},
isId: true,
},
{
align: 'center',
name: 'hasCmrDms',
label: t('route.cmr.params.hasCmrDms'),
component: 'checkbox',
cardVisible: true,
},
{
align: 'left',
label: t('route.cmr.params.ticketFk'),
align: 'right',
label: t('cmr.params.ticketFk'),
name: 'ticketFk',
},
{
align: 'left',
label: t('route.cmr.params.routeFk'),
align: 'right',
label: t('cmr.params.routeFk'),
name: 'routeFk',
},
{
align: 'left',
label: t('route.cmr.params.clientFk'),
label: t('cmr.params.client'),
name: 'clientFk',
component: 'select',
attrs: {
url: 'Clients',
fields: ['id', 'name'],
},
columnFilter: {
name: 'clientFk',
attrs: {
url: 'Clients',
fields: ['id', 'name'],
},
},
},
{
align: 'right',
label: t('route.cmr.params.countryFk'),
label: t('cmr.params.agency'),
name: 'agencyModeFk',
component: 'select',
attrs: {
url: 'Agencies',
fields: ['id', 'name'],
},
columnFilter: {
name: 'agencyModeFk',
attrs: {
url: 'Agencies',
fields: ['id', 'name'],
},
},
format: ({ agencyName }) => agencyName,
},
{
label: t('cmr.params.supplier'),
name: 'supplierFk',
component: 'select',
attrs: {
url: 'suppliers',
fields: ['id', 'name'],
},
columnFilter: {
name: 'supplierFk',
attrs: {
url: 'suppliers',
fields: ['id', 'name'],
},
},
},
{
label: t('cmr.params.sender'),
name: 'addressFromFk',
component: 'select',
attrs: {
url: 'Addresses',
fields: ['id', 'nickname'],
optionValue: 'id',
optionLabel: 'nickname',
},
columnFilter: {
name: 'addressFromFk',
attrs: {
url: 'Addresses',
fields: ['id', 'nickname'],
optionValue: 'id',
optionLabel: 'nickname',
},
},
format: ({ origin }) => origin,
},
{
label: t('cmr.params.destination'),
name: 'addressToFk',
component: 'select',
attrs: {
url: 'addresses',
fields: ['id', 'nickname'],
optionValue: 'id',
optionLabel: 'nickname',
},
columnFilter: {
name: 'addressToFk',
attrs: {
url: 'addresses',
fields: ['id', 'nickname'],
optionValue: 'id',
optionLabel: 'nickname',
},
},
format: ({ destination }) => destination,
},
{
label: t('cmr.params.country'),
name: 'countryFk',
component: 'select',
attrs: {
@ -79,16 +162,61 @@ const columns = computed(() => [
format: ({ countryName }) => countryName,
},
{
align: 'right',
label: t('route.cmr.params.shipped'),
name: 'shipped',
cardVisible: true,
label: t('cmr.params.created'),
name: 'created',
component: 'date',
format: ({ shipped }) => toDateHourMin(shipped),
format: ({ created }) => dashIfEmpty(toDateHourMin(created)),
},
{
align: 'right',
label: t('route.cmr.params.warehouseFk'),
label: t('cmr.params.shipped'),
name: 'shipped',
component: 'date',
format: ({ shipped }) => dashIfEmpty(toDateHourMin(shipped)),
},
{
label: t('cmr.params.etd'),
name: 'ead',
component: 'date',
format: ({ ead }) => dashIfEmpty(toDateHourMin(ead)),
toolTip: t('cmr.params.etdTooltip'),
},
{
label: t('globals.landed'),
name: 'landed',
component: 'date',
format: ({ landed }) => dashIfEmpty(toDateHourMin(landed)),
},
{
align: 'left',
label: t('cmr.params.packageList'),
name: 'packagesList',
columnFilter: false,
},
{
align: 'left',
label: t('cmr.params.observation'),
name: 'observation',
columnFilter: false,
},
{
align: 'left',
label: t('cmr.params.senderInstructions'),
name: 'senderInstruccions',
columnFilter: false,
},
{
align: 'left',
label: t('cmr.params.paymentInstructions'),
name: 'paymentInstruccions',
columnFilter: false,
},
{
align: 'left',
label: t('cmr.params.vehiclePlate'),
name: 'truckPlate',
},
{
label: t('cmr.params.warehouse'),
name: 'warehouseFk',
component: 'select',
attrs: {
@ -96,7 +224,6 @@ const columns = computed(() => [
fields: ['id', 'name'],
},
columnFilter: {
inWhere: true,
name: 'warehouseFk',
attrs: {
url: 'warehouses',
@ -105,12 +232,23 @@ const columns = computed(() => [
},
format: ({ warehouseName }) => warehouseName,
},
{
align: 'left',
name: 'specialAgreements',
label: t('cmr.params.specialAgreements'),
columnFilter: false,
},
{
name: 'hasCmrDms',
label: t('cmr.params.hasCmrDms'),
component: 'checkbox',
},
{
align: 'center',
name: 'tableActions',
actions: [
{
title: t('route.cmr.params.viewCmr'),
title: t('cmr.params.viewCmr'),
icon: 'visibility',
isPrimary: true,
action: (row) => window.open(getCmrUrl(row?.cmrFk), '_blank'),
@ -151,11 +289,7 @@ function downloadPdfs() {
}
</script>
<template>
<VnSearchbar
:data-key
:label="t('route.cmr.search')"
:info="t('route.cmr.searchInfo')"
/>
<VnSearchbar :data-key :label="t('cmr.search')" :info="t('cmr.searchInfo')" />
<VnSubToolbar>
<template #st-actions>
<QBtn
@ -165,7 +299,7 @@ function downloadPdfs() {
:disable="!selectedRows?.length"
@click="downloadPdfs"
>
<QTooltip>{{ t('route.cmr.params.downloadCmrs') }}</QTooltip>
<QTooltip>{{ t('cmr.params.downloadCmrs') }}</QTooltip>
</QBtn>
</template>
</VnSubToolbar>
@ -191,11 +325,72 @@ function downloadPdfs() {
<TicketDescriptorProxy :id="row.ticketFk" />
</span>
</template>
<template #column-routeFk="{ row }">
<span class="link" @click.stop>
{{ row.routeFk }}
<RouteDescriptorProxy :id="row.routeFk" />
</span>
</template>
<template #column-clientFk="{ row }">
<span class="link" @click.stop>
{{ row.clientFk }}
{{ row.clientName }}
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
</template>
<template #column-agencyModeFk="{ row }">
<span class="link" @click.stop>
{{ row.agencyName }}
<AgencyDescriptorProxy :id="row.agencyModeFk" />
</span>
</template>
<template #column-supplierFk="{ row }">
<span class="link" @click.stop>
{{ row.carrierName }}
<SupplierDescriptorProxy :id="row.supplierFk" />
</span>
</template>
<template #column-observation="{ row }">
<VnInput
v-if="row.observation"
type="textarea"
v-model="row.observation"
readonly
dense
rows="2"
style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap"
/>
</template>
<template #column-packagesList="{ row }">
<span>
{{ row.packagesList }}
<QTooltip v-if="row.packagesList" :label="row.packagesList">
{{ row.packagesList }}
</QTooltip>
</span>
</template>
<template #column-senderInstruccions="{ row }">
<span>
{{ row.senderInstruccions }}
<QTooltip v-if="row.packagesList" :label="row.packagesList">
{{ row.senderInstruccions }}
</QTooltip>
</span>
</template>
<template #column-paymentInstruccions="{ row }">
<span>
{{ row.paymentInstruccions }}
<QTooltip v-if="row.packagesList" :label="row.packagesList">
{{ row.paymentInstruccions }}
</QTooltip>
</span>
</template>
<template #column-specialAgreements="{ row }">
<span>
{{ row.specialAgreements }}
<QTooltip v-if="row.packagesList" :label="row.packagesList">
{{ row.specialAgreements }}
</QTooltip>
</span>
</template>
</VnTable>
</template>

View File

@ -0,0 +1,31 @@
cmr:
search: Search Cmr
searchInfo: You can search Cmr by Id
params:
agency: Agency
client: Client
cmrFk: CMR id
country: Country
created: Created
destination: Destination
downloadCmrs: Download CMRs
etd: ETD
etdTooltip: Estimated Time Delivery
hasCmrDms: Attached in gestdoc
observation: Observation
packageList: Package List
paymentInstructions: Payment instructions
routeFk: Route id
results: results
search: General search
sender: Sender
senderInstructions: Sender instructions
shipped: Shipped
specialAgreements: Special agreements
supplier: Carrier
ticketFk: Ticket id
vehiclePlate: Vehicle plate
viewCmr: View CMR
warehouse: Warehouse
'true': 'Yes'
'false': 'No'

View File

@ -0,0 +1,31 @@
cmr:
search: Buscar Cmr
searchInfo: Puedes buscar cmr por id
params:
agency: Agencia
client: Cliente
cmrFk: Id cmr
country: País
created: Creado
destination: Destinatario
downloadCmrs: Descargar CMRs
etd: ETD
etdTooltip: Fecha estimada de entrega
hasCmrDms: Adjunto en gestdoc
observation: Observaciones
packageList: Listado embalajes
paymentInstructions: Instrucciones de pago
routeFk: Id ruta
results: Resultados
search: Busqueda general
sender: Remitente
senderInstructions: Instrucciones de envío
shipped: F. envío
specialAgreements: Acuerdos especiales
supplier: Transportista
ticketFk: Id ticket
vehiclePlate: Matrícula
viewCmr: Ver CMR
warehouse: Almacén
'true': 'Si'
'false': 'No'

View File

@ -51,6 +51,11 @@ route:
agencyModeName: Agency route
isOwn: Own
isAnyVolumeAllowed: Any volume allowed
created: Created
addressFromFk: Sender
addressToFk: Destination
landed: Landed
ead: EAD
Worker: Worker
Agency: Agency
Vehicle: Vehicle
@ -70,21 +75,3 @@ route:
searchInfo: You can search by route reference
dated: Dated
preview: Preview
cmr:
search: Search Cmr
searchInfo: You can search Cmr by Id
params:
results: results
cmrFk: CMR id
hasCmrDms: Attached in gestdoc
'true': 'Yes'
'false': 'No'
ticketFk: Ticketd id
routeFk: Route id
countryFk: Country
clientFk: Client id
warehouseFk: Warehouse
shipped: Preparation date
viewCmr: View CMR
downloadCmrs: Download CMRs
search: General search

View File

@ -47,11 +47,16 @@ route:
routeFk: Id ruta
clientFk: Id cliente
countryFk: Pais
shipped: Fecha preparación
shipped: F. envío
agencyModeName: Agencia Ruta
agencyAgreement: Agencia Acuerdo
isOwn: Propio
isAnyVolumeAllowed: Cualquier volumen
created: Creado
addressFromFk: Remitente
addressToFk: Destinatario
landed: F. entrega
ead: ETD
Worker: Trabajador
Agency: Agencia
Vehicle: Vehículo

View File

@ -4,11 +4,6 @@ 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"
/>
<ParkingDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="ParkingSummary" />
</QPopupProxy>
</template>

View File

@ -7,12 +7,11 @@ import FetchData from 'components/FetchData.vue';
import CrudModel from 'components/CrudModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
import { useQuasar } from 'quasar';
import VnBankDetailsForm from 'src/components/common/VnBankDetailsForm.vue';
const { t } = useI18n();
const { notify } = useNotify();
@ -26,11 +25,6 @@ const wireTransferFk = ref(null);
const bankEntitiesOptions = ref([]);
const filteredBankEntitiesOptions = ref([]);
const onBankEntityCreated = async (dataSaved, rowData) => {
await bankEntitiesRef.value.fetch();
rowData.bankEntityFk = dataSaved.id;
};
const onChangesSaved = async () => {
if (supplier.value.payMethodFk !== wireTransferFk.value)
quasar
@ -56,23 +50,6 @@ const setWireTransfer = async () => {
await axios.patch(`Suppliers/${route.params.id}`, params);
notify('globals.dataSaved', 'positive');
};
function findBankFk(value, row) {
row.bankEntityFk = null;
if (!value) return;
const bankEntityFk = bankEntitiesOptions.value.find((b) => b.id == value.slice(4, 8));
if (bankEntityFk) row.bankEntityFk = bankEntityFk.id;
}
function bankEntityFilter(val) {
const needle = val.toLowerCase();
filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
(bank) =>
bank.bic.toLowerCase().startsWith(needle) ||
bank.name.toLowerCase().includes(needle),
);
}
</script>
<template>
<FetchData
@ -118,47 +95,16 @@ function bankEntityFilter(val) {
:key="index"
class="row q-gutter-md q-mb-md"
>
<VnInput
:label="t('supplier.accounts.iban')"
v-model="row.iban"
@update:model-value="(value) => findBankFk(value, row)"
:required="true"
>
<template #append>
<QIcon name="info" class="cursor-info">
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
</QIcon>
</template>
</VnInput>
<VnSelectDialog
:label="t('worker.create.bankEntity')"
v-model="row.bankEntityFk"
:options="filteredBankEntitiesOptions"
:filter-fn="bankEntityFilter"
option-label="bic"
hide-selected
:required="true"
:roles-allowed-to-create="['financial']"
>
<template #form>
<CreateBankEntityForm
@on-data-saved="
(_, requestResponse) =>
onBankEntityCreated(requestResponse, row)
<VnBankDetailsForm
v-model:iban="row.iban"
v-model:bankEntityFk="row.bankEntityFk"
@update-bic="
({ iban, bankEntityFk }) => {
row.iban = iban;
row.bankEntityFk = bankEntityFk;
}
"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel
>{{ scope.opt.bic }}
{{ scope.opt.name }}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelectDialog>
<VnInput
:label="t('supplier.accounts.beneficiary')"
v-model="row.beneficiary"

View File

@ -1,22 +1,20 @@
<script setup>
import { useRoute } from 'vue-router';
import { computed, onMounted, onUnmounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useQuasar } from 'quasar';
import FetchedTags from 'components/ui/FetchedTags.vue';
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
import SupplierConsumptionFilter from './SupplierConsumptionFilter.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import { dateRange, toDate } from 'src/filters';
import { dashIfEmpty } from 'src/filters';
import { usePrintService } from 'composables/usePrintService';
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
import { dateRange, toCurrency, toNumber, toDateHourMin } from 'src/filters';
import { usePrintService } from 'composables/usePrintService';
import useNotify from 'src/composables/useNotify';
import { useStateStore } from 'stores/useStateStore';
import { useState } from 'src/composables/useState';
import { useArrayData } from 'composables/useArrayData';
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
import SupplierConsumptionFilter from './SupplierConsumptionFilter.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
const state = useState();
const stateStore = useStateStore();
@ -31,7 +29,86 @@ const arrayData = useArrayData('SupplierConsumption', {
order: ['itemTypeFk', 'itemName', 'itemSize'],
userFilter: { where: { supplierFk: route.params.id } },
});
const headerColumns = computed(() => [
{
name: 'id',
label: t('globals.entry'),
align: 'left',
field: 'id',
sortable: true,
},
{
name: 'invoiceNumber',
label: t('globals.params.supplierRef'),
align: 'left',
field: 'invoiceNumber',
sortable: true,
},
{
name: 'shipped',
label: t('globals.shipped'),
align: 'center',
field: 'shipped',
format: toDateHourMin,
sortable: true,
},
{
name: 'quantity',
label: t('item.list.stems'),
align: 'center',
field: 'quantity',
format: (value) => toNumber(value),
sortable: true,
},
{
name: 'total',
label: t('globals.total'),
align: 'center',
field: 'total',
format: (value) => toCurrency(value),
sortable: true,
},
]);
const columns = computed(() => [
{
name: 'itemName',
label: t('globals.item'),
align: 'left',
field: 'itemName',
sortable: true,
},
{
name: 'subName',
align: 'left',
field: 'subName',
sortable: true,
},
{
name: 'quantity',
label: t('globals.quantity'),
align: 'right',
field: 'quantity',
format: (value) => toNumber(value),
sortable: true,
},
{
name: 'price',
label: t('globals.price'),
align: 'right',
field: 'price',
format: (value) => toCurrency(value),
sortable: true,
},
{
name: 'total',
label: t('globals.total'),
align: 'right',
field: 'total',
format: (value) => toCurrency(value),
sortable: true,
},
]);
const store = arrayData.store;
onUnmounted(() => state.unset('SupplierConsumption'));
@ -40,13 +117,11 @@ const dateRanges = computed(() => {
return { from, to };
});
const reportParams = computed(() => {
return {
const reportParams = computed(() => ({
recipientId: Number(route.params.id),
to: dateRange(dateRanges.value.to)[1],
from: dateRange(dateRanges.value.from)[1],
};
});
from: dateRange(dateRanges.value.from)[0].toISOString(),
to: dateRange(dateRanges.value.to)[1].toISOString(),
}));
async function getSupplierConsumptionData() {
await arrayData.fetch({ append: false });
@ -102,33 +177,34 @@ const sendCampaignMetricsEmail = ({ address }) => {
};
const totalEntryPrice = (rows) => {
let totalPrice = 0;
let totalQuantity = 0;
if (!rows) return totalPrice;
for (const row of rows) {
let total = 0;
let quantity = 0;
if (row.buys) {
for (const buy of row.buys) {
total = total + buy.total;
quantity = quantity + buy.quantity;
}
}
if (!rows) return [];
totalRows.value = rows.reduce(
(acc, row) => {
if (Array.isArray(row.buys)) {
const { total, quantity } = row.buys.reduce(
(buyAcc, buy) => {
buyAcc.total += buy.total || 0;
buyAcc.quantity += buy.quantity || 0;
return buyAcc;
},
{ total: 0, quantity: 0 },
);
row.total = total;
row.quantity = quantity;
totalPrice = totalPrice + total;
totalQuantity = totalQuantity + quantity;
acc.totalPrice += total;
acc.totalQuantity += quantity;
}
totalRows.value = { totalPrice, totalQuantity };
return acc;
},
{ totalPrice: 0, totalQuantity: 0 },
);
return rows;
};
onMounted(async () => {
stateStore.rightDrawer = true;
await getSupplierConsumptionData();
});
const expanded = ref([]);
</script>
<template>
@ -162,14 +238,14 @@ onMounted(async () => {
<div>
{{ t('Total entries') }}:
<QChip :dense="$q.screen.lt.sm" text-color="white">
{{ totalRows.totalPrice }}
{{ toCurrency(totalRows.totalPrice) }}
</QChip>
</div>
<QSeparator dark vertical />
<div>
{{ t('Total stems entries') }}:
<QChip :dense="$q.screen.lt.sm" text-color="white">
{{ totalRows.totalQuantity }}
{{ toNumber(totalRows.totalQuantity) }}
</QChip>
</div>
</div>
@ -179,59 +255,111 @@ onMounted(async () => {
<SupplierConsumptionFilter data-key="SupplierConsumption" />
</template>
</RightMenu>
<QCard class="full-width q-pa-md">
<QTable
flat
bordered
:rows="rows"
:columns="headerColumns"
row-key="id"
hide-header
class="full-width q-mt-md"
:no-data-label="t('No results')"
v-model:expanded="expanded"
:grid="$q.screen.lt.md"
>
<template #body="{ row }">
<QTr>
<QTd no-hover>
<span class="label">{{ t('supplier.consumption.entry') }}: </span>
<span>{{ row.id }}</span>
</QTd>
<QTd no-hover>
<span class="label">{{ t('globals.date') }}: </span>
<span>{{ toDate(row.shipped) }}</span></QTd
>
<QTd colspan="6" no-hover>
<span class="label">{{ t('globals.reference') }}: </span>
<span>{{ row.invoiceNumber }}</span>
</QTd>
<template #header="props">
<QTr :props="props">
<QTh auto-width />
<QTh v-for="col in props.cols" :key="col.name" :props="props">
<span v-text="col.label" class="tr-header" />
</QTh>
</QTr>
<QTr v-for="(buy, index) in row.buys" :key="index">
<QTd no-hover>
<QBtn flat class="link" dense no-caps>{{ buy.itemName }}</QBtn>
<ItemDescriptorProxy :id="buy.itemFk" />
</template>
<template #body="props">
<QTr
:props="props"
:key="`movement_${props.row.id}`"
class="bg-vn-page cursor-pointer"
@click="props.expand = !props.expand"
>
<QTd auto-width>
<QIcon
:class="props.expand ? '' : 'rotate-270'"
name="expand_circle_down"
size="md"
:color="props.expand ? 'primary' : 'white'"
/>
</QTd>
<QTd no-hover>
<span>{{ buy.subName }}</span>
<FetchedTags :item="buy" />
<QTd v-for="col in props.cols" :key="col.name" :props="props">
<span @click.stop class="link" v-if="col.name === 'id'">
{{ col.value }}
<EntryDescriptorProxy :id="col.value" />
</span>
<span v-else v-text="col.value" />
</QTd>
<QTd no-hover> {{ dashIfEmpty(buy.quantity) }}</QTd>
<QTd no-hover> {{ dashIfEmpty(buy.price) }}</QTd>
<QTd colspan="2" no-hover> {{ dashIfEmpty(buy.total) }}</QTd>
</QTr>
<QTr>
<QTd colspan="5" no-hover>
<span class="label">{{ t('Total entry') }}: </span>
<span>{{ row.total }} </span>
</QTd>
<QTd no-hover>
<span class="label">{{ t('Total stems') }}: </span>
<span>{{ row.quantity }}</span>
<QTr
v-show="props.expand"
:props="props"
:key="`expedition_${props.row.id}`"
>
<QTd colspan="12" style="padding: 1px 0">
<QTable
color="secondary"
card-class="bg-vn-page text-white "
style-class="height: 30px"
table-header-class="text-white"
:rows="props.row.buys"
:columns="columns"
row-key="id"
virtual-scroll
v-model:expanded="expanded"
>
<template #header="props">
<QTr :props="props">
<QTh
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<span v-text="col.label" class="tr-header" />
</QTh>
</QTr>
</template>
<template #body="props">
<QTr :props="props" :key="`m_${props.row.id}`">
<QTd
v-for="col in props.cols"
:key="col.name"
:title="col.label"
:props="props"
>
<span
@click.stop
class="link"
v-if="col.name === 'itemName'"
>
{{ col.value }}
<ItemDescriptorProxy :id="props.row.itemFk" />
</span>
<span v-else v-text="col.value" />
</QTd>
</QTr>
</template>
</QTable>
</QTd>
</QTr>
</template>
</QTable>
</QCard>
</template>
<style scoped lang="scss">
.label {
color: var(--vn-label-color);
.q-table thead tr,
.q-table tbody td {
height: 30px;
}
</style>

View File

@ -25,7 +25,9 @@ const { validate } = useValidator();
const { notify } = useNotify();
const router = useRouter();
const { t } = useI18n();
const canEditZone = useAcl().hasAcl('Ticket', 'editZone', 'WRITE');
const canEditZone = useAcl().hasAny([
{ model: 'Ticket', props: 'editZone', accessType: 'WRITE' },
]);
const agencyFetchRef = ref();
const warehousesOptions = ref([]);
@ -68,15 +70,20 @@ async function getDate(query, params) {
for (const param in params) {
if (!params[param]) return;
}
formData.value.zoneFk = null;
zonesOptions.value = [];
const { data } = await axios.get(query, { params });
if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
formData.value.zoneFk = data.zoneFk;
if (data.landed) formData.value.landed = data.landed;
if (data.shipped) formData.value.shipped = data.shipped;
formData.value.landed = data.landed;
const shippedDate = new Date(params.shipped);
const landedDate = new Date(data.hour);
shippedDate.setHours(
landedDate.getHours(),
landedDate.getMinutes(),
landedDate.getSeconds(),
);
formData.value.shipped = shippedDate.toISOString();
}
const onChangeZone = async (zoneId) => {
@ -125,6 +132,7 @@ const addressId = computed({
formData.value.addressFk = val;
onChangeAddress(val);
getShipped({
shipped: formData.value?.shipped,
landed: formData.value?.landed,
addressFk: val,
agencyModeFk: formData.value?.agencyModeFk,
@ -239,6 +247,9 @@ async function getZone(options) {
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: true,
}"
auto-load
/>
<FetchData
@ -283,7 +294,7 @@ async function getZone(options) {
</template>
</VnSelect>
<VnSelect
:label="t('ticketList.warehouse')"
:label="t('basicData.warehouse')"
v-model="warehouseId"
option-value="id"
option-label="name"
@ -291,7 +302,7 @@ async function getZone(options) {
hide-selected
map-options
:required="true"
:rules="validate('ticketList.warehouse')"
:rules="validate('basicData.warehouse')"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md no-wrap">
@ -419,6 +430,7 @@ async function getZone(options) {
v-model="formData.shipped"
:required="true"
:rules="validate('basicData.shippedHour')"
disabled
@update:model-value="setShipped"
/>
<VnInputDate

View File

@ -1,5 +1,4 @@
<script setup>
import { reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
@ -30,31 +29,29 @@ const { t } = useI18n();
const router = useRouter();
const { notify } = useNotify();
const newTicketFormData = reactive({});
const date = new Date();
const createTicket = async () => {
async function createTicket(formData) {
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
const params = {
clientId: $props.ticket.clientFk,
landed: newTicketFormData.landed,
landed: formData.landed,
warehouseId: $props.ticket.warehouseFk,
addressId: $props.ticket.addressFk,
agencyModeId: $props.ticket.agencyModeFk,
routeId: newTicketFormData.routeFk,
routeId: formData.routeFk,
expeditionIds: expeditionIds,
};
const { data } = await axios.post('Expeditions/moveExpeditions', params);
notify(t('globals.dataSaved'), 'positive');
router.push({ name: 'TicketSummary', params: { id: data.id } });
};
}
</script>
<template>
<FormModelPopup
model="expeditionNewTicket"
:form-initial-data="newTicketFormData"
:form-initial-data="{}"
:save-fn="createTicket"
>
<template #form-inputs="{ data }">

View File

@ -55,8 +55,10 @@ async function handleSave(e) {
auto-load
url="ObservationTypes"
/>
<div class="flex justify-center">
<div class="full-width flex justify-center">
<QPage class="card-width q-pa-lg">
<CrudModel
class="fit"
ref="ticketNotesCrudRef"
data-key="TicketNotes"
url="TicketObservations"
@ -65,14 +67,13 @@ async function handleSave(e) {
:data-required="crudModelRequiredData"
:default-remove="false"
auto-load
style="max-width: 800px"
>
<template #body="{ rows }">
<QCard class="q-px-lg q-py-md">
<div
v-for="(row, index) in rows"
:key="index"
class="q-mb-md row q-gutter-x-md"
class="q-mb-md row items-center q-gutter-x-md"
>
<VnSelect
:label="t('ticketNotes.observationType')"
@ -123,5 +124,6 @@ async function handleSave(e) {
</QCard>
</template>
</CrudModel>
</QPage>
</div>
</template>

View File

@ -49,10 +49,14 @@ watch(
<FetchData
@on-fetch="(data) => (listPackagingsOptions = data)"
auto-load
:filter="{ fields: ['packagingFk', 'name'], order: 'name ASC' }"
url="Packagings/listPackaging"
:filter="{
fields: ['packagingFk', 'name'],
order: ['name ASC'],
}"
/>
<div class="flex justify-center">
<div class="full-width flex justify-center">
<QPage class="card-width q-pa-lg">
<CrudModel
ref="ticketPackagingsCrudRef"
data-key="TicketPackagings"
@ -62,7 +66,6 @@ watch(
:data-required="crudModelRequiredData"
:default-remove="false"
auto-load
style="max-width: 800px"
>
<template #body="{ rows, validate }">
<QCard class="q-px-lg q-py-md">
@ -102,7 +105,10 @@ watch(
@update:model-value="handleInputQuantityClear(row)"
:rules="validate('TicketPackaging.quantity')"
/>
<VnInputDate :label="t('package.added')" v-model="row.created" />
<VnInputDate
:label="t('package.added')"
v-model="row.created"
/>
<QIcon
name="delete"
size="sm"
@ -132,5 +138,6 @@ watch(
</QCard>
</template>
</CrudModel>
</QPage>
</div>
</template>

View File

@ -47,7 +47,14 @@ const setUserParams = (params) => {
</script>
<template>
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehouses = data)"
:where="{
isForTicket: true,
}"
auto-load
/>
<FetchData
url="ItemCategories"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@ -130,8 +137,6 @@ const setUserParams = (params) => {
($event) => onCategoryChange($event, searchFn)
"
:options="categoriesOptions"
option-value="id"
option-label="name"
hide-selected
dense
filled
@ -145,10 +150,7 @@ const setUserParams = (params) => {
<VnSelect
:label="t('negative.type')"
v-model="params.typeFk"
@update:model-value="searchFn()"
:options="itemTypesOptions"
option-value="id"
option-label="name"
hide-selected
dense
filled

View File

@ -121,7 +121,7 @@ const ticketColumns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row.lines),
},
{
align: 'left',
align: 'right',
label: t('advanceTickets.import'),
name: 'totalWithVat',
hidden: true,
@ -172,6 +172,15 @@ const ticketColumns = computed(() => [
headerClass: 'horizontal-separator',
name: 'futureLiters',
},
{
label: t('advanceTickets.preparation'),
name: 'futurePreparation',
field: 'futurePreparation',
align: 'left',
sortable: true,
headerClass: 'horizontal-separator',
columnFilter: false,
},
{
align: 'left',
label: t('advanceTickets.futureZone'),
@ -196,15 +205,17 @@ const ticketColumns = computed(() => [
label: t('advanceTickets.notMovableLines'),
headerClass: 'horizontal-separator',
name: 'notMovableLines',
class: 'shrink',
},
{
align: 'left',
label: t('advanceTickets.futureLines'),
headerClass: 'horizontal-separator',
name: 'futureLines',
class: 'shrink',
},
{
align: 'left',
align: 'right',
label: t('advanceTickets.futureImport'),
name: 'futureTotalWithVat',
hidden: true,
@ -385,7 +396,12 @@ watch(
if (!$el) return;
const head = $el.querySelector('thead');
const firstRow = $el.querySelector('thead > tr');
const headSelectionCol = $el.querySelector(
'thead tr.bg-header th.q-table--col-auto-width',
);
if (headSelectionCol) {
headSelectionCol.classList.add('horizontal-separator');
}
const newRow = document.createElement('tr');
destinationElRef.value = document.createElement('th');
originElRef.value = document.createElement('th');
@ -394,8 +410,10 @@ watch(
destinationElRef.value.classList.add('text-uppercase', 'color-vn-label');
originElRef.value.classList.add('text-uppercase', 'color-vn-label');
destinationElRef.value.setAttribute('colspan', '7');
originElRef.value.setAttribute('colspan', '9');
originElRef.value.classList.add('advance-icon');
destinationElRef.value.setAttribute('colspan', '9');
originElRef.value.setAttribute('colspan', '11');
destinationElRef.value.textContent = `${t(
'advanceTickets.destination',
@ -490,8 +508,6 @@ watch(
selection: 'multiple',
}"
v-model:selected="selectedTickets"
:pagination="{ rowsPerPage: 0 }"
:no-data-label="$t('globals.noResults')"
:right-search="false"
:order="['futureTotalWithVat ASC']"
auto-load

View File

@ -51,6 +51,9 @@ onMounted(async () => await getItemPackingTypes());
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: true,
}"
auto-load
/>
<VnFilterPanel
@ -65,7 +68,7 @@ onMounted(async () => await getItemPackingTypes());
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<template #body="{ params }">
<QItem class="q-my-sm">
<QItemSection>
<VnInputDate
@ -93,12 +96,10 @@ onMounted(async () => await getItemPackingTypes());
option-value="code"
option-label="description"
:info="t('iptInfo')"
@update:model-value="searchFn()"
dense
filled
:use-like="false"
>
</VnSelect>
/>
</QItemSection>
</QItem>
<QItem>
@ -110,12 +111,10 @@ onMounted(async () => await getItemPackingTypes());
option-value="code"
option-label="description"
:info="t('iptInfo')"
@update:model-value="searchFn()"
dense
filled
:use-like="false"
>
</VnSelect>
/>
</QItemSection>
</QItem>
<QItem>
@ -134,7 +133,6 @@ onMounted(async () => await getItemPackingTypes());
:label="t('params.isFullMovable')"
v-model="params.isFullMovable"
toggle-indeterminate
@update:model-value="searchFn()"
dense
/>
</QItemSection>
@ -157,13 +155,9 @@ onMounted(async () => await getItemPackingTypes());
:label="t('params.warehouseFk')"
v-model="params.warehouseFk"
:options="warehousesOptions"
option-value="id"
option-label="name"
@update:model-value="searchFn()"
dense
filled
>
</VnSelect>
/>
</QItemSection>
</QItem>
<QItem>
@ -172,7 +166,6 @@ onMounted(async () => await getItemPackingTypes());
toggle-indeterminate
:label="t('params.onlyWithDestination')"
v-model="params.onlyWithDestination"
@update:model-value="searchFn()"
dense
/>
</QItemSection>

View File

@ -70,11 +70,9 @@ const fetchAvailableAgencies = async (formData) => {
const response = await getAgencies(formData, selectedClient.value);
if (!response) return;
const { options, agency } = response
if(options)
agenciesOptions.value = options;
if(agency)
formData.agencyModeId = agency;
const { options, agency } = response;
if (options) agenciesOptions.value = options;
if (agency) formData.agencyModeId = agency;
};
const redirectToTicketList = (_, { id }) => {
@ -92,6 +90,9 @@ const redirectToTicketList = (_, { id }) => {
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: true,
}"
order="name"
auto-load
/>

View File

@ -70,11 +70,9 @@ const fetchAvailableAgencies = async (formData) => {
const response = await getAgencies(formData, selectedClient.value);
if (!response) return;
const { options, agency } = response
if(options)
agenciesOptions.value = options;
if(agency)
formData.agencyModeId = agency;
const { options, agency } = response;
if (options) agenciesOptions.value = options;
if (agency) formData.agencyModeId = agency;
};
const redirectToTicketList = (_, { id }) => {
@ -86,6 +84,9 @@ const redirectToTicketList = (_, { id }) => {
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: true,
}"
order="name"
auto-load
/>

View File

@ -41,15 +41,26 @@ const groupedStates = ref([]);
@on-fetch="(data) => (agencies = data)"
auto-load
/>
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehouses = data)"
auto-load
:where="{
isForTicket: true,
}"
/>
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
:unremovableParams="['from', 'to']"
>
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<template #body="{ params }">
<QItem>
<QItemSection>
<VnInput v-model="params.clientFk" :label="t('Customer ID')" filled />
@ -97,10 +108,7 @@ const groupedStates = ref([]);
<VnSelect
:label="t('State')"
v-model="params.stateFk"
@update:model-value="searchFn()"
:options="states"
option-value="id"
option-label="name"
emit-value
map-options
use-input
@ -117,7 +125,6 @@ const groupedStates = ref([]);
<VnSelect
:label="t('params.groupedStates')"
v-model="params.groupedStates"
@update:model-value="searchFn()"
:options="groupedStates"
option-label="code"
emit-value
@ -152,7 +159,6 @@ const groupedStates = ref([]);
<QItemSection>
<QCheckbox
v-model="params.myTeam"
@update:model-value="searchFn()"
:label="t('My team')"
toggle-indeterminate
/>
@ -160,7 +166,6 @@ const groupedStates = ref([]);
<QItemSection>
<QCheckbox
v-model="params.pending"
@update:model-value="searchFn()"
:label="t('Pending')"
toggle-indeterminate
/>
@ -170,7 +175,6 @@ const groupedStates = ref([]);
<QItemSection>
<QCheckbox
v-model="params.hasInvoice"
@update:model-value="searchFn()"
:label="t('Invoiced')"
toggle-indeterminate
/>
@ -178,7 +182,6 @@ const groupedStates = ref([]);
<QItemSection>
<QCheckbox
v-model="params.hasRoute"
@update:model-value="searchFn()"
:label="t('Routed')"
toggle-indeterminate
/>
@ -192,10 +195,7 @@ const groupedStates = ref([]);
<VnSelect
:label="t('Province')"
v-model="params.provinceFk"
@update:model-value="searchFn()"
:options="provinces"
option-value="id"
option-label="name"
emit-value
map-options
use-input
@ -212,7 +212,6 @@ const groupedStates = ref([]);
<VnSelect
:label="t('Agency')"
v-model="params.agencyModeFk"
@update:model-value="searchFn()"
:options="agencies"
emit-value
map-options
@ -230,10 +229,7 @@ const groupedStates = ref([]);
<VnSelect
:label="t('Warehouse')"
v-model="params.warehouseFk"
@update:model-value="searchFn()"
:options="warehouses"
option-value="id"
option-label="name"
emit-value
map-options
use-input

View File

@ -85,11 +85,12 @@ const ticketColumns = computed(() => [
label: t('advanceTickets.liters'),
name: 'liters',
align: 'left',
class: 'shrink',
headerClass: 'horizontal-separator',
},
{
label: t('advanceTickets.import'),
name: 'import',
name: 'totalWithVat',
align: 'left',
headerClass: 'horizontal-separator',
columnFilter: false,
@ -177,7 +178,12 @@ watch(
if (!$el) return;
const head = $el.querySelector('thead');
const firstRow = $el.querySelector('thead > tr');
const headSelectionCol = $el.querySelector(
'thead tr.bg-header th.q-table--col-auto-width',
);
if (headSelectionCol) {
headSelectionCol.classList.add('horizontal-separator');
}
const newRow = document.createElement('tr');
destinationElRef.value = document.createElement('th');
originElRef.value = document.createElement('th');
@ -185,9 +191,10 @@ watch(
newRow.classList.add('bg-header');
destinationElRef.value.classList.add('text-uppercase', 'color-vn-label');
originElRef.value.classList.add('text-uppercase', 'color-vn-label');
originElRef.value.classList.add('advance-icon');
destinationElRef.value.setAttribute('colspan', '7');
originElRef.value.setAttribute('colspan', '9');
destinationElRef.value.setAttribute('colspan', '9');
originElRef.value.setAttribute('colspan', '7');
originElRef.value.textContent = `${t('advanceTickets.origin')}`;
destinationElRef.value.textContent = `${t('advanceTickets.destination')}`;
@ -317,7 +324,7 @@ watch(
</QBadge>
<span v-else> {{ dashIfEmpty(row.state) }}</span>
</template>
<template #column-import="{ row }">
<template #column-totalWithVat="{ row }">
<QBadge
:text-color="
totalPriceColor(row.totalWithVat) === 'warning'
@ -371,4 +378,12 @@ watch(
:deep(.horizontal-bottom-separator) {
border-bottom: 4px solid white !important;
}
:deep(th.advance-icon::after) {
content: '>>';
font-size: larger;
position: absolute;
text-align: center;
float: 0;
left: 0;
}
</style>

View File

@ -55,6 +55,9 @@ onMounted(async () => {
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: true,
}"
auto-load
/>
<VnFilterPanel
@ -67,7 +70,7 @@ onMounted(async () => {
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<template #body="{ params }">
<QItem class="q-my-sm">
<QItemSection>
<VnInputDate
@ -113,11 +116,9 @@ onMounted(async () => {
option-value="code"
option-label="description"
:info="t('iptInfo')"
@update:model-value="searchFn()"
dense
filled
>
</VnSelect>
/>
</QItemSection>
</QItem>
<QItem>
@ -129,11 +130,9 @@ onMounted(async () => {
option-value="code"
option-label="description"
:info="t('iptInfo')"
@update:model-value="searchFn()"
dense
filled
>
</VnSelect>
/>
</QItemSection>
</QItem>
<QItem>
@ -142,13 +141,9 @@ onMounted(async () => {
:label="t('params.state')"
v-model="params.state"
:options="stateOptions"
option-value="id"
option-label="name"
@update:model-value="searchFn()"
dense
filled
>
</VnSelect>
/>
</QItemSection>
</QItem>
<QItem>
@ -157,13 +152,9 @@ onMounted(async () => {
:label="t('params.futureState')"
v-model="params.futureState"
:options="stateOptions"
option-value="id"
option-label="name"
@update:model-value="searchFn()"
dense
filled
>
</VnSelect>
/>
</QItemSection>
</QItem>
@ -173,7 +164,6 @@ onMounted(async () => {
:label="t('params.problems')"
v-model="params.problems"
:toggle-indeterminate="false"
@update:model-value="searchFn()"
/>
</QItemSection>
</QItem>
@ -183,13 +173,9 @@ onMounted(async () => {
:label="t('params.warehouseFk')"
v-model="params.warehouseFk"
:options="warehousesOptions"
option-value="id"
option-label="name"
@update:model-value="searchFn()"
dense
filled
>
</VnSelect>
/>
</QItemSection>
</QItem>
</template>

View File

@ -204,6 +204,9 @@ const columns = computed(() => [
attrs: {
url: 'warehouses',
fields: ['id', 'name'],
where: {
isForTicket: true,
},
},
format: (row) => row.warehouse,
columnField: {
@ -670,9 +673,11 @@ function setReference(data) {
:sort-by="['name']"
:label="t('globals.warehouse')"
v-model="data.warehouseId"
:options="warehousesOptions"
hide-selected
required
:where="{
isForTicket: true,
}"
@update:model-value="() => fetchAvailableAgencies(data)"
/>
</div>

View File

@ -102,6 +102,9 @@ const columns = computed(() => [
attrs: {
url: 'Warehouses',
fields: ['id', 'name'],
where: {
isForTicket: true,
},
},
inWhere: true,
},

View File

@ -120,6 +120,7 @@ basicData:
difference: Difference
total: Total
price: Price
warehouse: Warehouse
newPrice: New price
chargeDifference: Charge difference to
withoutNegatives: Create without negatives
@ -208,6 +209,7 @@ ticketList:
hour: Hour
rounding: Rounding
noVerifiedData: No verified data
warehouse: Warehouse
purchaseRequest: Purchase request
notVisible: Not visible
clientFrozen: Client frozen

View File

@ -47,6 +47,7 @@ basicData:
difference: Diferencia
total: Total
price: Precio
warehouse: Almacén
newPrice: Nuevo precio
chargeDifference: Cargar diferencia a
withoutNegatives: Crear sin negativos

View File

@ -28,13 +28,17 @@ const warehousesOptionsIn = ref([]);
url="Warehouses"
@on-fetch="(data) => (warehousesOptionsOut = data)"
auto-load
:filter="{ where: { isOrigin: TRUE } }"
:where="{
isOrigin: true,
}"
/>
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehousesOptionsIn = data)"
auto-load
:filter="{ where: { isDestiny: TRUE } }"
:where="{
isDestiny: true,
}"
/>
<FormModel :url-update="`Travels/${route.params.id}`" model="Travel">
<template #form="{ data }">

View File

@ -183,7 +183,9 @@ warehouses();
<VnSelect
:label="t('extraCommunity.filter.warehouseOutFk')"
v-model="params.warehouseOutFk"
:options="warehousesOptions"
:options="
warehousesOptions.filter((option) => option.isOrigin === true)
"
option-value="id"
option-label="name"
hide-selected
@ -197,7 +199,11 @@ warehouses();
<VnSelect
:label="t('extraCommunity.filter.warehouseInFk')"
v-model="params.warehouseInFk"
:options="warehousesOptions"
:options="
warehousesOptions.filter(
(option) => option.isDestiny === true,
)
"
option-value="id"
option-label="name"
hide-selected

View File

@ -81,6 +81,9 @@ const redirectToTravelBasicData = (_, { id }) => {
option-value="id"
option-label="name"
hide-selected
:where="{
isOrigin: true,
}"
/>
<VnSelect
:label="t('globals.warehouseIn')"
@ -89,6 +92,9 @@ const redirectToTravelBasicData = (_, { id }) => {
option-value="id"
option-label="name"
hide-selected
:where="{
isDestiny: true,
}"
/>
</VnRow>
</template>

View File

@ -64,6 +64,9 @@ defineExpose({ states });
option-filter="name"
dense
filled
:where="{
isDestiny: true,
}"
/>
<VnInputDate
:label="t('travel.shipped')"
@ -89,6 +92,9 @@ defineExpose({ states });
option-filter="name"
dense
filled
:where="{
isOrigin: true,
}"
/>
<VnInputDate
:label="t('travel.landed')"

View File

@ -99,6 +99,7 @@ const columns = computed(() => [
fields: ['id', 'name'],
optionLabel: 'name',
optionValue: 'id',
where: { isDestiny: true },
},
format: (row) => row.warehouseInName,
columnField: {
@ -133,6 +134,7 @@ const columns = computed(() => [
attrs: {
url: 'warehouses',
fields: ['id', 'name'],
where: { isOrigin: true },
},
format: (row) => row.warehouseOutName,
columnField: {

View File

@ -1,6 +1,5 @@
<script setup>
import { ref, nextTick, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { ref, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import FetchData from 'components/FetchData.vue';
@ -9,21 +8,23 @@ import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import { useAdvancedSummary } from 'src/composables/useAdvancedSummary';
import { useRoute } from 'vue-router';
const { t } = useI18n();
const form = ref();
const educationLevels = ref([]);
const countries = ref([]);
const model = 'Worker';
const maritalStatus = [
{ code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') },
];
onMounted(async () => {
const advanced = await useAdvancedSummary('Workers', useRoute().params.id);
Object.assign(form.value.formData, advanced);
const route = useRoute();
async function addAdvancedData(data) {
const advanced = await useAdvancedSummary('Workers', route.params.id);
data.value = { ...data.value, ...advanced };
nextTick(() => (form.value.hasChanges = false));
});
}
</script>
<template>
<FetchData
@ -42,7 +43,8 @@ onMounted(async () => {
ref="form"
:url-update="`Workers/${$route.params.id}`"
auto-load
model="Worker"
:model
@on-fetch="(data, res, old, formData) => addAdvancedData(formData)"
>
<template #form="{ data }">
<VnRow>

View File

@ -4,9 +4,11 @@ import VnCard from 'src/components/common/VnCard.vue';
</script>
<template>
<VnCard
data-key="Worker"
:data-key="$attrs['data-key'] ?? 'Worker'"
url="Workers/summary"
:id-in-where="true"
:descriptor="WorkerDescriptor"
v-bind="$attrs"
v-on="$attrs"
/>
</template>

View File

@ -2,7 +2,6 @@
import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import EntityDescriptor from 'src/components/ui/EntityDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
@ -11,6 +10,8 @@ import VnImg from 'src/components/ui/VnImg.vue';
import EditPictureForm from 'components/EditPictureForm.vue';
import WorkerDescriptorMenu from './WorkerDescriptorMenu.vue';
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
import WorkerCard from './WorkerCard.vue';
const $props = defineProps({
id: {
@ -52,14 +53,17 @@ const handlePhotoUpdated = (evt = false) => {
};
</script>
<template>
<EntityDescriptor
<CardDescriptor
v-bind="$attrs"
ref="cardDescriptorRef"
:data-key="dataKey"
:summary="$props.summary"
url="Workers/summary"
:card="WorkerCard"
:id="entityId"
:filter="{ where: { id: entityId } }"
title="user.nickname"
@on-fetch="getIsExcluded"
module="Worker"
>
<template #menu="{ entity }">
<WorkerDescriptorMenu
@ -165,7 +169,7 @@ const handlePhotoUpdated = (evt = false) => {
</QBtn>
</QCardActions>
</template>
</EntityDescriptor>
</CardDescriptor>
<VnChangePassword
ref="changePassRef"
:submit-fn="

View File

@ -2,7 +2,6 @@
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { onMounted, ref, computed, onBeforeMount, nextTick, reactive } from 'vue';
import { axiosNoError } from 'src/boot/axios';
import FetchData from 'components/FetchData.vue';
import WorkerTimeHourChip from 'pages/Worker/Card/WorkerTimeHourChip.vue';
@ -282,10 +281,10 @@ const fetchWeekData = async () => {
};
try {
const [{ data: mailData }, { data: countData }] = await Promise.all([
axiosNoError.get(`Workers/${route.params.id}/mail`, {
axios.get(`Workers/${route.params.id}/mail`, {
params: { filter: { where } },
}),
axiosNoError.get('WorkerTimeControlMails/count', { params: { where } }),
axios.get('WorkerTimeControlMails/count', { params: { where } }),
]);
const mail = mailData[0];
@ -293,8 +292,9 @@ const fetchWeekData = async () => {
state.value = mail?.state;
reason.value = mail?.reason;
canResend.value = !!countData.count;
} catch {
} catch (error) {
state.value = null;
if (error?.status != 403) throw error;
}
};

View File

@ -10,15 +10,13 @@ import VnRadio from 'src/components/common/VnRadio.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnLocation from 'src/components/common/VnLocation.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import FetchData from 'src/components/FetchData.vue';
import WorkerFilter from './WorkerFilter.vue';
import { useState } from 'src/composables/useState';
import axios from 'axios';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
import VnSection from 'src/components/common/VnSection.vue';
import VnInputBic from 'src/components/common/VnInputBic.vue';
import VnBankDetailsForm from 'src/components/common/VnBankDetailsForm.vue';
const { t } = useI18n();
const tableRef = ref();
@ -122,12 +120,6 @@ onBeforeMount(async () => {
).data?.payMethodFk;
});
async function handleNewBankEntity(data, resp) {
await bankEntitiesRef.value.fetch();
data.bankEntityFk = resp.id;
bankEntitiesOptions.value.push(resp);
}
function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {};
data.postcode = code;
@ -323,51 +315,19 @@ function generateCodeUser(worker) {
(val) => !val && delete data.payMethodFk
"
/>
<VnInputBic
:label="t('IBAN')"
v-model="data.iban"
:disable="data.isFreelance"
@update-bic="
(bankEntityFk) => (data.bankEntityFk = bankEntityFk)
"
/>
</VnRow>
<VnRow>
<VnSelectDialog
:label="t('worker.create.bankEntity')"
v-model="data.bankEntityFk"
:options="bankEntitiesOptions"
option-label="name"
option-value="id"
hide-selected
:acls="[
{
model: 'BankEntity',
props: '*',
accessType: 'WRITE',
},
]"
:disable="data.isFreelance"
:filter-options="['bic', 'name']"
>
<template #form>
<CreateBankEntityForm
@on-data-saved="
(_, resp) => handleNewBankEntity(data, resp)
<VnBankDetailsForm
v-model:iban="data.iban"
v-model:bankEntityFk="data.bankEntityFk"
:disable-element="data.isFreelance"
@update-bic="
({ iban, bankEntityFk }) => {
data.iban = iban;
data.bankEntityFk = bankEntityFk;
}
"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel
>{{ scope.opt.bic }}
{{ scope.opt.name }}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelectDialog>
</VnRow>
</div>
</template>

View File

@ -189,16 +189,14 @@ const exprBuilder = (param, value) => {
return {
code: { like: `%${value}%` },
};
case 'id':
case 'price':
case 'agencyModeFk':
return {
agencyModeFk: value,
[param]: value,
};
case 'search':
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
case 'price':
return {
price: value,
};
}
};

View File

@ -6,6 +6,9 @@ const FINDED_PATHS = ['src', E2E_PATH];
function getGitDiff(options) {
const TARGET_BRANCH = options[2] || 'dev';
execSync(`git fetch origin ${TARGET_BRANCH}`, {
encoding: 'utf-8',
});
const diff = execSync(`git diff --name-only origin/${TARGET_BRANCH}`, {
encoding: 'utf-8',
});

View File

@ -23,7 +23,7 @@ describe('InvoiceOut list', () => {
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
});
it('should download all pdfs', () => {
it.skip('should download all pdfs', () => {
cy.get(columnCheckbox).click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
});
@ -31,7 +31,7 @@ describe('InvoiceOut list', () => {
it('should open the invoice descriptor from table icon', () => {
cy.get(firstSummaryIcon).click();
cy.get('.cardSummary').should('be.visible');
cy.get('.summaryHeader > div').should('include.text', 'V10100001');
cy.get('.summaryHeader > div').should('include.text', 'A1111111');
});
it('should open the client descriptor', () => {

View File

@ -54,7 +54,7 @@ describe('Handle Items FixedPrice', () => {
});
it('should edit all items', () => {
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
cy.get('.bg-header > :nth-child(1) [data-cy="vnCheckbox"]').click();
cy.dataCy('FixedPriceToolbarEditBtn').should('not.be.disabled');
cy.dataCy('FixedPriceToolbarEditBtn').click();
cy.dataCy('EditFixedPriceSelectOption').type(grouping);
@ -65,7 +65,7 @@ describe('Handle Items FixedPrice', () => {
});
it('should remove all items', () => {
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
cy.get('.bg-header > :nth-child(1) [data-cy="vnCheckbox"]').click();
cy.dataCy('crudModelDefaultRemoveBtn').should('not.be.disabled');
cy.dataCy('crudModelDefaultRemoveBtn').click();
cy.dataCy('VnConfirm_confirm').click();

View File

@ -5,6 +5,9 @@ describe('Cmr list', () => {
const selectors = {
ticket: getLinkSelector('ticketFk'),
client: getLinkSelector('clientFk'),
route: getLinkSelector('routeFk'),
agency: getLinkSelector('agencyModeFk'),
carrier: getLinkSelector('supplierFk'),
lastRowSelectCheckBox:
'.q-virtual-scroll__content > tr:last-child > :nth-child(1) > .q-checkbox',
downloadBtn: '#subToolbar > .q-btn',
@ -21,6 +24,10 @@ describe('Cmr list', () => {
const data = {
ticket: '1',
client: 'Bruce Wayne',
route: 'first route',
routeId: '1',
agency: 'inhouse pickup',
carrier: 'PLANTS SL',
};
beforeEach(() => {
@ -68,6 +75,26 @@ describe('Cmr list', () => {
});
});
describe('Route pop-ups', () => {
it('Should redirect to the route summary from the route descriptor pop-up', () => {
cy.get(selectors.route).should('be.visible').click();
cy.containContent(selectors.descriptorId, data.routeId);
cy.get(selectors.descriptorGoToSummaryBtn).should('be.visible').click();
cy.url().should('include', '/route/1/summary');
cy.containContent(selectors.summaryTitle, data.route);
});
it('Should redirect to the route summary from summary pop-up from the route descriptor pop-up', () => {
cy.get(selectors.route).should('be.visible').click();
cy.containContent(selectors.descriptorId, data.routeId);
cy.get(selectors.descriptorOpenSummaryBtn).should('be.visible').click();
cy.containContent(selectors.summaryTitle, data.route);
cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
cy.url().should('include', '/route/1/summary');
cy.containContent(selectors.summaryTitle, data.route);
});
});
describe('Client pop-ups', () => {
it('Should redirect to the client summary from the client descriptor pop-up', () => {
cy.get(selectors.client).should('be.visible').click();
@ -87,4 +114,44 @@ describe('Cmr list', () => {
cy.containContent(selectors.summaryTitle, data.client);
});
});
describe('Agency pop-ups', () => {
it('Should redirect to the agency summary from the agency descriptor pop-up', () => {
cy.get(selectors.agency).should('be.visible').click();
cy.containContent(selectors.descriptorTitle, data.agency);
cy.get(selectors.descriptorGoToSummaryBtn).should('be.visible').click();
cy.url().should('include', '/agency/1/summary');
cy.containContent(selectors.summaryTitle, data.agency);
});
it('Should redirect to the agency summary from summary pop-up from the agency descriptor pop-up', () => {
cy.get(selectors.agency).should('be.visible').click();
cy.containContent(selectors.descriptorTitle, data.agency);
cy.get(selectors.descriptorOpenSummaryBtn).should('be.visible').click();
cy.containContent(selectors.summaryTitle, data.agency);
cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
cy.url().should('include', '/agency/1/summary');
cy.containContent(selectors.summaryTitle, data.agency);
});
});
describe('Carrier pop-ups', () => {
it('Should redirect to the supplier summary from the supplier descriptor pop-up', () => {
cy.get(selectors.carrier).should('be.visible').click();
cy.containContent(selectors.descriptorTitle, data.carrier);
cy.get(selectors.descriptorGoToSummaryBtn).should('be.visible').click();
cy.url().should('include', '/supplier/1/summary');
cy.containContent(selectors.summaryTitle, data.carrier);
});
it('Should redirect to the supplier summary from summary pop-up from the supplier descriptor pop-up', () => {
cy.get(selectors.carrier).should('be.visible').click();
cy.containContent(selectors.descriptorTitle, data.carrier);
cy.get(selectors.descriptorOpenSummaryBtn).should('be.visible').click();
cy.containContent(selectors.summaryTitle, data.carrier);
cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
cy.url().should('include', '/supplier/1/summary');
cy.containContent(selectors.summaryTitle, data.carrier);
});
});
});

View File

@ -76,16 +76,13 @@ describe('TicketList', () => {
});
}).as('ticket');
cy.get('[data-cy="Warehouse_select"]').type('Warehouse Five');
cy.get('.q-menu .q-item').contains('Warehouse Five').click();
cy.selectOption('[data-cy="Warehouse_select"]', 'Warehouse Five');
cy.searchBtnFilterPanel();
cy.wait('@ticket').then((interception) => {
const data = interception.response.body[1];
const data = interception.response.body[0];
expect(data.hasComponentLack).to.equal(1);
expect(data.isTooLittle).to.equal(1);
expect(data.hasItemShortage).to.equal(1);
});
cy.get('.icon-components').should('exist');
cy.get('.icon-unavailable').should('exist');
cy.get('.icon-isTooLittle').should('exist');
});
});