0
0
Fork 0

Merge branch 'dev' into 6321_negative_tickets

This commit is contained in:
Javier Segarra 2024-07-02 20:31:44 +02:00
commit 9c8094a3d8
9 changed files with 62 additions and 31 deletions

View File

@ -1,6 +1,6 @@
{
"name": "salix-front",
"version": "24.28.1",
"version": "24.30.1",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",

View File

@ -260,7 +260,7 @@ defineExpose({
CrudModelRef.vnPaginateRef.paginate()
"
@row-click="(_, row) => rowClickFunction(row)"
@update:selected="$emit('update:selected', $event)"
@update:selected="emit('update:selected', $event)"
>
<template #top-left>
<slot name="top-left"></slot>
@ -325,13 +325,15 @@ defineExpose({
class="no-margin q-px-xs"
:class="getColAlign(col)"
>
<VnTableColumn
:column="col"
:row="row"
:is-editable="false"
v-model="row[col.name]"
component-prop="columnField"
/>
<slot :name="`column-${col.name}`" :col="col" :row="row">
<VnTableColumn
:column="col"
:row="row"
:is-editable="false"
v-model="row[col.name]"
component-prop="columnField"
/>
</slot>
</QTd>
</template>
<template #body-cell-tableActions="{ col, row }">
@ -427,14 +429,20 @@ defineExpose({
stopEventPropagation($event)
"
>
<VnTableColumn
:column="col"
<slot
:name="`column-${col.name}`"
:col="col"
:row="row"
:is-editable="false"
v-model="row[col.name]"
component-prop="columnField"
:show-label="true"
/>
>
<VnTableColumn
:column="col"
:row="row"
:is-editable="false"
v-model="row[col.name]"
component-prop="columnField"
:show-label="true"
/>
</slot>
</span>
</template>
</VnLv>

View File

@ -93,7 +93,12 @@ const inputRules = [
name="close"
size="xs"
v-if="hover && value && !$attrs.disabled && $props.clearable"
@click="value = null"
@click="
() => {
value = null;
emit('remove');
}
"
></QIcon>
<QIcon v-if="info" name="info">
<QTooltip max-width="350px">

View File

@ -65,6 +65,10 @@ const $props = defineProps({
type: Boolean,
default: false,
},
useLike: {
type: Boolean,
default: true,
},
});
const { t } = useI18n();
@ -118,11 +122,14 @@ async function fetchFilter(val) {
if (!$props.url || !dataRef.value) return;
const { fields, sortBy, limit } = $props;
let key = optionLabel.value;
let key = optionFilter.value ?? optionLabel.value;
if (new RegExp(/\d/g).test(val)) key = optionFilter.value ?? optionValue.value;
if (new RegExp(/\d/g).test(val)) key = optionValue.value;
const where = { ...{ [key]: { like: `%${val}%` } }, ...$props.where };
const defaultWhere = $props.useLike
? { [key]: { like: `%${val}%` } }
: { [key]: val };
const where = { ...defaultWhere, ...$props.where };
const fetchOptions = { where, order: sortBy, limit };
if (fields) fetchOptions.fields = fields;
return dataRef.value.fetch(fetchOptions);

View File

@ -10,7 +10,7 @@ const { t } = useI18n();
const $props = defineProps({
modelValue: {
type: Object,
default: () => {}
default: () => {},
},
dataKey: {
type: String,
@ -58,7 +58,14 @@ const $props = defineProps({
},
});
const emit = defineEmits(['refresh', 'clear', 'search', 'init', 'remove']);
const emit = defineEmits([
'update:modelValue',
'refresh',
'clear',
'search',
'init',
'remove',
]);
const arrayData = useArrayData($props.dataKey, {
exprBuilder: $props.exprBuilder,
@ -67,9 +74,9 @@ const arrayData = useArrayData($props.dataKey, {
});
const route = useRoute();
const store = arrayData.store;
const userParams = ref({})
const userParams = ref({});
onMounted(() => {
userParams.value = $props.modelValue ?? {}
userParams.value = $props.modelValue ?? {};
emit('init', { params: userParams.value });
});
@ -92,6 +99,11 @@ watch(
(val) => setUserParams(val)
);
watch(
() => $props.modelValue,
(val) => (userParams.value = val ?? {})
);
const isLoading = ref(false);
async function search(evt) {
if (evt && $props.disableSubmitEvent) return;
@ -145,6 +157,7 @@ async function clearFilters() {
isLoading.value = false;
emit('clear');
emit('update:modelValue', userParams.value);
}
const tagsList = computed(() => {
@ -168,6 +181,7 @@ async function remove(key) {
userParams.value[key] = undefined;
search();
emit('remove', key);
emit('update:modelValue', userParams.value);
}
function formatValue(value) {

View File

@ -65,6 +65,8 @@ const columns = computed(() => [
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
where: { role: 'salesPerson' },
optionFilter: 'firstName',
useLike: false,
},
create: true,
columnField: {

View File

@ -5,12 +5,11 @@ describe('InvoiceInList', () => {
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)';
const summaryHeaders = '.summaryBody .header-link';
const screen = '.q-page-container > .q-drawer-container > .fullscreen';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-in/list`);
cy.get(screen).click();
});
it('should redirect on clicking a invoice', () => {

View File

@ -8,9 +8,9 @@ describe('ParkingList', () => {
const summaryHeader = '.summaryBody .header';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/parking/list`);
cy.closeSideMenu();
});
it('should redirect on clicking a parking', () => {

View File

@ -221,10 +221,6 @@ Cypress.Commands.add('openLeftMenu', (element) => {
if (element) cy.waitForElement(element);
cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click();
});
Cypress.Commands.add('closeSideMenu', (element) => {
if (element) cy.waitForElement(element);
cy.get('.fullscreen.q-drawer__backdrop:not(.hidden)').click();
});
Cypress.Commands.add('clearSearchbar', (element) => {
if (element) cy.waitForElement(element);