forked from verdnatura/salix-front
Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 6480-improveCard
This commit is contained in:
commit
b71068ac64
|
@ -26,7 +26,7 @@ const value = computed({
|
|||
emit('update:modelValue', value);
|
||||
},
|
||||
});
|
||||
|
||||
const hover = ref(false);
|
||||
const styleAttrs = computed(() => {
|
||||
return $props.isOutlined
|
||||
? {
|
||||
|
@ -41,6 +41,10 @@ const onEnterPress = () => {
|
|||
emit('keyup.enter');
|
||||
};
|
||||
|
||||
const handleValue = (val = null) => {
|
||||
value.value = val;
|
||||
};
|
||||
|
||||
const focus = () => {
|
||||
vnInputRef.value.focus();
|
||||
};
|
||||
|
@ -51,20 +55,33 @@ defineExpose({
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QInput
|
||||
ref="vnInputRef"
|
||||
v-model="value"
|
||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||
type="text"
|
||||
:class="{ required: $attrs.required }"
|
||||
@keyup.enter="onEnterPress()"
|
||||
<div
|
||||
@mouseover="hover = true"
|
||||
@mouseleave="hover = 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()"
|
||||
:clearable="false"
|
||||
>
|
||||
<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="hover && value"
|
||||
@click="handleValue(null)"
|
||||
></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
import isValidDate from "filters/isValidDate";
|
||||
import isValidDate from 'filters/isValidDate';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
|
@ -17,6 +16,8 @@ const props = defineProps({
|
|||
default: false,
|
||||
},
|
||||
});
|
||||
const hover = ref(false);
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
const joinDateAndTime = (date, time) => {
|
||||
|
@ -77,30 +78,39 @@ const styleAttrs = computed(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<VnInput
|
||||
class="vn-input-date"
|
||||
:model-value="displayDate(value)"
|
||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||
readonly
|
||||
@click="isPopupOpen = true"
|
||||
>
|
||||
<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>
|
||||
</VnInput>
|
||||
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||
<QInput
|
||||
class="vn-input-date"
|
||||
readonly
|
||||
:model-value="displayDate(value)"
|
||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||
@click="isPopupOpen = true"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon
|
||||
name="close"
|
||||
size="xs"
|
||||
v-if="hover && 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"
|
||||
:model-value="formatDate(value)"
|
||||
@update:model-value="onDateUpdate"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import isValidDate from 'filters/isValidDate';
|
||||
import VnInput from "components/common/VnInput.vue";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
|
@ -20,6 +19,7 @@ const props = defineProps({
|
|||
});
|
||||
const { t } = useI18n();
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
const value = computed({
|
||||
get() {
|
||||
return props.modelValue;
|
||||
|
@ -27,12 +27,7 @@ const value = computed({
|
|||
set(value) {
|
||||
const [hours, minutes] = value.split(':');
|
||||
const date = new Date(props.modelValue);
|
||||
date.setHours(
|
||||
Number.parseInt(hours) || 0,
|
||||
Number.parseInt(minutes) || 0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
date.setHours(Number.parseInt(hours) || 0, Number.parseInt(minutes) || 0, 0, 0);
|
||||
emit('update:modelValue', value ? date.toISOString() : null);
|
||||
},
|
||||
});
|
||||
|
@ -71,7 +66,7 @@ const styleAttrs = computed(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<VnInput
|
||||
<QInput
|
||||
class="vn-input-time"
|
||||
readonly
|
||||
:model-value="formatTime(value)"
|
||||
|
@ -79,7 +74,7 @@ const styleAttrs = computed(() => {
|
|||
@click="isPopupOpen = true"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QIcon name="schedule" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
v-model="isPopupOpen"
|
||||
cover
|
||||
|
@ -111,7 +106,7 @@ const styleAttrs = computed(() => {
|
|||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
</QInput>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
@ -1095,6 +1095,7 @@ item:
|
|||
list: List
|
||||
diary: Diary
|
||||
tags: Tags
|
||||
wasteBreakdown: Waste breakdown
|
||||
itemCreate: New item
|
||||
descriptor:
|
||||
item: Item
|
||||
|
|
|
@ -1094,6 +1094,7 @@ item:
|
|||
list: Listado
|
||||
diary: Histórico
|
||||
tags: Etiquetas
|
||||
wasteBreakdown: Deglose de mermas
|
||||
itemCreate: Nuevo artículo
|
||||
descriptor:
|
||||
item: Artículo
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, onUpdated } from 'vue';
|
||||
import { ref, computed, onUpdated } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
|
@ -28,12 +27,6 @@ const entityId = computed(() => $props.id || route.params.id);
|
|||
|
||||
const summaryRef = ref();
|
||||
const supplier = ref();
|
||||
const supplierUrl = ref();
|
||||
|
||||
onMounted(async () => {
|
||||
await roleState.fetch();
|
||||
supplierUrl.value = (await getUrl('supplier/')) + entityId.value;
|
||||
});
|
||||
|
||||
async function setData(data) {
|
||||
if (data) {
|
||||
|
@ -44,6 +37,10 @@ async function setData(data) {
|
|||
const isAdministrative = computed(() => {
|
||||
return roleState.hasAny(['administrative']);
|
||||
});
|
||||
|
||||
function getUrl(section) {
|
||||
return isAdministrative.value && `#/supplier/${entityId.value}/${section}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -58,15 +55,10 @@ const isAdministrative = computed(() => {
|
|||
|
||||
<template #body>
|
||||
<QCard class="vn-one">
|
||||
<router-link
|
||||
v-if="isAdministrative"
|
||||
class="header link"
|
||||
:to="{ name: 'SupplierBasicData', params: { id: entityId } }"
|
||||
>
|
||||
{{ t('globals.summary.basicData') }}
|
||||
<QIcon name="open_in_new" />
|
||||
</router-link>
|
||||
<span v-else> {{ t('globals.summary.basicData') }}</span>
|
||||
<VnTitle
|
||||
:url="getUrl('basic-data')"
|
||||
:text="t('globals.summary.basicData')"
|
||||
/>
|
||||
<VnLv label="Id" :value="supplier.id" />
|
||||
<VnLv label="Alias" :value="supplier.nickname" />
|
||||
<VnLv :label="t('supplier.summary.responsible')">
|
||||
|
@ -94,15 +86,10 @@ const isAdministrative = computed(() => {
|
|||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<router-link
|
||||
v-if="isAdministrative"
|
||||
class="header link"
|
||||
:to="{ name: 'SupplierBillingData', params: { id: entityId } }"
|
||||
>
|
||||
{{ t('supplier.summary.billingData') }}
|
||||
<QIcon name="open_in_new" />
|
||||
</router-link>
|
||||
<span v-else> {{ t('supplier.summary.billingData') }}</span>
|
||||
<VnTitle
|
||||
:url="getUrl('billing-data')"
|
||||
:text="t('supplier.summary.billingData')"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.payMethod')"
|
||||
:value="supplier.payMethod?.name"
|
||||
|
@ -117,15 +104,10 @@ const isAdministrative = computed(() => {
|
|||
<VnLv :label="t('supplier.summary.account')" :value="supplier.account" />
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<router-link
|
||||
v-if="isAdministrative"
|
||||
class="header link"
|
||||
:to="{ name: 'SupplierFiscalData', params: { id: entityId } }"
|
||||
>
|
||||
{{ t('supplier.summary.fiscalData') }}
|
||||
<QIcon name="open_in_new" />
|
||||
</router-link>
|
||||
<span v-else> {{ t('supplier.summary.fiscalData') }}</span>
|
||||
<VnTitle
|
||||
:url="getUrl('fiscal-data')"
|
||||
:text="t('supplier.summary.fiscalData')"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.sageTaxType')"
|
||||
:value="supplier.sageTaxType?.vat"
|
||||
|
@ -152,15 +134,10 @@ const isAdministrative = computed(() => {
|
|||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<router-link
|
||||
v-if="isAdministrative"
|
||||
class="header link"
|
||||
:to="{ name: 'SupplierFiscalData', params: { id: entityId } }"
|
||||
>
|
||||
{{ t('supplier.summary.fiscalAddress') }}
|
||||
<QIcon name="open_in_new" />
|
||||
</router-link>
|
||||
<span v-else> {{ t('supplier.summary.fiscalAddress') }}</span>
|
||||
<VnTitle
|
||||
:url="getUrl('fiscal-data')"
|
||||
:text="t('supplier.summary.fiscalAddress')"
|
||||
/>
|
||||
<VnLv :label="t('supplier.summary.socialName')" :value="supplier.name" />
|
||||
<VnLv :label="t('supplier.summary.taxNumber')" :value="supplier.nif" />
|
||||
<VnLv :label="t('supplier.summary.street')" :value="supplier.street" />
|
||||
|
|
|
@ -10,7 +10,7 @@ export default {
|
|||
component: RouterView,
|
||||
redirect: { name: 'ItemMain' },
|
||||
menus: {
|
||||
main: ['ItemList'],
|
||||
main: ['ItemList', 'WasteBreakdown'],
|
||||
card: ['ItemBasicData'],
|
||||
},
|
||||
children: [
|
||||
|
@ -37,6 +37,19 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Item/ItemCreate.vue'),
|
||||
},
|
||||
{
|
||||
path: 'waste-breakdown',
|
||||
name: 'WasteBreakdown',
|
||||
meta: {
|
||||
title: 'wasteBreakdown',
|
||||
icon: 'vn:claims',
|
||||
},
|
||||
beforeEnter: (to, from, next) => {
|
||||
next({ name: 'ItemList' });
|
||||
window.location.href =
|
||||
'https://grafana.verdnatura.es/d/TTNXQAxVk';
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,48 +1,64 @@
|
|||
const locationOptions ='[role="listbox"] > div.q-virtual-scroll__content > .q-item'
|
||||
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';
|
||||
describe('Create', () => {
|
||||
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');
|
||||
cy.visit('/#/worker/create');
|
||||
cy.waitForElement('.q-card');
|
||||
});
|
||||
it('Show all options', function() {
|
||||
it('Show all options', function () {
|
||||
cy.get(inputLocation).click();
|
||||
cy.get(locationOptions).should('have.length.at.least',5);
|
||||
cy.get(locationOptions).should('have.length.at.least', 5);
|
||||
});
|
||||
it('input filter location as "al"', function() {
|
||||
it('input filter location as "al"', function () {
|
||||
cy.get(inputLocation).click();
|
||||
cy.get(inputLocation).clear();
|
||||
cy.get(inputLocation).type('al');
|
||||
cy.get(locationOptions).should('have.length.at.least',3);
|
||||
cy.get(locationOptions).should('have.length.at.least', 3);
|
||||
});
|
||||
it('input filter location as "ecuador"', function() {
|
||||
it('input filter location as "ecuador"', function () {
|
||||
cy.get(inputLocation).click();
|
||||
cy.get(inputLocation).clear();
|
||||
cy.get(inputLocation).type('ecuador');
|
||||
cy.get(locationOptions).should('have.length.at.least',1);
|
||||
cy.get(locationOptions).should('have.length.at.least', 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();
|
||||
});
|
||||
});
|
||||
describe('Fiscal-data',()=>{
|
||||
describe('Fiscal-data', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('developer');
|
||||
cy.visit('/#/supplier/567/fiscal-data', {timeout: 2000});
|
||||
cy.visit('/#/supplier/567/fiscal-data', { timeout: 2000 });
|
||||
cy.waitForElement('.q-card');
|
||||
});
|
||||
it('Create postCode', function() {
|
||||
cy.get(':nth-child(6) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(3) > .q-icon').click();
|
||||
it('Create postCode', function () {
|
||||
cy.get(
|
||||
':nth-child(6) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(3) > .q-icon'
|
||||
).click();
|
||||
cy.get(' .q-card > h1').should('have.text', 'New postcode');
|
||||
cy.get('.q-card > :nth-child(4) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(1) > input').clear('12');
|
||||
cy.get('.q-card > :nth-child(4) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(1) > input').type('1234453');
|
||||
cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(4) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ', 'Valencia');
|
||||
cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control ', 'Province one');
|
||||
cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ', 'España');
|
||||
cy.get(
|
||||
'.q-card > :nth-child(4) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(1) > input'
|
||||
).clear('12');
|
||||
cy.get(
|
||||
'.q-card > :nth-child(4) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(1) > input'
|
||||
).type('1234453');
|
||||
cy.selectOption(
|
||||
'.q-dialog__inner > .column > #formModel > .q-card > :nth-child(4) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ',
|
||||
'Valencia'
|
||||
);
|
||||
cy.selectOption(
|
||||
'.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control ',
|
||||
'Province one'
|
||||
);
|
||||
cy.selectOption(
|
||||
'.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ',
|
||||
'España'
|
||||
);
|
||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -72,6 +72,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();
|
||||
});
|
||||
|
@ -183,11 +184,11 @@ Cypress.Commands.add('closeSideMenu', (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);
|
||||
|
|
Loading…
Reference in New Issue