Merge branch 'Fix-SummaryCardsFlex' of https://gitea.verdnatura.es/verdnatura/salix-front into Fix-SummaryCardsFlex
gitea/salix-front/pipeline/pr-test There was a failure building this commit Details

This commit is contained in:
Jon Elias 2025-04-04 08:51:03 +02:00
commit 5eee9965bf
16 changed files with 136 additions and 97 deletions

View File

@ -219,6 +219,7 @@ function filterByRecord(modelLog) {
} }
async function applyFilter(params = {}) { async function applyFilter(params = {}) {
paginate.value.arrayData.resetPagination();
paginate.value.arrayData.applyFilter({ paginate.value.arrayData.applyFilter({
filter: {}, filter: {},
params: { originFk: route.params.id, ...params }, params: { originFk: route.params.id, ...params },

View File

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

View File

@ -72,6 +72,7 @@ const exprBuilder = (param, value) => {
option-value="id" option-value="id"
option-label="name" option-label="name"
url="Departments" url="Departments"
no-one="true"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
@ -154,9 +155,9 @@ en:
city: City city: City
phone: Phone phone: Phone
email: Email email: Email
departmentFk: Department
isToBeMailed: Mailed isToBeMailed: Mailed
isEqualizated: Equailized isEqualizated: Equailized
departmentFk: Department
businessTypeFk: Business type businessTypeFk: Business type
sageTaxTypeFk: Sage Tax Type sageTaxTypeFk: Sage Tax Type
sageTransactionTypeFk: Sage Tax Type sageTransactionTypeFk: Sage Tax Type

View File

@ -127,6 +127,7 @@ es:
Identifier: Identificador Identifier: Identificador
Social name: Razón social Social name: Razón social
Phone: Teléfono Phone: Teléfono
Postcode: Código postal
City: Población City: Población
Email: Email Email: Email
Campaign consumption: Consumo campaña Campaign consumption: Consumo campaña

View File

@ -93,10 +93,26 @@ const updateAddressTicket = async () => {
}; };
const updateObservations = async (payload) => { const updateObservations = async (payload) => {
await axios.post('AddressObservations/crud', payload); await axios.post('AddressObservations/crud', cleanPayload(payload));
notes.value = []; notes.value = [];
deletes.value = []; deletes.value = [];
}; };
function cleanPayload(payload) {
['creates', 'deletes', 'updates'].forEach((prop) => {
if (prop === 'creates' || prop === 'updates') {
payload[prop] = payload[prop].filter(
(item) => item.description !== '' && item.observationTypeFk !== '',
);
} else {
payload[prop] = payload[prop].filter(
(item) => item !== null && item !== undefined,
);
}
});
return payload;
}
async function updateAll({ data, payload }) { async function updateAll({ data, payload }) {
await updateObservations(payload); await updateObservations(payload);
await updateAddress(data); await updateAddress(data);

View File

@ -191,7 +191,7 @@ const getItemPackagingType = (ticketSales) => {
:without-header="true" :without-header="true"
auto-load auto-load
:row-click="rowClick" :row-click="rowClick"
order="shipped DESC, id" order="shipped DESC, id DESC"
:disable-option="{ card: true, table: true }" :disable-option="{ card: true, table: true }"
class="full-width" class="full-width"
:disable-infinite-scroll="true" :disable-infinite-scroll="true"

View File

@ -22,7 +22,7 @@ const routes = reactive({
getSupplier: (id) => { getSupplier: (id) => {
return { name: 'SupplierCard', params: { id } }; return { name: 'SupplierCard', params: { id } };
}, },
getTickets: (id) => { getInvoices: (id) => {
return { return {
name: 'InvoiceInList', name: 'InvoiceInList',
query: { query: {
@ -131,11 +131,11 @@ async function setInvoiceCorrection(id) {
</QBtn> </QBtn>
<QBtn <QBtn
size="md" size="md"
icon="vn:ticket" icon="vn:invoice-in"
color="primary" color="primary"
:to="routes.getTickets(entity.supplierFk)" :to="routes.getInvoices(entity.supplierFk)"
> >
<QTooltip>{{ t('globals.ticketList') }}</QTooltip> <QTooltip>{{ t('invoiceIn.descriptor.invoices') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
v-if=" v-if="

View File

@ -15,6 +15,7 @@ invoiceIn:
amount: Amount amount: Amount
descriptor: descriptor:
ticketList: Ticket list ticketList: Ticket list
invoices: Supplier invoices
descriptorMenu: descriptorMenu:
book: Book book: Book
unbook: Unbook unbook: Unbook

View File

@ -14,7 +14,7 @@ invoiceIn:
awb: AWB awb: AWB
amount: Importe amount: Importe
descriptor: descriptor:
ticketList: Listado de tickets invoices: Facturas de proveedor
descriptorMenu: descriptorMenu:
book: Contabilizar book: Contabilizar
unbook: Descontabilizar unbook: Descontabilizar

View File

@ -198,7 +198,7 @@ const getLocale = (label) => {
<QItemSection> <QItemSection>
<VnSelect <VnSelect
dense dense
rounded filled
:label="t('globals.params.packing')" :label="t('globals.params.packing')"
v-model="params.packing" v-model="params.packing"
url="ItemPackingTypes" url="ItemPackingTypes"

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref, computed, watch } from 'vue'; import { onMounted, ref, computed, watch, inject } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
@ -25,7 +25,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import VnConfirm from 'src/components/ui/VnConfirm.vue'; import VnConfirm from 'src/components/ui/VnConfirm.vue';
import TicketProblems from 'src/components/TicketProblems.vue'; import TicketProblems from 'src/components/TicketProblems.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
const app = inject('app');
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
@ -196,13 +196,17 @@ const changeQuantity = async (sale) => {
if (!sale.itemFk || sale.quantity == null || sale?.originalQuantity === sale.quantity) if (!sale.itemFk || sale.quantity == null || sale?.originalQuantity === sale.quantity)
return; return;
else sale.originalQuantity = sale.quantity; else sale.originalQuantity = sale.quantity;
if (!sale.id) return addSale(sale); try {
if (!sale.id) await addSale(sale);
} catch (e) {
app.config.errorHandler(e);
return;
}
if (await isSalePrepared(sale)) { if (await isSalePrepared(sale)) {
await confirmUpdate(() => updateQuantity(sale)); await confirmUpdate(() => updateQuantity(sale));
} else await updateQuantity(sale); } else await updateQuantity(sale);
}; };
const updateQuantity = async (sale) => { const updateQuantity = async (sale) => {
try { try {
let { quantity, id } = sale; let { quantity, id } = sale;
@ -215,7 +219,7 @@ const updateQuantity = async (sale) => {
(s) => s.id === sale.id, (s) => s.id === sale.id,
); );
sale.quantity = quantity; sale.quantity = quantity;
throw e; app.config.errorHandler(e);
} }
}; };
@ -224,24 +228,27 @@ const addSale = async (sale) => {
barcode: sale.itemFk, barcode: sale.itemFk,
quantity: sale.quantity, quantity: sale.quantity,
}; };
try {
const { data } = await axios.post(`tickets/${route.params.id}/addSale`, params);
const { data } = await axios.post(`tickets/${route.params.id}/addSale`, params); if (!data) return;
if (!data) return; const newSale = data;
sale.id = newSale.id;
sale.image = newSale.item.image;
sale.subName = newSale.item.subName;
sale.concept = newSale.concept;
sale.quantity = newSale.quantity;
sale.discount = newSale.discount;
sale.price = newSale.price;
sale.item = newSale.item;
const newSale = data; notify('globals.dataSaved', 'positive');
sale.id = newSale.id; sale.isNew = false;
sale.image = newSale.item.image; resetChanges();
sale.subName = newSale.item.subName; } catch (e) {
sale.concept = newSale.concept; app.config.errorHandler(e);
sale.quantity = newSale.quantity; }
sale.discount = newSale.discount;
sale.price = newSale.price;
sale.item = newSale.item;
notify('globals.dataSaved', 'positive');
sale.isNew = false;
resetChanges();
}; };
const changeConcept = async (sale) => { const changeConcept = async (sale) => {
if (await isSalePrepared(sale)) { if (await isSalePrepared(sale)) {
@ -250,10 +257,14 @@ const changeConcept = async (sale) => {
}; };
const updateConcept = async (sale) => { const updateConcept = async (sale) => {
const data = { newConcept: sale.concept }; try {
await axios.post(`Sales/${sale.id}/updateConcept`, data); const data = { newConcept: sale.concept };
notify('globals.dataSaved', 'positive'); await axios.post(`Sales/${sale.id}/updateConcept`, data);
resetChanges(); notify('globals.dataSaved', 'positive');
resetChanges();
} catch (e) {
app.config.errorHandler(e);
}
}; };
const DEFAULT_EDIT = { const DEFAULT_EDIT = {
@ -264,18 +275,6 @@ const DEFAULT_EDIT = {
oldQuantity: null, oldQuantity: null,
}; };
const edit = ref({ ...DEFAULT_EDIT }); const edit = ref({ ...DEFAULT_EDIT });
const usesMana = ref(null);
const getUsesMana = async () => {
const { data } = await axios.get('Sales/usesMana');
usesMana.value = data;
};
const getMana = async () => {
const { data } = await axios.get(`Tickets/${route.params.id}/getDepartmentMana`);
mana.value = data;
await getUsesMana();
};
const selectedValidSales = computed(() => { const selectedValidSales = computed(() => {
if (!sales.value) return; if (!sales.value) return;
@ -312,11 +311,15 @@ const changePrice = async (sale) => {
} }
}; };
const updatePrice = async (sale, newPrice) => { const updatePrice = async (sale, newPrice) => {
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice }); try {
sale.price = newPrice; await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
edit.value = { ...DEFAULT_EDIT }; sale.price = newPrice;
notify('globals.dataSaved', 'positive'); edit.value = { ...DEFAULT_EDIT };
resetChanges(); notify('globals.dataSaved', 'positive');
resetChanges();
} catch (e) {
app.config.errorHandler(e);
}
}; };
const changeDiscount = async (sale) => { const changeDiscount = async (sale) => {
@ -339,15 +342,20 @@ const updateDiscounts = async (sales, newDiscount) => {
}; };
const updateDiscount = async (sales, newDiscount = 0) => { const updateDiscount = async (sales, newDiscount = 0) => {
const salesIds = sales.map(({ id }) => id); try {
const params = { const salesIds = sales.map(({ id }) => id);
salesIds, const params = {
newDiscount, salesIds,
manaCode: manaCode.value, newDiscount,
}; manaCode: manaCode.value,
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params); };
notify('globals.dataSaved', 'positive'); await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
resetChanges(); notify('globals.dataSaved', 'positive');
resetChanges();
} catch (e) {
app.config.errorHandler(e);
return;
}
}; };
const getNewPrice = computed(() => { const getNewPrice = computed(() => {
@ -369,11 +377,15 @@ const getNewPrice = computed(() => {
}); });
const newOrderFromTicket = async () => { const newOrderFromTicket = async () => {
const { data } = await axios.post(`Orders/newFromTicket`, { try {
ticketFk: Number(route.params.id), const { data } = await axios.post(`Orders/newFromTicket`, {
}); ticketFk: Number(route.params.id),
const routeData = router.resolve({ name: 'OrderCatalog', params: { id: data } }); });
window.open(routeData.href, '_blank'); const routeData = router.resolve({ name: 'OrderCatalog', params: { id: data } });
window.open(routeData.href, '_blank');
} catch (e) {
app.config.errorHandler(e);
}
}; };
const goToLog = (saleId) => { const goToLog = (saleId) => {
@ -390,11 +402,15 @@ const goToLog = (saleId) => {
}; };
const changeTicketState = async (val) => { const changeTicketState = async (val) => {
stateBtnDropdownRef.value.hide(); try {
const params = { ticketFk: route.params.id, code: val }; stateBtnDropdownRef.value.hide();
await axios.post('Tickets/state', params); const params = { ticketFk: route.params.id, code: val };
notify('globals.dataSaved', 'positive'); await axios.post('Tickets/state', params);
resetChanges(); notify('globals.dataSaved', 'positive');
resetChanges();
} catch (e) {
app.config.errorHandler(e);
}
}; };
const removeSelectedSales = () => { const removeSelectedSales = () => {
@ -414,10 +430,14 @@ const removeSales = async () => {
.forEach((sale) => tableRef.value.CrudModelRef.formData.splice(sale.$index, 1)); .forEach((sale) => tableRef.value.CrudModelRef.formData.splice(sale.$index, 1));
if (params.sales.length == 0) return; if (params.sales.length == 0) return;
await axios.post('Sales/deleteSales', params); try {
removeSelectedSales(); await axios.post('Sales/deleteSales', params);
notify('globals.dataSaved', 'positive'); removeSelectedSales();
resetChanges(); notify('globals.dataSaved', 'positive');
resetChanges();
} catch (e) {
app.config.errorHandler(e);
}
}; };
const setTransferParams = async () => { const setTransferParams = async () => {

View File

@ -505,7 +505,6 @@ watch(route, () => {
:props="props" :props="props"
@click="stopEventPropagation($event, col)" @click="stopEventPropagation($event, col)"
:style="col.style" :style="col.style"
style="padding-left: 5px"
> >
<component <component
:is="tableColumnComponents[col.name].component" :is="tableColumnComponents[col.name].component"
@ -581,19 +580,20 @@ watch(route, () => {
<QBtn dense flat class="link">{{ entry.id }} </QBtn> <QBtn dense flat class="link">{{ entry.id }} </QBtn>
<EntryDescriptorProxy :id="entry.id" /> <EntryDescriptorProxy :id="entry.id" />
</QTd> </QTd>
<QTd> <QTd :colspan="2">
<QBtn flat class="link" dense>{{ entry.supplierName }}</QBtn> <div style="display: flex">
<SupplierDescriptorProxy :id="entry.supplierFk" /> <span class="link">
</QTd> {{ entry.supplierName }}
<QTd class="text-center"> <SupplierDescriptorProxy :id="entry.supplierFk" />
<QIcon </span>
v-if="entry.isCustomInspectionRequired" <QIcon
name="warning" v-if="entry.isCustomInspectionRequired"
color="negative" name="warning"
size="md" color="negative"
:title="t('extraCommunity.requiresInspection')" size="md"
> :title="t('extraCommunity.requiresInspection')"
</QIcon> />
</div>
</QTd> </QTd>
<QTd class="text-right"> <QTd class="text-right">
<span>{{ toCurrency(entry.invoiceAmount) }}</span> <span>{{ toCurrency(entry.invoiceAmount) }}</span>
@ -639,9 +639,7 @@ watch(route, () => {
&:nth-child(1) { &:nth-child(1) {
max-width: 65px; max-width: 65px;
} }
&:nth-child(4) { padding: 0 5px 0;
padding: 0;
}
} }
thead > tr > th { thead > tr > th {
padding: 3px; padding: 3px;

View File

@ -94,7 +94,7 @@ onBeforeMount(async () => {
</template> </template>
</VnLv> </VnLv>
</div> </div>
<div class="vn-card-content"> <div class="vn-card-content" v-if="advancedSummary">
<VnLv <VnLv
:label="t('worker.summary.fiDueDate')" :label="t('worker.summary.fiDueDate')"
:value="toDate(advancedSummary.fiDueDate)" :value="toDate(advancedSummary.fiDueDate)"

View File

@ -13,7 +13,7 @@ describe('InvoiceInDescriptor', () => {
cy.validateCheckbox(checkbox, false); cy.validateCheckbox(checkbox, false);
}); });
it.skip('should delete the invoice properly', () => { it('should delete the invoice properly', () => {
cy.visit('/#/invoice-in/2/summary'); cy.visit('/#/invoice-in/2/summary');
cy.selectDescriptorOption(2); cy.selectDescriptorOption(2);
cy.clickConfirm(); cy.clickConfirm();

View File

@ -1,6 +1,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
// https://redmine.verdnatura.es/issues/8848
describe('VnShortcuts', () => { describe.skip('VnShortcuts', () => {
const modules = { const modules = {
item: 'a', item: 'a',
customer: 'c', customer: 'c',

View File

@ -1,4 +1,5 @@
describe('WorkerList', () => { // https://redmine.verdnatura.es/issues/8848
describe.skip('WorkerList', () => {
const inputName = '.q-drawer .q-form input[aria-label="First Name"]'; const inputName = '.q-drawer .q-form input[aria-label="First Name"]';
const searchBtn = '.q-drawer button:nth-child(3)'; const searchBtn = '.q-drawer button:nth-child(3)';
const descriptorTitle = '.descriptor .title span'; const descriptorTitle = '.descriptor .title span';
@ -13,7 +14,7 @@ describe('WorkerList', () => {
cy.intercept('GET', /\/api\/Workers\/summary+/).as('worker'); cy.intercept('GET', /\/api\/Workers\/summary+/).as('worker');
cy.get(searchBtn).click(); cy.get(searchBtn).click();
cy.wait('@worker').then(() => cy.wait('@worker').then(() =>
cy.get(descriptorTitle).should('include.text', 'Jessica') cy.get(descriptorTitle).should('include.text', 'Jessica'),
); );
}); });
}); });