Merge pull request 'feat: refs #7271 basicData and Log' (!369) from 7271-EndZoneMigration into dev
gitea/salix-front/pipeline/head There was a failure building this commit Details

Reviewed-on: #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)
// --> boot files are part of "main.js"
// 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
css: ['app.scss'],

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@ export default {
redirect: { name: 'ZoneMain' },
menus: {
main: ['ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'],
card: ['ZoneBasicData'],
card: ['ZoneBasicData', 'ZoneHistory'],
},
children: [
{
@ -83,6 +83,15 @@ export default {
},
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',
// name: 'ZoneDeliveryMain',

View File

@ -1,13 +1,13 @@
const locationOptions = '[role="listbox"] > div.q-virtual-scroll__content > .q-item';
describe('VnLocation', () => {
const dialogInputs = '.q-dialog label input';
describe('Create', () => {
describe('Worker Create', () => {
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(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/worker/create');
cy.visit('/#/worker/create', { timeout: 5000 });
cy.waitForElement('.q-card');
});
it('Show all options', function () {
@ -25,34 +25,35 @@ describe('VnLocation', () => {
cy.get(inputLocation).clear();
cy.get(inputLocation).type('ecuador');
cy.get(locationOptions).should('have.length.at.least', 1);
cy.get(`${locationOptions}:nth-child(1)`).click();
cy.get(inputLocation + '> :nth-child(2) > .q-icon').click();
cy.get(
'.q-form .q-card > :nth-child(3) > .q-field > .q-field__inner > .q-field__control > :nth-child(3) > .q-icon'
).click();
});
});
describe('Fiscal-data', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/supplier/567/fiscal-data', { timeout: 2000 });
cy.waitForElement('.q-card');
cy.visit('/#/supplier/567/fiscal-data', { timeout: 7000 });
cy.waitForElement('.q-form');
});
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'
':nth-child(6) > .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(dialogInputs).eq(0).clear('12');
cy.get(dialogInputs).eq(0).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 ',
'.q-dialog__inner > .column > #formModel > .q-card > :nth-child(4) > .q-select > .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 ',
'.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > .q-select > .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 ',
'.q-dialog__inner > .column > #formModel > .q-card > :nth-child(6) > .q-select > .q-field__inner > .q-field__control ',
'España'
);
cy.get('.q-mt-lg > .q-btn--standard').click();