Compare commits
11 Commits
dev
...
7793_sortB
Author | SHA1 | Date |
---|---|---|
|
3f1195712a | |
|
126cbd3151 | |
|
ea5ef91fcc | |
|
022ced3116 | |
|
fb340d1f27 | |
|
d7b0b8b356 | |
|
8f963ab78a | |
|
ad76d81908 | |
|
0e05e2c7f8 | |
|
2d55013a90 | |
|
3476b4807f |
|
@ -31,7 +31,6 @@ yarn-error.log*
|
|||
# Cypress directories and files
|
||||
/test/cypress/videos
|
||||
/test/cypress/screenshots
|
||||
/junit
|
||||
|
||||
# VitePress directories and files
|
||||
/docs/.vitepress/cache
|
||||
|
|
38
CHANGELOG.md
38
CHANGELOG.md
|
@ -1,41 +1,3 @@
|
|||
# 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 🆕
|
||||
|
|
|
@ -12,21 +12,20 @@ def BRANCH_ENV = [
|
|||
node {
|
||||
stage('Setup') {
|
||||
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
|
||||
|
||||
PROTECTED_BRANCH = [
|
||||
'dev',
|
||||
'test',
|
||||
'master',
|
||||
'main',
|
||||
'beta'
|
||||
]
|
||||
].contains(env.BRANCH_NAME)
|
||||
|
||||
IS_PROTECTED_BRANCH = PROTECTED_BRANCH.contains(env.BRANCH_NAME)
|
||||
IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME)
|
||||
|
||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||
// 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',
|
||||
|
@ -37,7 +36,7 @@ node {
|
|||
props.each {key, value -> echo "${key}: ${value}" }
|
||||
}
|
||||
|
||||
if (IS_PROTECTED_BRANCH) {
|
||||
if (PROTECTED_BRANCH) {
|
||||
configFileProvider([
|
||||
configFile(fileId: "salix-front.branch.${env.BRANCH_NAME}",
|
||||
variable: 'BRANCH_PROPS_FILE')
|
||||
|
@ -64,7 +63,7 @@ pipeline {
|
|||
stages {
|
||||
stage('Version') {
|
||||
when {
|
||||
expression { IS_PROTECTED_BRANCH }
|
||||
expression { PROTECTED_BRANCH }
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
|
@ -85,7 +84,7 @@ pipeline {
|
|||
}
|
||||
stage('Test') {
|
||||
when {
|
||||
expression { !IS_PROTECTED_BRANCH }
|
||||
expression { !PROTECTED_BRANCH }
|
||||
}
|
||||
environment {
|
||||
NODE_ENV = ''
|
||||
|
@ -95,7 +94,7 @@ pipeline {
|
|||
parallel {
|
||||
stage('Unit') {
|
||||
steps {
|
||||
sh 'pnpm run test:front:ci'
|
||||
sh 'pnpm run test:unit:ci'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
@ -108,30 +107,24 @@ pipeline {
|
|||
}
|
||||
stage('E2E') {
|
||||
environment {
|
||||
CREDS = credentials('docker-registry')
|
||||
CREDENTIALS = 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 -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 --init") {
|
||||
sh 'sh test/cypress/cypressParallel.sh 3'
|
||||
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
|
||||
sh 'cypress run --browser chromium'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh "docker-compose ${env.COMPOSE_PARAMS} down -v"
|
||||
sh "docker-compose ${env.COMPOSE_PARAMS} down"
|
||||
junit(
|
||||
testResults: 'junit/e2e-*.xml',
|
||||
testResults: 'junit/e2e.xml',
|
||||
allowEmptyResults: true
|
||||
)
|
||||
}
|
||||
|
@ -141,9 +134,10 @@ pipeline {
|
|||
}
|
||||
stage('Build') {
|
||||
when {
|
||||
expression { IS_PROTECTED_BRANCH }
|
||||
expression { PROTECTED_BRANCH }
|
||||
}
|
||||
environment {
|
||||
CREDENTIALS = credentials('docker-registry')
|
||||
VERSION = readFile 'VERSION.txt'
|
||||
}
|
||||
steps {
|
||||
|
@ -162,7 +156,7 @@ pipeline {
|
|||
}
|
||||
stage('Deploy') {
|
||||
when {
|
||||
expression { IS_PROTECTED_BRANCH }
|
||||
expression { PROTECTED_BRANCH }
|
||||
}
|
||||
environment {
|
||||
VERSION = readFile 'VERSION.txt'
|
||||
|
|
|
@ -23,7 +23,7 @@ quasar dev
|
|||
### Run unit tests
|
||||
|
||||
```bash
|
||||
pnpm run test:front
|
||||
pnpm run test:unit
|
||||
```
|
||||
|
||||
### Run e2e tests
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import { defineConfig } from 'cypress';
|
||||
// https://docs.cypress.io/app/tooling/reporters
|
||||
// https://docs.cypress.io/app/references/configuration
|
||||
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
||||
|
||||
let urlHost, reporter, reporterOptions, timeouts;
|
||||
let urlHost,
|
||||
reporter,
|
||||
reporterOptions;
|
||||
|
||||
if (process.env.CI) {
|
||||
urlHost = 'front';
|
||||
reporter = 'junit';
|
||||
reporterOptions = {
|
||||
mochaFile: 'junit/e2e-[hash].xml',
|
||||
};
|
||||
timeouts = {
|
||||
defaultCommandTimeout: 30000,
|
||||
requestTimeout: 30000,
|
||||
responseTimeout: 60000,
|
||||
pageLoadTimeout: 60000,
|
||||
mochaFile: 'junit/e2e.xml',
|
||||
toConsole: false,
|
||||
};
|
||||
} else {
|
||||
urlHost = 'localhost';
|
||||
|
@ -25,20 +25,17 @@ 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,
|
||||
experimentalStudio: false, // Desactivado para evitar tiempos de espera innecesarios
|
||||
defaultCommandTimeout: 10000,
|
||||
trashAssetsBeforeRuns: false,
|
||||
defaultBrowser: 'chromium',
|
||||
requestTimeout: 10000,
|
||||
responseTimeout: 30000,
|
||||
pageLoadTimeout: 60000,
|
||||
fixturesFolder: 'test/cypress/fixtures',
|
||||
screenshotsFolder: 'test/cypress/screenshots',
|
||||
supportFile: 'test/cypress/support/index.js',
|
||||
|
@ -54,11 +51,27 @@ export default defineConfig({
|
|||
componentFolder: 'src',
|
||||
testFiles: '**/*.spec.js',
|
||||
supportFile: 'test/cypress/support/unit.js',
|
||||
},
|
||||
},/*
|
||||
setupNodeEvents: async (on, config) => {
|
||||
const plugin = await import('cypress-mochawesome-reporter/plugin');
|
||||
plugin.default(on);
|
||||
const fs = await import('fs');
|
||||
on('task', {
|
||||
deleteFile(filePath) {
|
||||
if (fs.existsSync(filePath)) {
|
||||
fs.unlinkSync(filePath);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
});
|
||||
|
||||
return config;
|
||||
},*/
|
||||
viewportWidth: 1280,
|
||||
viewportHeight: 720,
|
||||
...timeouts,
|
||||
includeShadowDom: true,
|
||||
waitForAnimations: true,
|
||||
},
|
||||
experimentalMemoryManagement: true,
|
||||
defaultCommandTimeout: 10000,
|
||||
numTestsKeptInMemory: 2,
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@ ENV PNPM_HOME="/home/app/.local/share/pnpm"
|
|||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
|
||||
RUN pnpm setup \
|
||||
&& pnpm install --global cypress@14.1.0 \
|
||||
&& pnpm install --global cypress@13.6.6 \
|
||||
&& cypress install
|
||||
|
||||
WORKDIR /app
|
||||
|
|
16
package.json
16
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "25.12.0",
|
||||
"version": "25.10.0",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
|
@ -13,11 +13,9 @@
|
|||
"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",
|
||||
"test:unit": "vitest",
|
||||
"test:unit:ci": "vitest run",
|
||||
"commitlint": "commitlint --edit",
|
||||
"prepare": "npx husky install",
|
||||
"addReferenceTag": "node .husky/addReferenceTag.js",
|
||||
|
@ -49,20 +47,18 @@
|
|||
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
|
||||
"@vue/test-utils": "^2.4.4",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"cypress": "^14.1.0",
|
||||
"cypress": "^13.6.6",
|
||||
"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",
|
||||
"xunit-viewer": "^10.6.1"
|
||||
"vitest": "^0.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20 || ^18 || ^16",
|
||||
|
@ -75,4 +71,4 @@
|
|||
"vite": "^6.0.11",
|
||||
"vitest": "^0.31.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2054
pnpm-lock.yaml
2054
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -184,11 +184,8 @@ async function saveChanges(data) {
|
|||
if ($props.beforeSaveFn) {
|
||||
changes = await $props.beforeSaveFn(changes, getChanges);
|
||||
}
|
||||
try {
|
||||
if (changes?.creates?.length === 0 && changes?.updates?.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await axios.post($props.saveUrl || $props.url + '/crud', changes);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -96,10 +96,6 @@ const $props = defineProps({
|
|||
type: [String, Boolean],
|
||||
default: '800px',
|
||||
},
|
||||
onDataSaved: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||
const modelValue = computed(
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
<script setup>
|
||||
import { ref, computed, useAttrs, nextTick } from 'vue';
|
||||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
|
||||
const emit = defineEmits(['onDataSaved', 'onDataCanceled']);
|
||||
|
||||
const props = defineProps({
|
||||
defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
|
@ -23,21 +22,12 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const attrs = useAttrs();
|
||||
const state = useState();
|
||||
|
||||
const formModelRef = ref(null);
|
||||
const closeButton = ref(null);
|
||||
const isSaveAndContinue = ref(props.showSaveAndContinueBtn);
|
||||
const isLoading = computed(() => formModelRef.value?.isLoading);
|
||||
const reset = computed(() => formModelRef.value?.reset);
|
||||
|
||||
const onDataSaved = async (formData, requestResponse) => {
|
||||
if (!isSaveAndContinue.value) closeButton.value?.click();
|
||||
if (isSaveAndContinue.value) {
|
||||
await nextTick();
|
||||
state.set(attrs.model, attrs.formInitialData);
|
||||
}
|
||||
isSaveAndContinue.value = props.showSaveAndContinueBtn;
|
||||
const isSaveAndContinue = ref(false);
|
||||
const onDataSaved = (formData, requestResponse) => {
|
||||
if (closeButton.value && !isSaveAndContinue.value) closeButton.value.click();
|
||||
emit('onDataSaved', formData, requestResponse);
|
||||
};
|
||||
|
||||
|
@ -46,6 +36,9 @@ const onClick = async (saveAndContinue) => {
|
|||
await formModelRef.value.save();
|
||||
};
|
||||
|
||||
const isLoading = computed(() => formModelRef.value?.isLoading);
|
||||
const reset = computed(() => formModelRef.value?.reset);
|
||||
|
||||
defineExpose({
|
||||
isLoading,
|
||||
onDataSaved,
|
||||
|
@ -81,7 +74,10 @@ defineExpose({
|
|||
data-cy="FormModelPopup_cancel"
|
||||
v-close-popup
|
||||
z-max
|
||||
@click="emit('onDataCanceled')"
|
||||
@click="
|
||||
isSaveAndContinue = false;
|
||||
emit('onDataCanceled');
|
||||
"
|
||||
/>
|
||||
<QBtn
|
||||
:flat="showSaveAndContinueBtn"
|
||||
|
|
|
@ -57,7 +57,7 @@ const refresh = () => window.location.reload();
|
|||
:class="{
|
||||
'no-visible': !stateQuery.isLoading().value,
|
||||
}"
|
||||
size="sm"
|
||||
size="xs"
|
||||
data-cy="loading-spinner"
|
||||
/>
|
||||
<QSpace />
|
||||
|
|
|
@ -12,31 +12,20 @@ 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?.reserved"
|
||||
color="primary"
|
||||
name="vn:reserva"
|
||||
size="xs"
|
||||
data-cy="ticketSaleReservedIcon"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticketSale.reserved') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row?.hasRisk"
|
||||
v-if="row?.risk"
|
||||
name="vn:risk"
|
||||
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ $t('salesTicketsTable.risk') }}:
|
||||
{{ toCurrency(row.risk - (row.credit ?? 0)) }}
|
||||
{{ toCurrency(row.risk - row.credit) }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
|
@ -78,7 +67,12 @@ defineProps({ row: { type: Object, required: true } });
|
|||
>
|
||||
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row?.isTaxDataChecked" name="vn:no036" color="primary" size="xs">
|
||||
<QIcon
|
||||
v-if="row?.isTaxDataChecked !== 0"
|
||||
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">
|
||||
|
|
|
@ -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,6 +122,7 @@ const makeInvoice = async () => {
|
|||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('Client')"
|
||||
:options="clientsOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
|
|
|
@ -91,6 +91,7 @@ const components = {
|
|||
event: updateEvent,
|
||||
attrs: {
|
||||
...defaultAttrs,
|
||||
style: 'min-width: 150px',
|
||||
},
|
||||
forceAttrs,
|
||||
},
|
||||
|
|
|
@ -31,7 +31,6 @@ import VnLv from 'components/ui/VnLv.vue';
|
|||
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
||||
import VnTableFilter from './VnTableFilter.vue';
|
||||
import { getColAlign } from 'src/composables/getColAlign';
|
||||
import RightMenu from '../common/RightMenu.vue';
|
||||
|
||||
const arrayData = useArrayData(useAttrs()['data-key']);
|
||||
const $props = defineProps({
|
||||
|
@ -51,11 +50,11 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
rowClick: {
|
||||
type: [Function, Boolean],
|
||||
default: null,
|
||||
rightSearchIcon: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
rowCtrlClick: {
|
||||
rowClick: {
|
||||
type: [Function, Boolean],
|
||||
default: null,
|
||||
},
|
||||
|
@ -138,10 +137,6 @@ const $props = defineProps({
|
|||
createComplement: {
|
||||
type: Object,
|
||||
},
|
||||
dataCy: {
|
||||
type: String,
|
||||
default: 'vn-table',
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -257,9 +252,7 @@ function splitColumns(columns) {
|
|||
col.columnFilter = { inWhere: true, ...col.columnFilter };
|
||||
splittedColumns.value.columns.push(col);
|
||||
}
|
||||
|
||||
splittedColumns.value.create = createOrderSort(splittedColumns.value.create);
|
||||
|
||||
// Status column
|
||||
if (splittedColumns.value.chips.length) {
|
||||
splittedColumns.value.columnChips = splittedColumns.value.chips.filter(
|
||||
(c) => !c.isId,
|
||||
|
@ -275,24 +268,6 @@ function splitColumns(columns) {
|
|||
}
|
||||
}
|
||||
|
||||
function createOrderSort(columns) {
|
||||
const orderedColumn = columns
|
||||
.map((column, index) =>
|
||||
column.createOrder !== undefined ? { ...column, originalIndex: index } : null,
|
||||
)
|
||||
.filter((item) => item !== null);
|
||||
|
||||
orderedColumn.sort((a, b) => a.createOrder - b.createOrder);
|
||||
|
||||
const filteredColumns = columns.filter((col) => col.createOrder === undefined);
|
||||
|
||||
orderedColumn.forEach((col) => {
|
||||
filteredColumns.splice(col.createOrder, 0, col);
|
||||
});
|
||||
|
||||
return filteredColumns;
|
||||
}
|
||||
|
||||
const rowClickFunction = computed(() => {
|
||||
if ($props.rowClick != undefined) return $props.rowClick;
|
||||
if ($props.redirect) return ({ id }) => redirectFn(id);
|
||||
|
@ -338,14 +313,8 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
if (evt?.shiftKey && added) {
|
||||
const rowIndex = selectedRows[0].$index;
|
||||
const selectedIndexes = new Set(selected.value.map((row) => row.$index));
|
||||
const minIndex = selectedIndexes.size
|
||||
? Math.min(...selectedIndexes, rowIndex)
|
||||
: 0;
|
||||
const maxIndex = Math.max(...selectedIndexes, rowIndex);
|
||||
|
||||
for (let i = minIndex; i <= maxIndex; i++) {
|
||||
const row = rows[i];
|
||||
if (row.$index == rowIndex) continue;
|
||||
for (const row of rows) {
|
||||
if (row.$index == rowIndex) break;
|
||||
if (!selectedIndexes.has(row.$index)) {
|
||||
selected.value.push(row);
|
||||
selectedIndexes.add(row.$index);
|
||||
|
@ -368,11 +337,12 @@ function hasEditableFormat(column) {
|
|||
|
||||
const clickHandler = async (event) => {
|
||||
const clickedElement = event.target.closest('td');
|
||||
|
||||
const isDateElement = event.target.closest('.q-date');
|
||||
const isTimeElement = event.target.closest('.q-time');
|
||||
const isQSelectDropDown = event.target.closest('.q-select__dropdown-icon');
|
||||
const isQselectDropDown = event.target.closest('.q-select__dropdown-icon');
|
||||
|
||||
if (isDateElement || isTimeElement || isQSelectDropDown) return;
|
||||
if (isDateElement || isTimeElement || isQselectDropDown) return;
|
||||
|
||||
if (clickedElement === null) {
|
||||
await destroyInput(editingRow.value, editingField.value);
|
||||
|
@ -443,13 +413,20 @@ async function renderInput(rowId, field, clickedElement) {
|
|||
eventHandlers: {
|
||||
'update:modelValue': async (value) => {
|
||||
if (isSelect && value) {
|
||||
await updateSelectValue(value, column, row, oldValue);
|
||||
row[column.name] = value[column.attrs?.optionValue ?? 'id'];
|
||||
row[column?.name + 'TextValue'] =
|
||||
value[column.attrs?.optionLabel ?? 'name'];
|
||||
await column?.cellEvent?.['update:modelValue']?.(
|
||||
value,
|
||||
oldValue,
|
||||
row,
|
||||
);
|
||||
} else row[column.name] = value;
|
||||
await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row);
|
||||
},
|
||||
keyup: async (event) => {
|
||||
if (event.key === 'Enter')
|
||||
await destroyInput(rowId, field, clickedElement);
|
||||
await destroyInput(rowIndex, field, clickedElement);
|
||||
},
|
||||
keydown: async (event) => {
|
||||
switch (event.key) {
|
||||
|
@ -480,17 +457,6 @@ async function renderInput(rowId, field, clickedElement) {
|
|||
node.el?.querySelector('span > div > div').focus();
|
||||
}
|
||||
|
||||
async function updateSelectValue(value, column, row, oldValue) {
|
||||
row[column.name] = value[column.attrs?.optionValue ?? 'id'];
|
||||
|
||||
row[column?.name + 'VnTableTextValue'] = value[column.attrs?.optionLabel ?? 'name'];
|
||||
|
||||
if (column?.attrs?.find?.label)
|
||||
row[column?.attrs?.find?.label] = value[column.attrs?.optionLabel ?? 'name'];
|
||||
|
||||
await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row);
|
||||
}
|
||||
|
||||
async function destroyInput(rowIndex, field, clickedElement) {
|
||||
if (!clickedElement)
|
||||
clickedElement = document.querySelector(
|
||||
|
@ -553,9 +519,9 @@ function getToggleIcon(value) {
|
|||
}
|
||||
|
||||
function formatColumnValue(col, row, dashIfEmpty) {
|
||||
if (col?.format || row[col?.name + 'VnTableTextValue']) {
|
||||
if (selectRegex.test(col?.component) && row[col?.name + 'VnTableTextValue']) {
|
||||
return dashIfEmpty(row[col?.name + 'VnTableTextValue']);
|
||||
if (col?.format || row[col?.name + 'TextValue']) {
|
||||
if (selectRegex.test(col?.component) && row[col?.name + 'TextValue']) {
|
||||
return dashIfEmpty(row[col?.name + 'TextValue']);
|
||||
} else {
|
||||
return col.format(row, dashIfEmpty);
|
||||
}
|
||||
|
@ -588,48 +554,19 @@ function formatColumnValue(col, row, dashIfEmpty) {
|
|||
}
|
||||
return dashIfEmpty(row[col?.name]);
|
||||
}
|
||||
|
||||
function cardClick(_, row) {
|
||||
if ($props.redirect) router.push({ path: `/${$props.redirect}/${row.id}` });
|
||||
}
|
||||
|
||||
function removeTextValue(data, getChanges) {
|
||||
let changes = data.updates;
|
||||
if (!changes) return data;
|
||||
|
||||
for (const change of changes) {
|
||||
for (const key in change.data) {
|
||||
if (key.endsWith('VnTableTextValue')) {
|
||||
delete change.data[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.updates = changes.filter((change) => Object.keys(change.data).length > 0);
|
||||
|
||||
if ($attrs?.beforeSaveFn) data = $attrs.beforeSaveFn(data, getChanges);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function handleRowClick(event, row) {
|
||||
if (event.ctrlKey) return rowCtrlClickFunction.value(event, row);
|
||||
if (rowClickFunction.value) rowClickFunction.value(row);
|
||||
}
|
||||
|
||||
const rowCtrlClickFunction = computed(() => {
|
||||
if ($props.rowCtrlClick != undefined) return $props.rowCtrlClick;
|
||||
if ($props.redirect)
|
||||
return (evt, { id }) => {
|
||||
stopEventPropagation(evt);
|
||||
window.open(`/#/${$props.redirect}/${id}`, '_blank');
|
||||
};
|
||||
return () => {};
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<RightMenu v-if="$props.rightSearch" :overlay="overlay">
|
||||
<template #right-panel>
|
||||
<QDrawer
|
||||
v-if="$props.rightSearch"
|
||||
v-model="stateStore.rightDrawer"
|
||||
side="right"
|
||||
:width="256"
|
||||
:overlay="$props.overlay"
|
||||
>
|
||||
<QScrollArea class="fit">
|
||||
<VnTableFilter
|
||||
:data-key="$attrs['data-key']"
|
||||
:columns="columns"
|
||||
|
@ -643,8 +580,8 @@ const rowCtrlClickFunction = computed(() => {
|
|||
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||
</template>
|
||||
</VnTableFilter>
|
||||
</template>
|
||||
</RightMenu>
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<CrudModel
|
||||
v-bind="$attrs"
|
||||
:class="$attrs['class'] ?? 'q-px-md'"
|
||||
|
@ -653,7 +590,6 @@ const rowCtrlClickFunction = computed(() => {
|
|||
@on-fetch="(...args) => emit('onFetch', ...args)"
|
||||
:search-url="searchUrl"
|
||||
:disable-infinite-scroll="isTableMode"
|
||||
:before-save-fn="removeTextValue"
|
||||
@save-changes="reload"
|
||||
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
|
||||
:auto-load="hasParams || $attrs['auto-load']"
|
||||
|
@ -681,11 +617,10 @@ const rowCtrlClickFunction = computed(() => {
|
|||
:style="isTableMode && `max-height: ${tableHeight}`"
|
||||
:virtual-scroll="isTableMode"
|
||||
@virtual-scroll="handleScroll"
|
||||
@row-click="(event, row) => handleRowClick(event, row)"
|
||||
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
||||
@update:selected="emit('update:selected', $event)"
|
||||
@selection="(details) => handleSelection(details, rows)"
|
||||
:hide-selected-banner="true"
|
||||
:data-cy="$props.dataCy ?? 'vnTable'"
|
||||
>
|
||||
<template #top-left v-if="!$props.withoutHeader">
|
||||
<slot name="top-left"> </slot>
|
||||
|
@ -699,7 +634,6 @@ const rowCtrlClickFunction = computed(() => {
|
|||
:skip="columnsVisibilitySkipped"
|
||||
/>
|
||||
<QBtnToggle
|
||||
v-if="!tableModes.some((mode) => mode.disable)"
|
||||
v-model="mode"
|
||||
toggle-color="primary"
|
||||
class="bg-vn-section-color"
|
||||
|
@ -1019,6 +953,14 @@ const rowCtrlClickFunction = computed(() => {
|
|||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
:full-width="createComplement?.isFullWidth ?? false"
|
||||
@before-hide="
|
||||
() => {
|
||||
if (createRef.isSaveAndContinue) {
|
||||
showForm = true;
|
||||
createForm.formInitialData = { ...create.formInitialData };
|
||||
}
|
||||
}
|
||||
"
|
||||
data-cy="vn-table-create-dialog"
|
||||
>
|
||||
<FormModelPopup
|
||||
|
@ -1029,10 +971,7 @@ const rowCtrlClickFunction = computed(() => {
|
|||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<div :style="createComplement?.containerStyle">
|
||||
<div
|
||||
:style="createComplement?.previousStyle"
|
||||
v-if="!quasar.screen.xs"
|
||||
>
|
||||
<div>
|
||||
<slot name="previous-create-dialog" :data="data" />
|
||||
</div>
|
||||
<div class="grid-create" :style="createComplement?.columnGridStyle">
|
||||
|
@ -1045,10 +984,7 @@ const rowCtrlClickFunction = computed(() => {
|
|||
:label="column.label"
|
||||
>
|
||||
<VnColumn
|
||||
:column="{
|
||||
...column,
|
||||
...{ disable: column?.createDisable ?? false },
|
||||
}"
|
||||
:column="column"
|
||||
:row="{}"
|
||||
default="input"
|
||||
v-model="data[column.name]"
|
||||
|
|
|
@ -27,58 +27,30 @@ describe('VnTable', () => {
|
|||
beforeEach(() => (vm.selected = []));
|
||||
|
||||
describe('handleSelection()', () => {
|
||||
const rows = [
|
||||
{ $index: 0 },
|
||||
{ $index: 1 },
|
||||
{ $index: 2 },
|
||||
{ $index: 3 },
|
||||
{ $index: 4 },
|
||||
];
|
||||
|
||||
it('should add rows to selected when shift key is pressed and rows are added in ascending order', () => {
|
||||
const selectedRows = [{ $index: 1 }];
|
||||
const rows = [{ $index: 0 }, { $index: 1 }, { $index: 2 }];
|
||||
const selectedRows = [{ $index: 1 }];
|
||||
it('should add rows to selected when shift key is pressed and rows are added except last one', () => {
|
||||
vm.handleSelection(
|
||||
{ evt: { shiftKey: true }, added: true, rows: selectedRows },
|
||||
rows,
|
||||
rows
|
||||
);
|
||||
expect(vm.selected).toEqual([{ $index: 0 }]);
|
||||
});
|
||||
|
||||
it('should add rows to selected when shift key is pressed and rows are added in descending order', () => {
|
||||
const selectedRows = [{ $index: 3 }];
|
||||
vm.handleSelection(
|
||||
{ evt: { shiftKey: true }, added: true, rows: selectedRows },
|
||||
rows,
|
||||
);
|
||||
expect(vm.selected).toEqual([{ $index: 0 }, { $index: 1 }, { $index: 2 }]);
|
||||
});
|
||||
|
||||
it('should not add rows to selected when shift key is not pressed', () => {
|
||||
const selectedRows = [{ $index: 1 }];
|
||||
vm.handleSelection(
|
||||
{ evt: { shiftKey: false }, added: true, rows: selectedRows },
|
||||
rows,
|
||||
rows
|
||||
);
|
||||
expect(vm.selected).toEqual([]);
|
||||
});
|
||||
|
||||
it('should not add rows to selected when rows are not added', () => {
|
||||
const selectedRows = [{ $index: 1 }];
|
||||
vm.handleSelection(
|
||||
{ evt: { shiftKey: true }, added: false, rows: selectedRows },
|
||||
rows,
|
||||
rows
|
||||
);
|
||||
expect(vm.selected).toEqual([]);
|
||||
});
|
||||
|
||||
it('should add all rows between the smallest and largest selected indexes', () => {
|
||||
vm.selected = [{ $index: 1 }, { $index: 3 }];
|
||||
const selectedRows = [{ $index: 4 }];
|
||||
vm.handleSelection(
|
||||
{ evt: { shiftKey: true }, added: true, rows: selectedRows },
|
||||
rows,
|
||||
);
|
||||
expect(vm.selected).toEqual([{ $index: 1 }, { $index: 3 }, { $index: 2 }]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -30,8 +30,8 @@ describe('CrudModel', () => {
|
|||
saveFn: '',
|
||||
},
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
wrapper=wrapper.wrapper;
|
||||
vm=wrapper.vm;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -143,14 +143,14 @@ describe('CrudModel', () => {
|
|||
});
|
||||
|
||||
it('should return true if object is empty', async () => {
|
||||
dummyObj = {};
|
||||
result = vm.isEmpty(dummyObj);
|
||||
dummyObj ={};
|
||||
result = vm.isEmpty(dummyObj);
|
||||
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false if object is not empty', async () => {
|
||||
dummyObj = { a: 1, b: 2, c: 3 };
|
||||
dummyObj = {a:1, b:2, c:3};
|
||||
result = vm.isEmpty(dummyObj);
|
||||
|
||||
expect(result).toBe(false);
|
||||
|
@ -158,31 +158,29 @@ describe('CrudModel', () => {
|
|||
|
||||
it('should return true if array is empty', async () => {
|
||||
dummyArray = [];
|
||||
result = vm.isEmpty(dummyArray);
|
||||
result = vm.isEmpty(dummyArray);
|
||||
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
it('should return false if array is not empty', async () => {
|
||||
dummyArray = [1, 2, 3];
|
||||
dummyArray = [1,2,3];
|
||||
result = vm.isEmpty(dummyArray);
|
||||
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('resetData()', () => {
|
||||
it('should add $index to elements in data[] and sets originalData and formData with data', async () => {
|
||||
data = [
|
||||
{
|
||||
name: 'Tony',
|
||||
lastName: 'Stark',
|
||||
age: 42,
|
||||
},
|
||||
];
|
||||
data = [{
|
||||
name: 'Tony',
|
||||
lastName: 'Stark',
|
||||
age: 42,
|
||||
}];
|
||||
|
||||
vm.resetData(data);
|
||||
|
||||
|
||||
expect(vm.originalData).toEqual(data);
|
||||
expect(vm.originalData[0].$index).toEqual(0);
|
||||
expect(vm.formData).toEqual(data);
|
||||
|
@ -202,7 +200,7 @@ describe('CrudModel', () => {
|
|||
lastName: 'Stark',
|
||||
age: 42,
|
||||
};
|
||||
|
||||
|
||||
vm.resetData(data);
|
||||
|
||||
expect(vm.originalData).toEqual(data);
|
||||
|
@ -212,19 +210,17 @@ describe('CrudModel', () => {
|
|||
});
|
||||
|
||||
describe('saveChanges()', () => {
|
||||
data = [
|
||||
{
|
||||
name: 'Tony',
|
||||
lastName: 'Stark',
|
||||
age: 42,
|
||||
},
|
||||
];
|
||||
data = [{
|
||||
name: 'Tony',
|
||||
lastName: 'Stark',
|
||||
age: 42,
|
||||
}];
|
||||
|
||||
it('should call saveFn if exists', async () => {
|
||||
await wrapper.setProps({ saveFn: vi.fn() });
|
||||
|
||||
vm.saveChanges(data);
|
||||
|
||||
|
||||
expect(vm.saveFn).toHaveBeenCalledOnce();
|
||||
expect(vm.isLoading).toBe(false);
|
||||
expect(vm.hasChanges).toBe(false);
|
||||
|
@ -233,15 +229,13 @@ describe('CrudModel', () => {
|
|||
});
|
||||
|
||||
it("should use default url if there's not saveFn", async () => {
|
||||
const postMock = vi.spyOn(axios, 'post');
|
||||
|
||||
vm.formData = [
|
||||
{
|
||||
name: 'Bruce',
|
||||
lastName: 'Wayne',
|
||||
age: 45,
|
||||
},
|
||||
];
|
||||
const postMock =vi.spyOn(axios, 'post');
|
||||
|
||||
vm.formData = [{
|
||||
name: 'Bruce',
|
||||
lastName: 'Wayne',
|
||||
age: 45,
|
||||
}]
|
||||
|
||||
await vm.saveChanges(data);
|
||||
|
||||
|
|
|
@ -11,13 +11,6 @@ const stateStore = useStateStore();
|
|||
const slots = useSlots();
|
||||
const hasContent = useHasContent('#right-panel');
|
||||
|
||||
defineProps({
|
||||
overlay: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
if ((!slots['right-panel'] && !hasContent.value) || quasar.platform.is.mobile)
|
||||
stateStore.rightDrawer = false;
|
||||
|
@ -41,12 +34,7 @@ onMounted(() => {
|
|||
</QBtn>
|
||||
</div>
|
||||
</Teleport>
|
||||
<QDrawer
|
||||
v-model="stateStore.rightDrawer"
|
||||
side="right"
|
||||
:width="256"
|
||||
:overlay="overlay"
|
||||
>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<div id="right-panel"></div>
|
||||
<slot v-if="!hasContent" name="right-panel" />
|
||||
|
|
|
@ -56,12 +56,7 @@ 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
|
||||
data-cy="SendEmailNotifiactionDialogInput"
|
||||
/>
|
||||
<VnInput v-model="address" is-outlined autofocus />
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn :label="t('globals.cancel')" color="primary" flat v-close-popup />
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<script setup>
|
||||
import { nextTick, ref } from 'vue';
|
||||
import VnInput from './VnInput.vue';
|
||||
import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import { QInput } from 'quasar';
|
||||
|
||||
const $props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
insertable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
@ -11,25 +14,70 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
||||
const model = defineModel({ prop: 'modelValue' });
|
||||
const inputRef = ref(false);
|
||||
|
||||
function setCursorPosition(pos) {
|
||||
const input = inputRef.value.vnInputRef.$el.querySelector('input');
|
||||
input.focus();
|
||||
input.setSelectionRange(pos, pos);
|
||||
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);
|
||||
}
|
||||
|
||||
async function handleUpdateModel(val) {
|
||||
model.value = val?.at(-1) === '.' ? useAccountShortToStandard(val) : val;
|
||||
await nextTick(() => setCursorPosition(0));
|
||||
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)
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnInput
|
||||
v-model="model"
|
||||
ref="inputRef"
|
||||
:insertable
|
||||
@update:model-value="handleUpdateModel"
|
||||
/>
|
||||
<QInput @keydown="handleKeydown" ref="vnInputRef" v-model="internalValue" />
|
||||
</template>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<script setup>
|
||||
import { onBeforeMount } from 'vue';
|
||||
import { useRouter, onBeforeRouteUpdate, onBeforeRouteLeave } from 'vue-router';
|
||||
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSubToolbar from '../ui/VnSubToolbar.vue';
|
||||
|
||||
const props = defineProps({
|
||||
|
@ -26,13 +27,7 @@ const arrayData = useArrayData(props.dataKey, {
|
|||
oneRecord: true,
|
||||
});
|
||||
|
||||
onBeforeRouteLeave(() => {
|
||||
stateStore.cardDescriptorChangeValue(null);
|
||||
});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
stateStore.cardDescriptorChangeValue(props.descriptor);
|
||||
|
||||
const route = router.currentRoute.value;
|
||||
try {
|
||||
await fetch(route.params.id);
|
||||
|
@ -67,6 +62,11 @@ function hasRouteParam(params, valueToCheck = ':addressId') {
|
|||
}
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#left-panel" v-if="stateStore.isHeaderMounted()">
|
||||
<component :is="descriptor" />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</Teleport>
|
||||
<VnSubToolbar />
|
||||
<div :class="[useCardSize(), $attrs.class]">
|
||||
<RouterView :key="$route.path" />
|
||||
|
|
|
@ -27,7 +27,7 @@ const checkboxModel = computed({
|
|||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<QCheckbox v-bind="$attrs" v-model="checkboxModel" />
|
||||
<QCheckbox v-bind="$attrs" v-on="$attrs" v-model="checkboxModel" />
|
||||
<QIcon
|
||||
v-if="info"
|
||||
v-bind="$attrs"
|
||||
|
|
|
@ -83,7 +83,7 @@ const mixinRules = [
|
|||
requiredFieldRule,
|
||||
...($attrs.rules ?? []),
|
||||
(val) => {
|
||||
const maxlength = $props.maxlength;
|
||||
const { maxlength } = vnInputRef.value;
|
||||
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 = $props.maxlength;
|
||||
const { maxlength } = vnInputRef.value;
|
||||
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['data-cy'] ?? $attrs.label) + '_input'"
|
||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
|
||||
>
|
||||
<template #prepend v-if="$slots.prepend">
|
||||
<slot name="prepend" />
|
||||
|
|
|
@ -641,7 +641,15 @@ watch(
|
|||
>
|
||||
{{ prop.nameI18n }}:
|
||||
</span>
|
||||
<VnJsonValue :value="prop.val.val" />
|
||||
<span
|
||||
v-if="prop.val.id"
|
||||
class="id-value"
|
||||
>
|
||||
#{{ prop.val.id }}
|
||||
</span>
|
||||
<span v-if="log.action == 'update'">
|
||||
←
|
||||
<VnJsonValue
|
||||
:value="prop.old.val"
|
||||
/>
|
||||
|
@ -651,26 +659,6 @@ watch(
|
|||
>
|
||||
#{{ prop.old.id }}
|
||||
</span>
|
||||
→
|
||||
<VnJsonValue
|
||||
:value="prop.val.val"
|
||||
/>
|
||||
<span
|
||||
v-if="prop.val.id"
|
||||
class="id-value"
|
||||
>
|
||||
#{{ prop.val.id }}
|
||||
</span>
|
||||
</span>
|
||||
<span v-else="prop.old.val">
|
||||
<VnJsonValue
|
||||
:value="prop.val.val"
|
||||
/>
|
||||
<span
|
||||
v-if="prop.old.id"
|
||||
class="id-value"
|
||||
>#{{ prop.old.id }}</span
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
|
|
|
@ -12,7 +12,7 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
onMounted(
|
||||
() => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false),
|
||||
() => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false)
|
||||
);
|
||||
|
||||
const teleportRef = ref({});
|
||||
|
@ -35,14 +35,8 @@ onMounted(() => {
|
|||
<template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<div id="left-panel" ref="teleportRef">
|
||||
<template v-if="stateStore.cardDescriptor">
|
||||
<component :is="stateStore.cardDescriptor" />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</template>
|
||||
<template v-else> <LeftMenu /></template>
|
||||
</div>
|
||||
<div id="left-panel" ref="teleportRef"></div>
|
||||
<LeftMenu v-if="!hasContent" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
|
|
|
@ -51,7 +51,7 @@ const url = computed(() => {
|
|||
option-value="id"
|
||||
option-label="nickname"
|
||||
:fields="['id', 'name', 'nickname', 'code']"
|
||||
:filter-options="['id', 'name', 'nickname', 'code']"
|
||||
:filter-options="['name','id', 'nickname', 'code']"
|
||||
sort-by="nickname ASC"
|
||||
data-cy="vnWorkerSelect"
|
||||
>
|
||||
|
|
|
@ -5,7 +5,7 @@ import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
|
|||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useClipboard } from 'src/composables/useClipboard';
|
||||
import VnMoreOptions from './VnMoreOptions.vue';
|
||||
|
||||
|
@ -42,7 +42,6 @@ const $props = defineProps({
|
|||
|
||||
const state = useState();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const { copyText } = useClipboard();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
|
@ -51,9 +50,6 @@ let store;
|
|||
let entity;
|
||||
const isLoading = ref(false);
|
||||
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
|
||||
const DESCRIPTOR_PROXY = 'DescriptorProxy';
|
||||
const moduleName = ref();
|
||||
const isSameModuleName = route.matched[1].meta.moduleName !== moduleName.value;
|
||||
defineExpose({ getData });
|
||||
|
||||
onBeforeMount(async () => {
|
||||
|
@ -80,18 +76,6 @@ onBeforeMount(async () => {
|
|||
);
|
||||
});
|
||||
|
||||
function getName() {
|
||||
let name = $props.dataKey;
|
||||
if ($props.dataKey.includes(DESCRIPTOR_PROXY)) {
|
||||
name = name.split(DESCRIPTOR_PROXY)[0];
|
||||
}
|
||||
return name;
|
||||
}
|
||||
const routeName = computed(() => {
|
||||
let routeName = getName();
|
||||
return `${routeName}Summary`;
|
||||
});
|
||||
|
||||
async function getData() {
|
||||
store.url = $props.url;
|
||||
store.filter = $props.filter ?? {};
|
||||
|
@ -127,35 +111,20 @@ function copyIdText(id) {
|
|||
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
||||
const iconModule = computed(() => {
|
||||
moduleName.value = getName();
|
||||
if (isSameModuleName) {
|
||||
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
|
||||
?.meta?.icon;
|
||||
} else {
|
||||
return route.matched[1].meta.icon;
|
||||
}
|
||||
});
|
||||
|
||||
const toModule = computed(() => {
|
||||
moduleName.value = getName();
|
||||
if (isSameModuleName) {
|
||||
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
|
||||
?.children[0]?.redirect;
|
||||
} else {
|
||||
return route.matched[1].path.split('/').length > 2
|
||||
? route.matched[1].redirect
|
||||
: route.matched[1].children[0].redirect;
|
||||
}
|
||||
});
|
||||
const iconModule = computed(() => route.matched[1].meta.icon);
|
||||
const toModule = computed(() =>
|
||||
route.matched[1].path.split('/').length > 2
|
||||
? route.matched[1].redirect
|
||||
: route.matched[1].children[0].redirect,
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="descriptor">
|
||||
<template v-if="entity && !isLoading">
|
||||
<div class="header bg-primary q-pa-sm justify-between">
|
||||
<slot name="header-extra-action">
|
||||
<QBtn
|
||||
<slot name="header-extra-action"
|
||||
><QBtn
|
||||
round
|
||||
flat
|
||||
dense
|
||||
|
@ -163,13 +132,13 @@ const toModule = computed(() => {
|
|||
:icon="iconModule"
|
||||
color="white"
|
||||
class="link"
|
||||
:to="toModule"
|
||||
:to="$attrs['to-module'] ?? toModule"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('globals.goToModuleIndex') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</slot>
|
||||
</QBtn></slot
|
||||
>
|
||||
<QBtn
|
||||
@click.stop="viewSummary(entity.id, $props.summary, $props.width)"
|
||||
round
|
||||
|
@ -185,7 +154,9 @@ const toModule = computed(() => {
|
|||
{{ t('components.smartCard.openSummary') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<RouterLink :to="{ name: routeName, params: { id: entity.id } }">
|
||||
<RouterLink
|
||||
:to="{ name: `${dataKey}Summary`, params: { id: entity.id } }"
|
||||
>
|
||||
<QBtn
|
||||
class="link"
|
||||
color="white"
|
||||
|
@ -225,6 +196,7 @@ const toModule = computed(() => {
|
|||
<QItemLabel class="subtitle">
|
||||
#{{ getValueFromPath(subtitle) ?? entity.id }}
|
||||
</QItemLabel>
|
||||
|
||||
<QBtn
|
||||
round
|
||||
flat
|
||||
|
@ -238,6 +210,7 @@ const toModule = computed(() => {
|
|||
{{ t('globals.copyId') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<!-- </QItemLabel> -->
|
||||
</QItem>
|
||||
</QList>
|
||||
<div class="list-box q-mt-xs">
|
||||
|
@ -247,11 +220,12 @@ const toModule = computed(() => {
|
|||
<div class="icons">
|
||||
<slot name="icons" :entity="entity" />
|
||||
</div>
|
||||
<div class="actions justify-center" data-cy="descriptor_actions">
|
||||
<div class="actions justify-center">
|
||||
<slot name="actions" :entity="entity" />
|
||||
</div>
|
||||
<slot name="after" />
|
||||
</template>
|
||||
<!-- Skeleton -->
|
||||
<SkeletonDescriptor v-if="!entity || isLoading" />
|
||||
</div>
|
||||
<QInnerLoading
|
||||
|
|
|
@ -132,8 +132,7 @@ const card = toRef(props, 'item');
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
white-space: nowrap;
|
||||
width: 192px;
|
||||
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
|
|
@ -18,16 +18,20 @@ import VnInput from 'components/common/VnInput.vue';
|
|||
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
||||
const $attrs = useAttrs();
|
||||
const originalAttrs = useAttrs();
|
||||
|
||||
const $attrs = computed(() => {
|
||||
const { style, ...rest } = originalAttrs;
|
||||
return rest;
|
||||
});
|
||||
|
||||
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 },
|
||||
userFilter: { type: Object, default: () => {} },
|
||||
saveUrl: {type: String, default: null},
|
||||
filter: { type: Object, default: () => {} },
|
||||
body: { type: Object, default: () => {} },
|
||||
addNote: { type: Boolean, default: false },
|
||||
|
@ -61,7 +65,7 @@ async function insert() {
|
|||
}
|
||||
|
||||
function confirmAndUpdate() {
|
||||
if (!newNote.text && originalText)
|
||||
if(!newNote.text && originalText)
|
||||
quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
|
@ -84,17 +88,11 @@ 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: {
|
||||
|
@ -106,11 +104,12 @@ 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
|
||||
|
@ -127,8 +126,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"
|
||||
>
|
||||
|
@ -180,8 +179,7 @@ function fetchData([data]) {
|
|||
:url="$props.url"
|
||||
order="created DESC"
|
||||
:limit="0"
|
||||
:user-filter="userFilter"
|
||||
:filter="filter"
|
||||
:user-filter="$props.filter"
|
||||
auto-load
|
||||
ref="vnPaginateRef"
|
||||
class="show"
|
||||
|
@ -220,7 +218,7 @@ function fetchData([data]) {
|
|||
>
|
||||
{{
|
||||
observationTypes.find(
|
||||
(ot) => ot.id === note.observationTypeFk,
|
||||
(ot) => ot.id === note.observationTypeFk
|
||||
)?.description
|
||||
}}
|
||||
</QBadge>
|
||||
|
|
|
@ -33,10 +33,6 @@ const props = defineProps({
|
|||
type: String,
|
||||
default: '',
|
||||
},
|
||||
userFilter: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
filter: {
|
||||
type: Object,
|
||||
default: null,
|
||||
|
@ -208,9 +204,8 @@ async function search() {
|
|||
}
|
||||
|
||||
:deep(.q-field--focused) {
|
||||
.q-icon,
|
||||
.q-placeholder {
|
||||
color: var(--vn-black-text-color);
|
||||
.q-icon {
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ export async function checkEntryLock(entryFk, userFk) {
|
|||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
'data-cy': 'entry-lock-confirm',
|
||||
title: t('entry.lock.title'),
|
||||
message: t('entry.lock.message', {
|
||||
userName: data?.user?.nickname,
|
||||
|
|
|
@ -148,7 +148,8 @@ export function useArrayData(key, userOptions) {
|
|||
}
|
||||
|
||||
async function applyFilter({ filter, params }, fetchOptions = {}) {
|
||||
if (filter) store.filter = filter;
|
||||
if (filter) store.userFilter = filter;
|
||||
store.filter = {};
|
||||
if (params) store.userParams = { ...params };
|
||||
|
||||
const response = await fetch(fetchOptions);
|
||||
|
@ -244,7 +245,7 @@ export function useArrayData(key, userOptions) {
|
|||
async function loadMore() {
|
||||
if (!store.hasMoreData) return;
|
||||
|
||||
store.skip = (store?.filter?.limit ?? store.limit) * store.page;
|
||||
store.skip = store.limit * store.page;
|
||||
store.page += 1;
|
||||
|
||||
await fetch({ append: true });
|
||||
|
|
|
@ -337,5 +337,5 @@ input::-webkit-inner-spin-button {
|
|||
}
|
||||
|
||||
.containerShrinked {
|
||||
width: 70%;
|
||||
width: 80%;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,6 @@ globals:
|
|||
maxTemperature: Max
|
||||
minTemperature: Min
|
||||
changePass: Change password
|
||||
setPass: Set password
|
||||
deleteConfirmTitle: Delete selected elements
|
||||
changeState: Change state
|
||||
raid: 'Raid {daysInForward} days'
|
||||
|
@ -369,7 +368,6 @@ globals:
|
|||
countryFk: Country
|
||||
countryCodeFk: Country
|
||||
companyFk: Company
|
||||
nickname: Alias
|
||||
model: Model
|
||||
fuel: Fuel
|
||||
active: Active
|
||||
|
@ -695,10 +693,8 @@ worker:
|
|||
machine: Machine
|
||||
business:
|
||||
tableVisibleColumns:
|
||||
id: ID
|
||||
started: Start Date
|
||||
ended: End Date
|
||||
hourlyLabor: Time sheet
|
||||
company: Company
|
||||
reasonEnd: Reason for Termination
|
||||
department: Department
|
||||
|
@ -706,7 +702,6 @@ worker:
|
|||
calendarType: Work Calendar
|
||||
workCenter: Work Center
|
||||
payrollCategories: Contract Category
|
||||
workerBusinessAgreementName: Agreement
|
||||
occupationCode: Contribution Code
|
||||
rate: Rate
|
||||
businessType: Contract Type
|
||||
|
|
|
@ -157,7 +157,6 @@ globals:
|
|||
maxTemperature: Máx
|
||||
minTemperature: Mín
|
||||
changePass: Cambiar contraseña
|
||||
setPass: Establecer contraseña
|
||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||
changeState: Cambiar estado
|
||||
raid: 'Redada {daysInForward} días'
|
||||
|
@ -370,7 +369,6 @@ globals:
|
|||
countryFk: País
|
||||
countryCodeFk: País
|
||||
companyFk: Empresa
|
||||
nickname: Alias
|
||||
errors:
|
||||
statusUnauthorized: Acceso denegado
|
||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||
|
@ -771,10 +769,8 @@ worker:
|
|||
concept: Concepto
|
||||
business:
|
||||
tableVisibleColumns:
|
||||
id: Id
|
||||
started: Fecha inicio
|
||||
ended: Fecha fin
|
||||
hourlyLabor: Ficha
|
||||
company: Empresa
|
||||
reasonEnd: Motivo finalización
|
||||
department: Departamento
|
||||
|
@ -785,13 +781,12 @@ worker:
|
|||
occupationCode: Cotización
|
||||
rate: Tarifa
|
||||
businessType: Contrato
|
||||
workerBusinessAgreementName: Convenio
|
||||
amount: Salario
|
||||
basicSalary: Salario transportistas
|
||||
notes: Notas
|
||||
operator:
|
||||
numberOfWagons: Número de vagones
|
||||
train: Tren
|
||||
train: tren
|
||||
itemPackingType: Tipo de embalaje
|
||||
warehouse: Almacén
|
||||
sector: Sector
|
||||
|
|
|
@ -25,13 +25,12 @@ const $props = defineProps({
|
|||
const { t } = useI18n();
|
||||
const { hasAccount } = toRefs($props);
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const arrayData = useArrayData('Account');
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
const { notify } = useQuasar();
|
||||
const account = computed(() => arrayData.store.data);
|
||||
const account = computed(() => useArrayData('Account').store.data[0]);
|
||||
account.value.hasAccount = hasAccount.value;
|
||||
const entityId = computed(() => +route.params.id);
|
||||
const hasitManagementAccess = ref();
|
||||
|
@ -40,7 +39,7 @@ const isHimself = computed(() => user.value.id === account.value.id);
|
|||
const url = computed(() =>
|
||||
isHimself.value
|
||||
? 'Accounts/change-password'
|
||||
: `Accounts/${entityId.value}/setPassword`,
|
||||
: `Accounts/${entityId.value}/setPassword`
|
||||
);
|
||||
|
||||
async function updateStatusAccount(active) {
|
||||
|
@ -154,7 +153,6 @@ onMounted(() => {
|
|||
t('account.card.actions.disableAccount.title'),
|
||||
t('account.card.actions.disableAccount.subtitle'),
|
||||
() => deleteAccount(),
|
||||
() => deleteAccount(),
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -174,7 +172,6 @@ onMounted(() => {
|
|||
t('account.card.actions.enableAccount.title'),
|
||||
t('account.card.actions.enableAccount.subtitle'),
|
||||
() => updateStatusAccount(true),
|
||||
() => updateStatusAccount(true),
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -189,7 +186,6 @@ onMounted(() => {
|
|||
t('account.card.actions.disableAccount.title'),
|
||||
t('account.card.actions.disableAccount.subtitle'),
|
||||
() => updateStatusAccount(false),
|
||||
() => updateStatusAccount(false),
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -205,7 +201,6 @@ onMounted(() => {
|
|||
t('account.card.actions.activateUser.title'),
|
||||
t('account.card.actions.activateUser.title'),
|
||||
() => updateStatusUser(true),
|
||||
() => updateStatusUser(true),
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -220,7 +215,6 @@ onMounted(() => {
|
|||
t('account.card.actions.deactivateUser.title'),
|
||||
t('account.card.actions.deactivateUser.title'),
|
||||
() => updateStatusUser(false),
|
||||
() => updateStatusUser(false),
|
||||
)
|
||||
"
|
||||
>
|
||||
|
|
|
@ -27,7 +27,6 @@ const claimActionsForm = ref();
|
|||
const rows = ref([]);
|
||||
const selectedRows = ref([]);
|
||||
const destinationTypes = ref([]);
|
||||
const shelvings = ref([]);
|
||||
const totalClaimed = ref(null);
|
||||
const DEFAULT_MAX_RESPONSABILITY = 5;
|
||||
const DEFAULT_MIN_RESPONSABILITY = 1;
|
||||
|
@ -57,12 +56,6 @@ const columns = computed(() => [
|
|||
field: (row) => row.claimDestinationFk,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'shelving',
|
||||
label: t('shelvings.shelving'),
|
||||
field: (row) => row.shelvingFk,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'Landed',
|
||||
label: t('Landed'),
|
||||
|
@ -132,10 +125,6 @@ async function updateDestination(claimDestinationFk, row, options = {}) {
|
|||
options.reload && claimActionsForm.value.reload();
|
||||
}
|
||||
}
|
||||
async function updateShelving(shelvingFk, row) {
|
||||
await axios.patch(`ClaimEnds/${row.id}`, { shelvingFk });
|
||||
claimActionsForm.value.reload();
|
||||
}
|
||||
|
||||
async function regularizeClaim() {
|
||||
await post(`Claims/${claimId}/regularizeClaim`);
|
||||
|
@ -211,7 +200,6 @@ async function post(query, params) {
|
|||
auto-load
|
||||
@on-fetch="(data) => (destinationTypes = data)"
|
||||
/>
|
||||
<FetchData url="Shelvings" auto-load @on-fetch="(data) => (shelvings = data)" />
|
||||
<RightMenu v-if="claim">
|
||||
<template #right-panel>
|
||||
<QCard class="totalClaim q-my-md q-pa-sm no-box-shadow">
|
||||
|
@ -324,20 +312,6 @@ async function post(query, params) {
|
|||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-shelving="{ row }">
|
||||
<QTd>
|
||||
<VnSelect
|
||||
v-model="row.shelvingFk"
|
||||
:options="shelvings"
|
||||
option-label="code"
|
||||
option-value="id"
|
||||
style="width: 100px"
|
||||
hide-selected
|
||||
@update:model-value="(value) => updateShelving(value, row)"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
|
||||
<template #body-cell-price="{ value }">
|
||||
<QTd align="center">
|
||||
{{ toCurrency(value) }}
|
||||
|
@ -380,7 +354,7 @@ async function post(query, params) {
|
|||
(value) =>
|
||||
updateDestination(
|
||||
value,
|
||||
props.row,
|
||||
props.row
|
||||
)
|
||||
"
|
||||
/>
|
||||
|
@ -397,17 +371,6 @@ async function post(query, params) {
|
|||
</QTable>
|
||||
</template>
|
||||
<template #moreBeforeActions>
|
||||
<QBtn
|
||||
color="primary"
|
||||
text-color="white"
|
||||
:unelevated="true"
|
||||
:label="tMobile('Import claim')"
|
||||
:title="t('Import claim')"
|
||||
icon="Download"
|
||||
@click="importToNewRefundTicket"
|
||||
:disable="claim.claimStateFk == resolvedStateId"
|
||||
:loading="loading"
|
||||
/>
|
||||
<QBtn
|
||||
color="primary"
|
||||
text-color="white"
|
||||
|
@ -431,6 +394,17 @@ async function post(query, params) {
|
|||
@click="dialogDestination = !dialogDestination"
|
||||
:loading="loading"
|
||||
/>
|
||||
<QBtn
|
||||
color="primary"
|
||||
text-color="white"
|
||||
:unelevated="true"
|
||||
:label="tMobile('Import claim')"
|
||||
:title="t('Import claim')"
|
||||
icon="Upload"
|
||||
@click="importToNewRefundTicket"
|
||||
:disable="claim.claimStateFk == resolvedStateId"
|
||||
:loading="loading"
|
||||
/>
|
||||
</template>
|
||||
</CrudModel>
|
||||
<QDialog v-model="dialogDestination">
|
||||
|
|
|
@ -40,7 +40,7 @@ const workersOptions = ref([]);
|
|||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('claim.attendedBy')"
|
||||
:label="t('claim.assignedTo')"
|
||||
v-model="data.workerFk"
|
||||
:options="workersOptions"
|
||||
option-value="id"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { computed, useAttrs } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||
|
@ -7,6 +7,7 @@ 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 },
|
||||
|
@ -14,21 +15,24 @@ const $props = defineProps({
|
|||
});
|
||||
const claimId = computed(() => $props.id || route.params.id);
|
||||
|
||||
const claimFilter = {
|
||||
fields: ['id', 'created', 'workerFk', 'text'],
|
||||
include: {
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['id', 'firstName', 'lastName'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['id', 'nickname', 'name'],
|
||||
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 body = {
|
||||
claimFk: claimId.value,
|
||||
|
@ -39,8 +43,7 @@ const body = {
|
|||
<VnNotes
|
||||
url="claimObservations"
|
||||
:add-note="$props.addNote"
|
||||
:user-filter="claimFilter"
|
||||
:filter="{ where: { claimFk: claimId } }"
|
||||
:filter="claimFilter"
|
||||
:body="body"
|
||||
v-bind="$attrs"
|
||||
style="overflow-y: auto"
|
||||
|
|
|
@ -210,7 +210,6 @@ 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"
|
||||
|
@ -228,7 +227,6 @@ function onDrag() {
|
|||
class="rounded-borders cursor-pointer fit"
|
||||
@click="openDialog(media.dmsFk)"
|
||||
v-if="!media.isVideo"
|
||||
:data-cy="`file-${index+1}`"
|
||||
>
|
||||
</QImg>
|
||||
<video
|
||||
|
@ -237,7 +235,6 @@ function onDrag() {
|
|||
muted="muted"
|
||||
v-if="media.isVideo"
|
||||
@click="openDialog(media.dmsFk)"
|
||||
:data-cy="`file-${index+1}`"
|
||||
/>
|
||||
</QCard>
|
||||
</div>
|
||||
|
|
|
@ -233,27 +233,20 @@ function claimUrl(section) {
|
|||
<ClaimDescriptorMenu :claim="entity.claim" />
|
||||
</template>
|
||||
<template #body="{ entity: { claim, salesClaimed, developments } }">
|
||||
<QCard class="vn-one">
|
||||
<QCard class="vn-one" v-if="$route.name != 'ClaimSummary'">
|
||||
<VnTitle
|
||||
:url="claimUrl('basic-data')"
|
||||
:text="t('globals.pageTitles.basicData')"
|
||||
/>
|
||||
<VnLv
|
||||
v-if="$route.name != 'ClaimSummary'"
|
||||
:label="t('claim.created')"
|
||||
:value="toDate(claim.created)"
|
||||
/>
|
||||
<VnLv v-if="$route.name != 'ClaimSummary'" :label="t('claim.state')">
|
||||
<VnLv :label="t('claim.created')" :value="toDate(claim.created)" />
|
||||
<VnLv :label="t('claim.state')">
|
||||
<template #value>
|
||||
<QChip :color="stateColor(claim.claimState.code)" dense>
|
||||
{{ claim.claimState.description }}
|
||||
</QChip>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
v-if="$route.name != 'ClaimSummary'"
|
||||
:label="t('globals.salesPerson')"
|
||||
>
|
||||
<VnLv :label="t('globals.salesPerson')">
|
||||
<template #value>
|
||||
<VnUserLink
|
||||
:name="claim.client?.salesPersonUser?.name"
|
||||
|
@ -261,7 +254,7 @@ function claimUrl(section) {
|
|||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv v-if="$route.name != 'ClaimSummary'" :label="t('claim.attendedBy')">
|
||||
<VnLv :label="t('claim.attendedBy')">
|
||||
<template #value>
|
||||
<VnUserLink
|
||||
:name="claim.worker?.user?.nickname"
|
||||
|
@ -269,7 +262,7 @@ function claimUrl(section) {
|
|||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv v-if="$route.name != 'ClaimSummary'" :label="t('claim.customer')">
|
||||
<VnLv :label="t('claim.customer')">
|
||||
<template #value>
|
||||
<span class="link cursor-pointer">
|
||||
{{ claim.client?.name }}
|
||||
|
@ -281,11 +274,6 @@ function claimUrl(section) {
|
|||
:label="t('claim.pickup')"
|
||||
:value="`${dashIfEmpty(claim.pickup)}`"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.packages')"
|
||||
:value="`${dashIfEmpty(claim.packages)}`"
|
||||
:translation="(value) => t(`claim.packages`)"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-two">
|
||||
<VnTitle :url="claimUrl('notes')" :text="t('claim.notes')" />
|
||||
|
|
|
@ -19,36 +19,30 @@ const columns = [
|
|||
name: 'itemFk',
|
||||
label: t('Id item'),
|
||||
columnFilter: false,
|
||||
align: 'right',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'ticketFk',
|
||||
label: t('Ticket'),
|
||||
columnFilter: false,
|
||||
align: 'right',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'claimDestinationFk',
|
||||
label: t('Destination'),
|
||||
columnFilter: false,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
name: 'shelvingCode',
|
||||
label: t('Shelving'),
|
||||
columnFilter: false,
|
||||
align: 'right',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'landed',
|
||||
label: t('Landed'),
|
||||
format: (row) => toDate(row.landed),
|
||||
align: 'center',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'quantity',
|
||||
label: t('Quantity'),
|
||||
align: 'right',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'concept',
|
||||
|
@ -58,18 +52,18 @@ const columns = [
|
|||
{
|
||||
name: 'price',
|
||||
label: t('Price'),
|
||||
align: 'right',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'discount',
|
||||
label: t('Discount'),
|
||||
format: ({ discount }) => toPercentage(discount / 100),
|
||||
align: 'right',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'total',
|
||||
label: t('Total'),
|
||||
align: 'right',
|
||||
align: 'left',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
|
|
@ -106,6 +106,7 @@ const props = defineProps({
|
|||
:label="t('claim.zone')"
|
||||
v-model="params.zoneFk"
|
||||
url="Zones"
|
||||
:use-like="false"
|
||||
outlined
|
||||
rounded
|
||||
dense
|
||||
|
|
|
@ -13,6 +13,7 @@ claim:
|
|||
province: Province
|
||||
zone: Zone
|
||||
customerId: client ID
|
||||
assignedTo: Assigned
|
||||
created: Created
|
||||
details: Details
|
||||
item: Item
|
||||
|
|
|
@ -13,6 +13,7 @@ claim:
|
|||
province: Provincia
|
||||
zone: Zona
|
||||
customerId: ID de cliente
|
||||
assignedTo: Asignado a
|
||||
created: Creado
|
||||
details: Detalles
|
||||
item: Artículo
|
||||
|
|
|
@ -118,6 +118,14 @@ 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"
|
||||
|
@ -142,14 +150,6 @@ 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(entity.unpaid?.dated),
|
||||
dated: toDate(customer.unpaid?.dated),
|
||||
})
|
||||
}}
|
||||
<br />
|
||||
{{
|
||||
t('unpaidAmount', {
|
||||
amount: toCurrency(entity.unpaid?.amount),
|
||||
amount: toCurrency(customer.unpaid?.amount),
|
||||
})
|
||||
}}
|
||||
</QTooltip>
|
||||
|
|
|
@ -1,15 +1,28 @@
|
|||
<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="{ where: { clientFk: $route.params.id } }"
|
||||
:body="{ clientFk: $route.params.id }"
|
||||
:filter="noteFilter"
|
||||
:body="{ clientFk: route.params.id }"
|
||||
style="overflow-y: auto"
|
||||
:select-type="true"
|
||||
required
|
||||
order="created DESC"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -325,7 +325,7 @@ const sumRisk = ({ clientRisks }) => {
|
|||
</QCard>
|
||||
<QCard class="vn-max">
|
||||
<VnTitle :text="t('Latest tickets')" />
|
||||
<CustomerSummaryTable :id="entityId" />
|
||||
<CustomerSummaryTable />
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
|
|
|
@ -143,7 +143,6 @@ const exprBuilder = (param, value) => {
|
|||
outlined
|
||||
rounded
|
||||
auto-load
|
||||
sortBy="name ASC"
|
||||
/></QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
|
|
|
@ -78,20 +78,10 @@ const columns = computed(() => [
|
|||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name', 'firstName'],
|
||||
fields: ['id', 'name'],
|
||||
where: { role: 'salesPerson' },
|
||||
optionFilter: 'firstName',
|
||||
},
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name', 'firstName'],
|
||||
where: { role: 'salesPerson' },
|
||||
optionLabel: 'firstName',
|
||||
optionValue: 'id',
|
||||
},
|
||||
},
|
||||
create: false,
|
||||
columnField: {
|
||||
component: null,
|
||||
|
|
|
@ -77,6 +77,7 @@ onBeforeMount(() => {
|
|||
function setPaymentType(accounting) {
|
||||
if (!accounting) return;
|
||||
accountingType.value = accounting.accountingType;
|
||||
|
||||
initialData.description = [];
|
||||
initialData.payed = Date.vnNew();
|
||||
isCash.value = accountingType.value.code == 'cash';
|
||||
|
@ -86,14 +87,14 @@ function setPaymentType(accounting) {
|
|||
initialData.payed.getDate() + accountingType.value.daysInFuture,
|
||||
);
|
||||
maxAmount.value = accountingType.value && accountingType.value.maxAmount;
|
||||
|
||||
if (accountingType.value.code == 'compensation')
|
||||
return (initialData.description = '');
|
||||
|
||||
let descriptions = [];
|
||||
if (accountingType.value.receiptDescription)
|
||||
descriptions.push(accountingType.value.receiptDescription);
|
||||
if (initialData.description) descriptions.push(initialData.description);
|
||||
initialData.description = descriptions.join(', ');
|
||||
initialData.description.push(accountingType.value.receiptDescription);
|
||||
if (initialData.description) initialData.description.push(initialData.description);
|
||||
|
||||
initialData.description = initialData.description.join(', ');
|
||||
}
|
||||
|
||||
const calculateFromAmount = (event) => {
|
||||
|
|
|
@ -18,7 +18,6 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import CustomerSamplesPreview from 'src/pages/Customer/components/CustomerSamplesPreview.vue';
|
||||
import FormPopup from 'src/components/FormPopup.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
||||
|
||||
|
@ -40,7 +39,7 @@ const optionsSamplesVisible = ref([]);
|
|||
const sampleType = ref({ hasPreview: false });
|
||||
const initialData = reactive({});
|
||||
const entityId = computed(() => route.params.id);
|
||||
const customer = computed(() => useArrayData('Customer').store?.data);
|
||||
const customer = computed(() => state.get('Customer'));
|
||||
const filterEmailUsers = { where: { userFk: user.value.id } };
|
||||
const filterClientsAddresses = {
|
||||
include: [
|
||||
|
@ -66,9 +65,9 @@ const filterSamplesVisible = {
|
|||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
initialData.clientFk = customer.value?.id;
|
||||
initialData.recipient = customer.value?.email;
|
||||
initialData.recipientId = customer.value?.id;
|
||||
initialData.clientFk = customer.value.id;
|
||||
initialData.recipient = customer.value.email;
|
||||
initialData.recipientId = customer.value.id;
|
||||
});
|
||||
|
||||
const setEmailUser = (data) => {
|
||||
|
|
|
@ -20,12 +20,7 @@ const { t } = useI18n();
|
|||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
{
|
||||
|
@ -48,7 +43,7 @@ const filter = {
|
|||
},
|
||||
},
|
||||
],
|
||||
where: { clientFk: $props.id ?? route.params.id },
|
||||
where: { clientFk: route.params.id },
|
||||
order: ['shipped DESC', 'id'],
|
||||
limit: 30,
|
||||
};
|
||||
|
|
|
@ -17,23 +17,9 @@ describe('getAddresses', () => {
|
|||
expect(axios.get).toHaveBeenCalledWith(`Clients/${clientId}/addresses`, {
|
||||
params: {
|
||||
filter: JSON.stringify({
|
||||
include: [
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['defaultAddressFk'],
|
||||
include: {
|
||||
relation: 'defaultAddress',
|
||||
scope: {
|
||||
fields: ['id', 'agencyModeFk'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
fields: ['nickname', 'street', 'city', 'id', 'isActive', 'clientFk'],
|
||||
fields: ['nickname', 'street', 'city', 'id'],
|
||||
where: { isActive: true },
|
||||
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
|
||||
order: 'nickname ASC',
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
@ -44,4 +30,4 @@ describe('getAddresses', () => {
|
|||
|
||||
expect(axios.get).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,29 +1,15 @@
|
|||
import axios from 'axios';
|
||||
|
||||
export async function getAddresses(clientId, _filter = {}) {
|
||||
export async function getAddresses(clientId, _filter = {}) {
|
||||
if (!clientId) return;
|
||||
const filter = {
|
||||
..._filter,
|
||||
include: [
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['defaultAddressFk'],
|
||||
include: {
|
||||
relation: 'defaultAddress',
|
||||
scope: {
|
||||
fields: ['id', 'agencyModeFk'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
fields: ['nickname', 'street', 'city', 'id', 'isActive', 'clientFk'],
|
||||
fields: ['nickname', 'street', 'city', 'id'],
|
||||
where: { isActive: true },
|
||||
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
|
||||
order: 'nickname ASC',
|
||||
};
|
||||
const params = { filter: JSON.stringify(filter) };
|
||||
return await axios.get(`Clients/${clientId}/addresses`, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
};
|
|
@ -54,7 +54,6 @@ const columns = [
|
|||
toggleIndeterminate: false,
|
||||
},
|
||||
create: true,
|
||||
createOrder: 12,
|
||||
width: '25px',
|
||||
},
|
||||
{
|
||||
|
@ -62,10 +61,9 @@ const columns = [
|
|||
name: 'workerFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'TicketRequests/getItemTypeWorker',
|
||||
url: 'Workers/search',
|
||||
fields: ['id', 'nickname'],
|
||||
optionLabel: 'nickname',
|
||||
sortBy: 'nickname ASC',
|
||||
optionValue: 'id',
|
||||
},
|
||||
visible: false,
|
||||
|
@ -89,6 +87,15 @@ const columns = [
|
|||
isEditable: false,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
name: 'entryFk',
|
||||
isId: true,
|
||||
visible: false,
|
||||
isEditable: false,
|
||||
disable: true,
|
||||
create: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
label: 'Id',
|
||||
|
@ -130,7 +137,6 @@ const columns = [
|
|||
name: 'itemFk',
|
||||
visible: false,
|
||||
create: true,
|
||||
createOrder: 0,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
|
@ -154,8 +160,6 @@ const columns = [
|
|||
name: 'stickers',
|
||||
component: 'input',
|
||||
create: true,
|
||||
|
||||
createOrder: 1,
|
||||
attrs: {
|
||||
positive: false,
|
||||
},
|
||||
|
@ -267,7 +271,6 @@ const columns = [
|
|||
},
|
||||
width: '45px',
|
||||
create: true,
|
||||
createOrder: 3,
|
||||
style: getQuantityStyle,
|
||||
},
|
||||
{
|
||||
|
@ -277,7 +280,6 @@ const columns = [
|
|||
toolTip: t('Buying value'),
|
||||
name: 'buyingValue',
|
||||
create: true,
|
||||
createOrder: 2,
|
||||
component: 'number',
|
||||
attrs: {
|
||||
positive: false,
|
||||
|
@ -310,7 +312,6 @@ const columns = [
|
|||
toolTip: t('Package'),
|
||||
name: 'price2',
|
||||
component: 'number',
|
||||
createDisable: true,
|
||||
width: '35px',
|
||||
create: true,
|
||||
format: (row) => parseFloat(row['price2']).toFixed(2),
|
||||
|
@ -320,7 +321,6 @@ const columns = [
|
|||
label: t('Box'),
|
||||
name: 'price3',
|
||||
component: 'number',
|
||||
createDisable: true,
|
||||
cellEvent: {
|
||||
'update:modelValue': async (value, oldValue, row) => {
|
||||
row['price2'] = row['price2'] * (value / oldValue);
|
||||
|
@ -508,14 +508,13 @@ async function setBuyUltimate(itemFk, data) {
|
|||
},
|
||||
});
|
||||
const buyUltimateData = buyUltimate.data[0];
|
||||
if (!buyUltimateData) return;
|
||||
|
||||
const allowedKeys = columns
|
||||
.filter((col) => col.create === true)
|
||||
.map((col) => col.name);
|
||||
|
||||
allowedKeys.forEach((key) => {
|
||||
if (buyUltimateData?.hasOwnProperty(key) && key !== 'entryFk') {
|
||||
if (buyUltimateData.hasOwnProperty(key) && key !== 'entryFk') {
|
||||
if (!['stickers', 'quantity'].includes(key)) data[key] = buyUltimateData[key];
|
||||
}
|
||||
});
|
||||
|
@ -608,7 +607,6 @@ onMounted(() => {
|
|||
ref="entryBuysRef"
|
||||
data-key="EntryBuys"
|
||||
:url="`Entries/${entityId}/getBuyList`"
|
||||
search-url="EntryBuys"
|
||||
save-url="Buys/crud"
|
||||
:disable-option="{ card: true }"
|
||||
v-model:selected="selectedRows"
|
||||
|
@ -638,24 +636,22 @@ onMounted(() => {
|
|||
isFullWidth: true,
|
||||
containerStyle: {
|
||||
display: 'flex',
|
||||
'flex-wrap': 'wrap',
|
||||
gap: '16px',
|
||||
position: 'relative',
|
||||
height: '450px',
|
||||
},
|
||||
columnGridStyle: {
|
||||
'max-width': '50%',
|
||||
'margin-right': '30px',
|
||||
flex: 1,
|
||||
'margin-right': '30px',
|
||||
},
|
||||
previousStyle: {
|
||||
'max-width': '30%',
|
||||
height: '500px',
|
||||
},
|
||||
displayPrevious: true,
|
||||
}"
|
||||
:is-editable="editableMode"
|
||||
:without-header="!editableMode"
|
||||
:with-filters="editableMode"
|
||||
:right-search="editableMode"
|
||||
:right-search="true"
|
||||
:right-search-icon="true"
|
||||
:row-click="false"
|
||||
:columns="columns"
|
||||
:beforeSaveFn="beforeSave"
|
||||
|
@ -664,7 +660,6 @@ onMounted(() => {
|
|||
auto-load
|
||||
footer
|
||||
data-cy="entry-buys"
|
||||
overlay
|
||||
>
|
||||
<template #column-hex="{ row }">
|
||||
<VnColor :colors="row?.hexJson" style="height: 100%; min-width: 2000px" />
|
||||
|
|
|
@ -65,7 +65,7 @@ const entriesTableColumns = computed(() => [
|
|||
]);
|
||||
|
||||
function downloadCSV(rows) {
|
||||
const headers = ['id', 'itemFk', 'name', 'stickers', 'packing', 'grouping', 'comment'];
|
||||
const headers = ['id', 'itemFk', 'name', 'stickers', 'packing', 'comment'];
|
||||
|
||||
const csvRows = rows.map((row) => {
|
||||
const buy = row;
|
||||
|
@ -77,7 +77,6 @@ function downloadCSV(rows) {
|
|||
item.name || '',
|
||||
buy.stickers,
|
||||
buy.packing,
|
||||
buy.grouping,
|
||||
item.comment || '',
|
||||
].join(',');
|
||||
});
|
||||
|
|
|
@ -145,7 +145,6 @@ const entryFilterPanel = ref();
|
|||
v-model="params.agencyModeId"
|
||||
@update:model-value="searchFn()"
|
||||
url="AgencyModes"
|
||||
sort-by="name ASC"
|
||||
:fields="['id', 'name']"
|
||||
hide-selected
|
||||
dense
|
||||
|
@ -249,7 +248,7 @@ const entryFilterPanel = ref();
|
|||
<i18n>
|
||||
en:
|
||||
params:
|
||||
isExcludedFromAvailable: Is excluded
|
||||
isExcludedFromAvailable: Inventory
|
||||
isOrdered: Ordered
|
||||
isReceived: Received
|
||||
isConfirmed: Confirmed
|
||||
|
|
|
@ -11,8 +11,6 @@ import VnTable from 'components/VnTable/VnTable.vue';
|
|||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
import VnSelectTravelExtended from 'src/components/common/VnSelectTravelExtended.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import EntrySummary from './Card/EntrySummary.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
|
@ -20,7 +18,6 @@ const defaultEntry = ref({});
|
|||
const state = useState();
|
||||
const user = state.getUser();
|
||||
const dataKey = 'EntryList';
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
|
||||
const entryQueryFilter = {
|
||||
include: [
|
||||
|
@ -225,19 +222,6 @@ const columns = computed(() => [
|
|||
visible: false,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
isPrimary: true,
|
||||
action: (row) => viewSummary(row.id, EntrySummary, 'xlg-width'),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
function getBadgeAttrs(row) {
|
||||
const date = row.landed;
|
||||
|
@ -283,7 +267,16 @@ onBeforeMount(async () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<VnSection :data-key="dataKey" prefix="entry">
|
||||
<VnSection
|
||||
:data-key="dataKey"
|
||||
prefix="entry"
|
||||
url="Entries/filter"
|
||||
:array-data-props="{
|
||||
url: 'Entries/filter',
|
||||
order: 'landed DESC',
|
||||
userFilter: EntryFilter,
|
||||
}"
|
||||
>
|
||||
<template #advanced-menu>
|
||||
<EntryFilter :data-key="dataKey" />
|
||||
</template>
|
||||
|
@ -292,7 +285,6 @@ onBeforeMount(async () => {
|
|||
v-if="defaultEntry.defaultSupplierFk"
|
||||
ref="tableRef"
|
||||
:data-key="dataKey"
|
||||
search-url="EntryList"
|
||||
url="Entries/filter"
|
||||
:filter="entryQueryFilter"
|
||||
order="landed DESC"
|
||||
|
|
|
@ -19,7 +19,6 @@ const { t } = useI18n();
|
|||
const quasar = useQuasar();
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
const footer = ref({ bought: 0, reserve: 0 });
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -39,14 +38,16 @@ const columns = computed(() => [
|
|||
cardVisible: true,
|
||||
create: true,
|
||||
attrs: {
|
||||
url: 'TicketRequests/getItemTypeWorker',
|
||||
fields: ['id', 'nickname'],
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name', 'nickname'],
|
||||
where: { role: 'buyer' },
|
||||
optionFilter: 'firstName',
|
||||
optionLabel: 'nickname',
|
||||
sortBy: 'nickname ASC',
|
||||
optionValue: 'id',
|
||||
useLike: false,
|
||||
},
|
||||
columnFilter: false,
|
||||
width: '50px',
|
||||
width: '70px',
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
|
@ -57,7 +58,6 @@ const columns = computed(() => [
|
|||
component: 'number',
|
||||
summation: true,
|
||||
width: '50px',
|
||||
format: ({ reserve }, dashIfEmpty) => dashIfEmpty(round(reserve)),
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
|
@ -65,7 +65,6 @@ const columns = computed(() => [
|
|||
name: 'bought',
|
||||
summation: true,
|
||||
cardVisible: true,
|
||||
style: ({ reserve, bought }) => boughtStyle(bought, reserve),
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
|
@ -96,6 +95,7 @@ const columns = computed(() => [
|
|||
},
|
||||
},
|
||||
],
|
||||
'data-cy': 'table-actions',
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -137,20 +137,20 @@ function openDialog() {
|
|||
}
|
||||
|
||||
function setFooter(data) {
|
||||
footer.value = { bought: 0, reserve: 0 };
|
||||
const footer = {
|
||||
bought: 0,
|
||||
reserve: 0,
|
||||
};
|
||||
data.forEach((row) => {
|
||||
footer.value.bought += row?.bought;
|
||||
footer.value.reserve += row?.reserve;
|
||||
footer.bought += row?.bought;
|
||||
footer.reserve += row?.reserve;
|
||||
});
|
||||
tableRef.value.footer = footer;
|
||||
}
|
||||
|
||||
function round(value) {
|
||||
return Math.round(value * 100) / 100;
|
||||
}
|
||||
|
||||
function boughtStyle(bought, reserve) {
|
||||
return reserve < bought ? { color: 'var(--q-negative)' } : '';
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnSubToolbar>
|
||||
|
@ -253,14 +253,24 @@ function boughtStyle(bought, reserve) {
|
|||
<WorkerDescriptorProxy :id="row?.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-bought="{ row }">
|
||||
<span :class="{ 'text-negative': row.reserve < row.bought }">
|
||||
{{ row?.bought }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-footer-reserve>
|
||||
<span>
|
||||
{{ round(footer.reserve) }}
|
||||
{{ round(tableRef.footer.reserve) }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-footer-bought>
|
||||
<span :style="boughtStyle(footer?.bought, footer?.reserve)">
|
||||
{{ round(footer.bought) }}
|
||||
<span
|
||||
:class="{
|
||||
'text-negative':
|
||||
tableRef.footer.reserve < tableRef.footer.bought,
|
||||
}"
|
||||
>
|
||||
{{ round(tableRef.footer.bought) }}
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
|
@ -276,7 +286,7 @@ function boughtStyle(bought, reserve) {
|
|||
justify-content: center;
|
||||
}
|
||||
.column {
|
||||
min-width: 35%;
|
||||
min-width: 40%;
|
||||
margin-top: 5%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
|
@ -14,7 +14,7 @@ const $props = defineProps({
|
|||
required: true,
|
||||
},
|
||||
dated: {
|
||||
type: [Date, String],
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -185,7 +185,6 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
data-key="InvoiceInSummary"
|
||||
:url="`InvoiceIns/${entityId}/summary`"
|
||||
@on-fetch="(data) => init(data)"
|
||||
module-name="InvoiceIn"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
<div>{{ entity.id }} - {{ entity.supplier?.name }}</div>
|
||||
|
|
|
@ -202,7 +202,7 @@ function setCursor(ref) {
|
|||
:option-label="col.optionLabel"
|
||||
:filter-options="['id', 'name']"
|
||||
:tooltip="t('Create a new expense')"
|
||||
@keydown.tab.prevent="
|
||||
@keydown.tab="
|
||||
autocompleteExpense(
|
||||
$event,
|
||||
row,
|
||||
|
|
|
@ -70,7 +70,6 @@ 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>
|
||||
|
@ -82,7 +81,6 @@ function ticketFilter(invoice) {
|
|||
name: 'TicketList',
|
||||
query: { table: ticketFilter(entity) },
|
||||
}"
|
||||
data-cy="invoiceOutDescriptorTicketList"
|
||||
>
|
||||
<QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip>
|
||||
</QBtn>
|
||||
|
|
|
@ -185,7 +185,7 @@ watchEffect(selectedRows);
|
|||
prefix="invoiceOut"
|
||||
:array-data-props="{
|
||||
url: 'InvoiceOuts/filter',
|
||||
order: 'id DESC',
|
||||
order: ['id DESC'],
|
||||
}"
|
||||
>
|
||||
<template #advanced-menu>
|
||||
|
@ -396,6 +396,7 @@ watchEffect(selectedRows);
|
|||
:label="
|
||||
t('invoiceOutList.tableVisibleColumns.taxArea')
|
||||
"
|
||||
:options="taxAreasOptions"
|
||||
option-label="code"
|
||||
option-value="code"
|
||||
/>
|
||||
|
|
|
@ -20,7 +20,7 @@ const props = defineProps({
|
|||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
:unremovable-params="['from', 'to']"
|
||||
:un-removable-params="['from', 'to']"
|
||||
:hidden-tags="['from', 'to']"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
|
|
|
@ -2,7 +2,6 @@ invoiceOut:
|
|||
search: Search invoice
|
||||
searchInfo: You can search by invoice reference
|
||||
params:
|
||||
id: ID
|
||||
company: Company
|
||||
country: Country
|
||||
clientId: Client
|
||||
|
|
|
@ -2,7 +2,6 @@ invoiceOut:
|
|||
search: Buscar factura emitida
|
||||
searchInfo: Puedes buscar por referencia de la factura
|
||||
params:
|
||||
id: ID
|
||||
company: Empresa
|
||||
country: País
|
||||
clientId: Cliente
|
||||
|
|
|
@ -94,7 +94,6 @@ const submit = async (rows) => {
|
|||
icon="add_circle"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
data-cy="addBarcode_input"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Add barcode') }}
|
||||
|
|
|
@ -120,9 +120,22 @@ const updateStock = async () => {
|
|||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('globals.producer')" :value="dashIfEmpty(entity.subName)" />
|
||||
<VnLv v-if="entity?.value5" :label="entity?.tag5" :value="entity.value5" />
|
||||
<VnLv v-if="entity?.value6" :label="entity?.tag6" :value="entity.value6" />
|
||||
<VnLv v-if="entity?.value7" :label="entity?.tag7" :value="entity.value7" />
|
||||
<VnLv
|
||||
v-if="entity.value5"
|
||||
:label="t('item.descriptor.color')"
|
||||
:value="entity.value5"
|
||||
>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
v-if="entity.value6"
|
||||
:label="t('item.descriptor.category')"
|
||||
:value="entity.value6"
|
||||
/>
|
||||
<VnLv
|
||||
v-if="entity.value7"
|
||||
:label="t('item.list.stems')"
|
||||
:value="entity.value7"
|
||||
/>
|
||||
</template>
|
||||
<template #icons="{ entity }">
|
||||
<QCardActions v-if="entity" class="q-gutter-x-md">
|
||||
|
|
|
@ -12,7 +12,7 @@ import FetchData from 'components/FetchData.vue';
|
|||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
|
||||
import { toDateTimeFormat } from 'src/filters/date.js';
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { date } from 'quasar';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
@ -27,7 +27,7 @@ const user = state.getUser();
|
|||
const today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const warehousesOptions = ref([]);
|
||||
const itemBalances = computed(() => arrayDataItemBalances.store.data || []);
|
||||
const itemBalances = computed(() => arrayDataItemBalances.store.data);
|
||||
const where = computed(() => arrayDataItemBalances.store.filter.where || {});
|
||||
const showWhatsBeforeInventory = ref(false);
|
||||
const inventoriedDate = ref(null);
|
||||
|
@ -143,12 +143,7 @@ onMounted(async () => {
|
|||
const fetchItemBalances = async () => await arrayDataItemBalances.fetch({});
|
||||
|
||||
const getBadgeAttrs = (_date) => {
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
let timeTicket = new Date(_date);
|
||||
timeTicket.setHours(0, 0, 0, 0);
|
||||
|
||||
const isSameDate = date.isSameDate(today, timeTicket);
|
||||
const isSameDate = date.isSameDate(today, _date);
|
||||
const attrs = {
|
||||
'text-color': isSameDate ? 'black' : 'white',
|
||||
color: isSameDate ? 'warning' : 'transparent',
|
||||
|
@ -158,10 +153,15 @@ const getBadgeAttrs = (_date) => {
|
|||
|
||||
const scrollToToday = async () => {
|
||||
await nextTick();
|
||||
const todayCell = document.querySelector(
|
||||
`td[data-date="${date.formatDate(today, 'YYYY-MM-DD')}"]`,
|
||||
);
|
||||
if (todayCell) todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
const todayCell = document.querySelector(`td[data-date="${today.toISOString()}"]`);
|
||||
if (todayCell) {
|
||||
todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
};
|
||||
|
||||
const formatDateForAttribute = (dateValue) => {
|
||||
if (dateValue instanceof Date) return date.formatDate(dateValue, 'YYYY-MM-DD');
|
||||
return dateValue;
|
||||
};
|
||||
|
||||
async function updateWarehouse(warehouseFk) {
|
||||
|
@ -237,14 +237,14 @@ async function updateWarehouse(warehouseFk) {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-date="{ row }">
|
||||
<QTd @click.stop :data-date="row?.shipped.substring(0, 10)">
|
||||
<QTd @click.stop :data-date="formatDateForAttribute(row.shipped)">
|
||||
<QBadge
|
||||
v-bind="getBadgeAttrs(row.shipped)"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ toDateTimeFormat(row.shipped) }}
|
||||
{{ toDateFormat(row.shipped) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
|
@ -313,8 +313,8 @@ async function updateWarehouse(warehouseFk) {
|
|||
row.lineFk == row.lastPreparedLineFk
|
||||
? 'black'
|
||||
: row.balance < 0
|
||||
? 'negative'
|
||||
: ''
|
||||
? 'negative'
|
||||
: ''
|
||||
"
|
||||
dense
|
||||
style="font-size: 14px"
|
||||
|
|
|
@ -11,6 +11,7 @@ import { toCurrency } from 'filters/index';
|
|||
import { useArrayData } from 'composables/useArrayData';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const from = ref();
|
||||
|
@ -40,7 +41,7 @@ const itemLastEntries = ref([]);
|
|||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: 'NV',
|
||||
label: 'Nv',
|
||||
name: 'ig',
|
||||
align: 'center',
|
||||
},
|
||||
|
@ -69,7 +70,6 @@ const columns = computed(() => [
|
|||
field: 'reference',
|
||||
align: 'center',
|
||||
format: (_, row) => toCurrency(row.price2) + ' / ' + toCurrency(row.price3),
|
||||
style: (row) => highlightedRow(row),
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.printedStickers'),
|
||||
|
@ -84,7 +84,6 @@ const columns = computed(() => [
|
|||
field: 'stickers',
|
||||
align: 'center',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
style: (row) => highlightedRow(row),
|
||||
},
|
||||
{
|
||||
label: 'Packing',
|
||||
|
@ -103,14 +102,12 @@ const columns = computed(() => [
|
|||
name: 'stems',
|
||||
field: 'stems',
|
||||
align: 'center',
|
||||
style: (row) => highlightedRow(row),
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.quantity'),
|
||||
name: 'quantity',
|
||||
field: 'quantity',
|
||||
align: 'center',
|
||||
style: (row) => highlightedRow(row),
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.cost'),
|
||||
|
@ -123,14 +120,12 @@ const columns = computed(() => [
|
|||
name: 'weight',
|
||||
field: 'weight',
|
||||
align: 'center',
|
||||
style: (row) => highlightedRow(row),
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.cube'),
|
||||
name: 'cube',
|
||||
field: 'packagingFk',
|
||||
align: 'center',
|
||||
style: (row) => highlightedRow(row),
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.supplier'),
|
||||
|
@ -213,14 +208,6 @@ onMounted(async () => {
|
|||
function getBadgeClass(groupingMode, expectedGrouping) {
|
||||
return groupingMode === expectedGrouping ? 'accent-badge' : 'simple-badge';
|
||||
}
|
||||
|
||||
function highlightedRow(row) {
|
||||
return row?.isInventorySupplier
|
||||
? {
|
||||
'background-color': 'var(--vn-section-hover-color)',
|
||||
}
|
||||
: '';
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnSubToolbar>
|
||||
|
@ -249,7 +236,7 @@ function highlightedRow(row) {
|
|||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #body-cell-ig="{ row }">
|
||||
<QTd class="text-center" :style="highlightedRow(row)">
|
||||
<QTd class="text-center">
|
||||
<QIcon
|
||||
:name="row.isIgnored ? 'check_box' : 'check_box_outline_blank'"
|
||||
style="color: var(--vn-label-color)"
|
||||
|
@ -258,38 +245,38 @@ function highlightedRow(row) {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-warehouse="{ row }">
|
||||
<QTd :style="highlightedRow(row)">
|
||||
<QTd>
|
||||
<span>{{ row.warehouse }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-date="{ row }">
|
||||
<QTd class="text-center" :style="highlightedRow(row)">
|
||||
<QTd class="text-center">
|
||||
<VnDateBadge :date="row.landed" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-entry="{ row }">
|
||||
<QTd @click.stop :style="highlightedRow(row)">
|
||||
<QTd @click.stop>
|
||||
<div class="full-width flex justify-center">
|
||||
<EntryDescriptorProxy :id="row.entryFk" class="q-ma-none" dense />
|
||||
<span class="link">{{ row.entryFk }}</span>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-pvp="{ row, value }">
|
||||
<QTd @click.stop class="text-center" :style="highlightedRow(row)">
|
||||
<template #body-cell-pvp="{ value }">
|
||||
<QTd @click.stop class="text-center">
|
||||
<span> {{ value }}</span>
|
||||
<QTooltip> {{ t('lastEntries.grouping') }}/Packing </QTooltip>
|
||||
</QTd>
|
||||
<QTooltip> {{ t('lastEntries.grouping') }}/Packing </QTooltip></QTd
|
||||
>
|
||||
</template>
|
||||
<template #body-cell-printedStickers="{ row }">
|
||||
<QTd @click.stop class="text-center" :style="highlightedRow(row)">
|
||||
<QTd @click.stop class="text-center">
|
||||
<span style="color: var(--vn-label-color)">
|
||||
{{ row.printedStickers }}</span
|
||||
>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-packing="{ row }">
|
||||
<QTd @click.stop :style="highlightedRow(row)">
|
||||
<QTd @click.stop>
|
||||
<QBadge
|
||||
class="center-content"
|
||||
:class="getBadgeClass(row.groupingMode, 'packing')"
|
||||
|
@ -301,7 +288,7 @@ function highlightedRow(row) {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-grouping="{ row }">
|
||||
<QTd @click.stop :style="highlightedRow(row)">
|
||||
<QTd @click.stop>
|
||||
<QBadge
|
||||
class="center-content"
|
||||
:class="getBadgeClass(row.groupingMode, 'grouping')"
|
||||
|
@ -313,7 +300,7 @@ function highlightedRow(row) {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-cost="{ row }">
|
||||
<QTd @click.stop class="text-center" :style="highlightedRow(row)">
|
||||
<QTd @click.stop class="text-center">
|
||||
<span>
|
||||
{{ toCurrency(row.cost, 'EUR', 3) }}
|
||||
<QTooltip>
|
||||
|
@ -332,7 +319,7 @@ function highlightedRow(row) {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-supplier="{ row }">
|
||||
<QTd @click.stop :style="highlightedRow(row)">
|
||||
<QTd @click.stop>
|
||||
<div class="full-width flex justify-left">
|
||||
<QBadge
|
||||
:class="
|
||||
|
@ -367,6 +354,7 @@ function highlightedRow(row) {
|
|||
.th :first-child {
|
||||
.td {
|
||||
text-align: center;
|
||||
background-color: red;
|
||||
}
|
||||
}
|
||||
.accent-badge {
|
||||
|
|
|
@ -87,7 +87,7 @@ const insertTag = (rows) => {
|
|||
tagFk: undefined,
|
||||
}"
|
||||
:default-remove="false"
|
||||
:user-filter="{
|
||||
:filter="{
|
||||
fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'],
|
||||
where: { itemFk: route.params.id },
|
||||
include: {
|
||||
|
@ -119,7 +119,6 @@ const insertTag = (rows) => {
|
|||
"
|
||||
:required="true"
|
||||
:rules="validate('itemTag.tagFk')"
|
||||
:data-cy="`tag${row?.tag?.name}`"
|
||||
/>
|
||||
<VnSelect
|
||||
v-if="row.tag?.isFree === false"
|
||||
|
@ -146,7 +145,6 @@ const insertTag = (rows) => {
|
|||
:label="t('itemTags.value')"
|
||||
:is-clearable="false"
|
||||
@keyup.enter.stop="(data) => itemTagsRef.onSubmit(data)"
|
||||
:data-cy="`tag${row?.tag?.name}Value`"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('itemBasicData.relevancy')"
|
||||
|
@ -164,7 +162,6 @@ const insertTag = (rows) => {
|
|||
name="delete"
|
||||
size="sm"
|
||||
dense
|
||||
:data-cy="`deleteTag${row?.tag?.name}`"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('itemTags.removeTag') }}
|
||||
|
@ -180,7 +177,6 @@ const insertTag = (rows) => {
|
|||
icon="add"
|
||||
v-shortcut="'+'"
|
||||
fab
|
||||
data-cy="createNewTag"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('itemTags.addTag') }}
|
||||
|
|
|
@ -226,6 +226,7 @@ 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 }"
|
||||
|
|
|
@ -17,7 +17,6 @@ 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();
|
||||
|
@ -322,7 +321,8 @@ const totalPriceColor = (ticket) => {
|
|||
if (total > 0 && total < 50) return 'warning';
|
||||
};
|
||||
|
||||
const openTab = (id) => useOpenURL(`#/ticket/${id}/sale`);
|
||||
const openTab = (id) =>
|
||||
window.open(`#/ticket/${id}/sale`, '_blank', 'noopener, noreferrer');
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -397,7 +397,6 @@ const openTab = (id) => useOpenURL(`#/ticket/${id}/sale`);
|
|||
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 }"
|
||||
>
|
||||
|
|
|
@ -22,7 +22,7 @@ salesTicketsTable:
|
|||
notVisible: Not visible
|
||||
purchaseRequest: Purchase request
|
||||
clientFrozen: Client frozen
|
||||
risk: Excess risk
|
||||
risk: Risk
|
||||
componentLack: Component lack
|
||||
tooLittle: Ticket too little
|
||||
identifier: Identifier
|
||||
|
|
|
@ -22,7 +22,7 @@ salesTicketsTable:
|
|||
notVisible: No visible
|
||||
purchaseRequest: Petición de compra
|
||||
clientFrozen: Cliente congelado
|
||||
risk: Exceso de riesgo
|
||||
risk: Riesgo
|
||||
componentLack: Faltan componentes
|
||||
tooLittle: Ticket demasiado pequeño
|
||||
identifier: Identificador
|
||||
|
|
|
@ -10,7 +10,6 @@ import OrderCatalogFilter from 'src/pages/Order/Card/OrderCatalogFilter.vue';
|
|||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import { onUnmounted } from 'vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
@ -24,40 +23,16 @@ const catalogParams = {
|
|||
const arrayData = useArrayData(dataKey, {
|
||||
url: 'Orders/CatalogFilter',
|
||||
userParams: catalogParams,
|
||||
exprBuilder,
|
||||
searchUrl: 'table',
|
||||
});
|
||||
const store = arrayData.store;
|
||||
const tags = ref([]);
|
||||
const itemRefs = ref({});
|
||||
|
||||
onMounted(async () => {
|
||||
onMounted(() => {
|
||||
stateStore.rightDrawer = true;
|
||||
checkOrderConfirmation();
|
||||
|
||||
if (
|
||||
arrayData.store.userParams &&
|
||||
Object.keys(arrayData.store.userParams).some((key) => !key.startsWith('order'))
|
||||
) {
|
||||
await arrayData.fetch({});
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
arrayData.destroy();
|
||||
});
|
||||
|
||||
function exprBuilder(param, value) {
|
||||
switch (param) {
|
||||
case 'categoryFk':
|
||||
case 'typeFk':
|
||||
return { [param]: value };
|
||||
case 'search':
|
||||
if (/^\d+$/.test(value)) return { 'i.id': value };
|
||||
else return { 'i.name': { like: `%${value}%` } };
|
||||
}
|
||||
}
|
||||
|
||||
async function checkOrderConfirmation() {
|
||||
const response = await axios.get(`Orders/${route.params.id}`);
|
||||
if (response.data.isConfirmed === 1) {
|
||||
|
@ -121,7 +96,6 @@ watch(
|
|||
:tag-value="tagValue"
|
||||
:tags="tags"
|
||||
:initial-catalog-params="catalogParams"
|
||||
:arrayData
|
||||
/>
|
||||
</template>
|
||||
</RightMenu>
|
||||
|
|
|
@ -24,10 +24,6 @@ const props = defineProps({
|
|||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
arrayData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -78,6 +74,17 @@ const loadTypes = async (id) => {
|
|||
typeList.value = data;
|
||||
};
|
||||
|
||||
function exprBuilder(param, value) {
|
||||
switch (param) {
|
||||
case 'categoryFk':
|
||||
case 'typeFk':
|
||||
return { [param]: value };
|
||||
case 'search':
|
||||
if (/^\d+$/.test(value)) return { 'i.id': value };
|
||||
else return { 'i.name': { like: `%${value}%` } };
|
||||
}
|
||||
}
|
||||
|
||||
const applyTags = (tagInfo, params, search) => {
|
||||
if (!tagInfo || !tagInfo.values.length) {
|
||||
params.tagGroups = null;
|
||||
|
@ -145,8 +152,9 @@ function addOrder(value, field, params) {
|
|||
:data-key="props.dataKey"
|
||||
:hidden-tags="['filter', 'orderFk', 'orderBy']"
|
||||
:unremovable-params="['orderFk', 'orderBy']"
|
||||
:expr-builder="exprBuilder"
|
||||
:custom-tags="['tagGroups', 'categoryFk']"
|
||||
:arrayData
|
||||
:redirect="false"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<strong v-if="tag.label === 'typeFk' && typeList">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed, ref, onMounted, watch } from 'vue';
|
||||
import { computed, ref, onMounted } from 'vue';
|
||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
|
@ -16,7 +16,6 @@ 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();
|
||||
|
@ -25,11 +24,6 @@ const agencyList = ref([]);
|
|||
const route = useRoute();
|
||||
const addressOptions = ref([]);
|
||||
const dataKey = 'OrderList';
|
||||
const formInitialData = ref({
|
||||
active: true,
|
||||
addressId: null,
|
||||
clientFk: null,
|
||||
});
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
|
@ -153,60 +147,27 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
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;
|
||||
onMounted(() => {
|
||||
if (!route.query.createForm) return;
|
||||
const clientId = route.query.createForm;
|
||||
const id = JSON.parse(clientId);
|
||||
fetchClientAddress(id.clientFk);
|
||||
});
|
||||
|
||||
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);
|
||||
async function fetchClientAddress(id, formData = {}) {
|
||||
const { data } = await axios.get(
|
||||
`Clients/${id}/addresses?filter[order]=isActive DESC`
|
||||
);
|
||||
addressOptions.value = data;
|
||||
formData.defaultAddressFk = data[0].client.defaultAddressFk;
|
||||
formData.addressId = formData.defaultAddressFk;
|
||||
|
||||
formInitialData.value = { addressId: formData.addressId, clientFk };
|
||||
await fetchAgencies(formData);
|
||||
formData.addressId = data.defaultAddressFk;
|
||||
fetchAgencies(formData);
|
||||
}
|
||||
|
||||
async function fetchAgencies({ landed, addressId }) {
|
||||
if (!landed || !addressId) return (agencyList.value = []);
|
||||
|
||||
const { data } = await axios.get('Agencies/landsThatDay', {
|
||||
params: {
|
||||
filter: JSON.stringify({
|
||||
order: ['name ASC', 'agencyMode DESC', 'agencyModeFk ASC'],
|
||||
}),
|
||||
addressFk: addressId,
|
||||
landed,
|
||||
},
|
||||
params: { addressFk: addressId, landed },
|
||||
});
|
||||
agencyList.value = data;
|
||||
}
|
||||
|
@ -245,7 +206,11 @@ const getDateColor = (date) => {
|
|||
onDataSaved: (url) => {
|
||||
tableRef.redirect(`${url}/catalog`);
|
||||
},
|
||||
formInitialData,
|
||||
formInitialData: {
|
||||
active: true,
|
||||
addressId: null,
|
||||
clientFk: null,
|
||||
},
|
||||
}"
|
||||
:user-params="{ showEmpty: false }"
|
||||
:columns="columns"
|
||||
|
@ -277,9 +242,7 @@ const getDateColor = (date) => {
|
|||
:include="{ relation: 'addresses' }"
|
||||
v-model="data.clientFk"
|
||||
:label="t('module.customer')"
|
||||
@update:model-value="
|
||||
(id) => onClientSelected({ clientFk: id }, data)
|
||||
"
|
||||
@update:model-value="(id) => fetchClientAddress(id, data)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -295,7 +258,6 @@ const getDateColor = (date) => {
|
|||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
:disable="!data.clientFk"
|
||||
v-model="data.addressId"
|
||||
:options="addressOptions"
|
||||
:label="t('module.address')"
|
||||
|
@ -304,22 +266,7 @@ const getDateColor = (date) => {
|
|||
@update:model-value="() => fetchAgencies(data)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<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>
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel
|
||||
:class="{
|
||||
|
@ -337,9 +284,6 @@ const getDateColor = (date) => {
|
|||
{{ scope.opt?.street }},
|
||||
{{ scope.opt?.city }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `#${scope.opt?.id}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
@ -347,7 +291,6 @@ const getDateColor = (date) => {
|
|||
<VnInputDate
|
||||
v-model="data.landed"
|
||||
:label="t('module.landed')"
|
||||
data-cy="landedDate"
|
||||
@update:model-value="() => fetchAgencies(data)"
|
||||
/>
|
||||
<VnSelect
|
||||
|
|
|
@ -27,17 +27,14 @@ describe('getAgencies', () => {
|
|||
landed: 'true',
|
||||
};
|
||||
const filter = {
|
||||
fields: ['name', 'street', 'city', 'id'],
|
||||
fields: ['nickname', 'street', 'city', 'id'],
|
||||
where: { isActive: true },
|
||||
order: ['name ASC'],
|
||||
order: 'nickname ASC',
|
||||
};
|
||||
|
||||
await getAgencies(formData, null, filter);
|
||||
|
||||
expect(axios.get).toHaveBeenCalledWith(
|
||||
'Agencies/getAgenciesWithWarehouse',
|
||||
generateParams(formData, filter),
|
||||
);
|
||||
expect(axios.get).toHaveBeenCalledWith('Agencies/getAgenciesWithWarehouse', generateParams(formData, filter));
|
||||
});
|
||||
|
||||
it('should not call API when formData is missing required landed field', async () => {
|
||||
|
@ -67,19 +64,19 @@ describe('getAgencies', () => {
|
|||
it('should return options and agency when default agency is found', async () => {
|
||||
const formData = { warehouseId: '123', addressId: '456', landed: 'true' };
|
||||
const client = { defaultAddress: { agencyModeFk: 'Agency1' } };
|
||||
|
||||
|
||||
const { options, agency } = await getAgencies(formData, client);
|
||||
|
||||
|
||||
expect(options).toEqual(response.data);
|
||||
expect(agency).toEqual(response.data[0]);
|
||||
});
|
||||
});
|
||||
|
||||
it('should return options and agency when client is not provided', async () => {
|
||||
it('should return options and agency when client is not provided', async () => {
|
||||
const formData = { warehouseId: '123', addressId: '456', landed: 'true' };
|
||||
|
||||
|
||||
const { options, agency } = await getAgencies(formData);
|
||||
|
||||
|
||||
expect(options).toEqual(response.data);
|
||||
expect(agency).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import axios from 'axios';
|
||||
import agency from 'src/router/modules/agency';
|
||||
|
||||
export async function getAgencies(formData, client, _filter = {}) {
|
||||
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
|
||||
|
||||
|
||||
const filter = {
|
||||
..._filter,
|
||||
order: ['name ASC'],
|
||||
..._filter
|
||||
};
|
||||
|
||||
let agency = null;
|
||||
let defaultAgency = null;
|
||||
let params = {
|
||||
filter: JSON.stringify(filter),
|
||||
warehouseFk: formData.warehouseId,
|
||||
|
@ -16,15 +16,11 @@ export async function getAgencies(formData, client, _filter = {}) {
|
|||
landed: formData.landed,
|
||||
};
|
||||
|
||||
const { data: options } = await axios.get('Agencies/getAgenciesWithWarehouse', {
|
||||
params,
|
||||
});
|
||||
const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params });
|
||||
|
||||
if (options && client) {
|
||||
agency = options.find(
|
||||
({ agencyModeFk }) => agencyModeFk === client.defaultAddress.agencyModeFk,
|
||||
);
|
||||
}
|
||||
|
||||
return { options, agency };
|
||||
if(data && client) {
|
||||
defaultAgency = data.find((agency) => agency.agencyModeFk === client.defaultAddress.agencyModeFk );
|
||||
};
|
||||
|
||||
return {options: data, agency: defaultAgency}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ const exprBuilder = (param, value) => {
|
|||
<template>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
sort-by="name ASC"
|
||||
@on-fetch="(data) => (agencyList = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
|
|
@ -27,16 +27,12 @@ const getZone = async () => {
|
|||
const filter = {
|
||||
where: { routeFk: $props.id ? $props.id : route.params.id },
|
||||
};
|
||||
const { data } = await axios.get('Tickets/filter', {
|
||||
const { data } = await axios.get('Tickets/findOne', {
|
||||
params: {
|
||||
filter: JSON.stringify(filter),
|
||||
},
|
||||
});
|
||||
|
||||
if (!data.length) return;
|
||||
const firstRecord = data[0];
|
||||
|
||||
zoneId.value = firstRecord.zoneFk;
|
||||
zoneId.value = data.zoneFk;
|
||||
const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`);
|
||||
zone.value = zoneData.name;
|
||||
};
|
||||
|
|
|
@ -180,7 +180,6 @@ const onDmsSaved = async (dms, response) => {
|
|||
rows: dmsDialog.value.rowsToCreateInvoiceIn,
|
||||
dms: response.data,
|
||||
});
|
||||
notify(t('Data saved'), 'positive');
|
||||
}
|
||||
dmsDialog.value.show = false;
|
||||
dmsDialog.value.initialForm = null;
|
||||
|
@ -244,7 +243,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</template>
|
||||
<template #column-invoiceInFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.supplierRef }}
|
||||
{{ row.invoiceInFk }}
|
||||
<InvoiceInDescriptorProxy v-if="row.invoiceInFk" :id="row.invoiceInFk" />
|
||||
</span>
|
||||
</template>
|
||||
|
|
|
@ -3,7 +3,7 @@ import { computed, ref } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { toDate, toHour } from 'src/filters';
|
||||
import { dashIfEmpty, toDate, toHour } from 'src/filters';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { usePrintService } from 'src/composables/usePrintService';
|
||||
|
||||
|
@ -335,6 +335,7 @@ const openTicketsDialog = (id) => {
|
|||
<QBtn
|
||||
icon="vn:clone"
|
||||
color="primary"
|
||||
flat
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="confirmationDialog = true"
|
||||
|
@ -344,6 +345,7 @@ const openTicketsDialog = (id) => {
|
|||
<QBtn
|
||||
icon="cloud_download"
|
||||
color="primary"
|
||||
flat
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="showRouteReport"
|
||||
|
@ -353,6 +355,7 @@ const openTicketsDialog = (id) => {
|
|||
<QBtn
|
||||
icon="check"
|
||||
color="primary"
|
||||
flat
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="markAsServed()"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { computed, ref, markRaw } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { toHour } from 'src/filters';
|
||||
|
@ -8,7 +8,6 @@ import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
|||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
|
@ -39,7 +38,17 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
name: 'workerFk',
|
||||
label: t('route.Worker'),
|
||||
component: markRaw(VnSelectWorker),
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
useLike: false,
|
||||
optionFilter: 'firstName',
|
||||
find: {
|
||||
value: 'workerFk',
|
||||
label: 'workerUserName',
|
||||
},
|
||||
},
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||
|
@ -50,10 +59,6 @@ const columns = computed(() => [
|
|||
name: 'agencyName',
|
||||
label: t('route.Agency'),
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
label: t('route.Agency'),
|
||||
name: 'agencyModeFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'agencyModes',
|
||||
|
@ -64,19 +69,14 @@ const columns = computed(() => [
|
|||
},
|
||||
},
|
||||
create: true,
|
||||
columnClass: 'expand',
|
||||
columnFilter: false,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'vehiclePlateNumber',
|
||||
label: t('route.Vehicle'),
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'vehicleFk',
|
||||
label: t('route.Vehicle'),
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'vehicles',
|
||||
|
@ -90,7 +90,6 @@ const columns = computed(() => [
|
|||
},
|
||||
create: true,
|
||||
columnFilter: false,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -157,7 +156,6 @@ const columns = computed(() => [
|
|||
<VnTable
|
||||
:data-key
|
||||
:columns="columns"
|
||||
ref="tableRef"
|
||||
:right-search="false"
|
||||
redirect="route"
|
||||
:create="{
|
||||
|
|
|
@ -22,12 +22,7 @@ const links = {
|
|||
};
|
||||
</script>
|
||||
<template>
|
||||
<CardSummary
|
||||
data-key="Vehicle"
|
||||
:url="`Vehicles/${entityId}`"
|
||||
module-name="Vehicle"
|
||||
:filter="VehicleFilter"
|
||||
>
|
||||
<CardSummary data-key="Vehicle" :url="`Vehicles/${entityId}`" :filter="VehicleFilter">
|
||||
<template #header="{ entity }">
|
||||
<div>{{ entity.id }} - {{ entity.numberPlate }}</div>
|
||||
</template>
|
||||
|
|
|
@ -45,6 +45,8 @@ const filter = {
|
|||
:label="t('parking.sector')"
|
||||
:value="entity.sector?.description"
|
||||
/>
|
||||
<VnLv :label="t('parking.row')" :value="entity.row" />
|
||||
<VnLv :label="t('parking.column')" :value="entity.column" />
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
<script setup>
|
||||
import { computed, onMounted, onUnmounted } from 'vue';
|
||||
import { onMounted, onUnmounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import CardList from 'components/ui/CardList.vue';
|
||||
import VnLv from 'components/ui/VnLv.vue';
|
||||
import ParkingFilter from './ParkingFilter.vue';
|
||||
import exprBuilder from './ParkingExprBuilder.js';
|
||||
import ParkingSummary from './Card/ParkingSummary.vue';
|
||||
import exprBuilder from './ParkingExprBuilder.js';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { push } = useRouter();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const dataKey = 'ParkingList';
|
||||
|
@ -20,48 +24,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
const filter = {
|
||||
fields: ['id', 'sectorFk', 'code', 'pickingOrder'],
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'code',
|
||||
label: t('globals.code'),
|
||||
isId: true,
|
||||
isTitle: true,
|
||||
columnFilter: false,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'sector',
|
||||
label: t('parking.sector'),
|
||||
format: (val) => val.sector.description ?? '',
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'pickingOrder',
|
||||
label: t('parking.pickingOrder'),
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row.id, ParkingSummary),
|
||||
isPrimary: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSection
|
||||
:data-key="dataKey"
|
||||
|
@ -77,24 +40,41 @@ const columns = computed(() => [
|
|||
<ParkingFilter data-key="ParkingList" />
|
||||
</template>
|
||||
<template #body>
|
||||
<VnTable
|
||||
:data-key="dataKey"
|
||||
:columns="columns"
|
||||
is-editable="false"
|
||||
:right-search="false"
|
||||
:use-model="true"
|
||||
:disable-option="{ table: true }"
|
||||
redirect="shelving/parking"
|
||||
default-mode="card"
|
||||
>
|
||||
<template #actions="{ row }">
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id, ParkingSummary)"
|
||||
color="primary"
|
||||
/>
|
||||
</template>
|
||||
</VnTable>
|
||||
<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="
|
||||
push({ path: `/shelving/parking/${row.id}/summary` })
|
||||
"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv
|
||||
label="Sector"
|
||||
:value="row.sector?.description"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('parking.pickingOrder')"
|
||||
:value="row.pickingOrder"
|
||||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id, ParkingSummary)"
|
||||
color="primary"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
</QPage>
|
||||
</template>
|
||||
</VnSection>
|
||||
</template>
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import CardList from 'components/ui/CardList.vue';
|
||||
import VnLv from 'components/ui/VnLv.vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
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 ShelvingSummary from 'pages/Shelving/Card/ShelvingSummary.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
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';
|
||||
|
@ -20,56 +17,9 @@ const filter = {
|
|||
include: [{ relation: 'parking' }],
|
||||
};
|
||||
|
||||
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 } });
|
||||
};
|
||||
function navigate(id) {
|
||||
router.push({ path: `/shelving/${id}` });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -87,75 +37,48 @@ const onDataSaved = ({ id }) => {
|
|||
<ShelvingFilter data-key="ShelvingList" />
|
||||
</template>
|
||||
<template #body>
|
||||
<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>
|
||||
<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>
|
||||
</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>
|
||||
|
|
|
@ -11,11 +11,6 @@ export default {
|
|||
'isSerious',
|
||||
'isTrucker',
|
||||
'account',
|
||||
'workerFk',
|
||||
'note',
|
||||
'isReal',
|
||||
'isPayMethodChecked',
|
||||
'companySize',
|
||||
],
|
||||
include: [
|
||||
{
|
||||
|
|
|
@ -108,6 +108,7 @@ function handleLocation(data, location) {
|
|||
<VnAccountNumber
|
||||
v-model="data.account"
|
||||
:label="t('supplier.fiscalData.account')"
|
||||
clearable
|
||||
data-cy="supplierFiscalDataAccount"
|
||||
insertable
|
||||
:maxlength="10"
|
||||
|
@ -184,8 +185,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>
|
||||
|
|
|
@ -4,11 +4,9 @@ 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';
|
||||
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const dataKey = 'SupplierList';
|
||||
|
@ -52,7 +50,7 @@ const columns = computed(() => [
|
|||
label: t('globals.alias'),
|
||||
name: 'alias',
|
||||
columnFilter: {
|
||||
name: 'nickname',
|
||||
name: 'search',
|
||||
},
|
||||
cardVisible: true,
|
||||
},
|
||||
|
@ -105,35 +103,7 @@ const columns = computed(() => [
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
isPrimary: true,
|
||||
action: (row) => viewSummary(row.id, SupplierSummary, 'md-width'),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
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
|
||||
|
@ -144,7 +114,7 @@ const filterColumns = computed(() => {
|
|||
/>
|
||||
<VnSection
|
||||
:data-key="dataKey"
|
||||
:columns="filterColumns"
|
||||
:columns="columns"
|
||||
prefix="supplier"
|
||||
:array-data-props="{
|
||||
url: 'Suppliers/filter',
|
||||
|
@ -179,6 +149,17 @@ const filterColumns = 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>
|
||||
|
||||
|
|
|
@ -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="{ entity }">
|
||||
<template #icons>
|
||||
<QCardActions class="q-gutter-x-xs">
|
||||
<TicketProblems :row="{ ...entity?.client, ...problems }" />
|
||||
<TicketProblems :row="problems" />
|
||||
</QCardActions>
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
|
|
|
@ -1,26 +1,32 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { toCurrency } from 'src/filters';
|
||||
import VnUsesMana from 'components/ui/VnUsesMana.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
newPrice: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
usesMana: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
manaCode: {
|
||||
type: String,
|
||||
default: 'mana',
|
||||
},
|
||||
sale: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const mana = ref(null);
|
||||
const usesMana = ref(false);
|
||||
|
||||
const emit = defineEmits(['save', 'cancel']);
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -32,47 +38,32 @@ const save = (sale = $props.sale) => {
|
|||
QPopupProxyRef.value.hide();
|
||||
};
|
||||
|
||||
const getMana = async () => {
|
||||
const { data } = await axios.get(`Tickets/${route.params.id}/getSalesPersonMana`);
|
||||
mana.value = data;
|
||||
await getUsesMana();
|
||||
};
|
||||
|
||||
const getUsesMana = async () => {
|
||||
const { data } = await axios.get('Sales/usesMana');
|
||||
usesMana.value = data;
|
||||
};
|
||||
|
||||
const cancel = () => {
|
||||
emit('cancel');
|
||||
QPopupProxyRef.value.hide();
|
||||
};
|
||||
const hasMana = computed(() => typeof mana.value === 'number');
|
||||
defineExpose({ save });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy
|
||||
ref="QPopupProxyRef"
|
||||
@before-show="getMana"
|
||||
data-cy="ticketEditManaProxy"
|
||||
>
|
||||
<QPopupProxy ref="QPopupProxyRef" data-cy="ticketEditManaProxy">
|
||||
<div class="container">
|
||||
<div class="header">Mana: {{ toCurrency(mana) }}</div>
|
||||
<QSpinner v-if="!hasMana" color="primary" size="md" />
|
||||
<div class="q-pa-md" v-else>
|
||||
<slot :popup="QPopupProxyRef" />
|
||||
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
|
||||
<VnUsesMana :mana-code="manaCode" />
|
||||
</div>
|
||||
<div v-if="newPrice" class="column items-center q-mt-lg">
|
||||
<span class="text-primary">{{ t('New price') }}</span>
|
||||
<span class="text-subtitle1">
|
||||
{{ toCurrency($props.newPrice) }}
|
||||
</span>
|
||||
<QSpinner v-if="!mana" color="primary" size="md" />
|
||||
<div v-else>
|
||||
<div class="header">Mana: {{ toCurrency(mana) }}</div>
|
||||
<div class="q-pa-md">
|
||||
<slot :popup="QPopupProxyRef" />
|
||||
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
|
||||
<VnUsesMana :mana-code="manaCode" />
|
||||
</div>
|
||||
<div v-if="newPrice" class="column items-center q-mt-lg">
|
||||
<span class="text-primary">{{ t('New price') }}</span>
|
||||
<span class="text-subtitle1">
|
||||
{{ toCurrency($props.newPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<QBtn
|
||||
color="primary"
|
||||
|
|
|
@ -37,6 +37,7 @@ const expeditionStateTypes = ref([]);
|
|||
|
||||
const expeditionsFilter = computed(() => ({
|
||||
where: { ticketFk: route.params.id },
|
||||
order: ['created DESC'],
|
||||
}));
|
||||
|
||||
const ticketArrayData = useArrayData('Ticket');
|
||||
|
@ -104,9 +105,6 @@ const columns = computed(() => [
|
|||
name: 'created',
|
||||
align: 'left',
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
component: 'date',
|
||||
},
|
||||
format: (row) => toDateTimeFormat(row.created),
|
||||
},
|
||||
{
|
||||
|
@ -203,7 +201,7 @@ const getExpeditionState = async (expedition) => {
|
|||
|
||||
const openGrafana = (expeditionFk) => {
|
||||
useOpenURL(
|
||||
`https://grafana.verdnatura.es/d/de1njb6p5answd/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}`,
|
||||
`https://grafana.verdnatura.es/d/de1njb6p5answd/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}`
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -289,7 +287,7 @@ onMounted(async () => {
|
|||
openConfirmationModal(
|
||||
'',
|
||||
t('expedition.removeExpeditionSubtitle'),
|
||||
deleteExpedition,
|
||||
deleteExpedition
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -304,6 +302,7 @@ onMounted(async () => {
|
|||
url="Expeditions/filter"
|
||||
search-url="expeditions"
|
||||
:columns="columns"
|
||||
:filter="expeditionsFilter"
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
|
@ -317,14 +316,11 @@ onMounted(async () => {
|
|||
return { id: value };
|
||||
case 'packageItemName':
|
||||
return { packagingItemFk: value };
|
||||
case 'created':
|
||||
return { 'e.created': { gte: value } };
|
||||
}
|
||||
}
|
||||
"
|
||||
:redirect="false"
|
||||
order="created DESC"
|
||||
:filter="expeditionsFilter"
|
||||
>
|
||||
<template #column-freightItemName="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
|
|
|
@ -45,6 +45,7 @@ const isTicketEditable = ref(false);
|
|||
const sales = ref([]);
|
||||
const editableStatesOptions = ref([]);
|
||||
const selectedSales = ref([]);
|
||||
const mana = ref(null);
|
||||
const manaCode = ref('mana');
|
||||
const ticketState = computed(() => store.data?.ticketState?.state?.code);
|
||||
const transfer = ref({
|
||||
|
@ -174,21 +175,17 @@ const getSaleTotal = (sale) => {
|
|||
return price - discount;
|
||||
};
|
||||
|
||||
const getRowUpdateInputEvents = (sale) => ({
|
||||
'keyup.enter': () => {
|
||||
changeQuantity(sale);
|
||||
},
|
||||
blur: () => {
|
||||
changeQuantity(sale);
|
||||
},
|
||||
});
|
||||
|
||||
const resetChanges = async () => {
|
||||
arrayData.fetch({ append: false });
|
||||
tableRef.value.reload();
|
||||
};
|
||||
const rowToUpdate = ref(null);
|
||||
const changeQuantity = async (sale) => {
|
||||
if (!sale.itemFk || sale.quantity == null || sale?.originalQuantity === sale.quantity)
|
||||
if (
|
||||
!sale.itemFk ||
|
||||
sale.quantity == null ||
|
||||
edit.value?.oldQuantity === sale.quantity
|
||||
)
|
||||
return;
|
||||
if (!sale.id) return addSale(sale);
|
||||
|
||||
|
@ -200,10 +197,13 @@ const changeQuantity = async (sale) => {
|
|||
const updateQuantity = async (sale) => {
|
||||
try {
|
||||
let { quantity, id } = sale;
|
||||
if (!rowToUpdate.value) return;
|
||||
rowToUpdate.value = null;
|
||||
sale.isNew = false;
|
||||
await axios.post(`Sales/${id}/updateQuantity`, { quantity });
|
||||
const params = { quantity: quantity };
|
||||
await axios.post(`Sales/${id}/updateQuantity`, params);
|
||||
notify('globals.dataSaved', 'positive');
|
||||
resetChanges();
|
||||
tableRef.value.reload();
|
||||
} catch (e) {
|
||||
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
|
||||
(s) => s.id === sale.id,
|
||||
|
@ -247,7 +247,7 @@ const updateConcept = async (sale) => {
|
|||
const data = { newConcept: sale.concept };
|
||||
await axios.post(`Sales/${sale.id}/updateConcept`, data);
|
||||
notify('globals.dataSaved', 'positive');
|
||||
resetChanges();
|
||||
tableRef.value.reload();
|
||||
};
|
||||
|
||||
const DEFAULT_EDIT = {
|
||||
|
@ -258,6 +258,18 @@ const DEFAULT_EDIT = {
|
|||
oldQuantity: null,
|
||||
};
|
||||
const edit = ref({ ...DEFAULT_EDIT });
|
||||
const usesMana = ref(null);
|
||||
|
||||
const getUsesMana = async () => {
|
||||
const { data } = await axios.get('Sales/usesMana');
|
||||
usesMana.value = data;
|
||||
};
|
||||
|
||||
const getMana = async () => {
|
||||
const { data } = await axios.get(`Tickets/${route.params.id}/getSalesPersonMana`);
|
||||
mana.value = data;
|
||||
await getUsesMana();
|
||||
};
|
||||
|
||||
const selectedValidSales = computed(() => {
|
||||
if (!sales.value) return;
|
||||
|
@ -265,6 +277,7 @@ const selectedValidSales = computed(() => {
|
|||
});
|
||||
|
||||
const onOpenEditPricePopover = async (sale) => {
|
||||
await getMana();
|
||||
edit.value = {
|
||||
sale: JSON.parse(JSON.stringify(sale)),
|
||||
price: sale.price,
|
||||
|
@ -272,6 +285,7 @@ const onOpenEditPricePopover = async (sale) => {
|
|||
};
|
||||
|
||||
const onOpenEditDiscountPopover = async (sale) => {
|
||||
await getMana();
|
||||
if (isLocked.value) return;
|
||||
if (sale) {
|
||||
edit.value = {
|
||||
|
@ -292,13 +306,14 @@ const changePrice = async (sale) => {
|
|||
await confirmUpdate(() => updatePrice(sale, newPrice));
|
||||
} else updatePrice(sale, newPrice);
|
||||
}
|
||||
await getMana();
|
||||
};
|
||||
const updatePrice = async (sale, newPrice) => {
|
||||
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
|
||||
sale.price = newPrice;
|
||||
edit.value = { ...DEFAULT_EDIT };
|
||||
notify('globals.dataSaved', 'positive');
|
||||
resetChanges();
|
||||
tableRef.value.reload();
|
||||
};
|
||||
|
||||
const changeDiscount = async (sale) => {
|
||||
|
@ -330,7 +345,7 @@ const updateDiscount = async (sales, newDiscount = null) => {
|
|||
};
|
||||
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
|
||||
notify('globals.dataSaved', 'positive');
|
||||
resetChanges();
|
||||
tableRef.value.reload();
|
||||
};
|
||||
|
||||
const getNewPrice = computed(() => {
|
||||
|
@ -398,7 +413,7 @@ const removeSales = async () => {
|
|||
await axios.post('Sales/deleteSales', params);
|
||||
removeSelectedSales();
|
||||
notify('globals.dataSaved', 'positive');
|
||||
resetChanges();
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
const setTransferParams = async () => {
|
||||
|
@ -584,7 +599,9 @@ watch(
|
|||
:is-ticket-editable="isTicketEditable"
|
||||
:sales="selectedValidSales"
|
||||
:disable="!hasSelectedRows"
|
||||
:mana="mana"
|
||||
:ticket-config="ticketConfig"
|
||||
@get-mana="getMana()"
|
||||
@update-discounts="updateDiscounts"
|
||||
@refresh-table="resetChanges"
|
||||
/>
|
||||
|
@ -681,17 +698,6 @@ 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 }">
|
||||
|
@ -751,7 +757,7 @@ watch(
|
|||
{{ row?.item?.subName.toUpperCase() }}
|
||||
</div>
|
||||
</div>
|
||||
<FetchedTags :item="row.item" :max-length="6" />
|
||||
<FetchedTags :item="row" :max-length="6" />
|
||||
<QPopupProxy v-if="row.id && isTicketEditable">
|
||||
<VnInput
|
||||
v-model="row.concept"
|
||||
|
@ -766,7 +772,9 @@ watch(
|
|||
v-if="row.isNew || isTicketEditable"
|
||||
type="number"
|
||||
v-model.number="row.quantity"
|
||||
v-on="getRowUpdateInputEvents(row)"
|
||||
@blur="changeQuantity(row)"
|
||||
@keyup.enter.stop="changeQuantity(row)"
|
||||
@update:model-value="() => (rowToUpdate = row)"
|
||||
@focus="edit.oldQuantity = row.quantity"
|
||||
/>
|
||||
<span v-else>{{ row.quantity }}</span>
|
||||
|
@ -778,6 +786,7 @@ watch(
|
|||
</QBtn>
|
||||
<TicketEditManaProxy
|
||||
ref="editPriceProxyRef"
|
||||
:mana="mana"
|
||||
:sale="row"
|
||||
:new-price="getNewPrice"
|
||||
@save="changePrice"
|
||||
|
@ -800,8 +809,10 @@ watch(
|
|||
|
||||
<TicketEditManaProxy
|
||||
ref="editManaProxyRef"
|
||||
:mana="mana"
|
||||
:sale="row"
|
||||
:new-price="getNewPrice"
|
||||
:uses-mana="usesMana"
|
||||
:mana-code="manaCode"
|
||||
@save="changeDiscount"
|
||||
>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue