0
0
Fork 0

Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into hotfix_itemFixedPrice

This commit is contained in:
Javier Segarra 2024-11-29 23:23:52 +01:00
commit 1b975193f0
10 changed files with 68 additions and 24 deletions

View File

@ -176,14 +176,13 @@ async function saveChanges(data) {
const changes = data || getChanges(); const changes = data || getChanges();
try { try {
await axios.post($props.saveUrl || $props.url + '/crud', changes); await axios.post($props.saveUrl || $props.url + '/crud', changes);
} catch (e) { } finally {
return (isLoading.value = false); isLoading.value = false;
} }
originalData.value = JSON.parse(JSON.stringify(formData.value)); originalData.value = JSON.parse(JSON.stringify(formData.value));
if (changes.creates?.length) await vnPaginateRef.value.fetch(); if (changes.creates?.length) await vnPaginateRef.value.fetch();
hasChanges.value = false; hasChanges.value = false;
isLoading.value = false;
emit('saveChanges', data); emit('saveChanges', data);
quasar.notify({ quasar.notify({
type: 'positive', type: 'positive',

View File

@ -284,9 +284,9 @@ async function onScroll({ to, direction, from, index }) {
:loading="isLoading" :loading="isLoading"
@virtual-scroll="onScroll" @virtual-scroll="onScroll"
> >
<template v-if="isClearable" #append> <template #append>
<QIcon <QIcon
v-show="value" v-show="isClearable && value"
name="close" name="close"
@click.stop=" @click.stop="
() => { () => {
@ -299,7 +299,22 @@ async function onScroll({ to, direction, from, index }) {
/> />
</template> </template>
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName"> <template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" /> <div v-if="slotName == 'append'">
<QIcon
v-show="isClearable && value"
name="close"
@click.stop="
() => {
value = null;
emit('remove');
}
"
class="cursor-pointer"
size="xs"
/>
<slot name="append" v-if="$slots.append" v-bind="slotData ?? {}" />
</div>
<slot v-else :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template> </template>
</QSelect> </QSelect>
</template> </template>

View File

@ -766,7 +766,7 @@ travel:
thermographs: Thermographs thermographs: Thermographs
hb: HB hb: HB
basicData: basicData:
daysInForward: Days in forward daysInForward: Automatic movement (Raid)
isRaid: Raid isRaid: Raid
thermographs: thermographs:
temperature: Temperature temperature: Temperature

View File

@ -760,7 +760,7 @@ travel:
thermographs: Termógrafos thermographs: Termógrafos
hb: HB hb: HB
basicData: basicData:
daysInForward: Días redada daysInForward: Desplazamiento automatico (redada)
isRaid: Redada isRaid: Redada
thermographs: thermographs:
temperature: Temperatura temperature: Temperatura

View File

@ -42,13 +42,13 @@ async function hasCustomerRole() {
> >
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<QCheckbox :label="t('Enable web access')" v-model="data.account.active" /> <QCheckbox :label="t('Enable web access')" v-model="data.account.active" />
<VnInput :label="t('User')" clearable v-model="data.name" /> <VnInput :label="t('User')" clearable v-model="data.account.name" />
<VnInput <VnInput
:label="t('Recovery email')" :label="t('Recovery email')"
:rules="validate('client.email')" :rules="validate('client.email')"
clearable clearable
type="email" type="email"
v-model="data.email" v-model="data.account.email"
class="q-mt-sm" class="q-mt-sm"
:info="t('This email is used for user to regain access their account')" :info="t('This email is used for user to regain access their account')"
/> />

View File

@ -18,8 +18,6 @@ const router = useRouter();
const formInitialData = reactive({ isDefaultAddress: false }); const formInitialData = reactive({ isDefaultAddress: false });
const urlCreate = ref('');
const agencyModes = ref([]); const agencyModes = ref([]);
const incoterms = ref([]); const incoterms = ref([]);
const customsAgents = ref([]); const customsAgents = ref([]);
@ -40,13 +38,18 @@ function handleLocation(data, location) {
data.countryFk = countryFk; data.countryFk = countryFk;
} }
function onAgentCreated(requestResponse, data) { function onAgentCreated({ id, fiscalName }, data) {
customsAgents.value.push(requestResponse); customsAgents.value.push({ id, fiscalName });
data.customsAgentFk = requestResponse.id; data.customsAgentFk = id;
} }
</script> </script>
<template> <template>
<FetchData
@on-fetch="(data) => (customsAgents = data)"
auto-load
url="CustomsAgents"
/>
<FetchData <FetchData
@on-fetch="(data) => (agencyModes = data)" @on-fetch="(data) => (agencyModes = data)"
auto-load auto-load
@ -57,7 +60,7 @@ function onAgentCreated(requestResponse, data) {
<FormModel <FormModel
:form-initial-data="formInitialData" :form-initial-data="formInitialData"
:observe-form-changes="false" :observe-form-changes="false"
:url-create="urlCreate" :url-create="`Clients/${route.params.id}/createAddress`"
@on-data-saved="toCustomerAddress()" @on-data-saved="toCustomerAddress()"
model="client" model="client"
> >
@ -141,8 +144,7 @@ function onAgentCreated(requestResponse, data) {
<template #form> <template #form>
<CustomerNewCustomsAgent <CustomerNewCustomsAgent
@on-data-saved=" @on-data-saved="
(_, requestResponse) => (requestResponse) => onAgentCreated(requestResponse, data)
onAgentCreated(requestResponse, data)
" "
/> />
</template> </template>

View File

@ -24,13 +24,14 @@ const supplier = ref(null);
const supplierAccountRef = ref(null); const supplierAccountRef = ref(null);
const wireTransferFk = ref(null); const wireTransferFk = ref(null);
const bankEntitiesOptions = ref([]); const bankEntitiesOptions = ref([]);
const filteredBankEntitiesOptions = ref([]);
const onBankEntityCreated = async (dataSaved, rowData) => { const onBankEntityCreated = async (dataSaved, rowData) => {
await bankEntitiesRef.value.fetch(); await bankEntitiesRef.value.fetch();
rowData.bankEntityFk = dataSaved.id; rowData.bankEntityFk = dataSaved.id;
}; };
const onChangesSaved = () => { const onChangesSaved = async () => {
if (supplier.value.payMethodFk !== wireTransferFk.value) if (supplier.value.payMethodFk !== wireTransferFk.value)
quasar quasar
.dialog({ .dialog({
@ -55,12 +56,35 @@ const setWireTransfer = async () => {
await axios.patch(`Suppliers/${route.params.id}`, params); await axios.patch(`Suppliers/${route.params.id}`, params);
notify('globals.dataSaved', 'positive'); 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, update) {
update(() => {
const needle = val.toLowerCase();
filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
(bank) =>
bank.bic.toLowerCase().startsWith(needle) ||
bank.name.toLowerCase().includes(needle)
);
});
}
</script> </script>
<template> <template>
<FetchData <FetchData
ref="bankEntitiesRef" ref="bankEntitiesRef"
url="BankEntities" url="BankEntities"
@on-fetch="(data) => (bankEntitiesOptions = data)" @on-fetch="
(data) => {
(bankEntitiesOptions = data), (filteredBankEntitiesOptions = data);
}
"
auto-load auto-load
/> />
<FetchData <FetchData
@ -98,6 +122,7 @@ const setWireTransfer = async () => {
<VnInput <VnInput
:label="t('supplier.accounts.iban')" :label="t('supplier.accounts.iban')"
v-model="row.iban" v-model="row.iban"
@update:model-value="(value) => findBankFk(value, row)"
:required="true" :required="true"
> >
<template #append> <template #append>
@ -109,7 +134,9 @@ const setWireTransfer = async () => {
<VnSelectDialog <VnSelectDialog
:label="t('worker.create.bankEntity')" :label="t('worker.create.bankEntity')"
v-model="row.bankEntityFk" v-model="row.bankEntityFk"
:options="bankEntitiesOptions" :options="filteredBankEntitiesOptions"
:default-filter="false"
@filter="(val, update) => bankEntityFilter(val, update)"
option-label="bic" option-label="bic"
option-value="id" option-value="id"
hide-selected hide-selected

View File

@ -471,7 +471,7 @@ const qCheckBoxController = (sale, action) => {
url="Shelvings" url="Shelvings"
hide-selected hide-selected
option-label="code" option-label="code"
option-value="code" option-value="id"
v-model="row.shelvingFk" v-model="row.shelvingFk"
@update:model-value="updateShelving(row)" @update:model-value="updateShelving(row)"
style="max-width: 120px" style="max-width: 120px"

View File

@ -104,7 +104,7 @@ const warehousesOptionsIn = ref([]);
<i18n> <i18n>
es: es:
raidDays: Si se marca "Redada", la fecha de entrega se moverá automáticamente los días indicados. raidDays: El travel se desplaza automáticamente cada día para estar desde hoy al número de días indicado. Si se deja vacio no se moverá
en: en:
raidDays: If "Raid" is checked, the landing date will automatically shift by the specified number of days. raidDays: The travel adjusts itself daily to match the number of days set, starting from today. If left blank, it wont move
</i18n> </i18n>

View File

@ -3,6 +3,7 @@ describe('VnBreadcrumbs', () => {
const firstCard = '.q-infinite-scroll > :nth-child(1)'; const firstCard = '.q-infinite-scroll > :nth-child(1)';
const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el'; const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el';
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit('/'); cy.visit('/');
}); });