salix-front/patch/entryLatestBuys.patch

231 lines
8.6 KiB
Diff

diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue
index 8a01e0be..06654081 100644
--- a/src/components/common/VnInput.vue
+++ b/src/components/common/VnInput.vue
@@ -1,5 +1,5 @@
<script setup>
-import { computed } from 'vue';
+import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
const emit = defineEmits(['update:modelValue', 'update:options', 'keyup.enter']);
@@ -26,7 +26,7 @@ const value = computed({
emit('update:modelValue', value);
},
});
-
+const focus = ref(false);
const styleAttrs = computed(() => {
return $props.isOutlined
? {
@@ -43,20 +43,32 @@ const onEnterPress = () => {
</script>
<template>
- <QInput
- ref="vnInputRef"
- v-model="value"
- v-bind="{ ...$attrs, ...styleAttrs }"
- type="text"
- :class="{ required: $attrs.required }"
- @keyup.enter="onEnterPress()"
+ <div
+ @mouseover="focus = true"
+ @mouseleave="focus = false"
:rules="$attrs.required ? [requiredFieldRule] : null"
>
- <template v-if="$slots.prepend" #prepend>
- <slot name="prepend" />
- </template>
- <template v-if="$slots.append" #append>
- <slot name="append" />
- </template>
- </QInput>
+ <QInput
+ ref="vnInputRef"
+ v-model="value"
+ v-bind="{ ...$attrs, ...styleAttrs }"
+ :type="$attrs.type"
+ :class="{ required: $attrs.required }"
+ @keyup.enter="onEnterPress()"
+ >
+ <template v-if="$slots.prepend" #prepend>
+ <slot name="prepend" />
+ </template>
+
+ <template #append>
+ <slot name="append" v-if="$slots.append" />
+ <QIcon
+ name="close"
+ size="xs"
+ v-if="focus && value"
+ @click="value = null"
+ ></QIcon>
+ </template>
+ </QInput>
+ </div>
</template>
diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue
index 8e0ef289..2f0863d0 100644
--- a/src/components/common/VnInputDate.vue
+++ b/src/components/common/VnInputDate.vue
@@ -16,6 +16,8 @@ const props = defineProps({
default: false,
},
});
+const focus = ref(false);
+
const emit = defineEmits(['update:modelValue']);
const value = computed({
get() {
@@ -53,30 +55,41 @@ const styleAttrs = computed(() => {
</script>
<template>
- <QInput
- class="vn-input-date"
- rounded
- readonly
- :model-value="toDate(value)"
- v-bind="{ ...$attrs, ...styleAttrs }"
- >
- <template #append>
- <QIcon name="event" class="cursor-pointer">
- <QPopupProxy
- v-model="isPopupOpen"
- cover
- transition-show="scale"
- transition-hide="scale"
- :no-parent-event="props.readonly"
- >
- <QDate
- :model-value="formatDate(value)"
- @update:model-value="onDateUpdate"
- />
- </QPopupProxy>
- </QIcon>
- </template>
- </QInput>
+ <div @mouseover="focus = true" @mouseleave="focus = false">
+ <QInput
+ class="vn-input-date"
+ rounded
+ readonly
+ :model-value="toDate(value)"
+ v-bind="{ ...$attrs, ...styleAttrs }"
+ @click="isPopupOpen = true"
+ >
+ <template #append>
+ <QIcon
+ name="close"
+ size="xs"
+ v-if="focus && value"
+ @click="onDateUpdate(null)"
+ ></QIcon>
+ <QIcon name="event" class="cursor-pointer">
+ <QPopupProxy
+ v-model="isPopupOpen"
+ cover
+ transition-show="scale"
+ transition-hide="scale"
+ :no-parent-event="props.readonly"
+ >
+ <QDate
+ :today-btn="true"
+ mask="YYYY-MM-DD"
+ :model-value="value"
+ @update:model-value="onDateUpdate"
+ />
+ </QPopupProxy>
+ </QIcon>
+ </template>
+ </QInput>
+ </div>
</template>
<style lang="scss">
diff --git a/test/cypress/integration/VnLocation.spec.js b/test/cypress/integration/VnLocation.spec.js
index 02b924e4..ab58395f 100644
--- a/test/cypress/integration/VnLocation.spec.js
+++ b/test/cypress/integration/VnLocation.spec.js
@@ -1,7 +1,7 @@
const locationOptions ='[role="listbox"] > div.q-virtual-scroll__content > .q-item'
describe('VnLocation', () => {
describe('Create',()=>{
- const inputLocation = ':nth-child(3) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control';
+ const inputLocation = '.q-form .q-card> :nth-child(3) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
@@ -26,7 +26,7 @@ describe('VnLocation', () => {
cy.get(inputLocation).type('ecuador');
cy.get(locationOptions).should('have.length',1);
cy.get(`${locationOptions}:nth-child(1)`).click();
- cy.get(':nth-child(3) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .q-icon').click();
+ cy.get(inputLocation+'> :nth-child(2) > .q-icon').click();
});
});
diff --git a/test/cypress/integration/claim/claimDevelopment.spec.js b/test/cypress/integration/claim/claimDevelopment.spec.js
index 26c7ee19..903f58d4 100755
--- a/test/cypress/integration/claim/claimDevelopment.spec.js
+++ b/test/cypress/integration/claim/claimDevelopment.spec.js
@@ -8,6 +8,7 @@ describe('ClaimDevelopment', () => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`);
+ cy.waitForElement('tbody');
});
it('should reset line', () => {
diff --git a/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js b/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js
index 20f137ae..fc989d6c 100644
--- a/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js
@@ -1,6 +1,6 @@
/// <reference types="cypress" />
describe('InvoiceInBasicData', () => {
- const selects = ':nth-child(1) > :nth-child(1) > .q-field';
+ const selects = '.q-form .q-card>:nth-child(1) > :nth-child(1) > .q-field';
const appendBtns = 'label button';
const dialogAppendBtns = '.q-dialog label button';
const dialogInputs = '.q-dialog input';
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index f075d500..70c6068e 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -70,6 +70,7 @@ Cypress.Commands.add('getValue', (selector) => {
// Fill Inputs
Cypress.Commands.add('selectOption', (selector, option) => {
+ cy.waitForElement(selector);
cy.get(selector).find('.q-select__dropdown-icon').click();
cy.get('.q-menu .q-item').contains(option).click();
});
@@ -181,11 +182,11 @@ Cypress.Commands.add('closeLeftMenu', (element) => {
Cypress.Commands.add('clearSearchbar', (element) => {
if (element) cy.waitForElement(element);
- cy.get('#searchbar > form > label > div:nth-child(1) input').clear();
+ cy.get('#searchbar > form > div:nth-child(1) > label > div:nth-child(1) input').clear();
});
Cypress.Commands.add('writeSearchbar', (value) => {
- cy.get('#searchbar > form > label > div:nth-child(1) input').type(value);
+ cy.get('#searchbar > form > div:nth-child(1) > label > div:nth-child(1) input').type(value);
});
Cypress.Commands.add('validateContent', (selector, expectedValue) => {
cy.get(selector).should('have.text', expectedValue);
diff --git a/src/pages/Entry/EntryLatestBuys.vue b/src/pages/Entry/EntryLatestBuys.vue
index 217a2587..438873a7 100644
--- a/src/pages/Entry/EntryLatestBuys.vue
+++ b/src/pages/Entry/EntryLatestBuys.vue
@@ -88,6 +88,7 @@ const getInputEvents = (col) => {
return col.columnFilter.type === 'select'
? { 'update:modelValue': () => applyColumnFilter(col) }
: {
+ 'update:modelValue': () => applyColumnFilter(col),
'keyup.enter': () => applyColumnFilter(col),
};
};