Merge branch 'master' into hotFixTravelSummaryDialog
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Pablo Natek 2025-03-31 10:31:24 +00:00
commit c3d51259c4
8 changed files with 32 additions and 82 deletions

View File

@ -1,35 +1,14 @@
<script setup>
import { nextTick, ref } from 'vue';
import VnInput from './VnInput.vue';
import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
const $props = defineProps({
insertable: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
const model = defineModel({ prop: 'modelValue' });
const inputRef = ref(false);
function setCursorPosition(pos) {
const input = inputRef.value.vnInputRef.$el.querySelector('input');
input.focus();
input.setSelectionRange(pos, pos);
}
async function handleUpdateModel(val) {
model.value = val?.at(-1) === '.' ? useAccountShortToStandard(val) : val;
await nextTick(() => setCursorPosition(0));
}
</script>
<template>
<VnInput
v-model="model"
ref="inputRef"
:insertable
@update:model-value="handleUpdateModel"
@keydown.tab="model = useAccountShortToStandard($event.target.value) ?? model"
@input="model = $event.target.value.replace(/[^\d.]/g, '')"
/>
</template>

View File

@ -248,7 +248,7 @@ function getBadgeAttrs(row) {
let timeDiff = today - timeTicket;
if (timeDiff > 0) return { color: 'info', 'text-color': 'black' };
if (timeDiff < 0) return { color: 'warning', 'text-color': 'black' };
switch (row.entryTypeCode) {
case 'regularization':
case 'life':
@ -273,7 +273,7 @@ function getBadgeAttrs(row) {
default:
break;
}
if (timeDiff < 0) return { color: 'warning', 'text-color': 'black' };
if (timeDiff > 0) return { color: 'info', 'text-color': 'black' };
return { color: 'transparent' };
}

View File

@ -1,13 +1,14 @@
<script setup>
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import DepartmentDescriptorProxy from '../Worker/Department/Card/DepartmentDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import { toDateFormat } from 'src/filters/date.js';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnRow from 'src/components/ui/VnRow.vue';
import { dateRange } from 'src/filters';
import useOpenURL from 'src/composables/useOpenURL';
const { t } = useI18n();
const dates = dateRange(Date.vnNew());
@ -124,12 +125,16 @@ const openTab = (id) => useOpenURL(`#/customer/${id}/summary`);
</VnRow>
</template>
<template #column-departmentFk="{ row }">
<span class="link" :title="row.department" v-text="row.department" />
<WorkerDescriptorProxy :id="row.departmentFk" dense />
<span @click.stop.prevent class="link" :title="row.department">
{{ row.department }}
<DepartmentDescriptorProxy :id="row.departmentFk" dense
/></span>
</template>
<template #column-clientFk="{ row }">
<span class="link" :title="row.clientName" v-text="row.clientName" />
<CustomerDescriptorProxy :id="row.clientFk" />
<span @click.stop.prevent class="link" :title="row.clientName">
{{ row.clientName }}
<CustomerDescriptorProxy :id="row.clientFk" dense
/></span>
</template>
</VnTable>
</template>

View File

@ -9,6 +9,7 @@ import { toDateFormat, toDateTimeFormat } from 'src/filters/date.js';
import { toCurrency } from 'src/filters';
import { useVnConfirm } from 'composables/useVnConfirm';
import axios from 'axios';
import useOpenURL from 'src/composables/useOpenURL';
const { t } = useI18n();
const { openConfirmationModal } = useVnConfirm();
@ -108,8 +109,7 @@ const removeOrders = async () => {
await table.value.reload();
};
const openTab = (id) =>
window.open(`#/order/${id}/summary`, '_blank', 'noopener, noreferrer');
const openTab = (id) => useOpenURL(`#/order/${id}/summary`);
</script>
<template>
<VnTable
@ -178,16 +178,16 @@ const openTab = (id) =>
</template>
<template #column-clientFk="{ row }">
<QTd @click.stop>
<span class="link" v-text="row.clientName" :title="row.clientName" />
<CustomerDescriptorProxy :id="row.clientFk" />
</QTd>
<span class="link" @click.stop :title="row.clientName">
{{ row.clientName }}
<CustomerDescriptorProxy :id="row.clientFk" dense
/></span>
</template>
<template #column-departmentFk="{ row }">
<QTd @click.stop>
<span class="link" v-text="row.departmentName" />
<DepartmentDescriptorProxy :id="row.departmentFk" dense />
</QTd>
<span class="link" @click.stop :title="row.departmentName">
{{ row.departmentName }}
<DepartmentDescriptorProxy :id="row.departmentFk" dense
/></span>
</template>
</VnTable>
</template>

View File

@ -187,7 +187,9 @@ const getRowUpdateInputEvents = (sale) => {
const resetChanges = async () => {
arrayData.fetch({ append: false });
tableRef.value.reload();
tableRef.value.CrudModelRef.hasChanges = false;
await tableRef.value.reload();
selectedRows.value = [];
};
const changeQuantity = async (sale) => {
@ -390,7 +392,7 @@ const changeTicketState = async (val) => {
const params = { ticketFk: route.params.id, code: val };
await axios.post('Tickets/state', params);
notify('globals.dataSaved', 'positive');
await resetChanges();
resetChanges();
};
const removeSelectedSales = () => {

View File

@ -8,6 +8,6 @@ import filter from './TravelFilter.js';
data-key="Travel"
url="Travels"
:descriptor="TravelDescriptor"
:filter="filter"
:filter="{ ...filter, where: { id: $route.params.id } }"
/>
</template>

View File

@ -44,11 +44,12 @@ describe('EntryList', () => {
},
);
checkBadgeDate(
// fix on task https://redmine.verdnatura.es/issues/8638
/* checkBadgeDate(
'td[data-col-field="landed"] > div .bg-info',
(badgeDate, compareDate) => {
expect(badgeDate.getTime()).to.be.lessThan(compareDate.getTime());
},
);
); */
});
});

View File

@ -1,37 +0,0 @@
describe('VnAccountNumber', () => {
const accountInput = 'input[data-cy="supplierFiscalDataAccount_input"]';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/supplier/1/fiscal-data');
});
describe('VnInput handleInsertMode()', () => {
it('should replace character at cursor position in insert mode', () => {
cy.get(accountInput).type('{selectall}4100000001');
cy.get(accountInput).type('{movetostart}');
cy.get(accountInput).type('999');
cy.get(accountInput).should('have.value', '9990000001');
});
it('should replace character at cursor position in insert mode', () => {
cy.get(accountInput).clear();
cy.get(accountInput).type('4100000001');
cy.get(accountInput).type('{movetostart}');
cy.get(accountInput).type('999');
cy.get(accountInput).should('have.value', '9990000001');
});
it('should respect maxlength prop', () => {
cy.get(accountInput).clear();
cy.get(accountInput).type('123456789012345');
cy.get(accountInput).should('have.value', '1234567890');
});
});
it('should convert short account number to standard format', () => {
cy.get(accountInput).clear();
cy.get(accountInput).type('123.');
cy.get(accountInput).should('have.value', '1230000000');
});
});