Merge branch 'dev' into 8648-addTestCasesInRoadmapListTest
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Alex Moreno 2025-03-07 11:13:23 +00:00
commit 3f21c61bef
127 changed files with 2815 additions and 1671 deletions

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ yarn-error.log*
# Cypress directories and files
/test/cypress/videos
/test/cypress/screenshots
/junit
# VitePress directories and files
/docs/.vitepress/cache

View File

@ -1,3 +1,41 @@
# Version 25.08 - 2025-03-04
### Added 🆕
- feat: add order for table (origin/8681_ticketAdvance_updates) by:Javier Segarra
- feat: detect when is descriptor proxy by:Javier Segarra
- feat: refs #7356 update CrudModel by:Javier Segarra
- feat: refs #8242 remove teleport by:Javier Segarra
- feat: refs #8242 use stateStore by:Javier Segarra
- fix: fixed negative bases style by:Jon
- fix: fixed style when clicking on icons by:Jon
- refactor: refs #6897 remove debug logs and unused style (origin/6897-fixSomeCaus) by:pablone
- style: refs #7356 eslint format by:Javier Segarra
### Changed 📦
- perf: refs #7356 minor changes (origin/7356_ticketService) by:Javier Segarra
- refactor: refs #6897 remove debug logs and unused style (origin/6897-fixSomeCaus) by:pablone
- refactor: refs #6897 update component props and attributes for consistency and improved functionality (origin/6897-fixMinorIssues) by:pablone
- refactor: refs #6897 update component props and improve UI handling in Entry pages by:pablone
- refactor: refs #6897 update VnTable components for improved value handling and UI adjustments (origin/6897-minorFixes) by:pablone
- refactor: refs #8697 simplify date handling in ItemDiary component by:pablone
### Fixed 🛠️
- fix: add datakey by:Javier Segarra
- fix: fixed account descriptor menu and created e2e by:Jon
- fix: fixed negative bases style by:Jon
- fix: fixed style when clicking on icons by:Jon
- fix: refs #6553 workerBusiness (origin/6553-fixWorkerBusinessV2) by:carlossa
- fix: refs #6553 workerBusiness v3 by:carlossa
- fix: refs #6897 prevent default event behavior in autocompleteExpense function by:pablone
- fix: refs #7356 chaining params by:Javier Segarra
- fix: refs #7356 ticketService by:Javier Segarra
- fix: refs #8242 workerDepartmentTree bug (origin/8242_leftMenu_responsive) by:Javier Segarra
- fix: workerBasicData by:carlossa
- Revert "revert 1015acefb7e400be2d8b5958dba69b4d98276b34" (origin/fix_revert_revert, fix_revert_revert) by:alexm
# Version 25.06 - 2025-02-18
### Added 🆕

13
Jenkinsfile vendored
View File

