0
0
Fork 0

Merge pull request 'feat: refs #7271 basicData and Log' (!369) from 7271-EndZoneMigration into dev

Reviewed-on: verdnatura/salix-front#369
Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
This commit is contained in:
Javier Segarra 2024-05-14 09:49:20 +00:00
commit 19bdd4fc36
6 changed files with 96 additions and 63 deletions

View File

@ -29,7 +29,7 @@ module.exports = configure(function (/* ctx */) {
// app boot file (/src/boot) // app boot file (/src/boot)
// --> boot files are part of "main.js" // --> boot files are part of "main.js"
// https://v2.quasar.dev/quasar-cli/boot-files // https://v2.quasar.dev/quasar-cli/boot-files
boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar.defaults'], boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar', 'quasar.defaults'],
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
css: ['app.scss'], css: ['app.scss'],

View File

@ -127,9 +127,10 @@ const onProvinceCreated = async ({ name }, formData) => {
<CreateNewProvinceForm <CreateNewProvinceForm
@on-data-saved="onProvinceCreated($event, data)" @on-data-saved="onProvinceCreated($event, data)"
/> />
</template> </template> </VnSelectDialog
</VnSelectDialog> ></VnRow>
<VnSelect <VnRow class="row q-gutter-md q-mb-xl"
><VnSelect
:label="t('Country')" :label="t('Country')"
:options="countriesOptions" :options="countriesOptions"
hide-selected hide-selected

View File

@ -1,34 +1,24 @@
<script setup> <script setup>
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FormModel from 'src/components/FormModel.vue'; import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import { QCheckbox } from 'quasar'; import { QCheckbox } from 'quasar';
import VnInputTime from 'src/components/common/VnInputTime.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const zoneFilter = {
include: [
{
relation: 'agency',
scope: {
fields: ['name'],
include: { relation: 'agencyModeFk', scope: { fields: ['id'] } },
},
},
{ relation: 'sip', scope: { fields: ['extension', 'secret'] } },
{ relation: 'department', scope: { include: { relation: 'department' } } },
{ relation: 'client', scope: { fields: ['phone'] } },
],
};
const agencyFilter = { const agencyFilter = {
fields: ['id', 'name'], fields: ['id', 'name'],
order: 'name ASC', order: 'name ASC',
limit: 30, limit: 30,
}; };
const agencyOptions = ref([]);
</script> </script>
<template> <template>
@ -36,58 +26,90 @@ const agencyFilter = {
:filter="agencyFilter" :filter="agencyFilter"
@on-fetch="(data) => (agencyOptions = data)" @on-fetch="(data) => (agencyOptions = data)"
auto-load auto-load
url="agencies" url="AgencyModes/isActive"
/>
<FetchData
:filter="zoneFilter"
@on-fetch="(data) => (zoneOptions = data)"
auto-load
url="zones"
/> />
<FormModel <FormModel :url="`Zones/${route.params.id}`" auto-load model="zone">
:filter="zoneFilter" <template #form="{ data, validate }">
:url="`zone/${route.params.id}/basic-data`"
auto-load
model="Zone"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnInput :label="t('Name')" clearable v-model="data.zone.name" /> <VnInput :label="t('Name')" clearable v-model="data.name" />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.agency.name" :label="t('Agency')" clearable /> <VnSelect
<VnInput v-model="data.zone.itemMaxSize" :label="t('Max m³')" clearable /> option-label="name"
<VnInput v-model="data.zone.m3Max" :label="t('Maximum m³')" clearable /> option-value="id"
v-model="data.agencyModeFk"
:rules="validate('zone.agencyModeFk')"
:options="agencyOptions"
:label="t('Agency')"
emit-value
map-options
use-input
hide-bottom-space
/>
<VnInput
class="mw-10"
v-model="data.itemMaxSize"
:label="t('Max m³')"
clearable
type="number"
min="0"
/>
<VnInput
class="mw-10"
v-model="data.m3Max"
:label="t('Maximum m³')"
clearable
type="number"
min="0"
/>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnInput <VnInput
v-model="data.zone.travelingDays" v-model="data.travelingDays"
:label="t('Traveling days')" :label="t('Traveling days')"
clearable clearable
type="number"
min="0"
/> />
<VnInput v-model="data.zone.hour" :label="t('Closing')" clearable /> <VnInputTime v-model="data.hour" :label="t('Closing')" clearable />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.zone.price" :label="t('Price')" clearable />
<VnInput v-model="data.zone.bonus" :label="t('Bonus')" clearable />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnInput <VnInput
v-model="data.zone.inflation" v-model="data.price"
:label="t('Inflation')" :label="t('Price')"
type="number"
min="0"
clearable clearable
/> />
<QCheckbox v-model="data.zone.isVolumetric" :label="t('Volumetric')" /> <VnInput
v-model="data.bonus"
:label="t('Bonus')"
type="number"
min="0"
clearable
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.inflation" :label="t('Inflation')" clearable />
<QCheckbox
v-model="data.isVolumetric"
:label="t('Volumetric')"
:toggle-indeterminate="false"
/>
</VnRow> </VnRow>
</template> </template>
</FormModel> </FormModel>
</template> </template>
<style lang="scss" scoped>
.mw-10 {
max-width: 10vw;
}
</style>
<i18n> <i18n>
es: es:
Name: Nombre Name: Nombre

View File

@ -9,6 +9,7 @@ import { toTimeFormat } from 'src/filters/date';
import { toCurrency } from 'filters/index'; import { toCurrency } from 'filters/index';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
import ZoneDescriptorMenuItems from './ZoneDescriptorMenuItems.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -69,11 +70,10 @@ const setData = (entity) => {
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</template> </template>
<!-- <template #menu="{ entity }"> <template #menu="{ entity }">
<ZoneDescriptorMenuItems :zone="entity" /> <ZoneDescriptorMenuItems :zone="entity" />
</template> --> </template>
<template #body="{ entity }"> <template #body="{ entity }">
{{ console.log('entity', entity) }}
<VnLv :label="t('summary.agency')" :value="entity.agencyMode.name" /> <VnLv :label="t('summary.agency')" :value="entity.agencyMode.name" />
<VnLv :label="t('summary.closeHour')" :value="toTimeFormat(entity.hour)" /> <VnLv :label="t('summary.closeHour')" :value="toTimeFormat(entity.hour)" />
<VnLv :label="t('summary.travelingDays')" :value="entity.travelingDays" /> <VnLv :label="t('summary.travelingDays')" :value="entity.travelingDays" />

View File

@ -12,7 +12,7 @@ export default {
redirect: { name: 'ZoneMain' }, redirect: { name: 'ZoneMain' },
menus: { menus: {
main: ['ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'], main: ['ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'],
card: ['ZoneBasicData'], card: ['ZoneBasicData', 'ZoneHistory'],
}, },
children: [ children: [
{ {
@ -83,6 +83,15 @@ export default {
}, },
component: () => import('src/pages/Zone/Card/ZoneBasicData.vue'), component: () => import('src/pages/Zone/Card/ZoneBasicData.vue'),
}, },
{
name: 'ZoneHistory',
path: 'history',
meta: {
title: 'log',
icon: 'history',
},
component: () => import('src/pages/Zone/Card/ZoneLog.vue'),
},
// { // {
// path: '/zone/delivery', // path: '/zone/delivery',
// name: 'ZoneDeliveryMain', // name: 'ZoneDeliveryMain',

View File

@ -1,13 +1,13 @@
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('VnLocation', () => {
const dialogInputs = '.q-dialog label input'; const dialogInputs = '.q-dialog label input';
describe('Create', () => { describe('Worker Create', () => {
const inputLocation = const inputLocation =
'.q-form .q-card> :nth-child(3) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control'; '.q-form .q-card > :nth-child(3) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('/#/worker/create'); cy.visit('/#/worker/create', { timeout: 5000 });
cy.waitForElement('.q-card'); cy.waitForElement('.q-card');
}); });
it('Show all options', function () { it('Show all options', function () {
@ -25,34 +25,35 @@ describe('VnLocation', () => {
cy.get(inputLocation).clear(); cy.get(inputLocation).clear();
cy.get(inputLocation).type('ecuador'); 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(
cy.get(inputLocation + '> :nth-child(2) > .q-icon').click(); '.q-form .q-card > :nth-child(3) > .q-field > .q-field__inner > .q-field__control > :nth-child(3) > .q-icon'
).click();
}); });
}); });
describe('Fiscal-data', () => { describe('Fiscal-data', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('/#/supplier/567/fiscal-data', { timeout: 2000 }); cy.visit('/#/supplier/567/fiscal-data', { timeout: 7000 });
cy.waitForElement('.q-card'); cy.waitForElement('.q-form');
}); });
it('Create postCode', function () { it('Create postCode', function () {
cy.get( cy.get(
':nth-child(6) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(3) > .q-icon' ':nth-child(6) > .q-field > .q-field__inner > .q-field__control > :nth-child(3) > .q-icon'
).click(); ).click();
cy.get('.q-card > h1').should('have.text', 'New postcode'); cy.get('.q-card > h1').should('have.text', 'New postcode');
cy.get(dialogInputs).eq(0).clear('12'); cy.get(dialogInputs).eq(0).clear('12');
cy.get(dialogInputs).eq(0).type('1234453'); cy.get(dialogInputs).eq(0).type('1234453');
cy.selectOption( cy.selectOption(
'.q-dialog__inner > .column > #formModel > .q-card > :nth-child(4) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ', '.q-dialog__inner > .column > #formModel > .q-card > :nth-child(4) > .q-select > .q-field__inner > .q-field__control ',
'Valencia' 'Valencia'
); );
cy.selectOption( cy.selectOption(
'.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control ', '.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > .q-select > .q-field__inner > .q-field__control ',
'Province one' 'Province one'
); );
cy.selectOption( cy.selectOption(
'.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ', '.q-dialog__inner > .column > #formModel > .q-card > :nth-child(6) > .q-select > .q-field__inner > .q-field__control ',
'España' 'España'
); );
cy.get('.q-mt-lg > .q-btn--standard').click(); cy.get('.q-mt-lg > .q-btn--standard').click();