forked from verdnatura/salix-front
Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7300-createResetFnArrayData
This commit is contained in:
commit
bfd8804d0d
|
@ -1,6 +1,6 @@
|
|||
const { defineConfig } = require('cypress');
|
||||
import { defineConfig } from 'cypress';
|
||||
|
||||
module.exports = defineConfig({
|
||||
export default defineConfig({
|
||||
e2e: {
|
||||
baseUrl: 'http://localhost:9000/',
|
||||
experimentalStudio: true,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"author": "Verdnatura",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@8.15.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"lint": "eslint --ext .js,.vue ./",
|
||||
"format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
|
||||
|
@ -22,7 +23,7 @@
|
|||
"chromium": "^3.0.3",
|
||||
"croppie": "^2.6.5",
|
||||
"pinia": "^2.1.3",
|
||||
"quasar": "^2.14.5",
|
||||
"quasar": "^2.16.4",
|
||||
"validator": "^13.9.0",
|
||||
"vue": "^3.3.4",
|
||||
"vue-i18n": "^9.2.2",
|
||||
|
@ -31,7 +32,7 @@
|
|||
"devDependencies": {
|
||||
"@intlify/unplugin-vue-i18n": "^0.8.1",
|
||||
"@pinia/testing": "^0.1.2",
|
||||
"@quasar/app-vite": "^1.7.3",
|
||||
"@quasar/app-vite": "^1.9.3",
|
||||
"@quasar/quasar-app-extension-qcalendar": "4.0.0-beta.15",
|
||||
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
|
||||
"@vue/test-utils": "^2.4.4",
|
||||
|
@ -43,7 +44,8 @@
|
|||
"eslint-plugin-vue": "^9.14.1",
|
||||
"postcss": "^8.4.23",
|
||||
"prettier": "^2.8.8",
|
||||
"vitest": "^0.31.1"
|
||||
"vite": "^2.5.10",
|
||||
"vitest": "^0.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20 || ^18 || ^16",
|
||||
|
|
5843
pnpm-lock.yaml
5843
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,104 @@
|
|||
/* eslint-env node */
|
||||
|
||||
/*
|
||||
* This file runs in a Node context (it's NOT transpiled by Babel), so use only
|
||||
* the ES6 features that are supported by your Node version. https://node.green/
|
||||
*/
|
||||
|
||||
const { configure } = require('quasar/wrappers');
|
||||
const VueI18nPlugin = require('@intlify/unplugin-vue-i18n/vite');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = configure(function (/* ctx */) {
|
||||
return {
|
||||
eslint: {
|
||||
warnings: true,
|
||||
errors: true,
|
||||
},
|
||||
boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar', 'quasar.defaults'],
|
||||
css: ['app.scss'],
|
||||
extras: ['roboto-font', 'material-icons-outlined', 'material-symbols-outlined'],
|
||||
build: {
|
||||
target: {
|
||||
browser: ['es2022', 'edge88', 'firefox78', 'chrome87', 'safari13.1'],
|
||||
node: 'node18',
|
||||
},
|
||||
vueRouterMode: 'hash',
|
||||
rawDefine: {
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
||||
},
|
||||
extendViteConf(viteConf) {
|
||||
delete viteConf.build.polyfillModulePreload;
|
||||
viteConf.build.modulePreload = {
|
||||
polyfill: false,
|
||||
};
|
||||
},
|
||||
alias: {
|
||||
composables: path.join(__dirname, './src/composables'),
|
||||
filters: path.join(__dirname, './src/filters'),
|
||||
},
|
||||
vitePlugins: [
|
||||
[
|
||||
VueI18nPlugin({
|
||||
runtimeOnly: false,
|
||||
include: [
|
||||
path.resolve(__dirname, './src/i18n/locale/**'),
|
||||
path.resolve(__dirname, './src/pages/**/locale/**'),
|
||||
],
|
||||
}),
|
||||
],
|
||||
],
|
||||
},
|
||||
devServer: {
|
||||
server: {
|
||||
type: 'http',
|
||||
},
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://0.0.0.0:3000',
|
||||
logLevel: 'debug',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
open: false,
|
||||
},
|
||||
framework: {
|
||||
config: {
|
||||
dark: 'auto',
|
||||
},
|
||||
lang: 'en-GB',
|
||||
plugins: ['Notify', 'Dialog'],
|
||||
all: 'auto',
|
||||
autoImportComponentCase: 'pascal',
|
||||
},
|
||||
animations: [],
|
||||
ssr: {
|
||||
pwa: false,
|
||||
prodPort: 3000,
|
||||
middlewares: ['render'],
|
||||
},
|
||||
pwa: {
|
||||
workboxMode: 'generateSW',
|
||||
injectPwaMetaTags: true,
|
||||
swFilename: 'sw.js',
|
||||
manifestFilename: 'manifest.json',
|
||||
useCredentialsForManifestTag: false,
|
||||
},
|
||||
cordova: {},
|
||||
capacitor: {
|
||||
hideSplashscreen: true,
|
||||
},
|
||||
electron: {
|
||||
inspectPort: 5858,
|
||||
bundler: 'packager',
|
||||
packager: {},
|
||||
builder: {
|
||||
appId: 'salix-frontend',
|
||||
},
|
||||
},
|
||||
bex: {
|
||||
contentScripts: ['my-content-script'],
|
||||
},
|
||||
};
|
||||
});
|
242
quasar.config.js
242
quasar.config.js
|
@ -1,242 +0,0 @@
|
|||
/* eslint-env node */
|
||||
|
||||
/*
|
||||
* This file runs in a Node context (it's NOT transpiled by Babel), so use only
|
||||
* the ES6 features that are supported by your Node version. https://node.green/
|
||||
*/
|
||||
|
||||
// Configuration for your app
|
||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js
|
||||
|
||||
const { configure } = require('quasar/wrappers');
|
||||
const VueI18nPlugin = require('@intlify/unplugin-vue-i18n/vite');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = configure(function (/* ctx */) {
|
||||
return {
|
||||
eslint: {
|
||||
// fix: true,
|
||||
// include = [],
|
||||
// exclude = [],
|
||||
// rawOptions = {},
|
||||
warnings: true,
|
||||
errors: true,
|
||||
},
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli/prefetch-feature
|
||||
// preFetch: true,
|
||||
|
||||
// app boot file (/src/boot)
|
||||
// --> boot files are part of "main.js"
|
||||
// https://v2.quasar.dev/quasar-cli/boot-files
|
||||
boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar', 'quasar.defaults'],
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
|
||||
css: ['app.scss'],
|
||||
|
||||
// https://github.com/quasarframework/quasar/tree/dev/extras
|
||||
extras: [
|
||||
// 'ionicons-v4',
|
||||
// 'mdi-v5',
|
||||
// 'fontawesome-v6',
|
||||
// 'eva-icons',
|
||||
// 'themify',
|
||||
// 'line-awesome',
|
||||
// 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both!
|
||||
|
||||
'roboto-font',
|
||||
'material-icons-outlined',
|
||||
'material-symbols-outlined',
|
||||
],
|
||||
|
||||
// Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#build
|
||||
build: {
|
||||
target: {
|
||||
browser: ['es2022', 'edge88', 'firefox78', 'chrome87', 'safari13.1'],
|
||||
node: 'node18',
|
||||
},
|
||||
|
||||
vueRouterMode: 'hash', // available values: 'hash', 'history'
|
||||
// vueRouterBase,
|
||||
// vueDevtools,
|
||||
// vueOptionsAPI: false,
|
||||
|
||||
// rebuildCache: true, // rebuilds Vite/linter/etc cache on startup
|
||||
|
||||
// publicPath: '/',
|
||||
// analyze: true,
|
||||
// env: {},
|
||||
rawDefine: {
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
||||
},
|
||||
// ignorePublicFolder: true,
|
||||
// minify: false,
|
||||
// polyfillModulePreload: true,
|
||||
// distDir
|
||||
|
||||
extendViteConf(viteConf) {
|
||||
// FIXME: Delete deprecated property polyfillModulePreload
|
||||
// that is set by Quasar by default
|
||||
delete viteConf.build.polyfillModulePreload;
|
||||
viteConf.build.modulePreload = {
|
||||
polyfill: false,
|
||||
};
|
||||
},
|
||||
// viteVuePluginOptions: {},
|
||||
|
||||
alias: {
|
||||
composables: path.join(__dirname, './src/composables'),
|
||||
filters: path.join(__dirname, './src/filters'),
|
||||
},
|
||||
|
||||
vitePlugins: [
|
||||
[
|
||||
VueI18nPlugin({
|
||||
runtimeOnly: false,
|
||||
include: [
|
||||
path.resolve(__dirname, './src/i18n/locale/**'),
|
||||
path.resolve(__dirname, './src/pages/**/locale/**'),
|
||||
],
|
||||
}),
|
||||
],
|
||||
],
|
||||
},
|
||||
|
||||
// Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#devServer
|
||||
devServer: {
|
||||
server: {
|
||||
type: 'http',
|
||||
},
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://0.0.0.0:3000',
|
||||
logLevel: 'debug',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
open: false,
|
||||
},
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework
|
||||
framework: {
|
||||
config: {
|
||||
config: {
|
||||
dark: 'auto',
|
||||
},
|
||||
},
|
||||
lang: 'en-GB',
|
||||
|
||||
// iconSet: 'material-icons', // Quasar icon set
|
||||
// lang: 'en-US', // Quasar language pack
|
||||
|
||||
// For special cases outside of where the auto-import strategy can have an impact
|
||||
// (like functional components as one of the examples),
|
||||
// you can manually specify Quasar components/directives to be available everywhere:
|
||||
//
|
||||
// components: [],
|
||||
// directives: [],
|
||||
|
||||
// Quasar plugins
|
||||
plugins: ['Notify', 'Dialog'],
|
||||
all: 'auto',
|
||||
autoImportComponentCase: 'pascal',
|
||||
},
|
||||
|
||||
// animations: 'all', // --- includes all animations
|
||||
// https://v2.quasar.dev/options/animations
|
||||
animations: [],
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#property-sourcefiles
|
||||
// sourceFiles: {
|
||||
// rootComponent: 'src/App.vue',
|
||||
// router: 'src/router/index',
|
||||
// store: 'src/store/index',
|
||||
// registerServiceWorker: 'src-pwa/register-service-worker',
|
||||
// serviceWorker: 'src-pwa/custom-service-worker',
|
||||
// pwaManifestFile: 'src-pwa/manifest.json',
|
||||
// electronMain: 'src-electron/electron-main',
|
||||
// electronPreload: 'src-electron/electron-preload'
|
||||
// },
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli/developing-ssr/configuring-ssr
|
||||
ssr: {
|
||||
// ssrPwaHtmlFilename: 'offline.html', // do NOT use index.html as name!
|
||||
// will mess up SSR
|
||||
|
||||
// extendSSRWebserverConf (esbuildConf) {},
|
||||
// extendPackageJson (json) {},
|
||||
|
||||
pwa: false,
|
||||
|
||||
// manualStoreHydration: true,
|
||||
// manualPostHydrationTrigger: true,
|
||||
|
||||
prodPort: 3000, // The default port that the production server should use
|
||||
// (gets superseded if process.env.PORT is specified at runtime)
|
||||
|
||||
middlewares: [
|
||||
'render', // keep this as last one
|
||||
],
|
||||
},
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli/developing-pwa/configuring-pwa
|
||||
pwa: {
|
||||
workboxMode: 'generateSW', // or 'injectManifest'
|
||||
injectPwaMetaTags: true,
|
||||
swFilename: 'sw.js',
|
||||
manifestFilename: 'manifest.json',
|
||||
useCredentialsForManifestTag: false,
|
||||
// useFilenameHashes: true,
|
||||
// extendGenerateSWOptions (cfg) {}
|
||||
// extendInjectManifestOptions (cfg) {},
|
||||
// extendManifestJson (json) {}
|
||||
// extendPWACustomSWConf (esbuildConf) {}
|
||||
},
|
||||
|
||||
// Full list of options: https://v2.quasar.dev/quasar-cli/developing-cordova-apps/configuring-cordova
|
||||
cordova: {
|
||||
// noIosLegacyBuildFlag: true, // uncomment only if you know what you are doing
|
||||
},
|
||||
|
||||
// Full list of options: https://v2.quasar.dev/quasar-cli/developing-capacitor-apps/configuring-capacitor
|
||||
capacitor: {
|
||||
hideSplashscreen: true,
|
||||
},
|
||||
|
||||
// Full list of options: https://v2.quasar.dev/quasar-cli/developing-electron-apps/configuring-electron
|
||||
electron: {
|
||||
// extendElectronMainConf (esbuildConf)
|
||||
// extendElectronPreloadConf (esbuildConf)
|
||||
|
||||
inspectPort: 5858,
|
||||
|
||||
bundler: 'packager', // 'packager' or 'builder'
|
||||
|
||||
packager: {
|
||||
// https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options
|
||||
// OS X / Mac App Store
|
||||
// appBundleId: '',
|
||||
// appCategoryType: '',
|
||||
// osxSign: '',
|
||||
// protocol: 'myapp://path',
|
||||
// Windows only
|
||||
// win32metadata: { ... }
|
||||
},
|
||||
|
||||
builder: {
|
||||
// https://www.electron.build/configuration/configuration
|
||||
|
||||
appId: 'salix-frontend',
|
||||
},
|
||||
},
|
||||
|
||||
// Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-browser-extensions/configuring-bex
|
||||
bex: {
|
||||
contentScripts: ['my-content-script'],
|
||||
|
||||
// extendBexScriptsConf (esbuildConf) {}
|
||||
// extendBexManifestJson (json) {}
|
||||
},
|
||||
};
|
||||
});
|
|
@ -148,7 +148,7 @@ async function onSubmit() {
|
|||
await saveChanges($props.saveFn ? formData.value : null);
|
||||
}
|
||||
|
||||
async function onSumbitAndGo() {
|
||||
async function onSubmitAndGo() {
|
||||
await onSubmit();
|
||||
push({ path: $props.goTo });
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ watch(formUrl, async () => {
|
|||
/>
|
||||
<QBtnDropdown
|
||||
v-if="$props.goTo && $props.defaultSave"
|
||||
@click="onSumbitAndGo"
|
||||
@click="onSubmitAndGo"
|
||||
:label="tMobile('globals.saveAndContinue')"
|
||||
:title="t('globals.saveAndContinue')"
|
||||
:disable="!hasChanges"
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
import { ref, reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { useQuasar } from 'quasar';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
|
@ -18,33 +19,68 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const checked = ref(true);
|
||||
const transferInvoiceParams = reactive({
|
||||
id: $props.invoiceOutData?.id,
|
||||
refFk: $props.invoiceOutData?.ref,
|
||||
});
|
||||
const closeButton = ref(null);
|
||||
const clientsOptions = ref([]);
|
||||
|
||||
const rectificativeTypeOptions = ref([]);
|
||||
const siiTypeInvoiceOutsOptions = ref([]);
|
||||
const invoiceCorrectionTypesOptions = ref([]);
|
||||
|
||||
const closeForm = () => {
|
||||
if (closeButton.value) closeButton.value.click();
|
||||
const selectedClient = (client) => {
|
||||
transferInvoiceParams.selectedClientData = client;
|
||||
};
|
||||
|
||||
const transferInvoice = async () => {
|
||||
const makeInvoice = async () => {
|
||||
const hasToInvoiceByAddress =
|
||||
transferInvoiceParams.selectedClientData.hasToInvoiceByAddress;
|
||||
|
||||
const params = {
|
||||
id: transferInvoiceParams.id,
|
||||
cplusRectificationTypeFk: transferInvoiceParams.cplusRectificationTypeFk,
|
||||
invoiceCorrectionTypeFk: transferInvoiceParams.invoiceCorrectionTypeFk,
|
||||
newClientFk: transferInvoiceParams.newClientFk,
|
||||
refFk: transferInvoiceParams.refFk,
|
||||
siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk,
|
||||
makeInvoice: checked.value,
|
||||
};
|
||||
|
||||
try {
|
||||
const { data } = await axios.post(
|
||||
'InvoiceOuts/transferInvoice',
|
||||
transferInvoiceParams
|
||||
);
|
||||
if (checked.value && hasToInvoiceByAddress) {
|
||||
const response = await new Promise((resolve) => {
|
||||
quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('Bill destination client'),
|
||||
message: t('transferInvoiceInfo'),
|
||||
},
|
||||
})
|
||||
.onOk(() => {
|
||||
resolve(true);
|
||||
})
|
||||
.onCancel(() => {
|
||||
resolve(false);
|
||||
});
|
||||
});
|
||||
if (!response) {
|
||||
console.log('entra cuando no checkbox');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
console.log('params: ', params);
|
||||
const { data } = await axios.post('InvoiceOuts/transferInvoice', params);
|
||||
console.log('data: ', data);
|
||||
notify(t('Transferred invoice'), 'positive');
|
||||
closeForm();
|
||||
router.push('InvoiceOutSummary', { id: data.id });
|
||||
const id = data?.[0];
|
||||
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||
} catch (err) {
|
||||
console.error('Error transfering invoice', err);
|
||||
}
|
||||
|
@ -52,22 +88,30 @@ const transferInvoice = async () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Clients"
|
||||
@on-fetch="(data) => (clientsOptions = data)"
|
||||
:filter="{ fields: ['id', 'name'], order: 'id', limit: 30 }"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="CplusRectificationTypes"
|
||||
:filter="{ order: 'description' }"
|
||||
@on-fetch="(data) => (rectificativeTypeOptions = data)"
|
||||
@on-fetch="
|
||||
(data) => (
|
||||
(rectificativeTypeOptions = data),
|
||||
(transferInvoiceParams.cplusRectificationTypeFk = data.filter(
|
||||
(type) => type.description == 'I – Por diferencias'
|
||||
)[0].id)
|
||||
)
|
||||
"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="SiiTypeInvoiceOuts"
|
||||
:filter="{ where: { code: { like: 'R%' } } }"
|
||||
@on-fetch="(data) => (siiTypeInvoiceOutsOptions = data)"
|
||||
@on-fetch="
|
||||
(data) => (
|
||||
(siiTypeInvoiceOutsOptions = data),
|
||||
(transferInvoiceParams.siiTypeInvoiceOutFk = data.filter(
|
||||
(type) => type.code == 'R4'
|
||||
)[0].id)
|
||||
)
|
||||
"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
|
@ -76,7 +120,7 @@ const transferInvoice = async () => {
|
|||
auto-load
|
||||
/>
|
||||
<FormPopup
|
||||
@on-submit="transferInvoice()"
|
||||
@on-submit="makeInvoice()"
|
||||
:title="t('Transfer invoice')"
|
||||
:custom-submit-button-label="t('Transfer client')"
|
||||
:default-cancel-button="false"
|
||||
|
@ -91,13 +135,18 @@ const transferInvoice = async () => {
|
|||
option-value="id"
|
||||
v-model="transferInvoiceParams.newClientFk"
|
||||
:required="true"
|
||||
url="Clients"
|
||||
:fields="['id', 'name', 'hasToInvoiceByAddress']"
|
||||
auto-load
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItem
|
||||
v-bind="scope.itemProps"
|
||||
@click="selectedClient(scope.opt)"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
#{{ scope.opt?.id }} -
|
||||
{{ scope.opt?.name }}
|
||||
#{{ scope.opt?.id }} - {{ scope.opt?.name }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -144,11 +193,23 @@ const transferInvoice = async () => {
|
|||
:required="true"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div>
|
||||
<QCheckbox :label="t('Bill destination client')" v-model="checked" />
|
||||
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
||||
<QTooltip>{{ t('transferInvoiceInfo') }}</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormPopup>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
checkInfo: New tickets from the destination customer will be generated in the consignee by default.
|
||||
transferInvoiceInfo: Destination customer is marked to bill in the consignee
|
||||
confirmTransferInvoice: The destination customer has selected to bill in the consignee, do you want to continue?
|
||||
es:
|
||||
Transfer invoice: Transferir factura
|
||||
Transfer client: Transferir cliente
|
||||
|
@ -157,4 +218,7 @@ es:
|
|||
Class: Clase
|
||||
Type: Tipo
|
||||
Transferred invoice: Factura transferida
|
||||
Bill destination client: Facturar cliente destino
|
||||
transferInvoiceInfo: Los nuevos tickets del cliente destino, serán generados en el consignatario por defecto.
|
||||
confirmTransferInvoice: El cliente destino tiene marcado facturar por consignatario, desea continuar?
|
||||
</i18n>
|
||||
|
|
|
@ -11,6 +11,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import { useClipboard } from 'src/composables/useClipboard';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
const state = useState();
|
||||
const session = useSession();
|
||||
|
@ -47,7 +48,6 @@ const darkMode = computed({
|
|||
});
|
||||
|
||||
const user = state.getUser();
|
||||
const token = session.getTokenMultimedia();
|
||||
const warehousesData = ref();
|
||||
const companiesData = ref();
|
||||
const accountBankData = ref();
|
||||
|
@ -149,10 +149,7 @@ function saveUserData(param, value) {
|
|||
|
||||
<div class="col column items-center q-mb-sm">
|
||||
<QAvatar size="80px">
|
||||
<QImg
|
||||
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"
|
||||
spinner-color="white"
|
||||
/>
|
||||
<VnImg :id="user.id" collection="user" size="160x160" />
|
||||
</QAvatar>
|
||||
|
||||
<div class="text-subtitle1 q-mt-md">
|
||||
|
|
|
@ -22,6 +22,10 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: '',
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -88,7 +92,7 @@ const inputRules = [
|
|||
<QIcon
|
||||
name="close"
|
||||
size="xs"
|
||||
v-if="hover && value && !$attrs.disabled"
|
||||
v-if="hover && value && !$attrs.disabled && $props.clearable"
|
||||
@click="value = null"
|
||||
></QIcon>
|
||||
<QIcon v-if="info" name="info">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import isValidDate from 'filters/isValidDate';
|
||||
|
||||
const props = defineProps({
|
||||
|
@ -24,6 +25,9 @@ const hover = ref(false);
|
|||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
const { t } = useI18n();
|
||||
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
||||
|
||||
const joinDateAndTime = (date, time) => {
|
||||
if (!date) {
|
||||
return null;
|
||||
|
@ -91,6 +95,8 @@ const styleAttrs = computed(() => {
|
|||
readonly
|
||||
:model-value="displayDate(value)"
|
||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||
:class="{ required: $attrs.required }"
|
||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||
@click="isPopupOpen = true"
|
||||
>
|
||||
<template #append>
|
||||
|
|
|
@ -17,8 +17,9 @@ const props = defineProps({
|
|||
default: false,
|
||||
},
|
||||
});
|
||||
const { t } = useI18n();
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const { t } = useI18n();
|
||||
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
||||
|
||||
const value = computed({
|
||||
get() {
|
||||
|
@ -71,6 +72,8 @@ const styleAttrs = computed(() => {
|
|||
readonly
|
||||
:model-value="formatTime(value)"
|
||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||
:class="{ required: $attrs.required }"
|
||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||
@click="isPopupOpen = true"
|
||||
>
|
||||
<template #append>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<script setup>
|
||||
defineProps({
|
||||
title: { type: String, default: null },
|
||||
content: { type: [String, Number], default: null },
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<QCard>
|
||||
<slot name="title">
|
||||
<div
|
||||
class="header q-px-sm q-py-xs q-ma-none text-white text-bold bg-primary"
|
||||
v-text="title"
|
||||
/>
|
||||
</slot>
|
||||
<slot name="content">
|
||||
<QCardSection class="change-detail q-pa-sm">
|
||||
{{ content }}
|
||||
</QCardSection>
|
||||
</slot>
|
||||
</QCard>
|
||||
</QPopupProxy>
|
||||
</template>
|
|
@ -0,0 +1,97 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const $props = defineProps({
|
||||
progress: {
|
||||
type: Number, //Progress value (1.0 > x > 0.0)
|
||||
required: true,
|
||||
},
|
||||
showDialog: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
cancelled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['cancel', 'close']);
|
||||
|
||||
const dialogRef = ref(null);
|
||||
|
||||
const _showDialog = computed({
|
||||
get: () => $props.showDialog,
|
||||
set: (value) => {
|
||||
if (value) dialogRef.value.show();
|
||||
},
|
||||
});
|
||||
|
||||
const _progress = computed(() => $props.progress);
|
||||
|
||||
const progressLabel = computed(() => `${Math.round($props.progress * 100)}%`);
|
||||
|
||||
const cancel = () => {
|
||||
dialogRef.value.hide();
|
||||
emit('cancel');
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef" v-model="_showDialog" @hide="onDialogHide">
|
||||
<QCard class="full-width dialog">
|
||||
<QCardSection class="row">
|
||||
<span class="text-h6">{{ t('Progress') }}</span>
|
||||
<QSpace />
|
||||
<QBtn icon="close" flat round dense @click="emit('close')" />
|
||||
</QCardSection>
|
||||
<QCardSection>
|
||||
<div class="column">
|
||||
<span>{{ t('Total progress') }}:</span>
|
||||
<QLinearProgress
|
||||
size="30px"
|
||||
:value="_progress"
|
||||
color="primary"
|
||||
stripe
|
||||
class="q-mt-sm q-mb-md"
|
||||
>
|
||||
<div class="absolute-full flex flex-center">
|
||||
<QBadge
|
||||
v-if="cancelled"
|
||||
text-color="white"
|
||||
color="negative"
|
||||
:label="t('Cancelled')"
|
||||
/>
|
||||
<span v-else class="text-white text-subtitle1">
|
||||
{{ progressLabel }}
|
||||
</span>
|
||||
</div>
|
||||
</QLinearProgress>
|
||||
<slot />
|
||||
</div>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn
|
||||
v-if="!cancelled && progress < 1"
|
||||
type="button"
|
||||
flat
|
||||
class="text-primary"
|
||||
@click="cancel()"
|
||||
>
|
||||
{{ t('globals.cancel') }}
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Progress: Progreso
|
||||
Total progress: Progreso total
|
||||
Cancelled: Cancelado
|
||||
</i18n>
|
|
@ -1,6 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, toRefs, computed, watch } from 'vue';
|
||||
import { onMounted } from 'vue';
|
||||
import { ref, toRefs, computed, watch, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
const emit = defineEmits(['update:modelValue', 'update:options']);
|
||||
|
@ -58,6 +57,10 @@ const $props = defineProps({
|
|||
type: [Number, String],
|
||||
default: '30',
|
||||
},
|
||||
focusOnMount: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -148,6 +151,10 @@ watch(modelValue, (newValue) => {
|
|||
if (!myOptions.value.some((option) => option[optionValue.value] == newValue))
|
||||
fetchFilter(newValue);
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -184,6 +184,7 @@ en:
|
|||
minAmount: 'A minimum amount of 50€ (VAT excluded) is required for your order
|
||||
{ orderId } of { shipped } to receive it without additional shipping costs.'
|
||||
orderChanges: 'Order {orderId} of { shipped }: { changes }'
|
||||
productNotAvailable: 'Verdnatura communicates: Your order {ticketFk} with reception date on {landed}. {notAvailables} not available. Sorry for the inconvenience.'
|
||||
en: English
|
||||
es: Spanish
|
||||
fr: French
|
||||
|
@ -203,6 +204,7 @@ es:
|
|||
Te recomendamos amplíes para no generar costes extra, provocarán un incremento de tu tarifa.
|
||||
¡Un saludo!'
|
||||
orderChanges: 'Pedido {orderId} con llegada estimada día { landing }: { changes }'
|
||||
productNotAvailable: 'Verdnatura le comunica: Pedido {ticketFk} con fecha de recepción {landed}. {notAvailables} no disponible/s. Disculpe las molestias.'
|
||||
en: Inglés
|
||||
es: Español
|
||||
fr: Francés
|
||||
|
@ -222,6 +224,7 @@ fr:
|
|||
Montant minimum nécessaire de 50 euros pour recevoir la commande { orderId } livraison { landing }.
|
||||
Merci.'
|
||||
orderChanges: 'Commande {orderId} livraison {landing} indisponible/s. Désolés pour le dérangement.'
|
||||
productNotAvailable: 'Verdnatura communique : Votre commande {ticketFk} avec date de réception le {landed}. {notAvailables} non disponible. Nous sommes désolés pour les inconvénients.'
|
||||
en: Anglais
|
||||
es: Espagnol
|
||||
fr: Français
|
||||
|
@ -240,6 +243,7 @@ pt:
|
|||
minAmount: 'É necessário um valor mínimo de 50€ (sem IVA) em seu pedido
|
||||
{ orderId } do dia { landing } para recebê-lo sem custos de envio adicionais.'
|
||||
orderChanges: 'Pedido { orderId } com chegada dia { landing }: { changes }'
|
||||
productNotAvailable: 'Verdnatura comunica: Seu pedido {ticketFk} com data de recepção em {landed}. {notAvailables} não disponível/eis. Desculpe pelo transtorno.'
|
||||
en: Inglês
|
||||
es: Espanhol
|
||||
fr: Francês
|
||||
|
|
|
@ -39,6 +39,7 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const state = useState();
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
let arrayData;
|
||||
|
@ -57,7 +58,7 @@ onBeforeMount(async () => {
|
|||
store = arrayData.store;
|
||||
entity = computed(() => (Array.isArray(store.data) ? store.data[0] : store.data));
|
||||
// It enables to load data only once if the module is the same as the dataKey
|
||||
if ($props.dataKey !== useRoute().meta.moduleName) await getData();
|
||||
if ($props.dataKey !== route.meta.moduleName || !route.params.id) await getData();
|
||||
watch(
|
||||
() => [$props.url, $props.filter],
|
||||
async () => await getData()
|
||||
|
|
|
@ -30,7 +30,7 @@ const props = defineProps({
|
|||
const emit = defineEmits(['onFetch']);
|
||||
const route = useRoute();
|
||||
const isSummary = ref();
|
||||
const arrayData = useArrayData(props.dataKey || route.meta.moduleName, {
|
||||
const arrayData = useArrayData(props.dataKey, {
|
||||
url: props.url,
|
||||
filter: props.filter,
|
||||
skip: 0,
|
||||
|
|
|
@ -60,7 +60,7 @@ const emit = defineEmits(['refresh', 'clear', 'search', 'init', 'remove']);
|
|||
const arrayData = useArrayData($props.dataKey, {
|
||||
exprBuilder: $props.exprBuilder,
|
||||
searchUrl: $props.searchUrl,
|
||||
navigate: {},
|
||||
navigate: $props.redirect ? {} : null,
|
||||
});
|
||||
const route = useRoute();
|
||||
const store = arrayData.store;
|
||||
|
|
|
@ -3,22 +3,26 @@ import { ref, computed, onMounted } from 'vue';
|
|||
import { useSession } from 'src/composables/useSession';
|
||||
|
||||
const $props = defineProps({
|
||||
collection: {
|
||||
storage: {
|
||||
type: [String, Number],
|
||||
default: 'Images',
|
||||
},
|
||||
collection: {
|
||||
type: String,
|
||||
default: 'catalog',
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: '200x200',
|
||||
},
|
||||
zoomSize: {
|
||||
type: String,
|
||||
required: true,
|
||||
required: false,
|
||||
default: 'lg',
|
||||
},
|
||||
id: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const show = ref(false);
|
||||
|
@ -26,10 +30,9 @@ const token = useSession().getTokenMultimedia();
|
|||
const timeStamp = ref(`timestamp=${Date.now()}`);
|
||||
const url = computed(
|
||||
() =>
|
||||
`/api/${$props.collection}/catalog/${$props.size}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
|
||||
`/api/${$props.storage}/${$props.collection}/${$props.size}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
|
||||
);
|
||||
const emits = defineEmits(['refresh']);
|
||||
const reload = (emit = false) => {
|
||||
const reload = () => {
|
||||
timeStamp.value = `timestamp=${Date.now()}`;
|
||||
};
|
||||
defineExpose({
|
||||
|
@ -41,20 +44,25 @@ onMounted(() => {});
|
|||
<template>
|
||||
<QImg :src="url" v-bind="$attrs" @click="show = !show" spinner-color="primary" />
|
||||
<QDialog v-model="show" v-if="$props.zoomSize">
|
||||
<QImg :src="url" class="img_zoom" v-bind="$attrs" spinner-color="primary" />
|
||||
<QImg
|
||||
:src="url"
|
||||
size="full"
|
||||
class="img_zoom"
|
||||
v-bind="$attrs"
|
||||
spinner-color="primary"
|
||||
/>
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.q-img {
|
||||
cursor: zoom-in;
|
||||
min-width: 50px;
|
||||
}
|
||||
.rounded {
|
||||
border-radius: 50%;
|
||||
}
|
||||
.img_zoom {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border-radius: 0%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -78,6 +78,7 @@ async function insert() {
|
|||
ref="vnPaginateRef"
|
||||
class="show"
|
||||
v-bind="$attrs"
|
||||
search-url="notes"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<TransitionGroup name="list" tag="div" class="column items-center full-width">
|
||||
|
|
|
@ -73,7 +73,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
const filter = {
|
||||
order: store.order,
|
||||
limit: store.limit,
|
||||
skip: store.skip,
|
||||
};
|
||||
|
||||
let exprFilter;
|
||||
|
@ -88,7 +87,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
}
|
||||
|
||||
Object.assign(filter, store.userFilter, exprFilter);
|
||||
Object.assign(store.filter, filter);
|
||||
Object.assign(store.filter, { ...filter, skip: store.skip });
|
||||
const params = {
|
||||
filter: JSON.stringify(store.filter),
|
||||
};
|
||||
|
|
|
@ -152,6 +152,15 @@ select:-webkit-autofill {
|
|||
color: var(--vn-label-color);
|
||||
}
|
||||
|
||||
.disabled {
|
||||
& .q-checkbox__label {
|
||||
color: var(--vn-text-color);
|
||||
}
|
||||
& .q-checkbox__inner {
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
}
|
||||
|
||||
.q-chip,
|
||||
.q-notification__message,
|
||||
.q-notification__icon {
|
||||
|
|
|
@ -8,11 +8,8 @@ export default function (value, fractionSize = 2) {
|
|||
const options = {
|
||||
style: 'percent',
|
||||
minimumFractionDigits: fractionSize,
|
||||
maximumFractionDigits: fractionSize
|
||||
maximumFractionDigits: fractionSize,
|
||||
};
|
||||
|
||||
return new Intl.NumberFormat(locale, options)
|
||||
.format(parseFloat(value));
|
||||
|
||||
|
||||
return new Intl.NumberFormat(locale, options).format(parseFloat(value));
|
||||
}
|
|
@ -113,6 +113,7 @@ globals:
|
|||
name: Name
|
||||
new: New
|
||||
comment: Comment
|
||||
observations: Observations
|
||||
errors:
|
||||
statusUnauthorized: Access denied
|
||||
statusInternalServerError: An internal server error has ocurred
|
||||
|
@ -443,6 +444,10 @@ ticket:
|
|||
sms: Sms
|
||||
notes: Notes
|
||||
sale: Sale
|
||||
ticketAdvance: Advance tickets
|
||||
futureTickets: Future tickets
|
||||
purchaseRequest: Purchase request
|
||||
weeklyTickets: Weekly tickets
|
||||
list:
|
||||
nickname: Nickname
|
||||
state: State
|
||||
|
@ -844,7 +849,8 @@ worker:
|
|||
calendar: Calendar
|
||||
timeControl: Time control
|
||||
locker: Locker
|
||||
|
||||
balance: Balance
|
||||
formation: Formation
|
||||
list:
|
||||
name: Name
|
||||
email: Email
|
||||
|
@ -914,7 +920,24 @@ worker:
|
|||
payMethods: Pay method
|
||||
iban: IBAN
|
||||
bankEntity: Swift / BIC
|
||||
formation:
|
||||
tableVisibleColumns:
|
||||
course: Curso
|
||||
startDate: Fecha Inicio
|
||||
endDate: Fecha Fin
|
||||
center: Centro Formación
|
||||
invoice: Factura
|
||||
amount: Importe
|
||||
remark: Bonficado
|
||||
hasDiploma: Diploma
|
||||
imageNotFound: Image not found
|
||||
balance:
|
||||
tableVisibleColumns:
|
||||
paymentDate: Date
|
||||
incomeType: Type
|
||||
debit: Debt
|
||||
credit: Have
|
||||
concept: Concept
|
||||
wagon:
|
||||
pageTitles:
|
||||
wagons: Wagons
|
||||
|
|
|
@ -114,6 +114,7 @@ globals:
|
|||
name: Nombre
|
||||
new: Nuevo
|
||||
comment: Comentario
|
||||
observations: Observaciones
|
||||
errors:
|
||||
statusUnauthorized: Acceso denegado
|
||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||
|
@ -442,6 +443,10 @@ ticket:
|
|||
sms: Sms
|
||||
notes: Notas
|
||||
sale: Lineas del pedido
|
||||
ticketAdvance: Adelantar tickets
|
||||
futureTickets: Tickets a futuro
|
||||
purchaseRequest: Petición de compra
|
||||
weeklyTickets: Tickets programados
|
||||
list:
|
||||
nickname: Alias
|
||||
state: Estado
|
||||
|
@ -840,6 +845,8 @@ worker:
|
|||
calendar: Calendario
|
||||
timeControl: Control de horario
|
||||
locker: Taquilla
|
||||
balance: Balance
|
||||
formation: Formación
|
||||
list:
|
||||
name: Nombre
|
||||
email: Email
|
||||
|
@ -900,7 +907,24 @@ worker:
|
|||
payMethods: Método de pago
|
||||
iban: IBAN
|
||||
bankEntity: Swift / BIC
|
||||
formation:
|
||||
tableVisibleColumns:
|
||||
course: Curso
|
||||
startDate: Fecha Inicio
|
||||
endDate: Fecha Fin
|
||||
center: Centro Formación
|
||||
invoice: Factura
|
||||
amount: Importe
|
||||
remark: Bonficado
|
||||
hasDiploma: Diploma
|
||||
imageNotFound: No se ha encontrado la imagen
|
||||
balance:
|
||||
tableVisibleColumns:
|
||||
paymentDate: Fecha
|
||||
incomeType: Tipo
|
||||
debit: Debe
|
||||
credit: Haber
|
||||
concept: Concepto
|
||||
wagon:
|
||||
pageTitles:
|
||||
wagons: Vagones
|
||||
|
|
|
@ -3,7 +3,6 @@ import { useRoute } from 'vue-router';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
|||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -19,7 +19,6 @@ const $props = defineProps({
|
|||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
|
@ -31,10 +30,6 @@ const filter = {
|
|||
fields: ['id', 'nickname', 'name', 'role'],
|
||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||
};
|
||||
function getAccountAvatar() {
|
||||
const token = getTokenMultimedia();
|
||||
return `/api/Images/user/160x160/${entityId.value}/download?access_token=${token}`;
|
||||
}
|
||||
const hasAccount = ref(false);
|
||||
</script>
|
||||
|
||||
|
@ -72,7 +67,8 @@ const hasAccount = ref(false);
|
|||
<AccountDescriptorMenu :has-account="hasAccount" />
|
||||
</template>
|
||||
<template #before>
|
||||
<QImg :src="getAccountAvatar()" class="photo">
|
||||
<!-- falla id :id="entityId.value" collection="user" size="160x160" -->
|
||||
<VnImg :id="entityId" collection="user" size="160x160" class="photo">
|
||||
<template #error>
|
||||
<div
|
||||
class="absolute-full picture text-center q-pa-md flex flex-center"
|
||||
|
@ -87,7 +83,7 @@ const hasAccount = ref(false);
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</QImg>
|
||||
</VnImg>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('account.card.nickname')" :value="entity.nickname" />
|
||||
|
|
|
@ -30,6 +30,7 @@ const filter = {
|
|||
|
||||
<template>
|
||||
<CardSummary
|
||||
data-key="AccountSummary"
|
||||
ref="AccountSummary"
|
||||
url="VnUsers/preview"
|
||||
:filter="filter"
|
||||
|
|
|
@ -14,7 +14,7 @@ const entityId = computed(() => $props.id || useRoute().params.id);
|
|||
|
||||
<template>
|
||||
<div class="q-pa-md">
|
||||
<CardSummary :url="`Agencies/${entityId}`">
|
||||
<CardSummary :url="`Agencies/${entityId}`" data-key="Agency">
|
||||
<template #header="{ entity: agency }">{{ agency.name }}</template>
|
||||
<template #body="{ entity: agency }">
|
||||
<QCard class="vn-one">
|
||||
|
|
|
@ -10,12 +10,13 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
// import { useSession } from 'src/composables/useSession';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const token = getTokenMultimedia();
|
||||
// const { getTokenMultimedia } = useSession();
|
||||
// const token = getTokenMultimedia();
|
||||
|
||||
const claimStates = ref([]);
|
||||
const claimStatesCopy = ref([]);
|
||||
|
@ -97,9 +98,11 @@ const statesFilter = {
|
|||
>
|
||||
<template #before>
|
||||
<QAvatar color="orange">
|
||||
<QImg
|
||||
<VnImg
|
||||
v-if="data.workerFk"
|
||||
:src="`/api/Images/user/160x160/${data.workerFk}/download?access_token=${token}`"
|
||||
:size="'160x160'"
|
||||
:id="data.workerFk"
|
||||
collection="user"
|
||||
spinner-color="white"
|
||||
/>
|
||||
</QAvatar>
|
||||
|
|
|
@ -185,6 +185,7 @@ async function changeState(value) {
|
|||
:url="`Claims/${entityId}/getSummary`"
|
||||
:entity-id="entityId"
|
||||
@on-fetch="getClaimDms"
|
||||
data-key="claimSummary"
|
||||
>
|
||||
<template #header="{ entity: { claim } }">
|
||||
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
|
||||
|
|
|
@ -3,16 +3,14 @@ import { ref } from 'vue';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const token = getTokenMultimedia();
|
||||
|
||||
const workers = ref([]);
|
||||
const workersCopy = ref([]);
|
||||
|
@ -143,10 +141,11 @@ const filterOptions = {
|
|||
>
|
||||
<template #prepend>
|
||||
<QAvatar color="orange">
|
||||
<QImg
|
||||
:src="`/api/Images/user/160x160/${data.salesPersonFk}/download?access_token=${token}`"
|
||||
spinner-color="white"
|
||||
<VnImg
|
||||
v-if="data.salesPersonFk"
|
||||
:id="user.id"
|
||||
collection="user"
|
||||
spinner-color="white"
|
||||
/>
|
||||
</QAvatar>
|
||||
</template>
|
||||
|
|
|
@ -61,7 +61,11 @@ const creditWarning = computed(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary ref="summary" :url="`Clients/${entityId}/summary`">
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`Clients/${entityId}/summary`"
|
||||
data-key="CustomerSummary"
|
||||
>
|
||||
<template #body="{ entity }">
|
||||
<QCard class="vn-one">
|
||||
<VnTitle
|
||||
|
|
|
@ -91,7 +91,6 @@ const tableColumnComponents = {
|
|||
props: (prop) => ({
|
||||
disable: true,
|
||||
'model-value': prop.value,
|
||||
class: 'disabled-checkbox',
|
||||
}),
|
||||
event: () => {},
|
||||
},
|
||||
|
|
|
@ -119,7 +119,7 @@ const departments = ref();
|
|||
emit-value
|
||||
hide-selected
|
||||
map-options
|
||||
option-label="country"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
outlined
|
||||
rounded
|
||||
|
|
|
@ -161,6 +161,7 @@ const fetchEntryBuys = async () => {
|
|||
ref="summaryRef"
|
||||
:url="`Entries/${entityId}/getEntry`"
|
||||
@on-fetch="(data) => setEntryData(data)"
|
||||
data-key="EntrySummary"
|
||||
>
|
||||
<template #header-left>
|
||||
<router-link
|
||||
|
|
|
@ -16,14 +16,15 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
|||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toDate, toCurrency } from 'src/filters';
|
||||
import { useSession } from 'composables/useSession';
|
||||
// import { useSession } from 'composables/useSession';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
const router = useRouter();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const token = getTokenMultimedia();
|
||||
// const { getTokenMultimedia } = useSession();
|
||||
// const token = getTokenMultimedia();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -695,14 +696,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</template>
|
||||
<template #body-cell-picture="{ row }">
|
||||
<QTd>
|
||||
<QImg
|
||||
:src="`/api/Images/catalog/50x50/${row.itemFk}/download?access_token=${token}`"
|
||||
spinner-color="primary"
|
||||
:ratio="1"
|
||||
height="50px"
|
||||
width="50px"
|
||||
class="image"
|
||||
/>
|
||||
<VnImg :id="row.itemFk" size="50x50" class="image" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-itemFk="{ row }">
|
||||
|
|
|
@ -106,6 +106,7 @@ const ticketsColumns = ref([
|
|||
ref="summary"
|
||||
:url="`InvoiceOuts/${entityId}/summary`"
|
||||
:entity-id="entityId"
|
||||
data-key="InvoiceOutSummary"
|
||||
>
|
||||
<template #header="{ entity: { invoiceOut } }">
|
||||
<div>{{ invoiceOut.ref }} - {{ invoiceOut.client?.socialName }}</div>
|
||||
|
|
|
@ -150,21 +150,19 @@ const downloadCSV = async () => {
|
|||
>
|
||||
<template #body-cell-clientId="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat dense color="blue"> {{ row.clientId }}</QBtn>
|
||||
<QBtn flat dense class="link"> {{ row.clientId }}</QBtn>
|
||||
<CustomerDescriptorProxy :id="row.clientId" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-ticketId="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat dense color="blue"> {{ row.ticketFk }}</QBtn>
|
||||
<QBtn flat dense class="link"> {{ row.ticketFk }}</QBtn>
|
||||
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-worker="{ row }">
|
||||
<QTd>
|
||||
<QBtn class="no-uppercase" flat dense color="blue">{{
|
||||
row.workerName
|
||||
}}</QBtn>
|
||||
<QBtn class="no-uppercase link" flat dense>{{ row.workerName }}</QBtn>
|
||||
<WorkerDescriptorProxy :id="row.comercialId" />
|
||||
</QTd>
|
||||
</template>
|
||||
|
|
|
@ -20,6 +20,7 @@ const props = defineProps({
|
|||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
:unremovable-params="['from', 'to']"
|
||||
:hidden-tags="['from', 'to']"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
|
|
|
@ -13,7 +13,6 @@ import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
|||
|
||||
import { useState } from 'src/composables/useState';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import axios from 'axios';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
|
@ -42,14 +41,12 @@ const quasar = useQuasar();
|
|||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
const image = ref(null);
|
||||
const regularizeStockFormDialog = ref(null);
|
||||
const item = ref(null);
|
||||
const available = ref(null);
|
||||
|
@ -67,17 +64,10 @@ const warehouseFk = computed({
|
|||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await getItemAvatar();
|
||||
warehouseFk.value = user.value.warehouseFk;
|
||||
salixUrl.value = await getUrl('');
|
||||
});
|
||||
|
||||
const getItemAvatar = async () => {
|
||||
const token = getTokenMultimedia();
|
||||
const timeStamp = `timestamp=${Date.now()}`;
|
||||
image.value = `/api/Images/catalog/200x200/${entityId.value}/download?access_token=${token}&${timeStamp}`;
|
||||
};
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => {
|
||||
if (!entity) return;
|
||||
|
|
|
@ -33,7 +33,6 @@ const user = state.getUser();
|
|||
const fixedPrices = ref([]);
|
||||
const fixedPricesOriginalData = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
const itemsWithNameOptions = ref([]);
|
||||
const rowsSelected = ref([]);
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
|
@ -371,12 +370,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
auto-load
|
||||
@on-fetch="(data) => onWarehousesFetched(data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Items/withName"
|
||||
:filter="{ fields: ['id', 'name'], order: 'id DESC' }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (itemsWithNameOptions = data)"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<ItemFixedPriceFilter
|
||||
|
@ -419,7 +412,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<template #body-cell-itemId="props">
|
||||
<QTd>
|
||||
<VnSelect
|
||||
:options="itemsWithNameOptions"
|
||||
url="Items/withName"
|
||||
hide-selected
|
||||
option-label="id"
|
||||
option-value="id"
|
||||
|
@ -562,7 +555,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
<QPageSticky v-if="rowsSelected.length > 0" :offset="[20, 20]">
|
||||
<QPageSticky v-if="rowsSelected.length" :offset="[20, 20]">
|
||||
<QBtn @click="openEditTableCellDialog()" color="primary" fab icon="edit" />
|
||||
<QTooltip>
|
||||
{{ t('Edit fixed price(s)') }}
|
||||
|
|
|
@ -16,17 +16,15 @@ import ItemListFilter from './ItemListFilter.vue';
|
|||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import { useSession } from 'composables/useSession';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import axios from 'axios';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
const router = useRouter();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const token = getTokenMultimedia();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
|
@ -491,10 +489,9 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</template>
|
||||
<template #body-cell-picture="{ row }">
|
||||
<QTd>
|
||||
<QImg
|
||||
:src="`/api/Images/catalog/50x50/${row.id}/download?access_token=${token}`"
|
||||
spinner-color="primary"
|
||||
:ratio="1"
|
||||
<VnImg
|
||||
size="50x50"
|
||||
:id="row.id"
|
||||
height="50px"
|
||||
width="50px"
|
||||
class="image"
|
||||
|
|
|
@ -219,6 +219,7 @@ const useLang = (values) => {
|
|||
:expr-builder="exprBuilder"
|
||||
:custom-tags="['tagGroups']"
|
||||
@remove="clearFilter"
|
||||
:redirect="false"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<strong v-if="tag.label === 'categoryFk'">
|
||||
|
|
|
@ -51,7 +51,11 @@ const detailsColumns = ref([
|
|||
|
||||
<template>
|
||||
<div class="q-pa-md">
|
||||
<CardSummary ref="summary" :url="`Orders/${entityId}/summary`">
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`Orders/${entityId}/summary`"
|
||||
data-key="OrderSummary"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
{{ t('order.summary.basket') }} #{{ entity?.id }} -
|
||||
{{ entity?.client?.name }} ({{ entity?.clientFk }})
|
||||
|
|
|
@ -30,6 +30,7 @@ const filter = {
|
|||
:url="`Parkings/${entityId}`"
|
||||
:filter="filter"
|
||||
@on-fetch="(data) => (parking = data)"
|
||||
data-key="Parking"
|
||||
>
|
||||
<template #header>{{ parking.code }}</template>
|
||||
<template #body>
|
||||
|
|
|
@ -123,6 +123,7 @@ const ticketColumns = ref([
|
|||
ref="summary"
|
||||
:url="`Routes/${entityId}/summary`"
|
||||
:entity-id="entityId"
|
||||
data-key="RouteSummary"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
<span>{{ `${entity?.route.id} - ${entity?.route?.description}` }}</span>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { dashIfEmpty, toHour } from 'src/filters';
|
||||
|
|
|
@ -128,8 +128,8 @@ function confirmRemove() {
|
|||
.onOk(() => refreshKey.value++);
|
||||
}
|
||||
|
||||
function navigateToRoadmapSummary(event, row) {
|
||||
router.push({ name: 'RoadmapSummary', params: { id: 1 } });
|
||||
function navigateToRoadmapSummary(_, { id }) {
|
||||
router.push({ name: 'RoadmapSummary', params: { id } });
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -36,7 +36,12 @@ const filter = {
|
|||
|
||||
<template>
|
||||
<div class="q-pa-md">
|
||||
<CardSummary ref="summary" :url="`Shelvings/${entityId}`" :filter="filter">
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`Shelvings/${entityId}`"
|
||||
:filter="filter"
|
||||
data-key="ShelvingSummary"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
<div>{{ entity.code }}</div>
|
||||
</template>
|
||||
|
|
|
@ -104,10 +104,14 @@ const totalEntryPrice = (rows) => {
|
|||
for (const row of rows) {
|
||||
let total = 0;
|
||||
let quantity = 0;
|
||||
|
||||
if (row.buys) {
|
||||
for (const buy of row.buys) {
|
||||
total = total + buy.total;
|
||||
quantity = quantity + buy.quantity;
|
||||
}
|
||||
}
|
||||
|
||||
row.total = total;
|
||||
row.quantity = quantity;
|
||||
totalPrice = totalPrice + total;
|
||||
|
|
|
@ -50,7 +50,7 @@ const itemCategoriesOptions = ref([]);
|
|||
@on-fetch="(data) => (itemCategoriesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" :redirect="false">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -48,6 +48,7 @@ function getUrl(section) {
|
|||
ref="summaryRef"
|
||||
:url="`Suppliers/${entityId}/getSummary`"
|
||||
@on-fetch="(data) => setData(data)"
|
||||
data-key="SupplierSummary"
|
||||
>
|
||||
<template #header>
|
||||
<span>{{ supplier.name }} - {{ supplier.id }}</span>
|
||||
|
|
|
@ -0,0 +1,263 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
|
||||
const $props = defineProps({
|
||||
formData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
haveNegatives: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['updateForm', 'update:haveNegatives']);
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { hasAny } = useRole();
|
||||
|
||||
const _ticketData = ref($props.formData);
|
||||
const ticketUpdateActions = ref(null);
|
||||
const haveNegatives = computed({
|
||||
get: () => $props.haveNegatives,
|
||||
set: (val) => emit('update:haveNegatives', val),
|
||||
});
|
||||
const rows = computed(() => _ticketData.value?.sale?.items || []);
|
||||
|
||||
watch(
|
||||
() => _ticketData.value,
|
||||
(val) => emit('updateForm', val),
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
required: true,
|
||||
label: t('basicData.item'),
|
||||
name: 'item',
|
||||
align: 'left',
|
||||
format: (val) => val.name,
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
label: t('basicData.description'),
|
||||
name: 'description',
|
||||
align: 'left',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
label: t('basicData.movable'),
|
||||
name: 'movable',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
label: t('basicData.quantity'),
|
||||
name: 'quantity',
|
||||
field: 'quantity',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
label: t('basicData.pricePPU'),
|
||||
name: 'price',
|
||||
field: 'price',
|
||||
align: 'left',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
label: t('basicData.newPricePPU'),
|
||||
name: 'newPrice',
|
||||
field: (row) => row.component.newPrice,
|
||||
align: 'left',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
label: t('basicData.difference'),
|
||||
name: 'difference',
|
||||
field: (row) => row.component.difference,
|
||||
align: 'left',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
]);
|
||||
|
||||
const loadDefaultTicketAction = () => {
|
||||
const isSalesAssistant = hasAny(['salesAssistant']);
|
||||
_ticketData.value.option = isSalesAssistant ? 'mana' : 'renewPrices';
|
||||
};
|
||||
|
||||
const totalPrice = computed(() => {
|
||||
return rows.value.reduce((acc, item) => acc + item.price * item.quantity, 0);
|
||||
});
|
||||
|
||||
const totalNewPrice = computed(() => {
|
||||
return rows.value.reduce(
|
||||
(acc, item) => acc + item.component.newPrice * item.quantity,
|
||||
0
|
||||
);
|
||||
});
|
||||
|
||||
const totalDifference = computed(() => {
|
||||
return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0);
|
||||
});
|
||||
const showMovablecolumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : []));
|
||||
const haveDifferences = computed(() => _ticketData.value.sale?.haveDifferences);
|
||||
const ticketHaveNegatives = () => {
|
||||
let _haveNegatives = false;
|
||||
let haveNotNegatives = false;
|
||||
_ticketData.value.withoutNegatives = false;
|
||||
_ticketData.value?.sale?.items.forEach((item) => {
|
||||
if (item.quantity > item.movable) _haveNegatives = true;
|
||||
else haveNotNegatives = true;
|
||||
});
|
||||
|
||||
haveNegatives.value = _haveNegatives && haveNotNegatives && haveDifferences.value;
|
||||
if (haveNegatives.value) _ticketData.value.withoutNegatives = true;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
stateStore.rightDrawer = true;
|
||||
loadDefaultTicketAction();
|
||||
ticketHaveNegatives();
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="TicketUpdateActions"
|
||||
@on-fetch="(data) => (ticketUpdateActions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<QCard
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('basicData.total') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-center" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.price') }}:
|
||||
{{ toCurrency(totalPrice) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-center" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.newPrice') }}: {{ toCurrency(totalNewPrice) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-center" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.difference') }}: {{ toCurrency(totalDifference) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
v-if="totalDifference"
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('basicData.chargeDifference') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection
|
||||
v-for="(action, index) in ticketUpdateActions"
|
||||
:key="index"
|
||||
horizontal
|
||||
>
|
||||
<QRadio
|
||||
v-model="_ticketData.option"
|
||||
:val="action.code"
|
||||
:label="action.description"
|
||||
dense
|
||||
/>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
v-if="haveNegatives"
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal class="flex row items-center">
|
||||
<QCheckbox
|
||||
:label="t('basicData.withoutNegatives')"
|
||||
v-model="_ticketData.withoutNegatives"
|
||||
:toggle-indeterminate="false"
|
||||
/>
|
||||
<QIcon name="info" size="xs" class="q-ml-sm">
|
||||
<QTooltip max-width="350px">
|
||||
{{ t('basicData.withoutNegativesInfo') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QTable
|
||||
:visible-columns="showMovablecolumn"
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
flat
|
||||
>
|
||||
<template #body-cell-item="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
{{ row.itemFk }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-description="{ row }">
|
||||
<QTd>
|
||||
<div class="column">
|
||||
<span>{{ row.item.name }}</span>
|
||||
<span class="color-vn-label">{{ row.item.subName }}</span>
|
||||
<FetchedTags :item="row.item" :max-length="6" />
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-movable="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
v-if="_ticketData?.sale?.haveDifferences"
|
||||
:text-color="row.quantity > row.movable ? 'black' : 'white'"
|
||||
:color="row.quantity > row.movable ? 'negative' : 'transparent'"
|
||||
:label="row.movable"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
|
@ -0,0 +1,468 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { toTimeFormat } from 'filters/date.js';
|
||||
|
||||
const $props = defineProps({
|
||||
formData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['updateForm']);
|
||||
|
||||
const { notify } = useNotify();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const agencyFetchRef = ref(null);
|
||||
const zonesFetchRef = ref(null);
|
||||
|
||||
const clientsOptions = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
const agenciesOptions = ref([]);
|
||||
const zonesOptions = ref([]);
|
||||
const addresses = ref([]);
|
||||
const formData = ref($props.formData);
|
||||
|
||||
watch(
|
||||
() => formData.value,
|
||||
(val) => emit('updateForm', val),
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const agencyByWarehouseFilter = computed(() => ({
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
where: {
|
||||
warehouseFk: warehouseId.value,
|
||||
},
|
||||
}));
|
||||
|
||||
const zonesFilter = computed(() => ({
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
where: formData.value?.agencyModeFk
|
||||
? {
|
||||
shipped: formData.value?.shipped,
|
||||
addressFk: formData.value?.addressFk,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
warehouseFk: formData.value?.warehouseFk,
|
||||
}
|
||||
: {},
|
||||
}));
|
||||
|
||||
const getLanded = async (params) => {
|
||||
try {
|
||||
const validParams =
|
||||
shipped.value && addressId.value && agencyModeId.value && warehouseId.value;
|
||||
if (!validParams) return;
|
||||
|
||||
formData.value.zoneFk = null;
|
||||
zonesOptions.value = [];
|
||||
const { data } = await axios.get(`Agencies/getLanded`, { params });
|
||||
if (data) {
|
||||
formData.value.zoneFk = data.zoneFk;
|
||||
formData.value.landed = data.landed;
|
||||
formData.value.shipped = params.shipped;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
}
|
||||
};
|
||||
|
||||
const getShipped = async (params) => {
|
||||
try {
|
||||
const validParams =
|
||||
landed.value && addressId.value && agencyModeId.value && warehouseId.value;
|
||||
if (!validParams) return;
|
||||
|
||||
formData.value.zoneFk = null;
|
||||
zonesOptions.value = [];
|
||||
const { data } = await axios.get(`Agencies/getShipped`, { params });
|
||||
if (data) {
|
||||
formData.value.zoneFk = data.zoneFk;
|
||||
formData.value.landed = params.landed;
|
||||
formData.value.shipped = data.shipped;
|
||||
} else {
|
||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
}
|
||||
};
|
||||
|
||||
const onChangeZone = async (zoneId) => {
|
||||
try {
|
||||
formData.value.agencyModeFk = null;
|
||||
const { data } = await axios.get(`Zones/${zoneId}`);
|
||||
formData.value.agencyModeFk = data.agencyModeFk;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const onChangeAddress = async (addressId) => {
|
||||
try {
|
||||
formData.value.nickname = null;
|
||||
const { data } = await axios.get(`Addresses/${addressId}`);
|
||||
formData.value.nickname = data.nickname;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const getClientDefaultAddress = async (clientId) => {
|
||||
try {
|
||||
const { data } = await axios.get(`Clients/${clientId}`);
|
||||
if (data) addressId.value = data.defaultAddressFk;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const clientAddressesList = async (value) => {
|
||||
let filter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'province',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'agencyMode',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
const params = { filter: JSON.stringify(filter) };
|
||||
const { data } = await axios.get(`Clients/${value}/addresses`, { params });
|
||||
if (data) addresses.value = data;
|
||||
};
|
||||
|
||||
const addressId = computed({
|
||||
get: () => formData.value?.addressFk,
|
||||
set: (val) => {
|
||||
if (val != formData.value?.addressFk) {
|
||||
formData.value.addressFk = val;
|
||||
onChangeAddress(val);
|
||||
getShipped({
|
||||
landed: formData.value?.landed,
|
||||
addressFk: val,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
warehouseFk: formData.value?.warehouseFk,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const clientId = computed({
|
||||
get: () => formData.value?.clientFk,
|
||||
set: (val) => {
|
||||
formData.value.clientFk = val;
|
||||
formData.value.addressFk = null;
|
||||
if (!val) return;
|
||||
getClientDefaultAddress(val);
|
||||
clientAddressesList(val);
|
||||
},
|
||||
});
|
||||
|
||||
const landed = computed({
|
||||
get: () => formData.value?.landed,
|
||||
set: (val) => {
|
||||
formData.value.landed = val;
|
||||
getShipped({
|
||||
landed: val,
|
||||
addressFk: formData.value?.addressFk,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
warehouseFk: formData.value?.warehouseFk,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const agencyModeId = computed({
|
||||
get: () => formData.value.agencyModeFk,
|
||||
set: (val) => {
|
||||
if (val != formData.value.agencyModeFk) {
|
||||
formData.value.agencyModeFk = val;
|
||||
if (!val) return;
|
||||
const agencyMode = agenciesOptions.value.find((a) => a.id == val);
|
||||
formData.value.warehouseFk = agencyMode.warehouseFk;
|
||||
|
||||
getLanded({
|
||||
shipped: formData.value?.shipped,
|
||||
addressFk: formData.value?.addressFk,
|
||||
agencyModeFk: val,
|
||||
warehouseFk: formData.value?.warehouseFk,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const zoneId = computed({
|
||||
get: () => formData.value?.zoneFk,
|
||||
set: (val) => {
|
||||
if (val != formData.value?.zoneFk) {
|
||||
formData.value.zoneFk = val;
|
||||
onChangeZone(val);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const warehouseId = computed({
|
||||
get: () => formData.value?.warehouseFk,
|
||||
set: (val) => {
|
||||
if (val != formData.value?.warehouseFk) {
|
||||
formData.value.warehouseFk = val;
|
||||
getShipped({
|
||||
landed: formData.value?.landed,
|
||||
addressFk: formData.value?.addressFk,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
warehouseFk: val,
|
||||
}).then(() => {
|
||||
if (zoneId.value == null) formData.value.agencyModeFk = null;
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const shipped = computed({
|
||||
get: () => formData.value?.shipped,
|
||||
set: (val) => {
|
||||
if (new Date(formData.value?.shipped).toDateString() != val.toDateString())
|
||||
val.setHours(0, 0, 0, 0);
|
||||
formData.value.shipped = val;
|
||||
getLanded({
|
||||
shipped: val,
|
||||
addressFk: formData.value?.addressFk,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
warehouseFk: formData.value?.warehouseFk,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const onFormModelInit = () => {
|
||||
if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk);
|
||||
};
|
||||
|
||||
const redirectToCustomerAddress = () => {
|
||||
router.push({
|
||||
name: 'CustomerAddressEditCard',
|
||||
params: { id: clientId.value, addressId: addressId.value },
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => onFormModelInit());
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="Clients"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'id',
|
||||
}"
|
||||
@on-fetch="(data) => (clientsOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Companies"
|
||||
:filter="{
|
||||
fields: ['id', 'code'],
|
||||
order: 'code ASC',
|
||||
}"
|
||||
@on-fetch="(data) => (companiesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
ref="agencyFetchRef"
|
||||
url="AgencyModes/byWarehouse"
|
||||
:filter="agencyByWarehouseFilter"
|
||||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
ref="zonesFetchRef"
|
||||
url="Zones/includingExpired"
|
||||
:filter="zonesFilter"
|
||||
@on-fetch="(data) => (zonesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QForm>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<VnSelect
|
||||
:label="t('basicData.client')"
|
||||
v-model="clientId"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:options="clientsOptions"
|
||||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel
|
||||
>#{{ scope.opt?.id }} {{ scope.opt?.name }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
:label="t('basicData.warehouse')"
|
||||
v-model="warehouseId"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:options="warehousesOptions"
|
||||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<VnSelect
|
||||
:label="t('basicData.address')"
|
||||
v-model="addressId"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
:options="addresses"
|
||||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel
|
||||
:class="{
|
||||
'color-vn-label': !scope.opt?.isActive,
|
||||
}"
|
||||
>
|
||||
{{
|
||||
`${
|
||||
!scope.opt?.isActive
|
||||
? t('basicData.inactive')
|
||||
: ''
|
||||
} `
|
||||
}}
|
||||
<span> {{ scope.opt?.nickname }}</span>
|
||||
<span
|
||||
v-if="
|
||||
scope.opt?.province ||
|
||||
scope.opt?.city ||
|
||||
scope.opt?.street
|
||||
"
|
||||
>, {{ scope.opt?.street }}, {{ scope.opt?.city }},
|
||||
{{ scope.opt?.province?.name }} -
|
||||
{{ scope.opt?.agencyMode?.name }}</span
|
||||
>
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
<template #append>
|
||||
<QIcon
|
||||
name="edit"
|
||||
color="primary"
|
||||
size="sm"
|
||||
class="fill-icon cursor-pointer"
|
||||
@click.stop="redirectToCustomerAddress()"
|
||||
>
|
||||
<QTooltip>{{ t('basicData.editAddress') }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnInput
|
||||
:label="t('basicData.alias')"
|
||||
v-model="formData.nickname"
|
||||
:required="true"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md no-wrap">
|
||||
<VnSelect
|
||||
:label="t('basicData.company')"
|
||||
v-model="formData.companyFk"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
:options="companiesOptions"
|
||||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('basicData.agency')"
|
||||
v-model="agencyModeId"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:options="agenciesOptions"
|
||||
hide-selected
|
||||
map-options
|
||||
@focus="agencyFetchRef.fetch()"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('basicData.zone')"
|
||||
v-model="zoneId"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:options="zonesOptions"
|
||||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
@focus="zonesFetchRef.fetch()"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel
|
||||
>{{ scope.opt?.name }} - Max.
|
||||
{{ toTimeFormat(scope.opt?.hour) }}
|
||||
h.</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<VnInputDate
|
||||
:label="t('basicData.shipped')"
|
||||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
/>
|
||||
<VnInputTime
|
||||
:label="t('basicData.shippedHour')"
|
||||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('basicData.landed')"
|
||||
v-model="formData.landed"
|
||||
:required="true"
|
||||
/>
|
||||
</VnRow>
|
||||
</QForm>
|
||||
</template>
|
|
@ -0,0 +1,195 @@
|
|||
<script setup>
|
||||
import { ref, onBeforeMount } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import BasicDataTable from './BasicDataTable.vue';
|
||||
import TicketBasicDataForm from './TicketBasicDataForm.vue';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
const { notify } = useNotify();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const stepperRef = ref(null);
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
|
||||
const step = ref(1);
|
||||
const formData = ref({});
|
||||
const initialDataLoaded = ref(false);
|
||||
const haveNegatives = ref(false);
|
||||
|
||||
const ticketFilter = {
|
||||
include: [
|
||||
{ relation: 'address' },
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: [
|
||||
'salesPersonFk',
|
||||
'name',
|
||||
'isActive',
|
||||
'isFreezed',
|
||||
'isTaxDataChecked',
|
||||
'credit',
|
||||
'email',
|
||||
'phone',
|
||||
'mobile',
|
||||
'hasElectronicInvoice',
|
||||
],
|
||||
include: {
|
||||
relation: 'salesPersonUser',
|
||||
scope: { fields: ['id', 'name'] },
|
||||
},
|
||||
},
|
||||
},
|
||||
{ relation: 'invoiceOut' },
|
||||
],
|
||||
};
|
||||
|
||||
const getTicketData = async () => {
|
||||
const params = { filter: JSON.stringify(ticketFilter) };
|
||||
const { data } = await axios.get(`tickets/${route.params.id}`, { params });
|
||||
formData.value = data;
|
||||
initialDataLoaded.value = true;
|
||||
};
|
||||
|
||||
const isFormInvalid = () => {
|
||||
return (
|
||||
!formData.value.clientFk ||
|
||||
!formData.value.addressFk ||
|
||||
!formData.value.agencyModeFk ||
|
||||
!formData.value.companyFk ||
|
||||
!formData.value.shipped ||
|
||||
!formData.value.landed ||
|
||||
!formData.value.zoneFk
|
||||
);
|
||||
};
|
||||
|
||||
const getPriceDifference = async () => {
|
||||
try {
|
||||
const params = {
|
||||
landed: formData.value.landed,
|
||||
addressId: formData.value.addressFk,
|
||||
agencyModeId: formData.value.agencyModeFk,
|
||||
zoneId: formData.value.zoneFk,
|
||||
warehouseId: formData.value.warehouseFk,
|
||||
shipped: formData.value.shipped,
|
||||
};
|
||||
const { data } = await axios.post(
|
||||
`tickets/${formData.value.id}/priceDifference`,
|
||||
params
|
||||
);
|
||||
formData.value.sale = data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const submit = async () => {
|
||||
try {
|
||||
if (!formData.value.option)
|
||||
return notify(t('basicData.chooseAnOption'), 'negative');
|
||||
|
||||
const params = {
|
||||
clientFk: formData.value.clientFk,
|
||||
nickname: formData.value.nickname,
|
||||
agencyModeFk: formData.value.agencyModeFk,
|
||||
addressFk: formData.value.addressFk,
|
||||
zoneFk: formData.value.zoneFk,
|
||||
warehouseFk: formData.value.warehouseFk,
|
||||
companyFk: formData.value.companyFk,
|
||||
shipped: formData.value.shipped,
|
||||
landed: formData.value.landed,
|
||||
isDeleted: formData.value.isDeleted,
|
||||
option: formData.value.option,
|
||||
isWithoutNegatives: formData.value.withoutNegatives,
|
||||
withWarningAccept: formData.value.withWarningAccept,
|
||||
keepPrice: false,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(
|
||||
`tickets/${formData.value.id}/componentUpdate`,
|
||||
params
|
||||
);
|
||||
|
||||
if (!data) return;
|
||||
|
||||
const ticketToMove = data.id;
|
||||
notify(t('basicData.unroutedTicket'), 'positive');
|
||||
router.push({ name: 'TicketSummary', params: { id: ticketToMove } });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const submitWithNegatives = async () => {
|
||||
formData.value.withWarningAccept = true;
|
||||
submit();
|
||||
};
|
||||
|
||||
const onNextStep = async () => {
|
||||
if (step.value === 1) {
|
||||
if (isFormInvalid())
|
||||
return notify(t('basicData.someFieldsAreInvalid'), 'negative');
|
||||
|
||||
await getPriceDifference();
|
||||
stepperRef.value.next();
|
||||
} else if (step.value === 2) {
|
||||
if (haveNegatives.value && !formData.value.withoutNegatives)
|
||||
openConfirmationModal(
|
||||
t('basicData.negativesConfirmTitle'),
|
||||
t('basicData.negativesConfirmMessage'),
|
||||
submitWithNegatives
|
||||
);
|
||||
else submit();
|
||||
}
|
||||
};
|
||||
|
||||
onBeforeMount(async () => await getTicketData());
|
||||
</script>
|
||||
<template>
|
||||
<QStepper
|
||||
v-model="step"
|
||||
ref="stepperRef"
|
||||
color="primary"
|
||||
animated
|
||||
keep-alive
|
||||
style="max-width: 800px; margin: auto"
|
||||
>
|
||||
<QStep :name="1" :title="t('globals.pageTitles.basicData')" :done="step > 1">
|
||||
<TicketBasicDataForm
|
||||
v-if="initialDataLoaded"
|
||||
@update-form="($event) => (formData = $event)"
|
||||
:form-data="formData"
|
||||
/>
|
||||
</QStep>
|
||||
<QStep :name="2" :title="t('basicData.priceDifference')">
|
||||
<BasicDataTable
|
||||
:form-data="formData"
|
||||
v-model:haveNegatives="haveNegatives"
|
||||
@update-form="($event) => (formData = $event)"
|
||||
/>
|
||||
</QStep>
|
||||
<template #navigation>
|
||||
<QStepperNavigation class="flex justify-between">
|
||||
<QBtn
|
||||
flat
|
||||
color="primary"
|
||||
@click="stepperRef.previous()"
|
||||
:label="t('basicData.back')"
|
||||
class="q-ml-sm"
|
||||
:class="{ invisible: step === 1 }"
|
||||
/>
|
||||
<QBtn
|
||||
@click="onNextStep()"
|
||||
color="primary"
|
||||
:label="step === 2 ? t('basicData.finalize') : t('basicData.next')"
|
||||
/>
|
||||
</QStepperNavigation>
|
||||
</template>
|
||||
</QStepper>
|
||||
</template>
|
|
@ -1,3 +0,0 @@
|
|||
<template>
|
||||
<QCard>Basic Data</QCard>
|
||||
</template>
|
|
@ -1,17 +1,30 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { computed } from 'vue';
|
||||
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import TicketDescriptor from './TicketDescriptor.vue';
|
||||
import TicketFilter from '../TicketFilter.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const routeName = computed(() => route.name);
|
||||
const searchBarDataKeys = {
|
||||
TicketSummary: 'TicketSummary',
|
||||
TicketSale: 'TicketSale',
|
||||
TicketPurchaseRequest: 'TicketPurchaseRequest',
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
data-key="Ticket"
|
||||
base-url="Tickets"
|
||||
:descriptor="TicketDescriptor"
|
||||
:filter-panel="TicketFilter"
|
||||
search-data-key="TicketList"
|
||||
search-url="Tickets/filter"
|
||||
searchbar-label="Search ticket"
|
||||
searchbar-info="You can search by ticket id or alias"
|
||||
:descriptor="TicketDescriptor"
|
||||
:search-data-key="searchBarDataKeys[routeName]"
|
||||
:search-custom-route-redirect="routeName"
|
||||
:searchbar-label="t('card.search')"
|
||||
:searchbar-info="t('card.searchInfo')"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
const emit = defineEmits(['onRequestCreated']);
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const attendersOptions = ref([]);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="TicketRequests/getItemTypeWorker"
|
||||
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC' }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (attendersOptions = data)"
|
||||
/>
|
||||
<FormModelPopup
|
||||
:title="t('Create request')"
|
||||
url-create="TicketRequests"
|
||||
model="CreateTicketRequest"
|
||||
:form-initial-data="{ ticketFk: route.params.id }"
|
||||
@on-data-saved="() => emit('onRequestCreated')"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<VnInput
|
||||
v-model="data.description"
|
||||
:label="t('purchaseRequest.description')"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('purchaseRequest.atender')"
|
||||
v-model="data.attenderFk"
|
||||
:options="attendersOptions"
|
||||
hide-selected
|
||||
option-label="nickname"
|
||||
option-value="id"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<VnInput
|
||||
v-model="data.quantity"
|
||||
:label="t('purchaseRequest.quantity')"
|
||||
type="number"
|
||||
min="1"
|
||||
/>
|
||||
<VnInput
|
||||
v-model="data.price"
|
||||
:label="t('purchaseRequest.price')"
|
||||
type="number"
|
||||
min="0"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Create request: Crear petición de compra
|
||||
</i18n>
|
|
@ -0,0 +1,96 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { toCurrency } from 'src/filters';
|
||||
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
newPrice: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['save', 'cancel']);
|
||||
|
||||
const { t } = useI18n();
|
||||
const QPopupProxyRef = ref(null);
|
||||
|
||||
const save = () => {
|
||||
emit('save');
|
||||
QPopupProxyRef.value.hide();
|
||||
};
|
||||
|
||||
const cancel = () => {
|
||||
emit('cancel');
|
||||
QPopupProxyRef.value.hide();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy ref="QPopupProxyRef">
|
||||
<div class="container">
|
||||
<QSpinner v-if="!mana" color="orange" size="md" />
|
||||
<div v-else>
|
||||
<div class="header">Mana: {{ toCurrency(mana) }}</div>
|
||||
<div class="q-pa-md">
|
||||
<slot />
|
||||
<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"
|
||||
class="no-border-radius"
|
||||
dense
|
||||
style="width: 50%"
|
||||
@click="cancel()"
|
||||
>
|
||||
{{ t('globals.cancel') }}
|
||||
</QBtn>
|
||||
<QBtn
|
||||
color="primary"
|
||||
class="no-border-radius"
|
||||
dense
|
||||
style="width: 50%"
|
||||
@click="save()"
|
||||
>
|
||||
{{ t('globals.save') }}
|
||||
</QBtn>
|
||||
</div>
|
||||
</div>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
background-color: $dark;
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
.header {
|
||||
height: 54px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: $primary;
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
min-width: 230px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
New price: Nuevo precio
|
||||
</i18n>
|
|
@ -1,7 +1,10 @@
|
|||
<script setup>
|
||||
import VnLog from 'src/components/common/VnLog.vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const route = useRoute();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnLog model="Ticket" url="/TicketLogs"></VnLog>
|
||||
<VnLog model="Ticket" url="/TicketLogs" :key="route.params.id"></VnLog>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,267 @@
|
|||
<script setup>
|
||||
import { ref, computed, watch, reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import TicketCreateRequest from './TicketCreateRequest.vue';
|
||||
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const createTicketRequestDialogRef = ref(null);
|
||||
const crudModelRef = ref(null);
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
async (val) => {
|
||||
crudModelFilter.where.ticketFk = val;
|
||||
crudModelRef.value.reload();
|
||||
}
|
||||
);
|
||||
|
||||
const crudModelFilter = reactive({
|
||||
include: [
|
||||
{
|
||||
relation: 'atender',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['nickname'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'requester',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['nickname'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'sale',
|
||||
},
|
||||
],
|
||||
fields: [
|
||||
'id',
|
||||
'description',
|
||||
'created',
|
||||
'requesterFk',
|
||||
'attenderFk',
|
||||
'quantity',
|
||||
'price',
|
||||
'saleFk',
|
||||
'isOk',
|
||||
],
|
||||
order: ['created ASC'],
|
||||
where: {
|
||||
ticketFk: route.params.id,
|
||||
},
|
||||
});
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: t('purchaseRequest.id'),
|
||||
name: 'id',
|
||||
field: 'id',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('purchaseRequest.description'),
|
||||
name: 'description',
|
||||
field: 'description',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('purchaseRequest.created'),
|
||||
name: 'created',
|
||||
field: 'created',
|
||||
align: 'left',
|
||||
format: (val) => toDateFormat(val),
|
||||
},
|
||||
{
|
||||
label: t('purchaseRequest.requester'),
|
||||
name: 'requester',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: t('purchaseRequest.atender'),
|
||||
name: 'atender',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('purchaseRequest.quantity'),
|
||||
name: 'quantity',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('purchaseRequest.price'),
|
||||
name: 'price',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('purchaseRequest.saleFk'),
|
||||
name: 'saleFk',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('purchaseRequest.state'),
|
||||
name: 'state',
|
||||
field: 'isOk',
|
||||
align: 'left',
|
||||
format: (val) => t(getRequestState(val)),
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
name: 'actions',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
},
|
||||
]);
|
||||
|
||||
const getRequestState = (state) => {
|
||||
switch (state) {
|
||||
case null:
|
||||
return 'New';
|
||||
case false:
|
||||
return 'Denied';
|
||||
case true:
|
||||
return 'Acepted';
|
||||
}
|
||||
};
|
||||
|
||||
const isEditable = (isOk) => isOk !== null;
|
||||
|
||||
const removeLine = async (row) => crudModelRef.value.remove([row]);
|
||||
|
||||
const openCreateModal = () => createTicketRequestDialogRef.value.show();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<CrudModel
|
||||
data-key="PurchaseRequests"
|
||||
url="TicketRequests"
|
||||
ref="crudModelRef"
|
||||
:filter="crudModelFilter"
|
||||
:order="['created ASC']"
|
||||
:default-remove="false"
|
||||
:default-save="false"
|
||||
:default-reset="false"
|
||||
:limit="0"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
@row-click="(_, row) => redirectToTicketSummary(row.ticketFk)"
|
||||
>
|
||||
<template #body-cell-description="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnInput
|
||||
v-model="row.description"
|
||||
@blur="crudModelRef.saveChanges()"
|
||||
:disable="isEditable(row.isOk)"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-requester="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary">
|
||||
{{ row.requester?.user?.nickname }}
|
||||
<WorkerDescriptorProxy :id="row.requesterFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-atender="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary">
|
||||
{{ row.atender?.user?.nickname }}
|
||||
<WorkerDescriptorProxy :id="row.attenderFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-quantity="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnInput
|
||||
v-model="row.quantity"
|
||||
@blur="crudModelRef.saveChanges()"
|
||||
:disable="isEditable(row.isOk)"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-price="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnInput
|
||||
v-model="row.price"
|
||||
@blur="crudModelRef.saveChanges()"
|
||||
:disable="isEditable(row.isOk)"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-saleFk="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn v-if="row.saleFk" flat color="primary">
|
||||
{{ row.sale.itemFk }}
|
||||
<ItemDescriptorProxy :id="row.sale.itemFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-actions="{ row }">
|
||||
<QTd>
|
||||
<QIcon
|
||||
@click.stop="removeLine(row)"
|
||||
class="q-ml-sm cursor-pointer"
|
||||
color="primary"
|
||||
name="delete"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('globals.delete') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</CrudModel>
|
||||
<QDialog
|
||||
ref="createTicketRequestDialogRef"
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<TicketCreateRequest @on-request-created="crudModelRef.reload()" />
|
||||
</QDialog>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn @click="openCreateModal()" color="primary" fab icon="add" />
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('purchaseRequest.newRequest') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
New: Nueva
|
||||
Denied: Denegada
|
||||
Accepted: Aceptada
|
||||
</i18n>
|
|
@ -1 +1,779 @@
|
|||
<template>Ticket sale</template>
|
||||
<script setup>
|
||||
import { onMounted, ref, computed, onUnmounted, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import TicketEditManaProxy from './TicketEditMana.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import TicketSaleMoreActions from './TicketSaleMoreActions.vue';
|
||||
import TicketTransfer from './TicketTransfer.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toCurrency, toPercentage, dashIfEmpty } from 'src/filters';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const editPriceProxyRef = ref(null);
|
||||
const stateBtnDropdownRef = ref(null);
|
||||
|
||||
const arrayData = useArrayData('ticketData');
|
||||
const { store } = arrayData;
|
||||
|
||||
const ticketConfig = ref(null);
|
||||
const isLocked = ref(false);
|
||||
const isTicketEditable = ref(false);
|
||||
const sales = ref([]);
|
||||
const itemsWithNameOptions = 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({
|
||||
lastActiveTickets: [],
|
||||
sales: [],
|
||||
});
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
async () => await getSales()
|
||||
);
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: '',
|
||||
name: 'statusIcons',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
name: 'picture',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.visible'),
|
||||
name: 'visible',
|
||||
field: 'visible',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.available'),
|
||||
name: 'available',
|
||||
field: 'available',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.id'),
|
||||
name: 'itemFk',
|
||||
field: 'itemFk',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.quantity'),
|
||||
name: 'quantity',
|
||||
field: 'quantity',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.item'),
|
||||
name: 'item',
|
||||
field: 'item',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.price'),
|
||||
name: 'price',
|
||||
field: 'price',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.discount'),
|
||||
name: 'discount',
|
||||
field: 'discount',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.amount'),
|
||||
name: 'amount',
|
||||
field: 'amount',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.packaging'),
|
||||
name: 'itemPackingTypeFk',
|
||||
field: 'item',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (val) => dashIfEmpty(val?.itemPackingTypeFk),
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
name: 'history',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
},
|
||||
]);
|
||||
|
||||
const getConfig = async () => {
|
||||
try {
|
||||
let filter = {
|
||||
fields: ['daysForWarningClaim'],
|
||||
};
|
||||
const { data } = await axios.get(`TicketConfigs`, { filter });
|
||||
ticketConfig.value = data;
|
||||
} catch (err) {
|
||||
console.error('Error getting ticket config', err);
|
||||
}
|
||||
};
|
||||
|
||||
const onSalesFetched = (salesData) => {
|
||||
sales.value = salesData;
|
||||
for (let sale of salesData) sale.amount = getSaleTotal(sale);
|
||||
};
|
||||
|
||||
const getSales = async () => {
|
||||
try {
|
||||
const { data } = await axios.get(`Tickets/${route.params.id}/getSales`);
|
||||
onSalesFetched(data);
|
||||
} catch (err) {
|
||||
console.error('Error fetching sales', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getSaleTotal = (sale) => {
|
||||
if (sale.quantity == null || sale.price == null) return null;
|
||||
|
||||
const price = sale.quantity * sale.price;
|
||||
const discount = (sale.discount * price) / 100;
|
||||
|
||||
return price - discount;
|
||||
};
|
||||
|
||||
const resetChanges = async () => {
|
||||
arrayData.fetch({ append: false });
|
||||
getSales();
|
||||
};
|
||||
|
||||
const updateQuantity = async (sale) => {
|
||||
try {
|
||||
const payload = { quantity: sale.quantity };
|
||||
await axios.post(`Sales/${sale.id}/updateQuantity`, payload);
|
||||
notify('globals.dataSaved', 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error updating quantity', err);
|
||||
}
|
||||
};
|
||||
|
||||
const addSale = async (sale) => {
|
||||
try {
|
||||
const payload = {
|
||||
barcode: sale.itemFk,
|
||||
quantity: sale.quantity,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(`tickets/${route.params.id}/addSale`, payload);
|
||||
|
||||
if (!data) return;
|
||||
|
||||
const newSale = data;
|
||||
sale.id = newSale.id;
|
||||
sale.image = newSale.item.image;
|
||||
sale.subName = newSale.item.subName;
|
||||
sale.concept = newSale.concept;
|
||||
sale.quantity = newSale.quantity;
|
||||
sale.discount = newSale.discount;
|
||||
sale.price = newSale.price;
|
||||
sale.item = newSale.item;
|
||||
|
||||
notify('globals.dataSaved', 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error adding sale', err);
|
||||
}
|
||||
};
|
||||
|
||||
const changeQuantity = (sale) => {
|
||||
if (
|
||||
!sale.itemFk ||
|
||||
sale.quantity == null ||
|
||||
edit.value?.oldQuantity === sale.quantity
|
||||
)
|
||||
return;
|
||||
if (!sale.id) return addSale(sale);
|
||||
updateQuantity(sale);
|
||||
};
|
||||
|
||||
const updateConcept = async (sale) => {
|
||||
try {
|
||||
const data = { newConcept: sale.concept };
|
||||
await axios.post(`Sales/${sale.id}/updateConcept`, data);
|
||||
notify('globals.dataSaved', 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error updating concept', err);
|
||||
}
|
||||
};
|
||||
|
||||
const DEFAULT_EDIT = {
|
||||
price: null,
|
||||
discount: null,
|
||||
sale: null,
|
||||
sales: null,
|
||||
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;
|
||||
return selectedSales.value.filter((sale) => sale.id != undefined);
|
||||
});
|
||||
|
||||
const onOpenEditPricePopover = async (sale) => {
|
||||
await getMana();
|
||||
edit.value = {
|
||||
sale: JSON.parse(JSON.stringify(sale)),
|
||||
price: sale.price,
|
||||
};
|
||||
};
|
||||
|
||||
const onOpenEditDiscountPopover = async (sale) => {
|
||||
await getMana();
|
||||
if (isLocked.value) return;
|
||||
if (sale) {
|
||||
edit.value = {
|
||||
sale: JSON.parse(JSON.stringify(sale)),
|
||||
discount: sale.discount,
|
||||
};
|
||||
} else {
|
||||
edit.value = {
|
||||
discount: null,
|
||||
sales: selectedValidSales.value,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const updatePrice = async (sale) => {
|
||||
try {
|
||||
const newPrice = edit.value.price;
|
||||
if (newPrice != null && newPrice != sale.price) {
|
||||
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
|
||||
sale.price = newPrice;
|
||||
edit.value = { ...DEFAULT_EDIT };
|
||||
notify('globals.dataSaved', 'positive');
|
||||
}
|
||||
await getMana();
|
||||
} catch (err) {
|
||||
console.error('Error updating price', err);
|
||||
}
|
||||
};
|
||||
|
||||
const changeDiscount = (sale) => {
|
||||
const newDiscount = edit.value.discount;
|
||||
if (newDiscount != null && newDiscount != sale.discount) updateDiscount([sale]);
|
||||
};
|
||||
|
||||
const updateDiscount = async (sales, newDiscount = null) => {
|
||||
const saleIds = sales.map((sale) => sale.id);
|
||||
const _newDiscount = newDiscount || edit.value.discount;
|
||||
const params = {
|
||||
salesIds: saleIds,
|
||||
newDiscount: _newDiscount,
|
||||
manaCode: manaCode.value,
|
||||
};
|
||||
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
|
||||
notify('globals.dataSaved', 'positive');
|
||||
for (let sale of sales) sale.discount = _newDiscount;
|
||||
edit.value = { ...DEFAULT_EDIT };
|
||||
};
|
||||
|
||||
const getNewPrice = computed(() => {
|
||||
if (edit.value?.sale) {
|
||||
const sale = edit.value.sale;
|
||||
let newDiscount = sale.discount;
|
||||
let newPrice = edit.value.price || sale.price;
|
||||
|
||||
if (edit.value.discount != null) newDiscount = edit.value.discount;
|
||||
|
||||
if (edit.value.price != null) newPrice = edit.value.price;
|
||||
|
||||
const price = sale.quantity * newPrice;
|
||||
const discount = (newDiscount * price) / 100;
|
||||
return price - discount;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
const newOrderFromTicket = async () => {
|
||||
try {
|
||||
const { data } = await axios.post(`Orders/newFromTicket`, {
|
||||
ticketFk: Number(route.params.id),
|
||||
});
|
||||
const routeData = router.resolve({ name: 'OrderCatalog', params: { id: data } });
|
||||
window.open(routeData.href, '_blank');
|
||||
} catch (err) {
|
||||
console.error('Error creating new order', err);
|
||||
}
|
||||
};
|
||||
|
||||
const goToLog = (saleId) => {
|
||||
router.push({
|
||||
name: 'TicketLog',
|
||||
params: {
|
||||
originId: route.params.id,
|
||||
changedModel: 'Sale',
|
||||
changedModelId: saleId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const changeTicketState = async (val) => {
|
||||
try {
|
||||
stateBtnDropdownRef.value.hide();
|
||||
const params = { ticketFk: route.params.id, code: val };
|
||||
await axios.post('Tickets/state', params);
|
||||
notify('globals.dataSaved', 'positive');
|
||||
await resetChanges();
|
||||
} catch (err) {
|
||||
console.error('Error changing ticket state', err);
|
||||
}
|
||||
};
|
||||
|
||||
const removeSelectedSales = () => {
|
||||
selectedSales.value.forEach((sale) => {
|
||||
const index = sales.value.indexOf(sale);
|
||||
sales.value.splice(index, 1);
|
||||
});
|
||||
};
|
||||
|
||||
const removeSales = async () => {
|
||||
try {
|
||||
const params = { sales: selectedValidSales.value, ticketId: store.data.id };
|
||||
await axios.post('Sales/deleteSales', params);
|
||||
removeSelectedSales();
|
||||
notify('globals.dataSaved', 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error deleting sales', err);
|
||||
}
|
||||
};
|
||||
|
||||
const insertRow = () => sales.value.push({ ...DEFAULT_EDIT });
|
||||
|
||||
const setTransferParams = async () => {
|
||||
try {
|
||||
const checkedSales = JSON.parse(JSON.stringify(selectedSales.value));
|
||||
transfer.value = {
|
||||
lastActiveTickets: [],
|
||||
sales: checkedSales,
|
||||
};
|
||||
|
||||
const params = { ticketId: store.data.id };
|
||||
const { data } = await axios.get(
|
||||
`clients/${store.data.clientFk}/lastActiveTickets`,
|
||||
{
|
||||
params,
|
||||
}
|
||||
);
|
||||
transfer.value.lastActiveTickets = data;
|
||||
} catch (err) {
|
||||
console.error('Error setting transfer params', err);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
getConfig();
|
||||
getSales();
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
:url="`Tickets/${route.params.id}/isEditable`"
|
||||
auto-load
|
||||
@on-fetch="(data) => (isTicketEditable = data)"
|
||||
/>
|
||||
<FetchData
|
||||
:url="`Tickets/${route.params.id}/isLocked`"
|
||||
auto-load
|
||||
@on-fetch="(data) => (isLocked = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Items/withName"
|
||||
:filter="{ fields: ['id', 'name'], order: 'id DESC' }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (itemsWithNameOptions = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="States/editableStates"
|
||||
:filter="{ fields: ['code', 'name', 'id', 'alertLevel'], order: 'name ASC' }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (editableStatesOptions = data)"
|
||||
/>
|
||||
<VnSubToolbar>
|
||||
<template #st-actions>
|
||||
<QBtnGroup push class="q-gutter-x-sm" flat>
|
||||
<QBtn
|
||||
:label="t('ticketSale.ok')"
|
||||
color="primary"
|
||||
:disable="!isTicketEditable || ticketState === 'OK'"
|
||||
@click="changeTicketState('OK')"
|
||||
>
|
||||
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtnDropdown
|
||||
ref="stateBtnDropdownRef"
|
||||
color="primary"
|
||||
:label="t('ticketSale.state')"
|
||||
:disable="!isTicketEditable"
|
||||
>
|
||||
<VnSelect
|
||||
:options="editableStatesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
hide-dropdown-icon
|
||||
focus-on-mount
|
||||
@update:model-value="changeTicketState"
|
||||
/>
|
||||
</QBtnDropdown>
|
||||
<TicketSaleMoreActions
|
||||
:ticket="store.data"
|
||||
:is-ticket-editable="isTicketEditable"
|
||||
:sales="selectedValidSales"
|
||||
:disable="!selectedSales.length"
|
||||
:mana="mana"
|
||||
:ticket-config="ticketConfig"
|
||||
@get-mana="getMana()"
|
||||
@update-discounts="updateDiscount"
|
||||
/>
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon="delete"
|
||||
:disable="!isTicketEditable || !selectedSales.length"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('Continue anyway?'),
|
||||
t('You are going to delete lines of the ticket'),
|
||||
removeSales
|
||||
)
|
||||
"
|
||||
>
|
||||
<QTooltip>{{ t('Remove lines') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon="vn:splitline"
|
||||
:disable="!isTicketEditable || !selectedSales.length"
|
||||
@click="setTransferParams()"
|
||||
>
|
||||
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
||||
<TicketTransfer
|
||||
:transfer="transfer"
|
||||
:ticket="store.data"
|
||||
@refresh-data="resetChanges()"
|
||||
/>
|
||||
</QBtn>
|
||||
</QBtnGroup>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<div
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
style="border: 2px solid black"
|
||||
>
|
||||
<QCardSection class="justify-center text-subtitle1" horizontal>
|
||||
<span class="q-mr-xs color-vn-label"
|
||||
>{{ t('ticketSale.subtotal') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(store.data?.totalWithoutVat) }}</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="justify-center text-subtitle1" horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketSale.tax') }}:
|
||||
</span>
|
||||
<span>{{
|
||||
toCurrency(store.data?.totalWithVat - store.data?.totalWithoutVat)
|
||||
}}</span>
|
||||
</QCardSection>
|
||||
<QCardSection
|
||||
class="justify-center text-weight-bold text-subtitle1"
|
||||
horizontal
|
||||
>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketSale.total') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(store.data?.totalWithVat) }}</span>
|
||||
</QCardSection>
|
||||
</div>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QTable
|
||||
:rows="sales"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedSales"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #body-cell-statusIcons="{ row }">
|
||||
<QTd class="q-gutter-x-xs">
|
||||
<router-link
|
||||
v-if="row.claim?.claimFk"
|
||||
:to="{ name: 'ClaimBasicData', params: { id: row.claim?.claimFk } }"
|
||||
>
|
||||
<QIcon color="primary" name="vn:claims" size="xs">
|
||||
<QTooltip>
|
||||
{{ t('ticketSale.claim') }}:
|
||||
{{ row.claim?.claimFk }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</router-link>
|
||||
<QIcon v-if="row.visible < 0" color="primary" name="warning" size="xs">
|
||||
<QTooltip>
|
||||
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row.reserved" color="primary" name="vn:reserva" size="xs">
|
||||
<QTooltip>
|
||||
{{ t('ticketSale.reserved') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.itemShortage"
|
||||
color="primary"
|
||||
name="vn:unavailable"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticketSale.noVisible') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasComponentLack"
|
||||
color="primary"
|
||||
name="vn:components"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticketSale.hasComponentLack') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-picture="{ row }">
|
||||
<QTd>
|
||||
<div class="image-wrapper">
|
||||
<VnImg :id="row.itemFk" class="rounded" />
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-visible="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBadge :color="row.visible < 0 ? 'alert' : 'transparent'" dense>
|
||||
{{ row.visible }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-available="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBadge :color="row.available < 0 ? 'alert' : 'transparent'" dense>
|
||||
{{ row.available }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-itemFk="{ row }">
|
||||
<QTd @click.stop>
|
||||
<div v-if="row.id">
|
||||
<QBtn flat color="primary" dense>
|
||||
{{ row.itemFk }}
|
||||
</QBtn>
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</div>
|
||||
<VnSelect
|
||||
v-else
|
||||
:options="itemsWithNameOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
@update:model-value="changeQuantity(row)"
|
||||
v-model="row.itemFk"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
||||
<QItemLabel caption>{{ scope.opt?.name }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-quantity="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnInput
|
||||
v-if="isTicketEditable"
|
||||
v-model.number="row.quantity"
|
||||
@keyup.enter="changeQuantity(row)"
|
||||
@blur="changeQuantity(row)"
|
||||
@focus="edit.oldQuantity = row.quantity"
|
||||
/>
|
||||
<span v-else>{{ row.quantity }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-item="{ row }">
|
||||
<QTd class="col">
|
||||
<div class="column">
|
||||
<span>{{ row.concept }}</span>
|
||||
<span class="color-vn-label">{{ row.item?.subName }}</span>
|
||||
<FetchedTags v-if="row.item" :item="row.item" :max-length="6" />
|
||||
<QPopupProxy v-if="row.id && isTicketEditable">
|
||||
<VnInput v-model="row.concept" @change="updateConcept(row)" />
|
||||
</QPopupProxy>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-price="{ row }">
|
||||
<QTd>
|
||||
<template v-if="isTicketEditable && row.id">
|
||||
<QBtn flat color="primary" dense @click="onOpenEditPricePopover(row)">
|
||||
{{ toCurrency(row.price) }}
|
||||
</QBtn>
|
||||
<TicketEditManaProxy
|
||||
ref="editPriceProxyRef"
|
||||
:mana="mana"
|
||||
:new-price="getNewPrice"
|
||||
@save="updatePrice(row)"
|
||||
>
|
||||
<VnInput
|
||||
v-model.number="edit.price"
|
||||
:label="t('ticketSale.price')"
|
||||
type="number"
|
||||
/>
|
||||
</TicketEditManaProxy>
|
||||
</template>
|
||||
<span v-else>{{ toCurrency(row.price) }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-discount="{ row }">
|
||||
<QTd>
|
||||
<template v-if="!isLocked && row.id">
|
||||
<QBtn
|
||||
flat
|
||||
color="primary"
|
||||
dense
|
||||
@click="onOpenEditDiscountPopover(row)"
|
||||
>
|
||||
{{ toPercentage(row.discount / 100) }}
|
||||
</QBtn>
|
||||
<TicketEditManaProxy
|
||||
:mana="mana"
|
||||
:new-price="getNewPrice"
|
||||
@save="changeDiscount(row)"
|
||||
>
|
||||
<VnInput
|
||||
v-model.number="edit.discount"
|
||||
:label="t('ticketSale.discount')"
|
||||
type="number"
|
||||
/>
|
||||
</TicketEditManaProxy>
|
||||
</template>
|
||||
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-history="{ row }">
|
||||
<QTd>
|
||||
<QBtn
|
||||
v-if="row.$hasLogs"
|
||||
@click.stop="goToLog(row.id)"
|
||||
color="primary"
|
||||
icon="history"
|
||||
size="md"
|
||||
flat
|
||||
>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('ticketSale.history') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #bottom-row>
|
||||
<QBtn
|
||||
class="cursor-pointer fill-icon q-ml-md q-my-lg"
|
||||
color="primary"
|
||||
icon="add_circle"
|
||||
size="md"
|
||||
round
|
||||
flat
|
||||
:disable="!isTicketEditable"
|
||||
@click="insertRow()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Add item') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</QTable>
|
||||
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn @click="newOrderFromTicket()" color="primary" fab icon="add" />
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('Add item to basket') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
New item: Nuevo artículo
|
||||
Add item to basket: Añadir artículo a la cesta
|
||||
Change ticket state to 'Ok': Cambiar estado del ticket a 'Ok'
|
||||
Remove lines: Eliminar líneas
|
||||
Continue anyway?: ¿Continuar de todas formas?
|
||||
You are going to delete lines of the ticket: Vas a eliminar lineas del ticket
|
||||
Add item: Añadir artículo
|
||||
Select lines to see the options: Selecciona líneas para ver las opciones
|
||||
Transfer lines: Transferir líneas
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1,289 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import VnSmsDialog from 'components/common/VnSmsDialog.vue';
|
||||
import TicketEditManaProxy from './TicketEditMana.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
import { toDateFormat } from 'src/filters/date';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
|
||||
const emit = defineEmits(['updateDiscounts', 'getMana']);
|
||||
|
||||
const props = defineProps({
|
||||
disable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isTicketEditable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
ticket: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => {},
|
||||
},
|
||||
sales: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
mana: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
ticketConfig: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const { dialog } = useQuasar();
|
||||
const { notify } = useNotify();
|
||||
const role = useRole();
|
||||
const btnDropdownRef = ref(null);
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
|
||||
const newDiscount = ref(null);
|
||||
const ticket = computed(() => props.ticket);
|
||||
const isClaimable = computed(() => {
|
||||
if (ticket.value) {
|
||||
const landedPlusWeek = new Date(ticket.value.landed);
|
||||
landedPlusWeek.setDate(landedPlusWeek.getDate() + 7);
|
||||
const hasClaimManagerRole = role.hasAny('claimManager');
|
||||
return landedPlusWeek >= Date.vnNew() || hasClaimManagerRole;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
const hasReserves = computed(() => props.sales.some((sale) => sale.reserved == true));
|
||||
|
||||
const sendSms = async (params) => {
|
||||
await axios.post(`Tickets/${ticket.value.id}/sendSms`, params);
|
||||
notify(t('SMS sent'), 'positive');
|
||||
};
|
||||
|
||||
const showSmsDialog = (template) => {
|
||||
const address = ticket.value.address;
|
||||
const client = ticket.value.client;
|
||||
const phone = address.mobile || address.phone || client.mobile || client.phone;
|
||||
const items = props.sales.map((sale) => {
|
||||
return `${sale.quantity} ${sale.concept}`;
|
||||
});
|
||||
|
||||
const notAvailables = items.join(', ');
|
||||
|
||||
const data = {
|
||||
ticketId: ticket.value.id,
|
||||
destinationFk: ticket.value.clientFk,
|
||||
destination: phone,
|
||||
ticketFk: ticket.value.id,
|
||||
created: ticket.value.updated,
|
||||
landed: toDateFormat(ticket.value.landed),
|
||||
notAvailables,
|
||||
};
|
||||
|
||||
dialog({
|
||||
component: VnSmsDialog,
|
||||
componentProps: {
|
||||
phone: phone,
|
||||
template: template,
|
||||
locale: client?.user?.lang ?? 'default_locale',
|
||||
data: data,
|
||||
promise: sendSms,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const calculateSalePrice = async () => {
|
||||
if (!props.sales) return;
|
||||
|
||||
await axios.post(`Sales/recalculatePrice`, props.sales);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
};
|
||||
|
||||
const changeMultipleDiscount = () => {
|
||||
const hasChanges = props.sales.some((sale) => {
|
||||
return sale.discount != newDiscount.value;
|
||||
});
|
||||
|
||||
if (newDiscount.value != null && hasChanges)
|
||||
emit('updateDiscounts', props.sales, newDiscount.value);
|
||||
btnDropdownRef.value.hide();
|
||||
};
|
||||
|
||||
const createClaim = () => {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const timeDifference = today.getTime() - new Date(ticket.value.landed).getTime();
|
||||
const pastDays = Math.floor(timeDifference / 86400000);
|
||||
if (pastDays >= props.ticketConfig[0].daysForWarningClaim)
|
||||
openConfirmationModal(
|
||||
t('Claim out of time'),
|
||||
t('Do you want to continue?'),
|
||||
onCreateClaimAccepted
|
||||
);
|
||||
else
|
||||
openConfirmationModal(t('Do you want to create a claim?'), onCreateClaimAccepted);
|
||||
};
|
||||
|
||||
const onCreateClaimAccepted = async () => {
|
||||
try {
|
||||
const params = { ticketId: ticket.value.id, sales: props.sales };
|
||||
const { data } = await axios.post(`Claims/createFromSales`, params);
|
||||
router.push({ name: 'ClaimBasicData', params: { id: data.id } });
|
||||
} catch (error) {
|
||||
console.error('Error creating claim: ', error);
|
||||
}
|
||||
};
|
||||
|
||||
const setReserved = async (reserved) => {
|
||||
const params = { ticketId: ticket.value.id, sales: props.sales, reserved: reserved };
|
||||
await axios.post(`Sales/reserve`, params);
|
||||
props.sales.forEach((sale) => {
|
||||
sale.reserved = reserved;
|
||||
});
|
||||
};
|
||||
|
||||
const createRefund = async (withWarehouse) => {
|
||||
if (!props.sales) return;
|
||||
|
||||
const salesIds = props.sales.map((sale) => sale.id);
|
||||
const params = { salesIds: salesIds, withWarehouse: withWarehouse, negative: true };
|
||||
const { data } = await axios.post('Sales/clone', params);
|
||||
const [refundTicket] = data;
|
||||
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
|
||||
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QBtnDropdown
|
||||
ref="btnDropdownRef"
|
||||
color="primary"
|
||||
:label="t('ticketSale.more')"
|
||||
:disable="disable"
|
||||
>
|
||||
<template #label>
|
||||
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
||||
</template>
|
||||
<QList>
|
||||
<QItem
|
||||
v-if="ticket"
|
||||
clickable
|
||||
v-close-popup
|
||||
v-ripple
|
||||
@click="showSmsDialog('productNotAvailable')"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isTicketEditable"
|
||||
clickable
|
||||
v-close-popup
|
||||
v-ripple
|
||||
@click="calculateSalePrice()"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem clickable v-ripple @click="emit('getMana')">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
<TicketEditManaProxy :mana="props.mana" @save="changeMultipleDiscount()">
|
||||
<VnInput
|
||||
v-model.number="newDiscount"
|
||||
:label="t('ticketSale.discount')"
|
||||
type="number"
|
||||
/>
|
||||
</TicketEditManaProxy>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isClaimable"
|
||||
clickable
|
||||
v-close-popup
|
||||
v-ripple
|
||||
@click="createClaim()"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isTicketEditable"
|
||||
clickable
|
||||
v-close-popup
|
||||
v-ripple
|
||||
@click="setReserved(true)"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isTicketEditable && hasReserves"
|
||||
clickable
|
||||
v-close-popup
|
||||
v-ripple
|
||||
@click="setReserved(false)"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem clickable v-ripple>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Refund...') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
<QItemSection side>
|
||||
<QIcon name="keyboard_arrow_right" />
|
||||
</QItemSection>
|
||||
<QMenu anchor="top end" self="top start" auto-close bordered>
|
||||
<QList>
|
||||
<QItem v-ripple clickable @click="createRefund(true)">
|
||||
<QItemSection>
|
||||
{{ t('with warehouse') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable @click="createRefund(false)">
|
||||
<QItemSection>
|
||||
{{ t('without warehouse') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QMenu>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QBtnDropdown>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
refundTicketCreated: 'The following refund ticket have been created {ticketId}'
|
||||
es:
|
||||
SMS sent: SMS enviado
|
||||
Send shortage SMS: Enviar SMS faltas
|
||||
Recalculate price: Recalcular precio
|
||||
Update discount: Actualizar descuento
|
||||
Add claim: Crear reclamación
|
||||
Mark as reserved: Marcar como reservado
|
||||
Unmark as reserved: Desmarcar como reservado
|
||||
Refund...: Abono...
|
||||
with warehouse: con almacén
|
||||
without warehouse: sin almacén
|
||||
Claim out of time: Reclamación fuera de plazo
|
||||
Do you want to continue?: ¿Desea continuar?
|
||||
Do you want to create a claim?: ¿Quieres crear una reclamación?
|
||||
refundTicketCreated: 'The following refund ticket have been created: {ticketId}'
|
||||
</i18n>
|
|
@ -90,6 +90,7 @@ async function changeState(value) {
|
|||
ref="summaryRef"
|
||||
:url="`Tickets/${entityId}/summary`"
|
||||
@on-fetch="(data) => setData(data)"
|
||||
data-key="TicketSummary"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
<div>
|
||||
|
|
|
@ -0,0 +1,196 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
newPrice: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
transfer: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
ticket: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['refreshData']);
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const QPopupProxyRef = ref(null);
|
||||
|
||||
const _transfer = ref(null);
|
||||
|
||||
const transferLinesColumns = computed(() => [
|
||||
{
|
||||
label: t('ticketSale.id'),
|
||||
name: 'itemFk',
|
||||
field: 'itemFk',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.item'),
|
||||
name: 'item',
|
||||
field: 'concept',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.quantity'),
|
||||
name: 'quantity',
|
||||
field: 'quantity',
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
||||
const destinationTicketColumns = computed(() => [
|
||||
{
|
||||
label: t('ticketSale.id'),
|
||||
name: 'id',
|
||||
field: 'id',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.shipped'),
|
||||
name: 'item',
|
||||
field: 'shipped',
|
||||
align: 'left',
|
||||
format: (val) => toDateFormat(val),
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.agency'),
|
||||
name: 'agency',
|
||||
field: 'agencyName',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('ticketSale.address'),
|
||||
name: 'address',
|
||||
field: 'address',
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
||||
const transferSales = async (ticketId) => {
|
||||
const params = {
|
||||
ticketId: ticketId,
|
||||
sales: $props.transfer.sales,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(
|
||||
`tickets/${$props.ticket.id}/transferSales`,
|
||||
params
|
||||
);
|
||||
|
||||
if (data && data.id === $props.ticket.id) emit('refreshData');
|
||||
else router.push({ name: 'TicketSale', params: { id: data.id } });
|
||||
};
|
||||
|
||||
onMounted(() => (_transfer.value = $props.transfer));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy ref="QPopupProxyRef">
|
||||
<QCard class="q-px-md" style="display: flex">
|
||||
<QTable
|
||||
v-if="transfer.sales"
|
||||
:rows="transfer.sales"
|
||||
:columns="transferLinesColumns"
|
||||
:title="t('Sales to transfer')"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #body-cell-quantity="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnInput
|
||||
v-model.number="row.quantity"
|
||||
:clearable="false"
|
||||
@keyup.enter="changeQuantity(row)"
|
||||
@blur="changeQuantity(row)"
|
||||
@focus="edit.oldQuantity = row.quantity"
|
||||
style="max-width: 60px"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
<QSeparator vertical spaced />
|
||||
<QTable
|
||||
v-if="transfer.lastActiveTickets"
|
||||
:rows="transfer.lastActiveTickets"
|
||||
:columns="destinationTicketColumns"
|
||||
:title="t('Destination ticket')"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #body-cell-address="{ row }">
|
||||
<QTd @click.stop>
|
||||
<span>
|
||||
{{ row.nickname }}
|
||||
{{ row.name }}
|
||||
{{ row.street }}
|
||||
{{ row.postalCode }}
|
||||
{{ row.city }}
|
||||
</span>
|
||||
<QTooltip>
|
||||
{{ row.nickname }}
|
||||
{{ row.name }}
|
||||
{{ row.street }}
|
||||
{{ row.postalCode }}
|
||||
{{ row.city }}
|
||||
</QTooltip>
|
||||
</QTd>
|
||||
</template>
|
||||
|
||||
<template #bottom>
|
||||
<QForm class="q-mt-lg full-width">
|
||||
<VnInput
|
||||
v-model.number="_transfer.ticketId"
|
||||
:label="t('Transfer to ticket')"
|
||||
:clearable="false"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="keyboard_arrow_right"
|
||||
color="primary"
|
||||
@click="transferSales(_transfer.ticketId)"
|
||||
style="width: 30px"
|
||||
/>
|
||||
</template>
|
||||
</VnInput>
|
||||
<QBtn
|
||||
:label="t('New ticket')"
|
||||
color="primary"
|
||||
class="full-width q-my-lg"
|
||||
@click="transferSales()"
|
||||
/>
|
||||
</QForm>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Sales to transfer: Líneas a transferir
|
||||
Destination ticket: Ticket destinatario
|
||||
Transfer to ticket: Transferir a ticket
|
||||
New ticket: Nuevo ticket
|
||||
</i18n>
|
|
@ -0,0 +1,710 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnProgress from 'src/components/common/VnProgressModal.vue';
|
||||
|
||||
import { dashIfEmpty, toCurrency } from 'src/filters';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const state = useState();
|
||||
const { t } = useI18n();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const { notify } = useNotify();
|
||||
const user = state.getUser();
|
||||
|
||||
const itemPackingTypesOptions = ref([]);
|
||||
const zonesOptions = ref([]);
|
||||
const selectedTickets = ref([]);
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'id':
|
||||
case 'futureId':
|
||||
case 'liters':
|
||||
case 'futureLiters':
|
||||
case 'lines':
|
||||
case 'futureLines':
|
||||
case 'totalWithVat':
|
||||
case 'futureTotalWithVat':
|
||||
case 'futureZone':
|
||||
case 'notMovableLines':
|
||||
case 'futureZoneFk':
|
||||
return { [param]: value };
|
||||
case 'ipt':
|
||||
return { ipt: { like: `%${value}%` } };
|
||||
case 'futureIpt':
|
||||
return { futureIpt: { like: `%${value}%` } };
|
||||
}
|
||||
};
|
||||
|
||||
const userParams = reactive({});
|
||||
|
||||
const arrayData = useArrayData('AdvanceTickets', {
|
||||
url: 'Tickets/getTicketsAdvance',
|
||||
userParams: userParams,
|
||||
exprBuilder: exprBuilder,
|
||||
});
|
||||
const { store } = arrayData;
|
||||
const tickets = computed(() =>
|
||||
(store.data || []).map((ticket, index) => ({ ...ticket, index: index }))
|
||||
);
|
||||
|
||||
const applyColumnFilter = async (col) => {
|
||||
try {
|
||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||
userParams[paramKey] = col.columnFilter.filterValue;
|
||||
await arrayData.addFilter({ params: userParams });
|
||||
} catch (err) {
|
||||
console.error('Error applying column filter', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getInputEvents = (col) => {
|
||||
return col.columnFilter.type === 'select'
|
||||
? { 'update:modelValue': () => applyColumnFilter(col) }
|
||||
: {
|
||||
'keyup.enter': () => applyColumnFilter(col),
|
||||
};
|
||||
};
|
||||
|
||||
const ticketColumns = computed(() => [
|
||||
{
|
||||
label: '',
|
||||
name: 'icons',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.ticketId'),
|
||||
name: 'ticketId',
|
||||
align: 'center',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
filterParamKey: 'id',
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.ipt'),
|
||||
name: 'ipt',
|
||||
field: 'ipt',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'ipt',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
options: itemPackingTypesOptions.value,
|
||||
'option-value': 'code',
|
||||
'option-label': 'description',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.state'),
|
||||
name: 'state',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.liters'),
|
||||
name: 'liters',
|
||||
field: 'liters',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.lines'),
|
||||
name: 'lines',
|
||||
field: 'lines',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.import'),
|
||||
field: 'import',
|
||||
name: 'import',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.futureId'),
|
||||
name: 'futureId',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
filterParamKey: 'futureId',
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.futureIpt'),
|
||||
name: 'futureIpt',
|
||||
field: 'futureIpt',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'futureIpt',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
options: itemPackingTypesOptions.value,
|
||||
'option-value': 'code',
|
||||
'option-label': 'description',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.futureState'),
|
||||
name: 'futureState',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.futureLiters'),
|
||||
name: 'futureLiters',
|
||||
field: 'futureLiters',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.futureZone'),
|
||||
name: 'futureZoneName',
|
||||
field: 'futureZoneName',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
filterParamKey: 'futureZoneFk',
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
options: zonesOptions.value,
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.notMovableLines'),
|
||||
name: 'notMovableLines',
|
||||
field: 'notMovableLines',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.futureLines'),
|
||||
name: 'futureLines',
|
||||
field: 'futureLines',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.futureImport'),
|
||||
name: 'futureImport',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
]);
|
||||
|
||||
const isLessThan50 = (totalWithVat) =>
|
||||
parseInt(totalWithVat) > 0 && parseInt(totalWithVat) < 50;
|
||||
|
||||
const totalPriceColor = (totalWithVat) =>
|
||||
isLessThan50(totalWithVat) ? 'warning' : 'transparent';
|
||||
|
||||
const getLanded = async (params) => {
|
||||
try {
|
||||
const query = `Agencies/getLanded`;
|
||||
const { data } = await axios.get(query, { params });
|
||||
if (!data) return;
|
||||
return data;
|
||||
} catch (error) {
|
||||
notify(t('advanceTickets.noDeliveryZone'), 'negative');
|
||||
console.error('Error getting landed', error);
|
||||
}
|
||||
};
|
||||
|
||||
const requestComponentUpdate = async (ticket, isWithoutNegatives) => {
|
||||
const query = `tickets/${ticket.futureId}/componentUpdate`;
|
||||
if (!ticket.landed) {
|
||||
const newLanded = await getLanded({
|
||||
shipped: userParams.dateToAdvance,
|
||||
addressFk: ticket.futureAddressFk,
|
||||
agencyModeFk: ticket.agencyModeFk ?? ticket.futureAgencyModeFk,
|
||||
warehouseFk: ticket.futureWarehouseFk,
|
||||
});
|
||||
|
||||
if (!newLanded) {
|
||||
notify(t('advanceTickets.noDeliveryZone'), 'negative');
|
||||
return;
|
||||
}
|
||||
|
||||
ticket.landed = newLanded.landed;
|
||||
ticket.zoneFk = newLanded.zoneFk;
|
||||
}
|
||||
|
||||
const params = {
|
||||
clientFk: ticket.futureClientFk,
|
||||
nickname: ticket.nickname,
|
||||
agencyModeFk: ticket.agencyModeFk ?? ticket.futureAgencyModeFk,
|
||||
addressFk: ticket.futureAddressFk,
|
||||
zoneFk: ticket.zoneFk ?? ticket.futureZoneFk,
|
||||
warehouseFk: ticket.futureWarehouseFk,
|
||||
companyFk: ticket.futureCompanyFk,
|
||||
shipped: userParams.dateToAdvance,
|
||||
landed: ticket.landed,
|
||||
isDeleted: false,
|
||||
isWithoutNegatives,
|
||||
newTicket: ticket.id ?? undefined,
|
||||
keepPrice: true,
|
||||
};
|
||||
|
||||
return { query, params };
|
||||
};
|
||||
|
||||
const moveTicketsAdvance = async () => {
|
||||
try {
|
||||
let ticketsToMove = [];
|
||||
for (const ticket of selectedTickets.value) {
|
||||
if (!ticket.id) {
|
||||
try {
|
||||
const { query, params } = await requestComponentUpdate(ticket, false);
|
||||
axios.post(query, params);
|
||||
} catch (e) {
|
||||
console.error('Error moving ticket', e);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
ticketsToMove.push({
|
||||
originId: ticket.futureId,
|
||||
destinationId: ticket.id,
|
||||
originShipped: ticket.futureShipped,
|
||||
destinationShipped: ticket.shipped,
|
||||
workerFk: ticket.workerFk,
|
||||
});
|
||||
}
|
||||
|
||||
const params = { tickets: ticketsToMove };
|
||||
await axios.post('Tickets/merge', params);
|
||||
arrayData.fetch({ append: false });
|
||||
selectedTickets.value = [];
|
||||
if (ticketsToMove.length)
|
||||
notify(t('advanceTickets.moveTicketSuccess'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error moving tickets', error);
|
||||
}
|
||||
};
|
||||
|
||||
const progressLength = ref(0);
|
||||
const progressPercentage = computed(() => {
|
||||
if (progressLength.value === 0 || selectedTickets.value.length === 0) return 0;
|
||||
return progressLength.value / selectedTickets.value.length;
|
||||
});
|
||||
const splitErrors = ref([]);
|
||||
const showProgressDialog = ref(false);
|
||||
const cancelProgress = ref(false);
|
||||
|
||||
const progressAdd = () => {
|
||||
progressLength.value++;
|
||||
if (progressLength.value === selectedTickets.value.length) {
|
||||
notify(
|
||||
t('advanceTickets.moveTicketSuccess', {
|
||||
ticketsNumber: progressLength.value - splitErrors.value.length,
|
||||
}),
|
||||
'positive'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const splitTickets = async () => {
|
||||
try {
|
||||
showProgressDialog.value = true;
|
||||
for (const ticket of selectedTickets.value) {
|
||||
if (cancelProgress.value) break;
|
||||
try {
|
||||
const { query, params } = await requestComponentUpdate(ticket, true);
|
||||
await axios.post(query, params);
|
||||
progressAdd(ticket.futureId);
|
||||
} catch (error) {
|
||||
splitErrors.value.push({
|
||||
id: ticket.futureId,
|
||||
reason: error.response?.data?.error?.message,
|
||||
});
|
||||
progressAdd(ticket.futureId);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error splitting tickets', error);
|
||||
} finally {
|
||||
arrayData.fetch({ append: false });
|
||||
}
|
||||
};
|
||||
|
||||
const resetProgressData = () => {
|
||||
if (cancelProgress.value) cancelProgress.value = false;
|
||||
progressLength.value = 0;
|
||||
splitErrors.value = [];
|
||||
selectedTickets.value = [];
|
||||
};
|
||||
|
||||
const handleCloseProgressDialog = () => {
|
||||
showProgressDialog.value = false;
|
||||
resetProgressData();
|
||||
};
|
||||
|
||||
const handleCancelProgress = () => (cancelProgress.value = true);
|
||||
|
||||
onMounted(async () => {
|
||||
let today = Date.vnNew();
|
||||
const tomorrow = new Date(today);
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
userParams.dateFuture = tomorrow;
|
||||
userParams.dateToAdvance = today;
|
||||
userParams.warehouseFk = user.value.warehouseFk;
|
||||
await arrayData.addFilter({ userParams });
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="itemPackingTypes"
|
||||
:filter="{
|
||||
fields: ['code', 'description'],
|
||||
order: 'description ASC',
|
||||
where: { isActive: true },
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (itemPackingTypesOptions = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Zones"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (zonesOptions = data)"
|
||||
/>
|
||||
<VnSearchbar
|
||||
data-key="WeeklyTickets"
|
||||
:label="t('weeklyTickets.search')"
|
||||
:info="t('weeklyTickets.searchInfo')"
|
||||
/>
|
||||
<VnSubToolbar>
|
||||
<template #st-data>
|
||||
<QBtn
|
||||
icon="keyboard_double_arrow_left"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedTickets.length"
|
||||
@click.stop="
|
||||
openConfirmationModal(
|
||||
t('advanceTickets.advanceTicketTitle'),
|
||||
t(`advanceTickets.advanceTitleSubtitle`, {
|
||||
selectedTickets: selectedTickets.length,
|
||||
}),
|
||||
moveTicketsAdvance
|
||||
)
|
||||
"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('advanceTickets.advanceTickets') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="alt_route"
|
||||
color="primary"
|
||||
:disable="!selectedTickets.length"
|
||||
@click.stop="
|
||||
openConfirmationModal(
|
||||
t('advanceTickets.advanceWithoutNegativeTitle'),
|
||||
t(`advanceTickets.advanceWithoutNegativeSubtitle`, {
|
||||
selectedTickets: selectedTickets.length,
|
||||
}),
|
||||
splitTickets
|
||||
)
|
||||
"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('advanceTickets.advanceTicketsWithoutNegatives') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
:rows="tickets"
|
||||
:columns="ticketColumns"
|
||||
row-key="index"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedTickets"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
style="max-width: 99%"
|
||||
>
|
||||
<template #header="props">
|
||||
<QTr :props="props">
|
||||
<QTh
|
||||
class="horizontal-separator text-uppercase color-vn-label"
|
||||
colspan="7"
|
||||
translate
|
||||
>
|
||||
{{ t('advanceTickets.destination') }}
|
||||
{{ toDateFormat(userParams.dateToAdvance) }}
|
||||
</QTh>
|
||||
<QTh
|
||||
class="horizontal-separator text-uppercase color-vn-label"
|
||||
colspan="9"
|
||||
translate
|
||||
>
|
||||
{{ t('advanceTickets.origin') }}
|
||||
{{ toDateFormat(userParams.dateFuture) }}
|
||||
</QTh>
|
||||
</QTr>
|
||||
<QTr>
|
||||
<QTh>
|
||||
<QCheckbox v-model="props.selected" />
|
||||
</QTh>
|
||||
<QTh
|
||||
v-for="(col, index) in ticketColumns"
|
||||
:key="index"
|
||||
:class="{ 'vertical-separator': col.name === 'futureId' }"
|
||||
>
|
||||
{{ col.label }}
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #top-row="{ cols }">
|
||||
<QTr>
|
||||
<QTd />
|
||||
<QTd
|
||||
v-for="(col, index) in cols"
|
||||
:key="index"
|
||||
style="max-width: 100px"
|
||||
>
|
||||
<component
|
||||
:is="col.columnFilter.component"
|
||||
v-if="col.columnFilter"
|
||||
v-model="col.columnFilter.filterValue"
|
||||
v-bind="col.columnFilter.attrs"
|
||||
v-on="col.columnFilter.event(col)"
|
||||
dense
|
||||
/>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #header-cell-availableLines="{ col }">
|
||||
<QTh class="vertical-separator">
|
||||
{{ col.label }}
|
||||
</QTh>
|
||||
</template>
|
||||
<template #body-cell-icons="{ row }">
|
||||
<QTd class="q-gutter-x-xs">
|
||||
<QIcon
|
||||
v-if="row.futureAgency !== row.agency && row.agency"
|
||||
color="primary"
|
||||
name="vn:agency-term"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip class="column">
|
||||
<span>
|
||||
{{
|
||||
t('advanceTickets.originAgency', {
|
||||
agency: row.futureAgency,
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
<span>
|
||||
{{
|
||||
t('advanceTickets.destinationAgency', {
|
||||
agency: row.agency,
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-ticketId="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
{{ row.id }}
|
||||
<TicketDescriptorProxy :id="row.id" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-state="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
text-color="black"
|
||||
:color="row.classColor"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
>
|
||||
{{ row.state }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-import="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
:text-color="isLessThan50(row.totalWithVat) ? 'black' : 'white'"
|
||||
:color="totalPriceColor(row.totalWithVat)"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
>
|
||||
{{ toCurrency(row.totalWithVat || 0) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-futureId="{ row }">
|
||||
<QTd class="vertical-separator">
|
||||
<QBtn flat color="primary" dense>
|
||||
{{ row.futureId }}
|
||||
<TicketDescriptorProxy :id="row.futureId" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-futureState="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
text-color="black"
|
||||
:color="row.futureClassColor"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
>
|
||||
{{ row.futureState }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-futureImport="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
:text-color="
|
||||
isLessThan50(row.futureTotalWithVat) ? 'black' : 'white'
|
||||
"
|
||||
:color="totalPriceColor(row.futureTotalWithVat)"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
>
|
||||
{{ toCurrency(row.futureTotalWithVat || 0) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
<VnProgress
|
||||
:progress="progressPercentage"
|
||||
:cancelled="cancelProgress"
|
||||
v-model:show-dialog="showProgressDialog"
|
||||
@cancel="handleCancelProgress()"
|
||||
@close="handleCloseProgressDialog()"
|
||||
>
|
||||
<div v-if="splitErrors.length" class="column">
|
||||
<span>{{ t('advanceTickets.errorsList') }}:</span>
|
||||
<span v-for="(error, index) in splitErrors" :key="index">
|
||||
{{ error.id }}: {{ error.reason }}
|
||||
</span>
|
||||
</div>
|
||||
</VnProgress>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.vertical-separator {
|
||||
border-left: 4px solid white !important;
|
||||
}
|
||||
|
||||
.horizontal-separator {
|
||||
border-bottom: 4px solid white !important;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,533 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
import { dashIfEmpty, toCurrency } from 'src/filters';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { toDateTimeFormat } from 'src/filters/date.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const state = useState();
|
||||
const { t } = useI18n();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const { notify } = useNotify();
|
||||
const user = state.getUser();
|
||||
|
||||
const itemPackingTypesOptions = ref([]);
|
||||
const selectedTickets = ref([]);
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'id':
|
||||
return { id: value };
|
||||
case 'futureId':
|
||||
return { futureId: value };
|
||||
case 'liters':
|
||||
return { liters: value };
|
||||
case 'lines':
|
||||
return { lines: value };
|
||||
case 'ipt':
|
||||
return { ipt: { like: `%${value}%` } };
|
||||
case 'futureIpt':
|
||||
return { futureIpt: { like: `%${value}%` } };
|
||||
case 'totalWithVat':
|
||||
return { totalWithVat: value };
|
||||
}
|
||||
};
|
||||
|
||||
const userParams = reactive({
|
||||
futureDated: Date.vnNew(),
|
||||
originDated: Date.vnNew(),
|
||||
warehouseFk: user.value.warehouseFk,
|
||||
});
|
||||
|
||||
const arrayData = useArrayData('FutureTickets', {
|
||||
url: 'Tickets/getTicketsFuture',
|
||||
userParams: userParams,
|
||||
exprBuilder: exprBuilder,
|
||||
});
|
||||
const { store } = arrayData;
|
||||
|
||||
const params = reactive({
|
||||
futureDated: Date.vnNew(),
|
||||
originDated: Date.vnNew(),
|
||||
warehouseFk: user.value.warehouseFk,
|
||||
});
|
||||
|
||||
const applyColumnFilter = async (col) => {
|
||||
try {
|
||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||
params[paramKey] = col.columnFilter.filterValue;
|
||||
await arrayData.addFilter({ params });
|
||||
} catch (err) {
|
||||
console.error('Error applying column filter', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getInputEvents = (col) => {
|
||||
return col.columnFilter.type === 'select'
|
||||
? { 'update:modelValue': () => applyColumnFilter(col) }
|
||||
: {
|
||||
'keyup.enter': () => applyColumnFilter(col),
|
||||
};
|
||||
};
|
||||
|
||||
const ticketColumns = computed(() => [
|
||||
{
|
||||
label: t('futureTickets.problems'),
|
||||
name: 'problems',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('futureTickets.ticketId'),
|
||||
name: 'ticketId',
|
||||
align: 'center',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
filterParamKey: 'id',
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('futureTickets.shipped'),
|
||||
name: 'shipped',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('futureTickets.ipt'),
|
||||
name: 'ipt',
|
||||
field: 'ipt',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'ipt',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
options: itemPackingTypesOptions.value,
|
||||
'option-value': 'code',
|
||||
'option-label': 'description',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('futureTickets.state'),
|
||||
name: 'state',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('futureTickets.liters'),
|
||||
name: 'liters',
|
||||
field: 'liters',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('futureTickets.import'),
|
||||
field: 'import',
|
||||
name: 'import',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: t('futureTickets.availableLines'),
|
||||
name: 'lines',
|
||||
field: 'lines',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('futureTickets.futureId'),
|
||||
name: 'futureId',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
filterParamKey: 'futureId',
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('futureTickets.futureShipped'),
|
||||
name: 'futureShipped',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
|
||||
{
|
||||
label: t('futureTickets.futureIpt'),
|
||||
name: 'futureIpt',
|
||||
field: 'futureIpt',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'futureIpt',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
options: itemPackingTypesOptions.value,
|
||||
'option-value': 'code',
|
||||
'option-label': 'description',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('futureTickets.futureState'),
|
||||
name: 'futureState',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
]);
|
||||
|
||||
const isLessThan50 = (totalWithVat) =>
|
||||
parseInt(totalWithVat) > 0 && parseInt(totalWithVat) < 50;
|
||||
|
||||
const totalPriceColor = (totalWithVat) =>
|
||||
isLessThan50(totalWithVat) ? 'warning' : 'transparent';
|
||||
|
||||
const moveTicketsFuture = async () => {
|
||||
try {
|
||||
const ticketsToMove = selectedTickets.value.map((ticket) => ({
|
||||
originId: ticket.id,
|
||||
destinationId: ticket.futureId,
|
||||
originShipped: ticket.shipped,
|
||||
destinationShipped: ticket.futureShipped,
|
||||
workerFk: ticket.workerFk,
|
||||
}));
|
||||
|
||||
let params = { tickets: ticketsToMove };
|
||||
await axios.post('Tickets/merge', params);
|
||||
notify(t('futureTickets.moveTicketSuccess'), 'positive');
|
||||
selectedTickets.value = [];
|
||||
arrayData.fetch({ append: false });
|
||||
} catch (error) {
|
||||
console.error('Error moving tickets to future', error);
|
||||
}
|
||||
};
|
||||
onMounted(async () => {
|
||||
await arrayData.fetch({ append: false });
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="itemPackingTypes"
|
||||
:filter="{
|
||||
fields: ['code', 'description'],
|
||||
order: 'description ASC',
|
||||
where: { isActive: true },
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (itemPackingTypesOptions = data)"
|
||||
/>
|
||||
<VnSearchbar
|
||||
data-key="FutureTickets"
|
||||
:label="t('Search ticket')"
|
||||
:info="t('futureTickets.searchInfo')"
|
||||
/>
|
||||
<VnSubToolbar>
|
||||
<template #st-data>
|
||||
<QBtn
|
||||
icon="keyboard_double_arrow_right"
|
||||
color="primary"
|
||||
:disable="!selectedTickets.length"
|
||||
@click.stop="
|
||||
openConfirmationModal(
|
||||
t('futureTickets.moveTicketTitle'),
|
||||
t(`futureTickets.moveTicketDialogSubtitle`, {
|
||||
selectedTickets: selectedTickets.length,
|
||||
}),
|
||||
moveTicketsFuture
|
||||
)
|
||||
"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('futureTickets.futureTicket') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
:rows="store.data"
|
||||
:columns="ticketColumns"
|
||||
row-key="id"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedTickets"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
style="max-width: 99%"
|
||||
>
|
||||
<template #header="props">
|
||||
<QTr>
|
||||
<QTh class="horizontal-separator" />
|
||||
<QTh
|
||||
class="horizontal-separator text-uppercase color-vn-label"
|
||||
colspan="8"
|
||||
translate
|
||||
>
|
||||
{{ t('futureTickets.origin') }}
|
||||
</QTh>
|
||||
<QTh
|
||||
class="horizontal-separator text-uppercase color-vn-label"
|
||||
colspan="4"
|
||||
translate
|
||||
>
|
||||
{{ t('futureTickets.destination') }}
|
||||
</QTh>
|
||||
</QTr>
|
||||
<QTr>
|
||||
<QTh>
|
||||
<QCheckbox v-model="props.selected" />
|
||||
</QTh>
|
||||
<QTh
|
||||
v-for="(col, index) in ticketColumns"
|
||||
:key="index"
|
||||
:class="{ 'vertical-separator': col.name === 'futureId' }"
|
||||
>
|
||||
{{ col.label }}
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #top-row="{ cols }">
|
||||
<QTr>
|
||||
<QTd />
|
||||
<QTd
|
||||
v-for="(col, index) in cols"
|
||||
:key="index"
|
||||
style="max-width: 100px"
|
||||
>
|
||||
<component
|
||||
:is="col.columnFilter.component"
|
||||
v-if="col.columnFilter"
|
||||
v-model="col.columnFilter.filterValue"
|
||||
v-bind="col.columnFilter.attrs"
|
||||
v-on="col.columnFilter.event(col)"
|
||||
dense
|
||||
/>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #header-cell-availableLines="{ col }">
|
||||
<QTh class="vertical-separator">
|
||||
{{ col.label }}
|
||||
</QTh>
|
||||
</template>
|
||||
<template #body-cell-problems="{ row }">
|
||||
<QTd class="q-gutter-x-xs">
|
||||
<QIcon
|
||||
v-if="row.isTaxDataChecked === 0"
|
||||
color="primary"
|
||||
name="vn:no036"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('futureTickets.noVerified') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasTicketRequest"
|
||||
color="primary"
|
||||
name="vn:buyrequest"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('futureTickets.purchaseRequest') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.itemShortage"
|
||||
color="primary"
|
||||
name="vn:unavailable"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('futureTickets.noVisible') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.isFreezed"
|
||||
color="primary"
|
||||
name="vn:frozen"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('futureTickets.clientFrozen') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row.risk" color="primary" name="vn:risk" size="xs">
|
||||
<QTooltip>
|
||||
{{ t('futureTickets.risk') }}: {{ row.risk }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasComponentLack"
|
||||
color="primary"
|
||||
name="vn:components"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('futureTickets.componentLack') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasRounding"
|
||||
color="primary"
|
||||
name="sync_problem"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('futureTickets.rounding') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-ticketId="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
{{ row.id }}
|
||||
<TicketDescriptorProxy :id="row.id" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-shipped="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
text-color="black"
|
||||
:color="getDateQBadgeColor(row.shipped)"
|
||||
class="q-ma-none"
|
||||
>
|
||||
{{ toDateTimeFormat(row.shipped) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-state="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
text-color="black"
|
||||
:color="row.classColor"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
>
|
||||
{{ row.state }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-import="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
:text-color="
|
||||
totalPriceColor(row.totalWithVat) === 'warning'
|
||||
? 'black'
|
||||
: 'white'
|
||||
"
|
||||
:color="totalPriceColor(row.totalWithVat)"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
>
|
||||
{{ toCurrency(row.totalWithVat || 0) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-futureId="{ row }">
|
||||
<QTd class="vertical-separator">
|
||||
<QBtn flat color="primary" dense>
|
||||
{{ row.futureId }}
|
||||
<TicketDescriptorProxy :id="row.futureId" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-futureShipped="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
text-color="black"
|
||||
:color="getDateQBadgeColor(row.futureShipped)"
|
||||
class="q-ma-none"
|
||||
>
|
||||
{{ toDateTimeFormat(row.futureShipped) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-futureState="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
text-color="black"
|
||||
:color="row.futureClassColor"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
>
|
||||
{{ row.futureState }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.vertical-separator {
|
||||
border-left: 4px solid white !important;
|
||||
}
|
||||
|
||||
.horizontal-separator {
|
||||
border-bottom: 4px solid white !important;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,326 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, reactive, onUnmounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const paginateRef = ref(null);
|
||||
const agencyModesOptions = ref([]);
|
||||
const visibleColumns = ref([]);
|
||||
const allColumnNames = ref([]);
|
||||
|
||||
const arrayData = useArrayData('WeeklyTickets');
|
||||
const { store } = arrayData;
|
||||
|
||||
const weekdays = [
|
||||
{ id: 0, name: t('weekdays.mon') },
|
||||
{ id: 1, name: t('weekdays.tue') },
|
||||
{ id: 2, name: t('weekdays.wed') },
|
||||
{ id: 3, name: t('weekdays.thu') },
|
||||
{ id: 4, name: t('weekdays.fri') },
|
||||
{ id: 5, name: t('weekdays.sat') },
|
||||
{ id: 6, name: t('weekdays.sun') },
|
||||
];
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'clientName':
|
||||
return { 'c.name': value };
|
||||
case 'nickName':
|
||||
return { 'u.name': value };
|
||||
}
|
||||
};
|
||||
|
||||
const params = reactive({});
|
||||
|
||||
const applyColumnFilter = async (col) => {
|
||||
try {
|
||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||
params[paramKey] = col.columnFilter.filterValue;
|
||||
await paginateRef.value.addFilter(null, params);
|
||||
} catch (err) {
|
||||
console.error('Error applying column filter', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getInputEvents = (col) => ({ 'keyup.enter': () => applyColumnFilter(col) });
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: t('weeklyTickets.id'),
|
||||
name: 'id',
|
||||
field: 'ticketFk',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('weeklyTickets.client'),
|
||||
name: 'client',
|
||||
field: 'clientName',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('weeklyTickets.shipment'),
|
||||
name: 'shipment',
|
||||
field: 'weekDay',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('weeklyTickets.agency'),
|
||||
name: 'agency',
|
||||
field: 'agencyModeFk',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('weeklyTickets.warehouse'),
|
||||
name: 'warehouse',
|
||||
field: 'warehouseName',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('weeklyTickets.salesperson'),
|
||||
field: 'salesperson',
|
||||
name: 'salesperson',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
filterParamKey: 'nickName',
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
name: 'actions',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
},
|
||||
]);
|
||||
|
||||
const redirectToTicketSummary = (ticketFk) =>
|
||||
router.push({ name: 'TicketSummary', params: { id: ticketFk } });
|
||||
|
||||
const deleteWeekly = async (ticketFk) => {
|
||||
try {
|
||||
await axios.delete(`TicketWeeklies/${ticketFk}`);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
const ticketIndex = store.data.findIndex((e) => e.ticketFk == ticketFk);
|
||||
store.data.splice(ticketIndex, 1);
|
||||
} catch (err) {
|
||||
console.error('Error deleting weekly', err);
|
||||
}
|
||||
};
|
||||
|
||||
const onUpdate = async (ticketFk, field, value) => {
|
||||
try {
|
||||
const params = { ticketFk, [field]: value };
|
||||
await axios.patch('TicketWeeklies', params);
|
||||
} catch (err) {
|
||||
console.error('Error updating weekly', err);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
const filteredColumns = columns.value.filter((col) => col.name !== 'actions');
|
||||
allColumnNames.value = filteredColumns.map((col) => col.name);
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="AgencyModes/isActive"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name' }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (agencyModesOptions = data)"
|
||||
/>
|
||||
<VnSearchbar
|
||||
data-key="WeeklyTickets"
|
||||
:label="t('weeklyTickets.search')"
|
||||
:info="t('weeklyTickets.searchInfo')"
|
||||
/>
|
||||
<VnSubToolbar>
|
||||
<template #st-data>
|
||||
<TableVisibleColumns
|
||||
:all-columns="allColumnNames"
|
||||
table-code="itemsIndex"
|
||||
labels-traductions-path="weeklyTickets"
|
||||
@on-config-saved="visibleColumns = [...$event, 'actions']"
|
||||
/>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<VnPaginate
|
||||
ref="paginateRef"
|
||||
data-key="WeeklyTickets"
|
||||
url="TicketWeeklies/filter"
|
||||
:order="['weekDay', 'ticketFk']"
|
||||
:limit="20"
|
||||
:expr-builder="exprBuilder"
|
||||
:user-params="params"
|
||||
:offset="50"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:visible-columns="visibleColumns"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
@row-click="(_, row) => redirectToTicketSummary(row.ticketFk)"
|
||||
>
|
||||
<template #top-row="{ cols }">
|
||||
<QTr>
|
||||
<QTd
|
||||
v-for="(col, index) in cols"
|
||||
:key="index"
|
||||
style="max-width: 100px"
|
||||
>
|
||||
<component
|
||||
:is="col.columnFilter.component"
|
||||
v-if="col.columnFilter"
|
||||
v-model="col.columnFilter.filterValue"
|
||||
v-bind="col.columnFilter.attrs"
|
||||
v-on="col.columnFilter.event(col)"
|
||||
dense
|
||||
/>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body-cell-id="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary">
|
||||
{{ row.ticketFk }}
|
||||
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-salesperson="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary">
|
||||
{{ row.userName }}
|
||||
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-client="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary" dense>
|
||||
{{ row.clientName }}
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-shipment="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnSelect
|
||||
:options="weekdays"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="row.weekDay"
|
||||
@update:model-value="
|
||||
onUpdate(row.ticketFk, 'weekDay', $event)
|
||||
"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-agency="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnSelect
|
||||
:options="agencyModesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="row.agencyModeFk"
|
||||
@update:model-value="
|
||||
onUpdate(row.ticketFk, 'agencyModeFk', $event)
|
||||
"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-actions="{ row }">
|
||||
<QTd>
|
||||
<QIcon
|
||||
@click.stop="
|
||||
openConfirmationModal(
|
||||
t('You are going to delete this weekly ticket'),
|
||||
t(
|
||||
'This ticket will be removed from weekly tickets! Continue anyway?'
|
||||
),
|
||||
() => deleteWeekly(row.ticketFk)
|
||||
)
|
||||
"
|
||||
class="q-ml-sm cursor-pointer"
|
||||
color="primary"
|
||||
name="delete"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('globals.delete') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
You are going to delete this weekly ticket: Vas a eliminar este ticket programado
|
||||
This ticket will be removed from weekly tickets! Continue anyway?: Este ticket se eliminará de tickets programados! ¿Continuar de todas formas?
|
||||
</i18n>
|
|
@ -0,0 +1,138 @@
|
|||
ticketSale:
|
||||
id: Id
|
||||
visible: Visible
|
||||
available: Available
|
||||
quantity: Quantity
|
||||
item: Item
|
||||
price: Price
|
||||
discount: Disc
|
||||
amount: Amount
|
||||
packaging: Packaging
|
||||
subtotal: Subtotal
|
||||
tax: VAT
|
||||
total: Total
|
||||
history: History
|
||||
claim: Claim
|
||||
reserved: Reserved
|
||||
noVisible: Not visible
|
||||
hasComponentLack: Component lack
|
||||
ok: Ok
|
||||
state: State
|
||||
more: More
|
||||
shipped: Shipped
|
||||
agency: Agency
|
||||
address: Address
|
||||
advanceTickets:
|
||||
origin: Origin
|
||||
destination: Destination
|
||||
originAgency: 'Origin agency: {agency}'
|
||||
destinationAgency: 'Destination agency: {agency}'
|
||||
ticketId: ID
|
||||
ipt: IPT
|
||||
state: State
|
||||
liters: Liters
|
||||
lines: Lines
|
||||
import: Import
|
||||
futureId: ID
|
||||
futureIpt: IPT
|
||||
futureState: State
|
||||
futureLiters: Liters
|
||||
futureZone: Zone
|
||||
notMovableLines: Not movable
|
||||
futureLines: Lines
|
||||
futureImport: Import
|
||||
advanceTickets: Advance tickets with negatives
|
||||
advanceTicketTitle: Advance {selectedTickets} tickets
|
||||
advanceTitleSubtitle: Advance {selectedTickets} tickets confirmation
|
||||
noDeliveryZone: No delivery zone available for this landing date
|
||||
moveTicketSuccess: 'Tickets moved successfully! {ticketsNumber}'
|
||||
advanceTicketsWithoutNegatives: Advance tickets without negatives
|
||||
advanceWithoutNegativeTitle: Advance tickets (without negatives)
|
||||
advanceWithoutNegativeSubtitle: Advance {selectedTickets} tickets confirmation
|
||||
errorsList: Errors list
|
||||
futureTickets:
|
||||
problems: Problems
|
||||
ticketId: ID
|
||||
shipped: Date
|
||||
ipt: IPT
|
||||
state: State
|
||||
liters: Liters
|
||||
import: Import
|
||||
availableLines: Available lines
|
||||
futureId: ID
|
||||
futureShipped: Date
|
||||
futureIpt: IPT
|
||||
futureState: State
|
||||
noVerified: No verified data
|
||||
noVisible: Not visible
|
||||
purchaseRequest: Purchase request
|
||||
clientFrozen: Client frozen
|
||||
componentLack: Component lack
|
||||
rounding: Rounding
|
||||
risk: Risk
|
||||
origin: Origin
|
||||
destination: Destination
|
||||
moveTicketTitle: Move tickets
|
||||
moveTicketDialogSubtitle: 'Do you want to move {selectedTickets} tickets to the future?'
|
||||
moveTicketSuccess: Tickets moved successfully!
|
||||
searchInfo: Search future tickets by date
|
||||
futureTicket: Future tickets
|
||||
basicData:
|
||||
next: Next
|
||||
back: Back
|
||||
finalize: Finalize
|
||||
client: Client
|
||||
warehouse: Warehouse
|
||||
address: Address
|
||||
inactive: (Inactive)
|
||||
noDeliveryZoneAvailable: No delivery zone available for this landing date
|
||||
editAddress: Edit address
|
||||
alias: Alias
|
||||
company: Company
|
||||
agency: Agency
|
||||
zone: Zone
|
||||
shipped: Shipped
|
||||
landed: Landed
|
||||
shippedHour: Shipped hour
|
||||
priceDifference: Price difference
|
||||
someFieldsAreInvalid: Some fields are invalid
|
||||
item: Item
|
||||
description: Description
|
||||
movable: Movable
|
||||
quantity: Quantity
|
||||
pricePPU: Price (PPU)
|
||||
newPricePPU: New (PPU)
|
||||
difference: Difference
|
||||
total: Total
|
||||
price: Price
|
||||
newPrice: New price
|
||||
chargeDifference: Charge difference to
|
||||
withoutNegatives: Create without negatives
|
||||
withoutNegativesInfo: Clone this ticket with the changes and only sales availables
|
||||
negativesConfirmTitle: Edit basic data
|
||||
negativesConfirmMessage: Negatives are going to be generated, are you sure you want to advance all the lines?
|
||||
chooseAnOption: Choose an option
|
||||
unroutedTicket: The ticket has been unrouted
|
||||
card:
|
||||
search: Search tickets
|
||||
searchInfo: You can search by ticket id or alias
|
||||
purchaseRequest:
|
||||
id: Id
|
||||
description: Description
|
||||
created: Created
|
||||
requester: Requester
|
||||
atender: Atender
|
||||
quantity: Quantity
|
||||
price: Price
|
||||
saleFk: Item id
|
||||
state: State
|
||||
newRequest: New request
|
||||
weeklyTickets:
|
||||
id: Ticket ID
|
||||
client: Client
|
||||
shipment: Shipment
|
||||
agency: Agency
|
||||
warehouse: Warehouse
|
||||
salesperson: Salesperson
|
||||
search: Search weekly tickets
|
||||
searchInfo: Search weekly tickets by id or client id
|
|
@ -1,2 +1,140 @@
|
|||
Search ticket: Buscar ticket
|
||||
card:
|
||||
search: Buscar tickets
|
||||
searchInfo: Buscar tickets por identificador o alias
|
||||
purchaseRequest:
|
||||
Id: Id
|
||||
description: Descripción
|
||||
created: Fecha creación
|
||||
requester: Solicitante
|
||||
atender: Comprador
|
||||
quantity: Cantidad
|
||||
price: Precio
|
||||
saleFk: Id artículo
|
||||
state: Estado
|
||||
newRequest: Crear petición
|
||||
basicData:
|
||||
next: Siguiente
|
||||
back: Anterior
|
||||
finalize: Finalizar
|
||||
client: Cliente
|
||||
warehouse: Almacén
|
||||
address: Consignatario
|
||||
inactive: (Inactivo)
|
||||
noDeliveryZoneAvailable: No hay una zona de reparto disponible para la fecha de envío seleccionada
|
||||
editAddress: Editar dirección
|
||||
alias: Alias
|
||||
company: Empresa
|
||||
agency: Agencia
|
||||
zone: Zona
|
||||
shipped: F. Envío
|
||||
landed: F. Entrega
|
||||
shippedHour: Hora de envío
|
||||
priceDifference: Diferencia de precio
|
||||
someFieldsAreInvalid: Algunos campos no son válidos
|
||||
item: Artículo
|
||||
description: Descripción
|
||||
movable: Movible
|
||||
quantity: Cantidad
|
||||
pricePPU: Precio (Ud.)
|
||||
newPricePPU: Nuevo (Ud.)
|
||||
difference: Diferencia
|
||||
total: Total
|
||||
price: Precio
|
||||
newPrice: Nuevo precio
|
||||
chargeDifference: Cargar diferencia a
|
||||
withoutNegatives: Crear sin negativos
|
||||
withoutNegativesInfo: Clonar este ticket con los cambios y solo ventas disponibles
|
||||
negativesConfirmTitle: Editar datos básicos
|
||||
negativesConfirmMessage: Se van a generar negativos, ¿seguro que quieres adelantar todas las líneas?
|
||||
chooseAnOption: Elige una opción
|
||||
unroutedTicket: El ticket ha sido desenrutado
|
||||
weeklyTickets:
|
||||
id: ID Ticket
|
||||
client: Cliente
|
||||
shipment: Salida
|
||||
agency: Agencia
|
||||
warehouse: Almacén
|
||||
salesperson: Comercial
|
||||
search: Buscar por tickets programados
|
||||
searchInfo: Buscar tickets programados por el identificador o el identificador del cliente
|
||||
advanceTickets:
|
||||
origin: Origen
|
||||
destination: Destinatario
|
||||
originAgency: 'Agencia origen: {agency}'
|
||||
destinationAgency: 'Agencia destino: {agency}'
|
||||
ticketId: ID
|
||||
ipt: IPT
|
||||
state: Estado
|
||||
liters: Litros
|
||||
lines: Líneas
|
||||
import: Importe
|
||||
futureId: ID
|
||||
futureIpt: IPT
|
||||
futureState: Estado
|
||||
futureLiters: Litros
|
||||
futureZone: Zona
|
||||
notMovableLines: No movibles
|
||||
futureLines: Líneas
|
||||
futureImport: Importe
|
||||
advanceTickets: Adelantar tickets con negativos
|
||||
advanceTicketTitle: Advance tickets
|
||||
advanceTitleSubtitle: '¿Desea adelantar {selectedTickets} tickets?'
|
||||
noDeliveryZone: No hay una zona de reparto disponible para la fecha de envío seleccionada
|
||||
moveTicketSuccess: 'Tickets movidos correctamente {ticketsNumber}'
|
||||
advanceTicketsWithoutNegatives: Adelantar tickets sin negativos
|
||||
advanceWithoutNegativeTitle: Adelantar tickets (sin negativos)
|
||||
advanceWithoutNegativeSubtitle: '¿Desea adelantar {selectedTickets} tickets?'
|
||||
errorsList: Lista de errores
|
||||
futureTickets:
|
||||
problems: Problemas
|
||||
ticketId: ID
|
||||
shipped: Fecha
|
||||
ipt: IPT
|
||||
state: Estado
|
||||
liters: Litros
|
||||
import: Importe
|
||||
availableLines: Líneas disponibles
|
||||
futureId: ID
|
||||
futureShipped: Fecha
|
||||
futureIpt: IPT
|
||||
futureState: Estado
|
||||
noVerified: Sin datos comprobados
|
||||
noVisible: No visible
|
||||
purchaseRequest: Petición de compra
|
||||
clientFrozen: Cliente congelado
|
||||
risk: Riesgo
|
||||
componentLack: Faltan componentes
|
||||
rounding: Redondeo
|
||||
origin: Origen
|
||||
destination: Destino
|
||||
moveTicketTitle: Mover tickets
|
||||
moveTicketDialogSubtitle: '¿Desea mover {selectedTickets} tickets hacia el futuro?'
|
||||
moveTicketSuccess: Tickets movidos correctamente
|
||||
searchInfo: Buscar tickets por fecha
|
||||
futureTicket: Tickets a futuro
|
||||
Search ticket: Buscar tickets
|
||||
You can search by ticket id or alias: Puedes buscar por id o alias del ticket
|
||||
ticketSale:
|
||||
id: Id
|
||||
visible: Visible
|
||||
available: Disponible
|
||||
quantity: Cantidad
|
||||
item: Artículo
|
||||
price: Precio
|
||||
discount: Dto
|
||||
amount: Importe
|
||||
packaging: Encajado
|
||||
subtotal: Subtotal
|
||||
tax: IVA
|
||||
total: Total
|
||||
history: Historial
|
||||
claim: Reclamación
|
||||
reserved: Reservado
|
||||
noVisible: No visible
|
||||
hasComponentLack: Faltan componentes
|
||||
ok: Ok
|
||||
state: Estado
|
||||
more: Más
|
||||
shipped: F. Envío
|
||||
agency: Agencia
|
||||
address: Consignatario
|
||||
|
|
|
@ -237,6 +237,7 @@ const getLink = (param) => `#/travel/${entityId.value}/${param}`;
|
|||
ref="summaryRef"
|
||||
:url="`Travels/${entityId}/getTravel`"
|
||||
@on-fetch="(data) => setTravelData(data)"
|
||||
data-key="TravelSummary"
|
||||
>
|
||||
<template #header>
|
||||
<span>{{ travel.ref }} - {{ travel.id }}</span>
|
||||
|
|
|
@ -137,7 +137,7 @@ const removeThermograph = async (id) => {
|
|||
data-key="TravelThermographs"
|
||||
url="TravelThermographs"
|
||||
:filter="thermographFilter"
|
||||
:params="{ travelFk: route.params.id }"
|
||||
:params="{ travelFk: id }"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import { onMounted, ref, computed, watch } from 'vue';
|
||||
import { QBtn } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
|
||||
|
@ -19,8 +18,8 @@ import { usePrintService } from 'composables/usePrintService';
|
|||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import axios from 'axios';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnPopup from 'src/components/common/VnPopup.vue';
|
||||
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { openReport } = usePrintService();
|
||||
|
@ -125,6 +124,10 @@ const tableColumnComponents = {
|
|||
component: 'span',
|
||||
attrs: {},
|
||||
},
|
||||
notes: {
|
||||
component: 'span',
|
||||
attrs: {},
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
|
@ -250,6 +253,14 @@ const columns = computed(() => [
|
|||
sortable: true,
|
||||
format: (value) => toDate(value),
|
||||
},
|
||||
{
|
||||
label: t('notes'),
|
||||
field: '',
|
||||
name: 'notes',
|
||||
align: 'center',
|
||||
showValue: false,
|
||||
sortable: true,
|
||||
},
|
||||
]);
|
||||
|
||||
async function getData() {
|
||||
|
@ -298,10 +309,6 @@ const saveFieldValue = async (val, field, index) => {
|
|||
}
|
||||
};
|
||||
|
||||
const navigateToTravelId = (id) => {
|
||||
router.push({ path: `/travel/${id}` });
|
||||
};
|
||||
|
||||
const stopEventPropagation = (event, col) => {
|
||||
// Detener la propagación del evento de los siguientes elementos para evitar el click sobre la row que dispararía la función navigateToTravelId
|
||||
if (!['ref', 'id', 'cargoSupplierNickname', 'kg'].includes(col.name)) return;
|
||||
|
@ -486,7 +493,7 @@ const getColor = (percentage) => {
|
|||
<QTr
|
||||
:props="props"
|
||||
class="cursor-pointer bg-travel"
|
||||
@click="navigateToTravelId(props.row.id)"
|
||||
@click="$router.push({ path: `/travel/${props.row.id}` })"
|
||||
@dragenter="handleDragEnter($event, props.rowIndex)"
|
||||
@dragover.prevent
|
||||
@drop="handleDrop()"
|
||||
|
@ -607,6 +614,20 @@ const getColor = (percentage) => {
|
|||
<QTd />
|
||||
<QTd />
|
||||
<QTd />
|
||||
<QTd>
|
||||
<QBtn
|
||||
v-if="entry.evaNotes"
|
||||
icon="comment"
|
||||
size="sm"
|
||||
flat
|
||||
color="primary"
|
||||
>
|
||||
<VnPopup
|
||||
:title="t('globals.observations')"
|
||||
:content="entry.evaNotes"
|
||||
/>
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const token = getTokenMultimedia();
|
||||
|
||||
const counters = ref({
|
||||
alquilerBandeja: { count: 0, id: 96001, title: 'CC Bandeja', isTray: true },
|
||||
|
@ -35,10 +33,6 @@ onMounted(() => {
|
|||
}
|
||||
});
|
||||
|
||||
function getUrl(id) {
|
||||
return `/api/Images/catalog/200x200/${id}/download?access_token=${token}`;
|
||||
}
|
||||
|
||||
async function handleEvent(type, action, amount) {
|
||||
const counter = counters.value[type].count;
|
||||
let isOk = true;
|
||||
|
@ -70,11 +64,7 @@ function confirm() {
|
|||
<QList class="row q-mx-auto q-mt-xl">
|
||||
<QItem v-for="(props, name) in counters" :key="name" class="col-6">
|
||||
<QItemSection>
|
||||
<QImg
|
||||
:src="getUrl(props.id)"
|
||||
width="130px"
|
||||
@click="handleEvent(name, 'add')"
|
||||
/>
|
||||
<VnImg :id="props.id" width="130px" @click="handleEvent(name, 'add')" />
|
||||
<p class="title">{{ props.title }}</p>
|
||||
</QItemSection>
|
||||
<QItemSection class="q-ma-none">
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
const tableRef = ref();
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const entityId = computed(() => route.params.id);
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'paymentDate',
|
||||
label: t('worker.balance.tableVisibleColumns.paymentDate'),
|
||||
create: true,
|
||||
component: 'date',
|
||||
field: 'paymentDate',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'incomeTypeFk',
|
||||
label: t('worker.balance.tableVisibleColumns.incomeType'),
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'payrollComponents',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'debit',
|
||||
label: t('worker.balance.tableVisibleColumns.debit'),
|
||||
create: true,
|
||||
component: 'input',
|
||||
field: 'debit',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'credit',
|
||||
label: t('worker.balance.tableVisibleColumns.credit'),
|
||||
create: true,
|
||||
component: 'input',
|
||||
field: 'credit',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'concept',
|
||||
label: t('worker.balance.tableVisibleColumns.concept'),
|
||||
create: true,
|
||||
component: 'input',
|
||||
field: 'concept',
|
||||
cardVisible: true,
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="WorkerBalance"
|
||||
:url="`Workers/${entityId}/incomes`"
|
||||
:url-create="`Workers/${entityId}/incomes`"
|
||||
save-url="WorkerIncomes/crud"
|
||||
:create="{
|
||||
urlCreate: 'workerIncomes',
|
||||
title: t('Create workerBalance'),
|
||||
onDataSaved: () => tableRef.reload(),
|
||||
formInitialData: {
|
||||
workerFk: entityId,
|
||||
},
|
||||
}"
|
||||
order="paymentDate DESC"
|
||||
:columns="columns"
|
||||
default-mode="table"
|
||||
auto-load
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
:use-model="true"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Create workerBalance: Crear balance
|
||||
</i18n>
|
|
@ -2,7 +2,6 @@
|
|||
import { computed, ref, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||
|
@ -10,6 +9,7 @@ import WorkerChangePasswordForm from 'src/pages/Worker/Card/WorkerChangePassword
|
|||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import axios from 'axios';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -25,7 +25,6 @@ const $props = defineProps({
|
|||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
const changePasswordFormDialog = ref(null);
|
||||
|
@ -73,11 +72,6 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
function getWorkerAvatar() {
|
||||
const token = getTokenMultimedia();
|
||||
return `/api/Images/user/160x160/${entityId.value}/download?access_token=${token}`;
|
||||
}
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => {
|
||||
if (!entity) return;
|
||||
|
@ -155,7 +149,7 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
|||
</QItem>
|
||||
</template>
|
||||
<template #before>
|
||||
<QImg :src="getWorkerAvatar()" class="photo">
|
||||
<VnImg :id="entityId" collection="user" size="160x160" class="photo">
|
||||
<template #error>
|
||||
<div
|
||||
class="absolute-full picture text-center q-pa-md flex flex-center"
|
||||
|
@ -170,7 +164,7 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</QImg>
|
||||
</VnImg>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" />
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
const tableRef = ref();
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const entityId = computed(() => route.params.id);
|
||||
const courseFilter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'trainingCourseType',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'trainingCenter',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'trainingCourseTypeFk',
|
||||
label: t('worker.formation.tableVisibleColumns.course'),
|
||||
isTitle: true,
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'TrainingCourseTypes',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'started',
|
||||
label: t('worker.formation.tableVisibleColumns.startDate'),
|
||||
component: 'date',
|
||||
field: 'started',
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'ended',
|
||||
label: t('worker.formation.tableVisibleColumns.endDate'),
|
||||
component: 'date',
|
||||
field: 'ended',
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'centerFk',
|
||||
label: t('worker.formation.tableVisibleColumns.center'),
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'TrainingCenters',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'invoice',
|
||||
label: t('worker.formation.tableVisibleColumns.invoice'),
|
||||
component: 'input',
|
||||
field: 'invoice',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'amount',
|
||||
label: t('worker.formation.tableVisibleColumns.amount'),
|
||||
component: 'input',
|
||||
field: 'amount',
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'remark',
|
||||
label: t('worker.formation.tableVisibleColumns.remark'),
|
||||
component: 'checkbox',
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'hasDiploma',
|
||||
label: t('worker.formation.tableVisibleColumns.hasDiploma'),
|
||||
create: true,
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
<template>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="WorkerFormation"
|
||||
:url="`Workers/${entityId}/trainingCourse`"
|
||||
:url-create="`Workers/${entityId}/trainingCourse`"
|
||||
save-url="TrainingCourses/crud"
|
||||
:filter="courseFilter"
|
||||
:create="{
|
||||
urlCreate: 'trainingCourses',
|
||||
title: 'Create trainingCourse',
|
||||
onDataSaved: () => tableRef.reload(),
|
||||
formInitialData: {
|
||||
workerFk: entityId,
|
||||
},
|
||||
}"
|
||||
order="id DESC"
|
||||
:columns="columns"
|
||||
default-mode="table"
|
||||
auto-load
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
:use-model="true"
|
||||
/>
|
||||
</template>
|
|
@ -66,7 +66,12 @@ const filter = {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary ref="summary" :url="`Workers/${entityId}`" :filter="filter">
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`Workers/${entityId}`"
|
||||
:filter="filter"
|
||||
data-key="WorkerSummary"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
|
||||
</template>
|
||||
|
|
|
@ -22,6 +22,7 @@ const searchBarDataKeys = {
|
|||
ZoneEvents: 'ZoneEvents',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnCard
|
||||
data-key="Zone"
|
||||
|
|
|
@ -274,7 +274,7 @@ export default {
|
|||
name: 'CustomerBalance',
|
||||
meta: {
|
||||
title: 'balance',
|
||||
icon: 'vn:invoice',
|
||||
icon: 'balance',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Customer/Card/CustomerBalance.vue'),
|
||||
|
|
|
@ -11,8 +11,15 @@ export default {
|
|||
component: RouterView,
|
||||
redirect: { name: 'TicketMain' },
|
||||
menus: {
|
||||
main: ['TicketList'],
|
||||
card: ['TicketBoxing', 'TicketSms', 'TicketSale', 'TicketLog'],
|
||||
main: ['TicketList', 'TicketAdvance', 'TicketWeekly', 'TicketFuture'],
|
||||
card: [
|
||||
'TicketBasicData',
|
||||
'TicketBoxing',
|
||||
'TicketSms',
|
||||
'TicketSale',
|
||||
'TicketLog',
|
||||
'TicketPurchaseRequest',
|
||||
],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
@ -40,6 +47,33 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Ticket/TicketCreate.vue'),
|
||||
},
|
||||
{
|
||||
name: 'TicketWeekly',
|
||||
path: 'weekly',
|
||||
meta: {
|
||||
title: 'weeklyTickets',
|
||||
icon: 'access_time',
|
||||
},
|
||||
component: () => import('src/pages/Ticket/TicketWeekly.vue'),
|
||||
},
|
||||
{
|
||||
name: 'TicketFuture',
|
||||
path: 'future',
|
||||
meta: {
|
||||
title: 'futureTickets',
|
||||
icon: 'keyboard_double_arrow_right',
|
||||
},
|
||||
component: () => import('src/pages/Ticket/TicketFuture.vue'),
|
||||
},
|
||||
{
|
||||
name: 'TicketAdvance',
|
||||
path: 'advance',
|
||||
meta: {
|
||||
title: 'ticketAdvance',
|
||||
icon: 'keyboard_double_arrow_left',
|
||||
},
|
||||
component: () => import('src/pages/Ticket/TicketAdvance.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -64,7 +98,8 @@ export default {
|
|||
title: 'basicData',
|
||||
icon: 'vn:settings',
|
||||
},
|
||||
component: () => import('src/pages/Ticket/Card/TicketBasicData.vue'),
|
||||
component: () =>
|
||||
import('src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue'),
|
||||
},
|
||||
{
|
||||
name: 'TicketSale',
|
||||
|
@ -75,6 +110,25 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Ticket/Card/TicketSale.vue'),
|
||||
},
|
||||
{
|
||||
path: 'request',
|
||||
name: 'TicketPurchaseRequest',
|
||||
meta: {
|
||||
title: 'purchaseRequest',
|
||||
icon: 'vn:buyrequest',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Ticket/Card/TicketPurchaseRequest.vue'),
|
||||
},
|
||||
{
|
||||
path: 'log',
|
||||
name: 'TicketLog',
|
||||
meta: {
|
||||
title: 'log',
|
||||
icon: 'history',
|
||||
},
|
||||
component: () => import('src/pages/Ticket/Card/TicketLog.vue'),
|
||||
},
|
||||
{
|
||||
path: 'boxing',
|
||||
name: 'TicketBoxing',
|
||||
|
@ -93,15 +147,6 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Ticket/Card/TicketSms.vue'),
|
||||
},
|
||||
{
|
||||
path: 'log',
|
||||
name: 'TicketLog',
|
||||
meta: {
|
||||
title: 'log',
|
||||
icon: 'history',
|
||||
},
|
||||
component: () => import('src/pages/Ticket/Card/TicketLog.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -23,6 +23,8 @@ export default {
|
|||
'WorkerDms',
|
||||
'WorkerTimeControl',
|
||||
'WorkerLocker',
|
||||
'WorkerBalance',
|
||||
'WorkerFormation',
|
||||
],
|
||||
},
|
||||
children: [
|
||||
|
@ -176,6 +178,24 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Worker/Card/WorkerLocker.vue'),
|
||||
},
|
||||
{
|
||||
name: 'WorkerBalance',
|
||||
path: 'balance',
|
||||
meta: {
|
||||
title: 'balance',
|
||||
icon: 'balance',
|
||||
},
|
||||
component: () => import('src/pages/Worker/Card/WorkerBalance.vue'),
|
||||
},
|
||||
{
|
||||
name: 'WorkerFormation',
|
||||
path: 'formation',
|
||||
meta: {
|
||||
title: 'formation',
|
||||
icon: 'clinical_notes',
|
||||
},
|
||||
component: () => import('src/pages/Worker/Card/WorkerFormation.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -6,15 +6,14 @@ describe('InvoiceInCorrective', () => {
|
|||
const saveDialog = '.q-card > .q-card__actions > .q-btn--standard ';
|
||||
|
||||
it('should create a correcting invoice', () => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/invoice-in/1/summary?limit=10`);
|
||||
|
||||
cy.openLeftMenu();
|
||||
cy.openActionsDescriptor();
|
||||
|
||||
cy.get(createRectificative).click();
|
||||
cy.get(saveDialog).click();
|
||||
cy.openLeftMenu();
|
||||
cy.get(rectificativeSection).click();
|
||||
cy.get('tbody > tr:visible').should('have.length', 1);
|
||||
});
|
||||
|
|
|
@ -5,18 +5,15 @@ describe('InvoiceInDescriptor', () => {
|
|||
'.q-card:nth-child(3) .vn-label-value:nth-child(5) > .value > span';
|
||||
|
||||
it('should booking and unbooking the invoice properly', () => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/invoice-in/1/summary?limit=10`);
|
||||
cy.visit('/#/invoice-in/1/summary');
|
||||
|
||||
cy.openLeftMenu();
|
||||
cy.openActionsDescriptor();
|
||||
cy.get(firstDescritorOpt).click();
|
||||
cy.get(dialogBtns).eq(1).click();
|
||||
cy.get('.fullscreen').first().click();
|
||||
cy.get(isBookedField).should('have.attr', 'title', 'true');
|
||||
|
||||
cy.openLeftMenu();
|
||||
cy.openActionsDescriptor();
|
||||
cy.get(firstDescritorOpt).click();
|
||||
cy.get(dialogBtns).eq(1).click();
|
||||
cy.get(isBookedField).should('have.attr', 'title', 'false');
|
||||
|
|
|
@ -5,14 +5,11 @@ import jsconfigPaths from 'vite-jsconfig-paths';
|
|||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
||||
import path from 'path';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
test: {
|
||||
environment: 'happy-dom',
|
||||
setupFiles: 'test/vitest/setup-file.js',
|
||||
include: [
|
||||
// Matches vitest tests in any subfolder of 'src' or into 'test/vitest/__tests__'
|
||||
// Matches all files with extension 'js', 'jsx', 'ts' and 'tsx'
|
||||
'test/vitest/__tests__/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
|
||||
],
|
||||
},
|
Loading…
Reference in New Issue