@ -26,6 +26,7 @@ node {
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
echo "NODE_NAME: ${env.NODE_NAME}"
echo "WORKSPACE: ${env.WORKSPACE}"
echo "CHANGE_TARGET: ${env.CHANGE_TARGET}"
configFileProvider([
configFile(fileId: 'salix-front.properties',
@ -107,18 +108,22 @@ pipeline {
}
stage('E2E') {
environment {
CREDENTIALS = credentials('docker-registry')
CREDS = credentials('docker-registry')
COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}"
COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ."
}
steps {
script {
sh 'rm junit/e2e-*.xml || true'
sh 'rm -f junit/e2e-*.xml'
env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev'
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
sh 'cypress run --browser chromium || true'
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
sh 'sh test/cypress/cypressParallel.sh 3'
}
}
}

View File

@ -1,13 +1,18 @@
import { defineConfig } from 'cypress';
let urlHost, reporter, reporterOptions;
let urlHost, reporter, reporterOptions, timeouts;
if (process.env.CI) {
urlHost = 'front';
reporter = 'junit';
reporterOptions = {
mochaFile: 'junit/e2e-[hash].xml',
toConsole: false,
};
timeouts = {
defaultCommandTimeout: 30000,
requestTimeout: 30000,
responseTimeout: 60000,
pageLoadTimeout: 60000,
};
} else {
urlHost = 'localhost';
@ -20,17 +25,19 @@ if (process.env.CI) {
reportDir: 'test/cypress/reports',
inlineAssets: true,
};
timeouts = {
defaultCommandTimeout: 10000,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
};
}
export default defineConfig({
e2e: {
baseUrl: `http://${urlHost}:9000`,
experimentalStudio: false,
defaultCommandTimeout: 10000,
trashAssetsBeforeRuns: false,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
defaultBrowser: 'chromium',
fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots',
@ -50,8 +57,8 @@ export default defineConfig({
},
viewportWidth: 1280,
viewportHeight: 720,
...timeouts,
includeShadowDom: true,
waitForAnimations: true,
},
experimentalMemoryManagement: true,
defaultCommandTimeout: 10000,
numTestsKeptInMemory: 2,
});

View File

@ -39,7 +39,7 @@ ENV PNPM_HOME="/home/app/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN pnpm setup \
&& pnpm install --global cypress@13.6.6 \
&& pnpm install --global cypress@14.1.0 \
&& cypress install
WORKDIR /app

View File

@ -1,6 +1,6 @@
{
"name": "salix-front",
"version": "25.10.0",
"version": "25.12.0",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",
@ -13,6 +13,8 @@
"format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
"test:e2e": "cypress open",
"test:e2e:ci": "npm run resetDatabase && cd ../salix-front && cypress run",
"test:e2e:parallel": "bash ./test/cypress/cypressParallel.sh",
"test:e2e:summary": "bash ./test/cypress/summary.sh",
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
"test:front": "vitest",
"test:front:ci": "vitest run",
@ -47,18 +49,20 @@
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
"@vue/test-utils": "^2.4.4",
"autoprefixer": "^10.4.14",
"cypress": "^13.6.6",
"cypress": "^14.1.0",
"cypress-mochawesome-reporter": "^3.8.2",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-vue": "^9.32.0",
"husky": "^8.0.0",
"mocha": "^11.1.0",
"postcss": "^8.4.23",
"prettier": "^3.4.2",
"sass": "^1.83.4",
"vitepress": "^1.6.3",
"vitest": "^0.34.0"
"vitest": "^0.34.0",
"xunit-viewer": "^10.6.1"
},
"engines": {
"node": "^20 || ^18 || ^16",
@ -71,4 +75,4 @@
"vite": "^6.0.11",
"vitest": "^0.31.1"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -124,7 +124,7 @@ const selectTravel = ({ id }) => {
<FetchData
url="AgencyModes"
@on-fetch="(data) => (agenciesOptions = data)"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
auto-load
/>
<FetchData

View File

@ -57,7 +57,7 @@ const refresh = () => window.location.reload();
:class="{
'no-visible': !stateQuery.isLoading().value,
}"
size="xs"
size="sm"
data-cy="loading-spinner"
/>
<QSpace />

View File

@ -12,20 +12,31 @@ defineProps({ row: { type: Object, required: true } });
>
<QIcon name="vn:claims" size="xs">
<QTooltip>
{{ t('ticketSale.claim') }}:
{{ $t('ticketSale.claim') }}:
{{ row.claim?.claimFk }}
</QTooltip>
</QIcon>
</router-link>
<QIcon
v-if="row?.risk"
v-if="row?.reserved"
color="primary"
name="vn:reserva"
size="xs"
data-cy="ticketSaleReservedIcon"
>
<QTooltip>
{{ t('ticketSale.reserved') }}
</QTooltip>
</QIcon>
<QIcon
v-if="row?.hasRisk"
name="vn:risk"
:color="row.hasHighRisk ? 'negative' : 'primary'"
size="xs"
>
<QTooltip>
{{ $t('salesTicketsTable.risk') }}:
{{ toCurrency(row.risk - row.credit) }}
{{ toCurrency(row.risk - (row.credit ?? 0)) }}
</QTooltip>
</QIcon>
<QIcon
@ -67,12 +78,7 @@ defineProps({ row: { type: Object, required: true } });
>
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
</QIcon>
<QIcon
v-if="row?.isTaxDataChecked !== 0"
name="vn:no036"
color="primary"
size="xs"
>
<QIcon v-if="row?.isTaxDataChecked" name="vn:no036" color="primary" size="xs">
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
</QIcon>
<QIcon v-if="row?.isFreezed" name="vn:frozen" color="primary" size="xs">

View File

@ -87,7 +87,7 @@ const makeInvoice = async () => {
(data) => (
(rectificativeTypeOptions = data),
(transferInvoiceParams.cplusRectificationTypeFk = data.filter(
(type) => type.description == 'I Por diferencias'
(type) => type.description == 'I Por diferencias',
)[0].id)
)
"
@ -100,7 +100,7 @@ const makeInvoice = async () => {
(data) => (
(siiTypeInvoiceOutsOptions = data),
(transferInvoiceParams.siiTypeInvoiceOutFk = data.filter(
(type) => type.code == 'R4'
(type) => type.code == 'R4',
)[0].id)
)
"
@ -122,7 +122,6 @@ const makeInvoice = async () => {
<VnRow>
<VnSelect
:label="t('Client')"
:options="clientsOptions"
hide-selected
option-label="name"
option-value="id"

View File

@ -55,6 +55,10 @@ const $props = defineProps({
type: [Function, Boolean],
default: null,
},
rowCtrlClick: {
type: [Function, Boolean],
default: null,
},
redirect: {
type: String,
default: null,

View File

@ -56,7 +56,12 @@ async function confirm() {
{{ t('The notification will be sent to the following address') }}
</QCardSection>
<QCardSection class="q-pt-none">
<VnInput v-model="address" is-outlined autofocus />
<VnInput
v-model="address"
is-outlined
autofocus
data-cy="SendEmailNotifiactionDialogInput"
/>
</QCardSection>
<QCardActions align="right">
<QBtn :label="t('globals.cancel')" color="primary" flat v-close-popup />

View File

@ -1,12 +1,9 @@
<script setup>
import { nextTick, ref, watch } from 'vue';
import { QInput } from 'quasar';
import { nextTick, ref } from 'vue';
import VnInput from './VnInput.vue';
import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
const $props = defineProps({
modelValue: {
type: String,
default: '',
},
insertable: {
type: Boolean,
default: false,
@ -14,70 +11,25 @@ const $props = defineProps({
});
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
const model = defineModel({ prop: 'modelValue' });
const inputRef = ref(false);
let internalValue = ref($props.modelValue);
watch(
() => $props.modelValue,
(newVal) => {
internalValue.value = newVal;
}
);
watch(
() => internalValue.value,
(newVal) => {
emit('update:modelValue', newVal);
accountShortToStandard();
}
);
const handleKeydown = (e) => {
if (e.key === 'Backspace') return;
if (e.key === '.') {
accountShortToStandard();
// TODO: Fix this setTimeout, with nextTick doesn't work
setTimeout(() => {
setCursorPosition(0, e.target);
}, 1);
return;
}
if ($props.insertable && e.key.match(/[0-9]/)) {
handleInsertMode(e);
}
};
function setCursorPosition(pos, el = vnInputRef.value) {
el.focus();
el.setSelectionRange(pos, pos);
function setCursorPosition(pos) {
const input = inputRef.value.vnInputRef.$el.querySelector('input');
input.focus();
input.setSelectionRange(pos, pos);
}
const vnInputRef = ref(false);
const handleInsertMode = (e) => {
e.preventDefault();
const input = e.target;
const cursorPos = input.selectionStart;
const { maxlength } = vnInputRef.value;
let currentValue = internalValue.value;
if (!currentValue) currentValue = e.key;
const newValue = e.key;
if (newValue && !isNaN(newValue) && cursorPos < maxlength) {
internalValue.value =
currentValue.substring(0, cursorPos) +
newValue +
currentValue.substring(cursorPos + 1);
}
nextTick(() => {
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
});
};
function accountShortToStandard() {
internalValue.value = internalValue.value?.replace(
'.',
'0'.repeat(11 - internalValue.value.length)
);
async function handleUpdateModel(val) {
model.value = val?.at(-1) === '.' ? useAccountShortToStandard(val) : val;
await nextTick(() => setCursorPosition(0));
}
</script>
<template>
<QInput @keydown="handleKeydown" ref="vnInputRef" v-model="internalValue" />
<VnInput
v-model="model"
ref="inputRef"
:insertable
@update:model-value="handleUpdateModel"
/>
</template>

View File

@ -83,7 +83,7 @@ const mixinRules = [
requiredFieldRule,
...($attrs.rules ?? []),
(val) => {
const { maxlength } = vnInputRef.value;
const maxlength = $props.maxlength;
if (maxlength && +val.length > maxlength)
return t(`maxLength`, { value: maxlength });
const { min, max } = vnInputRef.value.$attrs;
@ -108,7 +108,7 @@ const handleInsertMode = (e) => {
e.preventDefault();
const input = e.target;
const cursorPos = input.selectionStart;
const { maxlength } = vnInputRef.value;
const maxlength = $props.maxlength;
let currentValue = value.value;
if (!currentValue) currentValue = e.key;
const newValue = e.key;
@ -143,7 +143,7 @@ const handleUppercase = () => {
:rules="mixinRules"
:lazy-rules="true"
hide-bottom-space
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
:data-cy="($attrs['data-cy'] ?? $attrs.label) + '_input'"
>
<template #prepend v-if="$slots.prepend">
<slot name="prepend" />

View File

@ -302,6 +302,8 @@ defineExpose({ opts: myOptions, vnSelectRef });
function handleKeyDown(event) {
if (event.key === 'Tab' && !event.shiftKey) {
event.preventDefault();
const inputValue = vnSelectRef.value?.inputValue;
if (inputValue) {

View File

@ -132,7 +132,8 @@ const card = toRef(props, 'item');
display: flex;
flex-direction: column;
gap: 4px;
white-space: nowrap;
width: 192px;
p {
margin-bottom: 0;
}

View File

@ -18,20 +18,16 @@ import VnInput from 'components/common/VnInput.vue';
const emit = defineEmits(['onFetch']);
const originalAttrs = useAttrs();
const $attrs = computed(() => {
const { style, ...rest } = originalAttrs;
return rest;
});
const $attrs = useAttrs();
const isRequired = computed(() => {
return Object.keys($attrs).includes('required')
return Object.keys($attrs).includes('required');
});
const $props = defineProps({
url: { type: String, default: null },
saveUrl: {type: String, default: null},
saveUrl: { type: String, default: null },
userFilter: { type: Object, default: () => {} },
filter: { type: Object, default: () => {} },
body: { type: Object, default: () => {} },
addNote: { type: Boolean, default: false },
@ -65,7 +61,7 @@ async function insert() {
}
function confirmAndUpdate() {
if(!newNote.text && originalText)
if (!newNote.text && originalText)
quasar
.dialog({
component: VnConfirm,
@ -88,11 +84,17 @@ async function update() {
...body,
...{ notes: newNote.text },
};
await axios.patch(`${$props.saveUrl ?? `${$props.url}/${$props.body.workerFk}`}`, newBody);
await axios.patch(
`${$props.saveUrl ?? `${$props.url}/${$props.body.workerFk}`}`,
newBody,
);
}
onBeforeRouteLeave((to, from, next) => {
if ((newNote.text && !$props.justInput) || (newNote.text !== originalText) && $props.justInput)
if (
(newNote.text && !$props.justInput) ||
(newNote.text !== originalText && $props.justInput)
)
quasar.dialog({
component: VnConfirm,
componentProps: {
@ -104,12 +106,11 @@ onBeforeRouteLeave((to, from, next) => {
else next();
});
function fetchData([ data ]) {
function fetchData([data]) {
newNote.text = data?.notes;
originalText = data?.notes;
emit('onFetch', data);
}
</script>
<template>
<FetchData
@ -126,8 +127,8 @@ function fetchData([ data ]) {
@on-fetch="fetchData"
auto-load
/>
<QCard
class="q-pa-xs q-mb-lg full-width"
<QCard
class="q-pa-xs q-mb-lg full-width"
:class="{ 'just-input': $props.justInput }"
v-if="$props.addNote || $props.justInput"
>
@ -179,7 +180,8 @@ function fetchData([ data ]) {
:url="$props.url"
order="created DESC"
:limit="0"
:user-filter="$props.filter"
:user-filter="userFilter"
:filter="filter"
auto-load
ref="vnPaginateRef"
class="show"
@ -218,7 +220,7 @@ function fetchData([ data ]) {
>
{{
observationTypes.find(
(ot) => ot.id === note.observationTypeFk
(ot) => ot.id === note.observationTypeFk,
)?.description
}}
</QBadge>

View File

@ -33,6 +33,10 @@ const props = defineProps({
type: String,
default: '',
},
userFilter: {
type: Object,
default: null,
},
filter: {
type: Object,
default: null,

View File

@ -148,8 +148,7 @@ export function useArrayData(key, userOptions) {
}
async function applyFilter({ filter, params }, fetchOptions = {}) {
if (filter) store.userFilter = filter;
store.filter = {};
if (filter) store.filter = filter;
if (params) store.userParams = { ...params };
const response = await fetch(fetchOptions);
@ -245,7 +244,7 @@ export function useArrayData(key, userOptions) {
async function loadMore() {
if (!store.hasMoreData) return;
store.skip = store.limit * store.page;
store.skip = (store?.filter?.limit ?? store.limit) * store.page;
store.page += 1;
await fetch({ append: true });

View File

@ -337,5 +337,5 @@ input::-webkit-inner-spin-button {
}
.containerShrinked {
width: 80%;
width: 70%;
}

View File

@ -369,6 +369,7 @@ globals:
countryFk: Country
countryCodeFk: Country
companyFk: Company
nickname: Alias
model: Model
fuel: Fuel
active: Active

View File

@ -370,6 +370,7 @@ globals:
countryFk: País
countryCodeFk: País
companyFk: Empresa
nickname: Alias
errors:
statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor

View File

@ -1,5 +1,5 @@
<script setup>
import { computed, useAttrs } from 'vue';
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useState } from 'src/composables/useState';
import VnNotes from 'src/components/ui/VnNotes.vue';
@ -7,7 +7,6 @@ import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute();
const state = useState();
const user = state.getUser();
const $attrs = useAttrs();
const $props = defineProps({
id: { type: [Number, String], default: null },
@ -15,24 +14,21 @@ const $props = defineProps({
});
const claimId = computed(() => $props.id || route.params.id);
const claimFilter = computed(() => {
return {
where: { claimFk: claimId.value },
fields: ['id', 'created', 'workerFk', 'text'],
include: {
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName'],
include: {
relation: 'user',
scope: {
fields: ['id', 'nickname', 'name'],
},
const claimFilter = {
fields: ['id', 'created', 'workerFk', 'text'],
include: {
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName'],
include: {
relation: 'user',
scope: {
fields: ['id', 'nickname', 'name'],
},
},
},
};
});
},
};
const body = {
claimFk: claimId.value,
@ -43,7 +39,8 @@ const body = {
<VnNotes
url="claimObservations"
:add-note="$props.addNote"
:filter="claimFilter"
:user-filter="claimFilter"
:filter="{ where: { claimFk: claimId } }"
:body="body"
v-bind="$attrs"
style="overflow-y: auto"

View File

@ -210,6 +210,7 @@ function onDrag() {
class="all-pointer-events absolute delete-button zindex"
@click.stop="viewDeleteDms(index)"
round
:data-cy="`delete-button-${index+1}`"
/>
<QIcon
name="play_circle"
@ -227,6 +228,7 @@ function onDrag() {
class="rounded-borders cursor-pointer fit"
@click="openDialog(media.dmsFk)"
v-if="!media.isVideo"
:data-cy="`file-${index+1}`"
>
</QImg>
<video
@ -235,6 +237,7 @@ function onDrag() {
muted="muted"
v-if="media.isVideo"
@click="openDialog(media.dmsFk)"
:data-cy="`file-${index+1}`"
/>
</QCard>
</div>

View File

@ -118,14 +118,6 @@ const debtWarning = computed(() => {
>
<QTooltip>{{ t('Allowed substitution') }}</QTooltip>
</QIcon>
<QIcon
v-if="customer?.isFreezed"
name="vn:frozen"
size="xs"
color="primary"
>
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
</QIcon>
<QIcon
v-if="!entity.account?.active"
color="primary"
@ -150,6 +142,14 @@ const debtWarning = computed(() => {
>
<QTooltip>{{ t('customer.card.notChecked') }}</QTooltip>
</QIcon>
<QIcon
v-if="entity?.isFreezed"
name="vn:frozen"
size="xs"
color="primary"
>
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
</QIcon>
<QBtn
v-if="entity.unpaid"
flat
@ -163,13 +163,13 @@ const debtWarning = computed(() => {
<br />
{{
t('unpaidDated', {
dated: toDate(customer.unpaid?.dated),
dated: toDate(entity.unpaid?.dated),
})
}}
<br />
{{
t('unpaidAmount', {
amount: toCurrency(customer.unpaid?.amount),
amount: toCurrency(entity.unpaid?.amount),
})
}}
</QTooltip>

View File

@ -1,28 +1,15 @@
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute();
const noteFilter = computed(() => {
return {
order: 'created DESC',
where: {
clientFk: `${route.params.id}`,
},
};
});
</script>
<template>
<VnNotes
url="clientObservations"
:add-note="true"
:filter="noteFilter"
:body="{ clientFk: route.params.id }"
:filter="{ where: { clientFk: $route.params.id } }"
:body="{ clientFk: $route.params.id }"
style="overflow-y: auto"
:select-type="true"
required
order="created DESC"
/>
</template>

View File

@ -17,7 +17,21 @@ describe('getAddresses', () => {
expect(axios.get).toHaveBeenCalledWith(`Clients/${clientId}/addresses`, {
params: {
filter: JSON.stringify({
fields: ['nickname', 'street', 'city', 'id', 'isActive'],
include: [
{
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: ['id', 'agencyModeFk'],
},
},
},
},
],
fields: ['nickname', 'street', 'city', 'id', 'isActive', 'clientFk'],
where: { isActive: true },
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
}),

View File

@ -4,7 +4,21 @@ export async function getAddresses(clientId, _filter = {}) {
if (!clientId) return;
const filter = {
..._filter,
fields: ['nickname', 'street', 'city', 'id', 'isActive'],
include: [
{
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: ['id', 'agencyModeFk'],
},
},
},
},
],
fields: ['nickname', 'street', 'city', 'id', 'isActive', 'clientFk'],
where: { isActive: true },
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
};

View File

@ -145,6 +145,7 @@ const entryFilterPanel = ref();
v-model="params.agencyModeId"
@update:model-value="searchFn()"
url="AgencyModes"
sort-by="name ASC"
:fields="['id', 'name']"
hide-selected
dense

View File

@ -70,6 +70,7 @@ function ticketFilter(invoice) {
icon="vn:client"
color="primary"
:to="{ name: 'CustomerCard', params: { id: entity.client.id } }"
data-cy="invoiceOutDescriptorCustomerCard"
>
<QTooltip>{{ t('invoiceOut.card.customerCard') }}</QTooltip>
</QBtn>
@ -81,6 +82,7 @@ function ticketFilter(invoice) {
name: 'TicketList',
query: { table: ticketFilter(entity) },
}"
data-cy="invoiceOutDescriptorTicketList"
>
<QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip>
</QBtn>

View File

@ -185,7 +185,7 @@ watchEffect(selectedRows);
prefix="invoiceOut"
:array-data-props="{
url: 'InvoiceOuts/filter',
order: ['id DESC'],
order: 'id DESC',
}"
>
<template #advanced-menu>
@ -396,7 +396,6 @@ watchEffect(selectedRows);
:label="
t('invoiceOutList.tableVisibleColumns.taxArea')
"
:options="taxAreasOptions"
option-label="code"
option-value="code"
/>

View File

@ -20,7 +20,7 @@ const props = defineProps({
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
:un-removable-params="['from', 'to']"
:unremovable-params="['from', 'to']"
:hidden-tags="['from', 'to']"
>
<template #tags="{ tag, formatFn }">

View File

@ -94,6 +94,7 @@ const submit = async (rows) => {
icon="add_circle"
v-shortcut="'+'"
flat
data-cy="addBarcode_input"
>
<QTooltip>
{{ t('Add barcode') }}

View File

@ -226,7 +226,6 @@ const onDenyAccept = (_, responseData) => {
order="shipped ASC, isOk ASC"
:columns="columns"
:user-params="userParams"
:is-editable="true"
:right-search="false"
auto-load
:disable-option="{ card: true }"

View File

@ -17,6 +17,7 @@ import MonitorTicketFilter from './MonitorTicketFilter.vue';
import TicketProblems from 'src/components/TicketProblems.vue';
import VnDateBadge from 'src/components/common/VnDateBadge.vue';
import { useStateStore } from 'src/stores/useStateStore';
import useOpenURL from 'src/composables/useOpenURL';
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000;
const { t } = useI18n();
@ -321,8 +322,7 @@ const totalPriceColor = (ticket) => {
if (total > 0 && total < 50) return 'warning';
};
const openTab = (id) =>
window.open(`#/ticket/${id}/sale`, '_blank', 'noopener, noreferrer');
const openTab = (id) => useOpenURL(`#/ticket/${id}/sale`);
</script>
<template>
<FetchData
@ -397,6 +397,7 @@ const openTab = (id) =>
default-mode="table"
auto-load
:row-click="({ id }) => openTab(id)"
:row-ctrl-click="(_, { id }) => openTab(id)"
:disable-option="{ card: true }"
:user-params="{ from, to, scopeDays: 0 }"
>

View File

@ -22,7 +22,7 @@ salesTicketsTable:
notVisible: Not visible
purchaseRequest: Purchase request
clientFrozen: Client frozen
risk: Risk
risk: Excess risk
componentLack: Component lack
tooLittle: Ticket too little
identifier: Identifier

View File

@ -22,7 +22,7 @@ salesTicketsTable:
notVisible: No visible
purchaseRequest: Petición de compra
clientFrozen: Cliente congelado
risk: Riesgo
risk: Exceso de riesgo
componentLack: Faltan componentes
tooLittle: Ticket demasiado pequeño
identifier: Identificador

View File

@ -1,6 +1,6 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { computed, ref, onMounted } from 'vue';
import { computed, ref, onMounted, watch } from 'vue';
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
import { toDateTimeFormat } from 'src/filters/date';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
@ -16,6 +16,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSection from 'src/components/common/VnSection.vue';
import { getAddresses } from '../Customer/composables/getAddresses';
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
@ -24,6 +25,11 @@ const agencyList = ref([]);
const route = useRoute();
const addressOptions = ref([]);
const dataKey = 'OrderList';
const formInitialData = ref({
active: true,
addressId: null,
clientFk: null,
});
const columns = computed(() => [
{
@ -147,32 +153,47 @@ const columns = computed(() => [
],
},
]);
onMounted(() => {
if (!route.query.createForm) return;
const clientId = route.query.createForm;
const id = JSON.parse(clientId);
fetchClientAddress(id.clientFk);
onMounted(async () => {
if (!route.query) return;
if (route.query?.createForm) {
const query = JSON.parse(route.query?.createForm);
formInitialData.value = query;
await onClientSelected({ ...formInitialData.value, clientFk: query?.clientFk });
} else if (route.query?.table) {
const query = JSON.parse(route.query?.table);
const clientFk = query?.clientFk;
if (clientFk) await onClientSelected({ clientFk });
}
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
});
async function fetchClientAddress(id, formData = {}) {
const { data } = await axios.get(`Clients/${id}/addresses`, {
params: {
filter: JSON.stringify({
include: [
{
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
},
},
],
order: ['isActive DESC'],
}),
},
});
watch(
() => route.query.table,
async (newValue) => {
if (newValue) {
const clientFk = +JSON.parse(newValue)?.clientFk;
if (clientFk) await onClientSelected({ clientFk });
if (tableRef.value)
tableRef.value.create.formInitialData = formInitialData.value;
}
},
{ immediate: true },
);
async function onClientSelected({ clientFk }, formData = {}) {
if (!clientFk) {
addressOptions.value = [];
formData.defaultAddressFk = null;
formData.addressId = null;
return;
}
const { data } = await getAddresses(clientFk);
addressOptions.value = data;
formData.addressId = data[0].client.defaultAddressFk;
fetchAgencies(formData);
formData.defaultAddressFk = data[0].client.defaultAddressFk;
formData.addressId = formData.defaultAddressFk;
formInitialData.value = { addressId: formData.addressId, clientFk };
await fetchAgencies(formData);
}
async function fetchAgencies({ landed, addressId }) {
@ -181,7 +202,7 @@ async function fetchAgencies({ landed, addressId }) {
const { data } = await axios.get('Agencies/landsThatDay', {
params: {
filter: JSON.stringify({
order: ['agencyMode DESC', 'agencyModeFk ASC'],
order: ['name ASC', 'agencyMode DESC', 'agencyModeFk ASC'],
}),
addressFk: addressId,
landed,
@ -224,11 +245,7 @@ const getDateColor = (date) => {
onDataSaved: (url) => {
tableRef.redirect(`${url}/catalog`);
},
formInitialData: {
active: true,
addressId: null,
clientFk: null,
},
formInitialData,
}"
:user-params="{ showEmpty: false }"
:columns="columns"
@ -260,7 +277,9 @@ const getDateColor = (date) => {
:include="{ relation: 'addresses' }"
v-model="data.clientFk"
:label="t('module.customer')"
@update:model-value="(id) => fetchClientAddress(id, data)"
@update:model-value="
(id) => onClientSelected({ clientFk: id }, data)
"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -285,7 +304,22 @@ const getDateColor = (date) => {
@update:model-value="() => fetchAgencies(data)"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItem
v-bind="scope.itemProps"
:class="{ disabled: !scope.opt.isActive }"
>
<QItemSection style="min-width: min-content" avatar>
<QIcon
v-if="
scope.opt.isActive &&
data.defaultAddressFk === scope.opt.id
"
size="sm"
color="grey"
name="star"
class="fill-icon"
/>
</QItemSection>
<QItemSection>
<QItemLabel
:class="{
@ -313,6 +347,7 @@ const getDateColor = (date) => {
<VnInputDate
v-model="data.landed"
:label="t('module.landed')"
data-cy="landedDate"
@update:model-value="() => fetchAgencies(data)"
/>
<VnSelect

View File

@ -44,8 +44,7 @@ const exprBuilder = (param, value) => {
<template>
<FetchData
url="AgencyModes"
:filter="{ fields: ['id', 'name'] }"
sort-by="name ASC"
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
@on-fetch="(data) => (agencyList = data)"
auto-load
/>

View File

@ -27,12 +27,16 @@ const getZone = async () => {
const filter = {
where: { routeFk: $props.id ? $props.id : route.params.id },
};
const { data } = await axios.get('Tickets/findOne', {
const { data } = await axios.get('Tickets/filter', {
params: {
filter: JSON.stringify(filter),
},
});
zoneId.value = data.zoneFk;
if (!data.length) return;
const firstRecord = data[0];
zoneId.value = firstRecord.zoneFk;
const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`);
zone.value = zoneData.name;
};

View File

@ -1,14 +1,17 @@
<script setup>
import VnPaginate from 'components/ui/VnPaginate.vue';
import CardList from 'components/ui/CardList.vue';
import VnLv from 'components/ui/VnLv.vue';
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
import ShelvingSummary from 'pages/Shelving/Card/ShelvingSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useI18n } from 'vue-i18n';
import VnTable from 'components/VnTable/VnTable.vue';
import VnSection from 'src/components/common/VnSection.vue';
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
import ShelvingSummary from './Card/ShelvingSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import exprBuilder from './ShelvingExprBuilder.js';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
const { t } = useI18n();
const router = useRouter();
const { viewSummary } = useSummaryDialog();
const dataKey = 'ShelvingList';
@ -17,9 +20,56 @@ const filter = {
include: [{ relation: 'parking' }],
};
function navigate(id) {
router.push({ path: `/shelving/${id}` });
}
const columns = computed(() => [
{
align: 'left',
name: 'code',
label: t('globals.code'),
isId: true,
isTitle: true,
columnFilter: false,
create: true,
},
{
align: 'left',
name: 'parking',
label: t('shelving.list.parking'),
sortable: true,
format: (val) => val?.code ?? '',
cardVisible: true,
},
{
align: 'left',
name: 'priority',
label: t('shelving.list.priority'),
sortable: true,
cardVisible: true,
create: true,
},
{
align: 'left',
name: 'isRecyclable',
label: t('shelving.summary.recyclable'),
sortable: true,
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('components.smartCard.viewSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, ShelvingSummary),
isPrimary: true,
},
],
},
]);
const onDataSaved = ({ id }) => {
router.push({ name: 'ShelvingBasicData', params: { id } });
};
</script>
<template>
@ -37,48 +87,75 @@ function navigate(id) {
<ShelvingFilter data-key="ShelvingList" />
</template>
<template #body>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate :data-key="dataKey">
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:id="row.id"
:title="row.code"
@click="navigate(row.id)"
>
<template #list-items>
<VnLv
:label="$t('shelving.list.parking')"
:title-label="$t('shelving.list.parking')"
:value="row.parking?.code"
/>
<VnLv
:label="$t('shelving.list.priority')"
:value="row?.priority"
/>
</template>
<template #actions>
<QBtn
:label="$t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, ShelvingSummary)"
color="primary"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[20, 20]">
<RouterLink :to="{ name: 'ShelvingCreate' }">
<QBtn fab icon="add" color="primary" v-shortcut="'+'" />
<QTooltip>
{{ $t('shelving.list.newShelving') }}
</QTooltip>
</RouterLink>
</QPageSticky>
</QPage>
<VnTable
:data-key="dataKey"
:columns="columns"
is-editable="false"
:right-search="false"
:use-model="true"
:disable-option="{ table: true }"
redirect="shelving"
default-mode="card"
:create="{
urlCreate: 'Shelvings',
title: t('globals.pageTitles.shelvingCreate'),
onDataSaved,
formInitialData: {
parkingFk: null,
priority: null,
code: '',
isRecyclable: false,
},
}"
>
<template #more-create-dialog="{ data }">
<VnSelect
v-model="data.parkingFk"
url="Parkings"
option-value="id"
option-label="code"
:label="t('shelving.list.parking')"
:filter-options="['id', 'code']"
:fields="['id', 'code']"
/>
<VnCheckbox
v-model="data.isRecyclable"
:label="t('shelving.summary.recyclable')"
/>
</template>
</VnTable>
</template>
</VnSection>
</template>
<style lang="scss" scoped>
.list {
display: flex;
flex-direction: column;
align-items: center;
width: 55%;
}
.list-container {
display: flex;
justify-content: center;
}
</style>
<i18n>
es:
shelving:
list:
parking: Estacionamiento
priority: Prioridad
summary:
recyclable: Reciclable
en:
shelving:
list:
parking: Parking
priority: Priority
summary:
recyclable: Recyclable
</i18n>

View File

@ -11,6 +11,11 @@ export default {
'isSerious',
'isTrucker',
'account',
'workerFk',
'note',
'isReal',
'isPayMethodChecked',
'companySize',
],
include: [
{

View File

@ -108,7 +108,6 @@ function handleLocation(data, location) {
<VnAccountNumber
v-model="data.account"
:label="t('supplier.fiscalData.account')"
clearable
data-cy="supplierFiscalDataAccount"
insertable
:maxlength="10"
@ -185,8 +184,8 @@ function handleLocation(data, location) {
/>
<VnCheckbox
v-model="data.isVies"
:label="t('globals.isVies')"
:info="t('whenActivatingIt')"
:label="t('globals.isVies')"
:info="t('whenActivatingIt')"
/>
</div>
</VnRow>

View File

@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
import VnTable from 'components/VnTable/VnTable.vue';
import VnSection from 'src/components/common/VnSection.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import FetchData from 'src/components/FetchData.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import SupplierSummary from './Card/SupplierSummary.vue';
@ -53,7 +52,7 @@ const columns = computed(() => [
label: t('globals.alias'),
name: 'alias',
columnFilter: {
name: 'search',
name: 'nickname',
},
cardVisible: true,
},
@ -120,6 +119,21 @@ const columns = computed(() => [
],
},
]);
const filterColumns = computed(() => {
const copy = [...columns.value];
copy.splice(copy.length - 1, 0, {
align: 'left',
label: t('globals.params.provinceFk'),
name: 'provinceFk',
options: provincesOptions.value,
columnFilter: {
component: 'select',
},
});
return copy;
});
</script>
<template>
<FetchData
@ -130,7 +144,7 @@ const columns = computed(() => [
/>
<VnSection
:data-key="dataKey"
:columns="columns"
:columns="filterColumns"
prefix="supplier"
:array-data-props="{
url: 'Suppliers/filter',
@ -165,17 +179,6 @@ const columns = computed(() => [
</template>
</VnTable>
</template>
<template #moreFilterPanel="{ params, searchFn }">
<VnSelect
:label="t('globals.params.provinceFk')"
v-model="params.provinceFk"
@update:model-value="searchFn()"
:options="provincesOptions"
filled
dense
class="q-px-sm q-pr-lg"
/>
</template>
</VnSection>
</template>

View File

@ -93,9 +93,9 @@ function ticketFilter(ticket) {
<VnLv :label="t('globals.warehouse')" :value="entity.warehouse?.name" />
<VnLv :label="t('globals.alias')" :value="entity.nickname" />
</template>
<template #icons>
<template #icons="{ entity }">
<QCardActions class="q-gutter-x-xs">
<TicketProblems :row="problems" />
<TicketProblems :row="{ ...entity?.client, ...problems }" />
</QCardActions>
</template>
<template #actions="{ entity }">

View File

@ -37,7 +37,6 @@ const expeditionStateTypes = ref([]);
const expeditionsFilter = computed(() => ({
where: { ticketFk: route.params.id },
order: ['created DESC'],
}));
const ticketArrayData = useArrayData('Ticket');
@ -325,6 +324,7 @@ onMounted(async () => {
"
:redirect="false"
order="created DESC"
:filter="expeditionsFilter"
>
<template #column-freightItemName="{ row }">
<span class="link" @click.stop>

View File

@ -681,6 +681,17 @@ watch(
:disabled-attr="isTicketEditable"
>
<template #column-statusIcons="{ row }">
<QIcon
v-if="row.saleGroupFk"
name="inventory_2"
size="xs"
color="primary"
class="cursor-pointer"
>
<QTooltip class="no-pointer-events">
{{ `saleGroup: ${row.saleGroupFk}` }}
</QTooltip>
</QIcon>
<TicketProblems :row="row" />
</template>
<template #body-cell-picture="{ row }">
@ -740,7 +751,7 @@ watch(
{{ row?.item?.subName.toUpperCase() }}
</div>
</div>
<FetchedTags :item="row" :max-length="6" />
<FetchedTags :item="row.item" :max-length="6" />
<QPopupProxy v-if="row.id && isTicketEditable">
<VnInput
v-model="row.concept"

View File

@ -123,7 +123,7 @@ async function handleSave() {
}
function validateFields(item) {
// Only validate fields that are being updated
const shouldExist = (field) => !isUpdate || field in item;
const shouldExist = (field) => field in item;
if (!shouldExist('ticketServiceTypeFk') && !item.ticketServiceTypeFk) {
notify('Description is required', 'negative');

View File

@ -81,6 +81,7 @@ const openCreateModal = () => createTrackingDialogRef.value.show();
ref="paginateRef"
data-key="TicketTracking"
:user-filter="paginateFilter"
search-url="table"
url="TicketTrackings"
auto-load
order="created DESC"

View File

@ -48,7 +48,7 @@ const getGroupedStates = (data) => {
/>
<FetchData
url="AgencyModes"
:sort-by="['name ASC']"
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
@on-fetch="(data) => (agencies = data)"
auto-load
/>
@ -256,8 +256,6 @@ const getGroupedStates = (data) => {
v-model="params.agencyModeFk"
@update:model-value="searchFn()"
:options="agencies"
option-value="id"
option-label="name"
emit-value
map-options
use-input

View File

@ -1,6 +1,6 @@
<script setup>
import axios from 'axios';
import { computed, ref, onBeforeMount, watch } from 'vue';
import { computed, ref, onBeforeMount, watch, onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStateStore } from 'stores/useStateStore';
import { useI18n } from 'vue-i18n';
@ -22,7 +22,6 @@ import { toTimeFormat } from 'src/filters/date';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import TicketProblems from 'src/components/TicketProblems.vue';
import VnSection from 'src/components/common/VnSection.vue';
import { getClient } from 'src/pages/Customer/composables/getClient';
import { getAddresses } from 'src/pages/Customer/composables/getAddresses';
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
@ -51,10 +50,21 @@ const userParams = {
onBeforeMount(() => {
initializeFromQuery();
stateStore.rightDrawer = true;
if (!route.query.createForm) return;
onClientSelected(JSON.parse(route.query.createForm));
});
onMounted(async () => {
if (!route.query) return;
if (route.query?.createForm) {
formInitialData.value = JSON.parse(route.query?.createForm);
await onClientSelected(formInitialData.value);
} else if (route.query?.table) {
const query = route.query?.table;
const clientId = +JSON.parse(query)?.clientFk;
if (clientId) await onClientSelected({ clientId });
}
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
});
const initializeFromQuery = () => {
if (!route) return;
const query = route.query.table ? JSON.parse(route.query.table) : {};
from.value = query.from || from.toISOString();
to.value = query.to || to.toISOString();
@ -69,7 +79,6 @@ const companiesOptions = ref([]);
const accountingOptions = ref([]);
const amountToReturn = ref();
const dataKey = 'TicketList';
const filterPanelRef = ref(null);
const formInitialData = ref({});
const columns = computed(() => [
@ -251,7 +260,38 @@ const columns = computed(() => [
],
},
]);
const onClientSelected = async (formData) => {
resetAgenciesSelector(formData);
await fetchAddresses(formData);
};
const fetchAddresses = async (formData) => {
if (!formData.clientId) {
addressesOptions.value = [];
formData.defaultAddressFk = null;
formData.addressId = null;
return;
}
const { data } = await getAddresses(formData.clientId);
formInitialData.value = { clientId: formData.clientId };
if (!data) return;
addressesOptions.value = data;
selectedClient.value = data[0].client;
formData.addressId = selectedClient.value.defaultAddressFk;
formInitialData.value.addressId = formData.addressId;
};
watch(
() => route.query.table,
async (newValue) => {
if (newValue) {
const clientId = +JSON.parse(newValue)?.clientFk;
if (clientId) await onClientSelected({ clientId });
if (tableRef.value)
tableRef.value.create.formInitialData = formInitialData.value;
}
},
{ immediate: true },
);
function resetAgenciesSelector(formData) {
agenciesOptions.value = [];
if (formData) formData.agencyModeId = null;
@ -262,12 +302,6 @@ function redirectToLines(id) {
window.open(url, '_blank');
}
const onClientSelected = async (formData) => {
resetAgenciesSelector(formData);
await fetchClient(formData);
await fetchAddresses(formData);
};
const fetchAvailableAgencies = async (formData) => {
resetAgenciesSelector(formData);
const response = await getAgencies(formData, selectedClient.value);
@ -278,22 +312,6 @@ const fetchAvailableAgencies = async (formData) => {
if (agency) formData.agencyModeId = agency.agencyModeFk;
};
const fetchClient = async (formData) => {
const response = await getClient(formData.clientId);
if (!response) return;
const [client] = response.data;
selectedClient.value = client;
};
const fetchAddresses = async (formData) => {
const response = await getAddresses(formData.clientId);
if (!response) return;
addressesOptions.value = response.data;
const { defaultAddress } = selectedClient.value;
formData.addressId = defaultAddress.id;
};
const getColor = (row) => {
if (row.alertLevelCode === 'OK') return 'bg-success';
else if (row.alertLevelCode === 'FREE') return 'bg-notice';
@ -445,22 +463,6 @@ function setReference(data) {
dialogData.value.value.description = newDescription;
}
watch(
() => route.query.table,
(newValue) => {
if (newValue) {
const clientId = +JSON.parse(newValue)?.clientFk;
if (!clientId) return;
formInitialData.value = {
clientId,
};
if (tableRef.value) tableRef.value.create.formInitialData = { clientId };
onClientSelected({ clientId });
}
},
{ immediate: true },
);
</script>
<template>

View File

@ -73,6 +73,7 @@ warehouses();
/>
<FetchData
url="AgencyModes"
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
@on-fetch="(data) => (agenciesOptions = data)"
auto-load
/>

View File

@ -39,6 +39,7 @@ const redirectToTravelBasicData = (_, { id }) => {
<template>
<FetchData
url="AgencyModes"
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
@on-fetch="(data) => (agenciesOptions = data)"
auto-load
/>

View File

@ -52,9 +52,8 @@ defineExpose({ states });
v-model="params.agencyModeFk"
@update:model-value="searchFn()"
url="agencyModes"
sort-by="name ASC"
:use-like="false"
option-value="id"
option-label="name"
option-filter="name"
dense
outlined

View File

@ -5,9 +5,9 @@ import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute();
const filter = {
const userFilter = {
order: 'created DESC',
where: { workerFk: route.params.id },
include: {
relation: 'worker',
scope: {
@ -22,11 +22,15 @@ const filter = {
},
};
const body = {
workerFk: route.params.id,
};
const body = { workerFk: route.params.id };
</script>
<template>
<VnNotes :add-note="true" url="WorkerObservations" :filter="filter" :body="body" />
<VnNotes
:add-note="true"
url="WorkerObservations"
:user-filter="userFilter"
:filter="{ where: { workerFk: $route.params.id } }"
:body="body"
/>
</template>

View File

@ -343,19 +343,29 @@ const updateData = async () => {
const getMailStates = async (date) => {
const url = `WorkerTimeControls/${route.params.id}/getMailStates`;
const year = date.getFullYear();
const month = date.getMonth() + 1;
const prevMonth = month == 1 ? 12 : month - 1;
const params = {
month,
year: date.getFullYear(),
const getMonthStates = async (month, year) => {
return (await axios.get(url, { params: { month, year } })).data;
};
const curMonthStates = (await axios.get(url, { params })).data;
const prevMonthStates = (
await axios.get(url, { params: { ...params, month: prevMonth } })
).data;
const curMonthStates = await getMonthStates(month, year);
workerTimeControlMails.value = curMonthStates.concat(prevMonthStates);
const prevMonthStates = await getMonthStates(
month === 1 ? 12 : month - 1,
month === 1 ? year - 1 : year,
);
const postMonthStates = await getMonthStates(
month === 12 ? 1 : month + 1,
month === 12 ? year + 1 : year,
);
workerTimeControlMails.value = [
...curMonthStates,
...prevMonthStates,
...postMonthStates,
];
};
const showWorkerTimeForm = (propValue, formType) => {

View File

@ -279,7 +279,11 @@ async function autofillBic(worker) {
/>
</VnRow>
<VnRow>
<VnInput v-model="data.fi" :label="t('worker.create.fi')" />
<VnInput
v-model="data.fi"
:label="t('worker.create.fi')"
required
/>
<VnInputDate
v-model="data.birth"
:label="t('worker.create.birth')"

View File

@ -9,30 +9,30 @@ import VnInputTime from 'src/components/common/VnInputTime.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const validAddresses = ref([]);
const addresses = ref([]);
const setFilteredAddresses = (data) => {
const validIds = new Set(validAddresses.value.map((item) => item.addressFk));
addresses.value = data.filter((address) => validIds.has(address.id));
addresses.value = data.map(({ address }) => address);
};
</script>
<template>
<FetchData
url="RoadmapAddresses"
:filter="{
include: { relation: 'address' },
}"
auto-load
@on-fetch="(data) => (validAddresses = data)"
@on-fetch="setFilteredAddresses"
/>
<FetchData url="Addresses" auto-load @on-fetch="setFilteredAddresses" />
<FormModel auto-load model="Zone">
<template #form="{ data, validate }">
<VnRow>
<VnInput
data-cy="zone-basic-data-name"
:label="t('Name')"
clearable
v-model="data.name"
data-cy="ZoneBasicDataName"
:required="true"
/>
</VnRow>
@ -75,7 +75,6 @@ const setFilteredAddresses = (data) => {
min="0"
/>
</VnRow>
<VnRow>
<VnInput
v-model="data.travelingDays"
@ -86,7 +85,6 @@ const setFilteredAddresses = (data) => {
/>
<VnInputTime v-model="data.hour" :label="t('Closing')" :required="true" />
</VnRow>
<VnRow>
<VnInput
v-model="data.price"
@ -95,6 +93,7 @@ const setFilteredAddresses = (data) => {
min="0"
:required="true"
clearable
data-cy="ZoneBasicDataPrice"
/>
<VnInput
v-model="data.priceOptimum"
@ -120,12 +119,10 @@ const setFilteredAddresses = (data) => {
option-label="nickname"
:options="addresses"
:fields="['id', 'nickname']"
sort-by="id"
sort-by="nickname ASC"
hide-selected
map-options
:rules="validate('data.addressFk')"
:filter-options="['id']"
:where="filterWhere"
/>
</VnRow>
<VnRow>

View File

@ -1,38 +1,7 @@
<script setup>
import { useRoute } from 'vue-router';
import { computed } from 'vue';
import VnCard from 'components/common/VnCard.vue';
import VnCardBeta from 'src/components/common/VnCardBeta.vue';
import ZoneDescriptor from './ZoneDescriptor.vue';
import ZoneFilterPanel from '../ZoneFilterPanel.vue';
import filter from './ZoneFilter.js';
const route = useRoute();
const routeName = computed(() => route.name);
function notIsLocations(ifIsFalse, ifIsTrue) {
if (routeName.value != 'ZoneLocations') return ifIsFalse;
return ifIsTrue;
}
</script>
<template>
<VnCard
data-key="Zone"
:url="notIsLocations('Zones', undefined)"
:descriptor="ZoneDescriptor"
:filter="filter"
:filter-panel="notIsLocations(ZoneFilterPanel, undefined)"
:search-data-key="notIsLocations('ZoneList', undefined)"
:searchbar-props="{
url: notIsLocations('Zones', 'ZoneLocations'),
label: notIsLocations($t('list.searchZone'), $t('list.searchLocation')),
info: $t('list.searchInfo'),
whereFilter: notIsLocations((value) => {
return /^\d+$/.test(value)
? { id: value }
: { name: { like: `%${value}%` } };
}),
}"
/>
<VnCardBeta data-key="Zone" url="Zones" :descriptor="ZoneDescriptor" />
</template>

View File

@ -36,13 +36,13 @@ function openConfirmDialog(callback) {
}
</script>
<template>
<QItem @click="openConfirmDialog('remove')" v-ripple clickable>
<QItem @click="openConfirmDialog('remove')" v-ripple clickable data-cy="Delete_button">
<QItemSection avatar>
<QIcon name="delete" />
</QItemSection>
<QItemSection>{{ t('deleteZone') }}</QItemSection>
</QItem>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable data-cy="Clone_button">
<QItemSection avatar>
<QIcon name="content_copy" />
</QItemSection>

View File

@ -171,9 +171,10 @@ onMounted(() => {
openConfirmationModal(
t('eventsPanel.deleteTitle'),
t('eventsPanel.deleteSubtitle'),
() => deleteEvent()
() => deleteEvent(),
)
"
data-cy="ZoneEventExclusionDeleteBtn"
/>
<QBtn
:label="isNew ? t('globals.add') : t('globals.save')"

View File

@ -18,7 +18,6 @@ import axios from 'axios';
const props = defineProps({
date: {
type: Date,
required: true,
default: null,
},
event: {
@ -58,7 +57,7 @@ const arrayData = useArrayData('ZoneEvents');
const createEvent = async () => {
eventInclusionFormData.value.weekDays = weekdayStore.toSet(
eventInclusionFormData.value.wdays
eventInclusionFormData.value.wdays,
);
if (inclusionType.value == 'day') eventInclusionFormData.value.weekDays = '';
@ -74,7 +73,7 @@ const createEvent = async () => {
else
await axios.put(
`Zones/${route.params.id}/events/${props.event?.id}`,
eventInclusionFormData.value
eventInclusionFormData.value,
);
await refetchEvents();
@ -123,12 +122,14 @@ onMounted(() => {
dense
val="day"
:label="t('eventsInclusionForm.oneDay')"
data-cy="ZoneEventInclusionDayRadio"
/>
<QRadio
v-model="inclusionType"
dense
val="indefinitely"
:label="t('eventsInclusionForm.indefinitely')"
data-cy="ZoneEventInclusionIndefinitelyRadio"
/>
<QRadio
v-model="inclusionType"
@ -136,6 +137,7 @@ onMounted(() => {
val="range"
:label="t('eventsInclusionForm.rangeOfDates')"
class="q-mb-sm"
data-cy="ZoneEventInclusionRangeRadio"
/>
</div>
<VnRow>
@ -221,7 +223,7 @@ onMounted(() => {
openConfirmationModal(
t('zone.deleteTitle'),
t('zone.deleteSubtitle'),
() => deleteEvent()
() => deleteEvent(),
)
"
/>

View File

@ -1,18 +1,14 @@
<script setup>
import { ref } from 'vue';
import { ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import ZoneEventsPanel from './ZoneEventsPanel.vue';
import ZoneCalendarGrid from '../ZoneCalendarGrid.vue';
import ZoneEventInclusionForm from './ZoneEventInclusionForm.vue';
import ZoneEventExclusionForm from './ZoneEventExclusionForm.vue';
import { useStateStore } from 'stores/useStateStore';
import { reactive } from 'vue';
import RightMenu from 'src/components/common/RightMenu.vue';
const { t } = useI18n();
const stateStore = useStateStore();
const firstDay = ref();
const lastDay = ref();
@ -43,14 +39,16 @@ const onZoneEventFormClose = () => {
</script>
<template>
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
<ZoneEventsPanel
:first-day="firstDay"
:last-day="lastDay"
:events="events"
v-model:formModeName="formModeName"
/>
</Teleport>
<RightMenu>
<template #right-panel>
<ZoneEventsPanel
:first-day="firstDay"
:last-day="lastDay"
:events="events"
v-model:formModeName="formModeName"
/>
</template>
</RightMenu>
<QPage class="q-pa-md flex justify-center">
<ZoneCalendarGrid
v-model:events="events"

View File

@ -14,12 +14,10 @@ import { useVnConfirm } from 'composables/useVnConfirm';
const props = defineProps({
firstDay: {
type: Date,
required: true,
default: null,
},
lastDay: {
type: Date,
required: true,
default: null,
},
events: {
@ -67,7 +65,7 @@ watch(
async () => {
await fetchData();
},
{ immediate: true, deep: true }
{ immediate: true, deep: true },
);
const formatWdays = (event) => {
@ -178,9 +176,10 @@ onMounted(async () => {
openConfirmationModal(
t('zone.deleteTitle'),
t('zone.deleteSubtitle'),
() => deleteEvent(event.id)
() => deleteEvent(event.id),
)
"
data-cy="ZoneEventsPanelDeleteBtn"
>
<QTooltip>{{ t('eventsPanel.delete') }}</QTooltip>
</QBtn>

View File

@ -1,6 +1,7 @@
<script setup>
import { onMounted, ref, computed, watch, onUnmounted } from 'vue';
import { useRoute } from 'vue-router';
import { useStateStore } from 'stores/useStateStore';
import VnInput from 'src/components/common/VnInput.vue';
import { useState } from 'src/composables/useState';
import axios from 'axios';
@ -30,7 +31,7 @@ const emit = defineEmits(['update:tickedNodes']);
const route = useRoute();
const state = useState();
const stateStore = useStateStore();
const treeRef = ref();
const expanded = ref([]);
@ -82,7 +83,7 @@ const onNodeExpanded = async (nodeKeysArray) => {
await fetchNodeLeaves(lastNodeKey, true);
} else {
const difference = new Set(
[...previousExpandedNodes.value].filter((x) => !nodeKeysSet.has(x))
[...previousExpandedNodes.value].filter((x) => !nodeKeysSet.has(x)),
);
const collapsedNode = Array.from(difference).pop();
const node = treeRef.value?.getNodeByKey(collapsedNode);
@ -135,7 +136,7 @@ watch(
}
previousExpandedNodes.value = new Set(expanded.value);
},
{ immediate: true }
{ immediate: true },
);
const reFetch = async () => {
@ -153,6 +154,17 @@ onUnmounted(() => {
</script>
<template>
<Teleport to="#section-searchbar" v-if="stateStore.isHeaderMounted()">
<VnSearchbar
v-if="!showSearchBar"
:data-key="datakey"
:url="url"
:redirect="false"
:search-remove-params="false"
:label="$t('zone.searchLocations')"
:info="$t('zone.searchLocationsInfo')"
/>
</Teleport>
<VnInput
v-if="showSearchBar"
v-model="store.userParams.search"
@ -163,13 +175,6 @@ onUnmounted(() => {
<QBtn color="primary" icon="search" dense flat @click="reFetch()" />
</template>
</VnInput>
<VnSearchbar
v-if="!showSearchBar"
:data-key="datakey"
:url="url"
:redirect="false"
:search-remove-params="false"
/>
<QTree
ref="treeRef"
:nodes="nodes"

View File

@ -2,5 +2,5 @@
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="Zone" url="/ZoneLogs"></VnLog>
<VnLog model="Zone" />
</template>

View File

@ -1,74 +0,0 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
const { t } = useI18n();
const exprBuilder = (param, value) => {
switch (param) {
case 'name':
return {
name: { like: `%${value}%` },
};
case 'code':
return {
code: { like: `%${value}%` },
};
case 'agencyModeFk':
return {
agencyModeFk: value,
};
case 'search':
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
}
};
const tableFilter = {
include: [
{
relation: 'agencyMode',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'address',
scope: {
fields: ['id', 'nickname', 'provinceFk', 'postalCode'],
include: [
{
relation: 'province',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'postcode',
scope: {
fields: ['code', 'townFk'],
include: {
relation: 'town',
scope: {
fields: ['id', 'name'],
},
},
},
},
],
},
},
],
};
</script>
<template>
<VnSearchbar
data-key="ZonesList"
url="Zones"
:filter="tableFilter"
:expr-builder="exprBuilder"
:label="t('list.searchZone')"
:info="t('list.searchInfo')"
custom-route-redirect-name="ZoneSummary"
/>
</template>

View File

@ -60,10 +60,11 @@ onMounted(async () => {
<template>
<CardSummary
data-key="Zone"
data-key="ZoneSummary"
ref="summary"
:url="`Zones/${entityId}`"
:filter="filter"
:entity-id="entityId"
>
<template #header="{ entity }">
<div>#{{ entity.id }} - {{ entity.name }}</div>

View File

@ -185,6 +185,7 @@ const handleDateClick = (timestamp) => {
:class="{
'--today': isToday(timestamp),
}"
data-cy="ZoneCalendarDay"
>
<QPopupProxy v-if="isZoneDeliveryView">
<ZoneClosingTable

View File

@ -3,7 +3,6 @@ import { ref } from 'vue';
import ZoneDeliveryPanel from './ZoneDeliveryPanel.vue';
import ZoneCalendarGrid from './ZoneCalendarGrid.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const firstDay = ref(null);
const lastDay = ref(null);
@ -11,7 +10,6 @@ const events = ref([]);
</script>
<template>
<ZoneSearchbar />
<RightMenu>
<template #right-panel>
<ZoneDeliveryPanel />

View File

@ -46,7 +46,7 @@ watch(
inq.value = {
deliveryMethodFk: { inq: deliveryMethods.value[deliveryMethodFk.value] },
};
}
},
);
</script>
@ -89,7 +89,7 @@ watch(
v-model="formData.geoFk"
url="Postcodes/location"
:fields="['geoFk', 'code', 'townFk', 'countryFk']"
:sort-by="['code ASC']"
:sort-by="'code ASC'"
option-value="geoFk"
option-label="code"
:filter-options="['code']"
@ -98,6 +98,7 @@ watch(
outlined
rounded
map-key="geoFk"
data-cy="ZoneDeliveryDaysPostcodeSelect"
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
@ -129,6 +130,7 @@ watch(
dense
outlined
rounded
data-cy="ZoneDeliveryDaysAgencySelect"
/>
<VnSelect
v-else

View File

@ -1,68 +0,0 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnInput from 'components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'components/common/VnSelect.vue';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
exprBuilder: {
type: Function,
default: null,
},
});
const agencies = ref([]);
</script>
<template>
<FetchData
url="AgencyModes"
:filter="{ fields: ['id', 'name'] }"
@on-fetch="(data) => (agencies = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag }">
<div class="q-gutter-x-xs">
<strong>{{ t(`filterPanel.${tag.label}`) }}: </strong>
<span>{{ tag.value }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnInput
:label="t('list.name')"
v-model="params.name"
is-outlined
data-cy="zoneFilterPanelNameInput"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('filterPanel.agencyModeFk')"
v-model="params.agencyModeFk"
:options="agencies"
option-value="id"
option-label="name"
@update:model-value="searchFn()"
dense
outlined
rounded
data-cy="zoneFilterPanelAgencySelect"
>
</VnSelect>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>

View File

@ -14,9 +14,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputTime from 'src/components/common/VnInputTime.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneFilterPanel from './ZoneFilterPanel.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
import VnSection from 'src/components/common/VnSection.vue';
const { t } = useI18n();
const router = useRouter();
@ -25,7 +23,7 @@ const { viewSummary } = useSummaryDialog();
const { openConfirmationModal } = useVnConfirm();
const tableRef = ref();
const warehouseOptions = ref([]);
const dataKey = 'ZoneList';
const tableFilter = {
include: [
{
@ -114,6 +112,7 @@ const columns = computed(() => [
columnFilter: {
inWhere: true,
},
columnClass: 'shrink-column',
},
{
align: 'left',
@ -169,78 +168,128 @@ function formatRow(row) {
return dashIfEmpty(`${row?.address?.nickname},
${row?.address?.postcode?.town?.name} (${row?.address?.province?.name})`);
}
const exprBuilder = (param, value) => {
switch (param) {
case 'name':
return {
name: { like: `%${value}%` },
};
case 'code':
return {
code: { like: `%${value}%` },
};
case 'agencyModeFk':
return {
agencyModeFk: value,
};
case 'search':
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
case 'price':
return {
price: value,
};
}
};
</script>
<template>
<ZoneSearchbar />
<RightMenu>
<template #right-panel>
<ZoneFilterPanel data-key="ZonesList" />
</template>
</RightMenu>
<VnTable
ref="tableRef"
data-key="ZonesList"
url="Zones"
:create="{
urlCreate: 'Zones',
title: t('list.createZone'),
onDataSaved: ({ id }) => tableRef.redirect(`${id}/location`),
formInitialData: {},
}"
:user-filter="tableFilter"
<VnSection
:data-key="dataKey"
:columns="columns"
redirect="zone"
:right-search="false"
prefix="zone"
:array-data-props="{
url: 'Zones',
order: ['id ASC'],
userFilter: tableFilter,
exprBuilder,
}"
>
<template #column-addressFk="{ row }">
{{ dashIfEmpty(formatRow(row)) }}
<template #body>
<div class="table-container">
<div class="column items-center">
<VnTable
ref="tableRef"
:data-key="dataKey"
:columns="columns"
redirect="Zone"
:create="{
urlCreate: 'Zones',
title: t('list.createZone'),
onDataSaved: ({ id }) => tableRef.redirect(`${id}/location`),
formInitialData: {},
}"
table-height="85vh"
>
<template #column-addressFk="{ row }">
{{ dashIfEmpty(formatRow(row)) }}
</template>
<template #more-create-dialog="{ data }">
<VnSelect
url="AgencyModes"
v-model="data.agencyModeFk"
option-value="id"
option-label="name"
:label="t('list.agency')"
/>
<VnInput
v-model="data.price"
:label="t('list.price')"
min="0"
type="number"
required="true"
/>
<VnInput
v-model="data.bonus"
:label="t('zone.bonus')"
min="0"
type="number"
/>
<VnInput
v-model="data.travelingDays"
:label="t('zone.travelingDays')"
type="number"
min="0"
/>
<VnInputTime v-model="data.hour" :label="t('list.close')" />
<VnSelect
url="Warehouses"
v-model="data.warehouseFK"
option-value="id"
option-label="name"
:label="t('list.warehouse')"
:options="warehouseOptions"
/>
<QCheckbox
v-model="data.isVolumetric"
:label="t('list.isVolumetric')"
:toggle-indeterminate="false"
/>
</template>
</VnTable>
</div>
</div>
</template>
<template #more-create-dialog="{ data }">
<VnSelect
url="AgencyModes"
v-model="data.agencyModeFk"
option-value="id"
option-label="name"
:label="t('list.agency')"
/>
<VnInput
v-model="data.price"
:label="t('list.price')"
min="0"
type="number"
required="true"
/>
<VnInput
v-model="data.bonus"
:label="t('zone.bonus')"
min="0"
type="number"
/>
<VnInput
v-model="data.travelingDays"
:label="t('zone.travelingDays')"
type="number"
min="0"
/>
<VnInputTime v-model="data.hour" :label="t('list.close')" />
<VnSelect
url="Warehouses"
v-model="data.warehouseFK"
option-value="id"
option-label="name"
:label="t('list.warehouse')"
:options="warehouseOptions"
/>
<QCheckbox
v-model="data.isVolumetric"
:label="t('list.isVolumetric')"
:toggle-indeterminate="false"
/>
</template>
</VnTable>
</VnSection>
</template>
<style lang="scss" scoped>
.table-container {
display: flex;
justify-content: center;
}
.column {
display: flex;
flex-direction: column;
align-items: center;
min-width: 70%;
}
:deep(.shrink-column) {
width: 8%;
}
</style>
<i18n>
es:
Search zone: Buscar zona

View File

@ -7,7 +7,6 @@ import FetchData from 'components/FetchData.vue';
import { toDateFormat } from 'src/filters/date.js';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const { t } = useI18n();
const weekdayStore = useWeekdayStore();
@ -31,7 +30,7 @@ const columns = computed(() => [
label: t('list.id'),
name: 'id',
field: 'zoneFk',
align: 'left',
align: 'center',
},
]);
@ -53,7 +52,6 @@ onMounted(() => weekdayStore.initStore());
@on-fetch="(data) => (details = data)"
auto-load
/>
<ZoneSearchbar />
<VnSubToolbar />
<QPage class="column items-center q-pa-md">
<QCard class="containerShrinked q-pa-md">

View File

@ -11,10 +11,13 @@ zone:
m3Max: Max m³
deleteTitle: This item will be deleted
deleteSubtitle: Are you sure you want to continue?
volumetric: Volumetric
bonus: Bonus
closing: Closing
travelingDays: Traveling days
search: Search zone
searchInfo: Search zone by id or name
searchLocations: Search locations
searchLocationsInfo: Search locations by post code
list:
clone: Clone
id: Id
@ -30,6 +33,7 @@ list:
confirmCloneTitle: All it's properties will be copied
confirmCloneSubtitle: Do you want to clone this zone?
warehouse: Warehouse
isVolumetric: Volumetric
createZone: Create zone
zoneSummary: Summary
addressFk: Address

View File

@ -15,6 +15,10 @@ zone:
bonus: Bonificación
closing: Cierre
travelingDays: Días de viaje
search: Buscar zona
searchInfo: Buscar zona por Id o nombre
searchLocations: Buscar localización
searchLocationsInfo: Buscar localización por código postal
list:
clone: Clonar
id: Id

View File

@ -1,10 +1,15 @@
import { RouterView } from 'vue-router';
import { setRectificative } from 'src/pages/InvoiceIn/composables/setRectificative';
const invoiceInCard = {
name: 'InvoiceInCard',
path: ':id',
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
redirect: { name: 'InvoiceInSummary' },
beforeEnter: async (to, from, next) => {
await setRectificative(to);
next();
},
meta: {
menu: [
'InvoiceInBasicData',
@ -32,8 +37,7 @@ const invoiceInCard = {
title: 'basicData',
icon: 'vn:settings',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInBasicData.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInBasicData.vue'),
},
{
name: 'InvoiceInVat',
@ -51,8 +55,7 @@ const invoiceInCard = {
title: 'dueDay',
icon: 'vn:calendar',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInDueDay.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInDueDay.vue'),
},
{
name: 'InvoiceInIntrastat',
@ -61,8 +64,7 @@ const invoiceInCard = {
title: 'intrastat',
icon: 'vn:lines',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'),
},
{
name: 'InvoiceInCorrective',
@ -71,8 +73,7 @@ const invoiceInCard = {
title: 'corrective',
icon: 'attachment',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInCorrective.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCorrective.vue'),
},
{
name: 'InvoiceInLog',
@ -86,7 +87,7 @@ const invoiceInCard = {
],
};
export default {
export default {
name: 'InvoiceIn',
path: '/invoice-in',
meta: {
@ -98,7 +99,7 @@ export default {
component: RouterView,
redirect: { name: 'InvoiceInMain' },
children: [
{
{
name: 'InvoiceInMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
@ -111,7 +112,7 @@ export default {
component: () => import('src/pages/InvoiceIn/InvoiceInList.vue'),
children: [
{
name: 'InvoiceInList',
name: 'InvoiceInList',
path: 'list',
meta: {
title: 'list',
@ -137,9 +138,10 @@ export default {
title: 'serial',
icon: 'view_list',
},
component: () => import('src/pages/InvoiceIn/Serial/InvoiceInSerial.vue'),
component: () =>
import('src/pages/InvoiceIn/Serial/InvoiceInSerial.vue'),
},
],
},
],
};
};

View File

@ -111,15 +111,6 @@ export default {
shelvingCard,
],
},
{
path: 'create',
name: 'ShelvingCreate',
meta: {
title: 'shelvingCreate',
icon: 'add',
},
component: () => import('src/pages/Shelving/Card/ShelvingForm.vue'),
},
{
path: 'parking',
name: 'ParkingMain',

View File

@ -1,24 +1,12 @@
import { RouterView } from 'vue-router';
export default {
path: '/zone',
name: 'Zone',
const zoneCard = {
name: 'ZoneCard',
path: ':id',
component: () => import('src/pages/Zone/Card/ZoneCard.vue'),
redirect: { name: 'ZoneSummary' },
meta: {
title: 'zones',
icon: 'vn:zone',
moduleName: 'Zone',
keyBinding: 'z',
},
component: RouterView,
redirect: { name: 'ZoneMain' },
menus: {
main: [
'ZoneList',
'ZoneDeliveryDays',
'ZoneUpcomingList',
'ZoneUpcomingDeliveries',
],
card: [
menu: [
'ZoneBasicData',
'ZoneWarehouses',
'ZoneHistory',
@ -28,19 +16,102 @@ export default {
},
children: [
{
path: '/zone',
name: 'ZoneSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'launch',
},
component: () => import('src/pages/Zone/Card/ZoneSummary.vue'),
},
{
path: 'basic-data',
name: 'ZoneBasicData',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('src/pages/Zone/Card/ZoneBasicData.vue'),
},
{
path: 'location',
name: 'ZoneLocations',
meta: {
title: 'locations',
icon: 'my_location',
},
component: () => import('src/pages/Zone/Card/ZoneLocations.vue'),
},
{
path: 'warehouses',
name: 'ZoneWarehouses',
meta: {
title: 'warehouses',
icon: 'home',
},
component: () => import('src/pages/Zone/Card/ZoneWarehouses.vue'),
},
{
path: 'log',
name: 'ZoneHistory',
meta: {
title: 'log',
icon: 'history',
},
component: () => import('src/pages/Zone/Card/ZoneLog.vue'),
},
{
path: 'events',
name: 'ZoneEvents',
meta: {
title: 'calendar',
icon: 'vn:calendar',
},
component: () => import('src/pages/Zone/Card/ZoneEvents.vue'),
},
],
};
export default {
name: 'Zone',
path: '/zone',
meta: {
title: 'zones',
icon: 'vn:zone',
moduleName: 'Zone',
keyBinding: 'z',
menu: [
'ZoneList',
'ZoneDeliveryDays',
'ZoneUpcomingList',
'ZoneUpcomingDeliveries',
],
},
component: RouterView,
redirect: { name: 'ZoneMain' },
children: [
{
name: 'ZoneMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'ZoneList' },
redirect: { name: 'ZoneIndexMain' },
children: [
{
path: 'list',
name: 'ZoneList',
meta: {
title: 'zonesList',
icon: 'view_list',
},
path: '',
name: 'ZoneIndexMain',
redirect: { name: 'ZoneList' },
component: () => import('src/pages/Zone/ZoneList.vue'),
children: [
{
name: 'ZoneList',
path: 'list',
meta: {
title: 'list',
icon: 'view_list',
},
},
zoneCard,
],
},
{
path: 'delivery-days',
@ -62,67 +133,5 @@ export default {
},
],
},
{
name: 'ZoneCard',
path: ':id',
component: () => import('src/pages/Zone/Card/ZoneCard.vue'),
redirect: { name: 'ZoneSummary' },
children: [
{
name: 'ZoneSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'launch',
},
component: () => import('src/pages/Zone/Card/ZoneSummary.vue'),
},
{
name: 'ZoneBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('src/pages/Zone/Card/ZoneBasicData.vue'),
},
{
name: 'ZoneLocations',
path: 'location',
meta: {
title: 'locations',
icon: 'my_location',
},
component: () => import('src/pages/Zone/Card/ZoneLocations.vue'),
},
{
name: 'ZoneWarehouses',
path: 'warehouses',
meta: {
title: 'warehouses',
icon: 'home',
},
component: () => import('src/pages/Zone/Card/ZoneWarehouses.vue'),
},
{
name: 'ZoneHistory',
path: 'log',
meta: {
title: 'log',
icon: 'history',
},
component: () => import('src/pages/Zone/Card/ZoneLog.vue'),
},
{
name: 'ZoneEvents',
path: 'events',
meta: {
title: 'calendar',
icon: 'vn:calendar',
},
component: () => import('src/pages/Zone/Card/ZoneEvents.vue'),
},
],
},
],
};

View File

@ -5,3 +5,4 @@ downloads/*
storage/*
reports/*
docker/logs/*
results/*

View File

@ -0,0 +1,15 @@
#!/bin/bash
find 'test/cypress/integration' \
-mindepth 1 \
-maxdepth 1 \
-type d | \
xargs -P "$1" -I {} sh -c '
echo "🔷 {}" &&
xvfb-run -a cypress run \
--headless \
--spec "{}" \
--quiet \
> /dev/null
'
wait

View File

@ -10,8 +10,6 @@ describe('ClaimDevelopment', () => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`);
cy.intercept('GET', /\/api\/Workers\/search/).as('workers');
cy.intercept('GET', /\/api\/Workers\/search/).as('workers');
cy.waitForElement('tbody');
});
@ -36,7 +34,6 @@ describe('ClaimDevelopment', () => {
});
it('should add and remove new line', () => {
cy.wait(['@workers', '@workers']);
cy.addCard();
cy.waitForElement(thirdRow);

View File

@ -1,4 +1,4 @@
describe.skip('ClaimNotes', () => {
describe('ClaimNotes', () => {
const saveBtn = '.q-field__append > .q-btn > .q-btn__content > .q-icon';
const firstNote = '.q-infinite-scroll :nth-child(1) > .q-card__section--vert';
beforeEach(() => {
@ -8,7 +8,10 @@ describe.skip('ClaimNotes', () => {
it('should add a new note', () => {
const message = 'This is a new message.';
cy.get('.q-textarea').should('not.be.disabled').type(message);
cy.get('.q-textarea')
.should('be.visible')
.should('not.be.disabled')
.type(message);
cy.get(saveBtn).click();
cy.get(firstNote).should('have.text', message);

View File

@ -1,6 +1,7 @@
/// <reference types="cypress" />
// redmine.verdnatura.es/issues/8417
describe.skip('ClaimPhoto', () => {
describe('ClaimPhoto', () => {
const carrouselClose =
'.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon';
beforeEach(() => {
const claimId = 1;
cy.login('developer');
@ -12,47 +13,38 @@ describe.skip('ClaimPhoto', () => {
cy.get('label > .q-btn input').selectFile('test/cypress/fixtures/image.jpg', {
force: true,
});
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.checkNotification('Data saved');
});
it('should add new file with drag and drop', () => {
cy.get('.container').should('be.visible').and('exist');
cy.get('.container').selectFile('test/cypress/fixtures/image.jpg', {
action: 'drag-drop',
});
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.checkNotification('Data saved');
});
it('should open first image dialog change to second and close', () => {
cy.get(':nth-last-child(1) > .q-card').click();
cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should(
'be.visible',
);
cy.dataCy('file-1').click();
cy.get(carrouselClose).click();
cy.get('.q-carousel__control > button').click();
cy.get(
'.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon',
).click();
cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should(
'not.be.visible',
);
cy.dataCy('file-1').click();
cy.get('.q-carousel__control > button').as('nextButton').click();
cy.get('.q-carousel__slide > .q-ma-none').should('be.visible');
cy.get(carrouselClose).click();
});
it('should remove third and fourth file', () => {
cy.get(
'.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon',
).click();
cy.dataCy('delete-button-4').click();
cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click();
cy.get('.q-notification__message').should('have.text', 'Data deleted');
cy.checkNotification('Data deleted');
cy.get(
'.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon',
).click();
cy.dataCy('delete-button-3').click();
cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click();
cy.get('.q-notification__message').should('have.text', 'Data deleted');
cy.checkNotification('Data deleted');
});
});

View File

@ -58,14 +58,23 @@ describe('Client list', () => {
cy.waitForElement('.q-form');
cy.checkValueForm(1, search);
cy.checkValueForm(2, search);
cy.dataCy('Customer_select').should('have.value', search);
cy.dataCy('Address_select').should('have.value', search);
});
it('Client founded create order', () => {
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
cy.intercept('GET', /\/api\/Clients\/1110\/summary/).as('customer');
cy.dataCy('Name_input').type(`${search}{enter}`);
cy.wait('@customer');
cy.get('.actions > .q-card__actions').should('exist');
cy.clickButtonWith('icon', 'icon-basketadd');
cy.url().should('include', `/customer/1110/summary`);
cy.waitForElement('#formModel');
cy.waitForElement('.q-form');
cy.checkValueForm(1, search);
cy.dataCy('Client_select').should('have.value', search);
cy.dataCy('Address_select').should('have.value', search);
});
});

View File

@ -12,7 +12,7 @@ describe('Client web-access', () => {
cy.get('.q-btn-group > :nth-child(1)').should('not.be.disabled');
cy.get('.q-checkbox__inner').click();
cy.get('.q-btn-group > .q-btn--standard.q-btn--actionable').should(
'not.be.disabled'
'not.be.disabled',
);
cy.get('.q-btn-group > .q-btn--flat').should('not.be.disabled');
cy.get('.q-btn-group > :nth-child(1)').click();

View File

@ -20,7 +20,7 @@ describe('Entry', () => {
);
});
it('Create entry, modify travel and add buys', () => {
it.skip('Create entry, modify travel and add buys', () => {
createEntryAndBuy();
cy.get('a[data-cy="EntryBasicData-menu-item"]').click();
selectTravel('two');

View File

@ -10,8 +10,6 @@ describe('InvoiceInVat', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/invoice-in/1/vat`);
cy.intercept('GET', '/api/InvoiceIns/1/getTotals').as('lastCall');
cy.wait('@lastCall');
});
it('should edit the sage iva', () => {

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" />
describe('InvoiceOut manual invoice', () => {
describe.skip('InvoiceOut manual invoice', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
@ -10,12 +10,17 @@ describe('InvoiceOut manual invoice', () => {
it('should create an invoice from a ticket and go to that invoice', () => {
cy.searchByLabel('Customer ID', '1101');
cy.get(
'[data-q-vs-anchor=""] > :nth-child(1) > .q-checkbox > .q-checkbox__inner'
'[data-q-vs-anchor=""] > :nth-child(1) > .q-checkbox > .q-checkbox__inner',
).click();
cy.dataCy('ticketListMakeInvoiceBtn').click();
cy.checkNotification('Data saved');
cy.get('.q-virtual-scroll__content > :nth-child(1) > :nth-child(3)').click();
cy.get(':nth-child(8) > .value > .link').click();
cy.get('.header > :nth-child(3) > .q-btn__content').click();
cy.get('.q-menu > .descriptor > .header').should('be.visible');
cy.get(
'.q-menu > .descriptor > .header > [data-cy="descriptor-more-opts"] > .q-btn__content',
).click();
cy.get('[data-cy="descriptor-more-opts-menu"] > .q-list > :nth-child(4)').click();
cy.dataCy('VnConfirm_confirm').click();
});
});

View File

@ -9,7 +9,7 @@ describe('InvoiceOut negative bases', () => {
cy.visit(`/#/invoice-out/negative-bases`);
});
it('should open the posible descriptors', () => {
it.skip('should open the posible descriptors', () => {
cy.get(getDescriptors('clientId')).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');

View File

@ -7,17 +7,14 @@ describe('InvoiceOut summary', () => {
const firstRowDescriptors = (opt) =>
`tbody > :nth-child(1) > :nth-child(${opt}) > .q-btn`;
const toCustomerSummary = '[href="#/customer/1101"]';
const toTicketList = '[href="#/ticket/list?table={%22refFk%22:%22T1111111%22}"]';
const selectMenuOption = (opt) => `.q-menu > .q-list > :nth-child(${opt})`;
const confirmSend = '.q-btn--unelevated';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/1/summary`);
});
it('open the descriptors', () => {
cy.get(firstRowDescriptors(1)).click();
cy.get('.descriptor').should('be.visible');
@ -27,16 +24,17 @@ describe('InvoiceOut summary', () => {
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
it('should open the client summary and the ticket list', () => {
cy.get(toCustomerSummary).click();
it('should open the client summary', () => {
cy.dataCy('invoiceOutDescriptorCustomerCard').click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
it('should open the ticket list', () => {
cy.get(toTicketList).click();
cy.get('.descriptor').should('be.visible');
cy.dataCy('vnFilterPanelChip').should('include.text', 'T1111111');
cy.get('[data-col-field="stateFk"]').each(($el) => {
cy.wrap($el).contains('T1111111');
});
});
it('should transfer the invoice ', () => {
@ -52,6 +50,7 @@ describe('InvoiceOut summary', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(3)).click();
cy.dataCy('InvoiceOutDescriptorMenuSendPdfOption').click();
cy.dataCy('SendEmailNotifiactionDialogInput').should('be.visible');
cy.get(confirmSend).click();
cy.checkNotification('Notification sent');
});
@ -60,18 +59,11 @@ describe('InvoiceOut summary', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(3)).click();
cy.dataCy('InvoiceOutDescriptorMenuSendCsvOption').click();
cy.dataCy('SendEmailNotifiactionDialogInput').should('be.visible');
cy.get(confirmSend).click();
cy.checkNotification('Notification sent');
});
it('should delete an invoice ', () => {
cy.typeSearchbar('T2222222{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(4)).click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut deleted');
});
it('should book the invoice', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(5)).click();

View File

@ -3,7 +3,6 @@ function goTo(n = 1) {
return `.q-virtual-scroll__content > :nth-child(${n})`;
}
const firstRow = goTo();
`.q-virtual-scroll__content > :nth-child(2)`;
describe('Handle Items FixedPrice', () => {
beforeEach(() => {
cy.viewport(1280, 720);

View File

@ -3,23 +3,22 @@ describe('ItemBarcodes', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/list`);
cy.typeSearchbar('1{enter}');
cy.visit(`/#/item/1/barcode`);
});
it('should throw an error if the barcode exists', () => {
cy.get('[href="#/item/1/barcode"]').click();
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
cy.dataCy('Code_input').eq(3).type('1111111111');
cy.dataCy('crudModelDefaultSaveBtn').click();
newBarcode('1111111111');
cy.checkNotification('Codes can not be repeated');
});
it('should create a new barcode', () => {
cy.get('[href="#/item/1/barcode"]').click();
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
cy.dataCy('Code_input').eq(3).type('1231231231');
cy.dataCy('crudModelDefaultSaveBtn').click();
newBarcode('1231231231');
cy.checkNotification('Data saved');
});
function newBarcode(text) {
cy.dataCy('addBarcode_input').click();
cy.dataCy('Code_input').eq(3).should('exist').type(text);
cy.dataCy('crudModelDefaultSaveBtn').click();
}
});

View File

@ -7,11 +7,9 @@ describe('Item botanical', () => {
});
it('should modify the botanical', () => {
cy.dataCy('AddGenusSelectDialog').type('Abies');
cy.get('.q-menu .q-item').contains('Abies').click();
cy.dataCy('AddSpeciesSelectDialog').type('dealbata');
cy.get('.q-menu .q-item').contains('dealbata').click();
cy.get('.q-btn-group > .q-btn--standard').click();
cy.selectOption('[data-cy="AddGenusSelectDialog"]', 'Abies');
cy.selectOption('[data-cy="AddSpeciesSelectDialog"]', 'dealbata');
cy.saveCard();
cy.checkNotification('Data saved');
});

View File

@ -1,6 +1,6 @@
/// <reference types="cypress" />
describe('Item list', () => {
describe.skip('Item list', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
@ -16,8 +16,7 @@ describe('Item list', () => {
cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click();
});
// https://redmine.verdnatura.es/issues/8421
it.skip('should create an item', () => {
it('should create an item', () => {
const data = {
Description: { val: `Test item` },
Type: { val: `Crisantemo`, type: 'select' },

View File

@ -0,0 +1,74 @@
/// <reference types="cypress" />
describe('OrderList', () => {
const clientCreateSelect = '#formModel [data-cy="Client_select"]';
const addressCreateSelect = '#formModel [data-cy="Address_select"]';
const agencyCreateSelect = '#formModel [data-cy="Agency_select"]';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/order/list');
});
it('create order', () => {
cy.get('[data-cy="vnTableCreateBtn"]').click();
cy.selectOption(clientCreateSelect, 1101);
cy.get(addressCreateSelect).click();
cy.get(
'.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i',
).should('have.text', 'star');
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.selectOption(agencyCreateSelect, 1);
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
cy.get('.q-item > .q-item__label.subtitle').then((text) => {
const id = text.text().trim().split('#')[1];
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
});
cy.url().should('include', `/order`);
});
it('filter list and create order', () => {
cy.dataCy('Customer ID_input').type('1101{enter}');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get(agencyCreateSelect).click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
cy.get('.q-item > .q-item__label.subtitle').then((text) => {
const id = text.text().trim().split('#')[1];
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
});
cy.url().should('include', `/order`);
});
it('create order from customer summary', function () {
const clientId = 1101;
cy.dataCy('Customer ID_input').type(`${clientId}{enter}`);
cy.get(
':nth-child(1) > [data-col-field="clientFk"] > .no-padding > .link',
).click();
cy.get(
`[href="#/order/list?createForm={%22clientFk%22:${clientId},%22addressId%22:1}"] > .q-btn__content > .q-icon`,
).click();
cy.dataCy('vnTableCreateBtn').click();
cy.get(clientCreateSelect).should('have.value', 'Bruce Wayne');
cy.get(addressCreateSelect).should('have.value', 'Bruce Wayne');
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get(agencyCreateSelect).click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
cy.get('.q-item > .q-item__label.subtitle').then((text) => {
const id = text.text().trim().split('#')[1];
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
});
cy.url().should('include', `/order`);
});
});

View File

@ -2,7 +2,7 @@
describe('Logout', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/dashboard`);
cy.visit(`/#/dashboard`, false);
cy.waitForElement('.q-page', 6000);
});
describe('by user', () => {

View File

@ -1,4 +1,4 @@
describe.skip('Route extended list', () => {
describe('Route extended list', () => {
const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
const selectors = {
@ -32,18 +32,18 @@ describe.skip('Route extended list', () => {
const originalFields = [
{ selector: selectors.worker, type: 'select', value: 'logistic' },
{ selector: selectors.agency, type: 'select', value: 'Super-Man delivery' },
{ selector: selectors.agency, type: 'select', value: 'inhouse pickup' },
{ selector: selectors.vehicle, type: 'select', value: '3333-IMK' },
{ selector: selectors.date, type: 'date', value: '01/02/2024' },
{ selector: selectors.date, type: 'date', value: '01/01/2001' },
{ selector: selectors.description, type: 'input', value: 'Test route' },
{ selector: selectors.served, type: 'checkbox', value: checkboxState.uncheck },
];
const updateFields = [
{ selector: selectors.worker, type: 'select', value: 'salesperson' },
{ selector: selectors.agency, type: 'select', value: 'inhouse pickup' },
{ selector: selectors.agency, type: 'select', value: 'Super-Man delivery' },
{ selector: selectors.vehicle, type: 'select', value: '1111-IMK' },
{ selector: selectors.date, type: 'date', value: '01/01/2001' },
{ selector: selectors.date, type: 'date', value: '11/01/2001' },
{ selector: selectors.description, type: 'input', value: 'Description updated' },
{ selector: selectors.served, type: 'checkbox', value: checkboxState.check },
];
@ -57,11 +57,11 @@ describe.skip('Route extended list', () => {
break;
case 'input':
cy.get(selector).should('be.visible').click();
cy.dataCy('null_input').clear().type(`${value}{enter}`);
cy.dataCy('null_input').clear().type(`${value}`);
break;
case 'date':
cy.get(selector).should('be.visible').click();
cy.dataCy('null_inputDate').clear().type(`${value}{enter}`);
cy.dataCy('null_inputDate').clear().type(`${value}`);
break;
case 'checkbox':
cy.get(selector).should('be.visible').click().click();
@ -76,15 +76,6 @@ describe.skip('Route extended list', () => {
cy.typeSearchbar('{enter}');
});
after(() => {
cy.visit(url);
cy.typeSearchbar('{enter}');
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.removeBtn).click();
cy.dataCy(selectors.confirmBtn).click();
});
it('Should list routes', () => {
cy.get('.q-table')
.children()
@ -97,9 +88,9 @@ describe.skip('Route extended list', () => {
const data = {
Worker: { val: 'logistic', type: 'select' },
Agency: { val: 'Super-Man delivery', type: 'select' },
Agency: { val: 'inhouse pickup', type: 'select' },
Vehicle: { val: '3333-IMK', type: 'select' },
Date: { val: '02-01-2024', type: 'date' },
Date: { val: '01-01-2001', type: 'date' },
From: { val: '01-01-2024', type: 'date' },
To: { val: '10-01-2024', type: 'date' },
'Km start': { val: 1000 },
@ -129,7 +120,7 @@ describe.skip('Route extended list', () => {
it('Should clone selected route', () => {
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.cloneBtn).click();
cy.dataCy('route.Starting date_inputDate').type('10-05-2001{enter}');
cy.dataCy('route.Starting date_inputDate').type('10-05-2001').click();
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
cy.validateContent(selectors.date, '05/10/2001');
});
@ -142,10 +133,6 @@ describe.skip('Route extended list', () => {
const fileName = 'download.zip';
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
cy.task('deleteFile', `${downloadsFolder}/${fileName}`).then((deleted) => {
expect(deleted).to.be.true;
});
});
it('Should mark as served the selected route', () => {
@ -165,6 +152,13 @@ describe.skip('Route extended list', () => {
cy.checkNotification(dataSaved);
});
it('Should add ticket to route', () => {
cy.dataCy('tableAction-0').last().click();
cy.get(selectors.firstTicketsRowSelectCheckBox).click();
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
cy.checkNotification(dataSaved);
});
it('Should save changes in route', () => {
updateFields.forEach(({ selector, type, value }) => {
fillField(selector, type, value);
@ -175,18 +169,15 @@ describe.skip('Route extended list', () => {
cy.typeSearchbar('{enter}');
updateFields.forEach(({ selector, value }) => {
updateFields.forEach(({ selector, value, type }) => {
if (type === 'date') {
const [month, day, year] = value.split('/');
value = `${day}/${month}/${year}`;
}
cy.validateContent(selector, value);
});
});
it('Should add ticket to route', () => {
cy.dataCy('tableAction-0').last().click();
cy.get(selectors.firstTicketsRowSelectCheckBox).click();
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
cy.checkNotification(dataSaved);
});
it('Should open summary pop-up when click summuary icon', () => {
cy.dataCy('tableAction-1').last().click();
cy.get('.summaryHeader > :nth-child(2').should('contain', updateFields[4].value);

View File

@ -6,13 +6,16 @@ describe('ParkingBasicData', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/shelving/parking/1/basic-data`);
cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should(
'not.be.visible',
);
});
it('should give an error if the code aldready exists', () => {
cy.get(codeInput).eq(0).should('have.value', '700-01').clear();
cy.get(codeInput).eq(0).type('700-02');
cy.saveCard();
cy.get('.q-notification__message').should('have.text', 'The code already exists');
cy.checkNotification('The code already exists');
});
it('should edit the code and sector', () => {
@ -24,7 +27,8 @@ describe('ParkingBasicData', () => {
cy.dataCy('Picking order_input').clear().type(80230);
cy.saveCard();
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.checkNotification('Data saved');
cy.get(sectorSelect).should('have.value', 'First sector');
cy.get(codeInput).should('have.value', '700-01');
cy.dataCy('Picking order_input').should('have.value', 80230);

Some files were not shown because too many files have changed in this diff Show More