feat: minor visual changes
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Javier Segarra 2025-03-04 12:32:27 +01:00
parent 5276dbee62
commit 2ef1539773
3 changed files with 58 additions and 10 deletions

View File

@ -171,7 +171,8 @@ async function fetchClientAddress(id, formData = {}) {
},
});
addressOptions.value = data;
formData.addressId = data[0].client.defaultAddressFk;
formData.defaultAddressFk = data[0].client.defaultAddressFk;
formData.addressId = formData.defaultAddressFk;
fetchAgencies(formData);
}
@ -181,7 +182,7 @@ async function fetchAgencies({ landed, addressId }) {
const { data } = await axios.get('Agencies/landsThatDay', {
params: {
filter: JSON.stringify({
order: ['agencyMode DESC', 'agencyModeFk ASC'],
order: ['name ASC', 'agencyMode DESC', 'agencyModeFk ASC'],
}),
addressFk: addressId,
landed,
@ -285,7 +286,22 @@ const getDateColor = (date) => {
@update:model-value="() => fetchAgencies(data)"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItem
v-bind="scope.itemProps"
:class="{ disabled: !scope.opt.isActive }"
>
<QItemSection style="min-width: min-content" avatar>
<QIcon
v-if="
scope.opt.isActive &&
data.defaultAddressFk === scope.opt.id
"
size="sm"
color="grey"
name="star"
class="fill-icon"
/>
</QItemSection>
<QItemSection>
<QItemLabel
:class="{
@ -313,6 +329,7 @@ const getDateColor = (date) => {
<VnInputDate
v-model="data.landed"
:label="t('module.landed')"
data-cy="landedDate"
@update:model-value="() => fetchAgencies(data)"
/>
<VnSelect

View File

@ -287,11 +287,13 @@ const fetchClient = async (formData) => {
const fetchAddresses = async (formData) => {
const response = await getAddresses(formData.clientId);
formInitialData.value = { clientId: formData.clientId };
if (!response) return;
addressesOptions.value = response.data;
const { defaultAddress } = selectedClient.value;
formData.addressId = defaultAddress.id;
formInitialData.value.addressId = formData.addressId;
};
const getColor = (row) => {
@ -448,15 +450,12 @@ function setReference(data) {
watch(
() => route.query.table,
(newValue) => {
async (newValue) => {
if (newValue) {
const clientId = +JSON.parse(newValue)?.clientFk;
if (!clientId) return;
formInitialData.value = {
clientId,
};
if (tableRef.value) tableRef.value.create.formInitialData = { clientId };
onClientSelected({ clientId });
await onClientSelected({ clientId });
if (tableRef.value)
tableRef.value.create.formInitialData = formInitialData.value;
}
},
{ immediate: true },

View File

@ -0,0 +1,32 @@
/// <reference types="cypress" />
describe('OrderList', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/order/list');
cy.domContentLoad();
});
it('create order', () => {
/* ==== Generated with Cypress Studio ==== */
cy.get('[data-cy="vnTableCreateBtn"]').click();
cy.get('[data-cy="Client_select"]').type('1101');
cy.get('.q-menu').contains('Bruce Wayne').click();
cy.get('[data-cy="Address_select"]').click();
cy.get(
'.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i',
).should('have.text', 'star');
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get('.q-card [data-cy="Agency_select"]').click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
cy.get('.q-item > .q-item__label.subtitle').then((text) => {
const id = text.text().trim().split('#')[1];
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
});
cy.url().should('include', `/order`);
});
});