Merge branch 'dev' of https: refs #6919//gitea.verdnatura.es/verdnatura/salix-front into 6919-syncData
This commit is contained in:
commit
848d00a8b3
144
package.json
144
package.json
|
@ -1,74 +1,74 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "25.06.0",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@8.15.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"resetDatabase": "cd ../salix && gulp docker",
|
||||
"lint": "eslint --ext .js,.vue ./",
|
||||
"format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
|
||||
"test:e2e": "cypress open",
|
||||
"test:e2e:ci": "npm run resetDatabase && cd ../salix-front && cypress run",
|
||||
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
||||
"test:unit": "vitest",
|
||||
"test:unit:ci": "vitest run",
|
||||
"commitlint": "commitlint --edit",
|
||||
"prepare": "npx husky install",
|
||||
"addReferenceTag": "node .husky/addReferenceTag.js",
|
||||
"docs:dev": "vitepress dev docs",
|
||||
"docs:build": "vitepress build docs",
|
||||
"docs:preview": "vitepress preview docs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@quasar/cli": "^2.4.1",
|
||||
"@quasar/extras": "^1.16.16",
|
||||
"axios": "^1.4.0",
|
||||
"chromium": "^3.0.3",
|
||||
"croppie": "^2.6.5",
|
||||
"moment": "^2.30.1",
|
||||
"pinia": "^2.1.3",
|
||||
"quasar": "^2.17.7",
|
||||
"validator": "^13.9.0",
|
||||
"vue": "^3.5.13",
|
||||
"vue-i18n": "^9.3.0",
|
||||
"vue-router": "^4.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.2.1",
|
||||
"@commitlint/config-conventional": "^19.1.0",
|
||||
"@intlify/unplugin-vue-i18n": "^0.8.2",
|
||||
"@pinia/testing": "^0.1.2",
|
||||
"@quasar/app-vite": "^2.0.8",
|
||||
"@quasar/quasar-app-extension-qcalendar": "^4.0.2",
|
||||
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
|
||||
"@vue/test-utils": "^2.4.4",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"cypress": "^13.6.6",
|
||||
"cypress-mochawesome-reporter": "^3.8.2",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-plugin-cypress": "^4.1.0",
|
||||
"eslint-plugin-vue": "^9.32.0",
|
||||
"husky": "^8.0.0",
|
||||
"postcss": "^8.4.23",
|
||||
"prettier": "^3.4.2",
|
||||
"sass": "^1.83.4",
|
||||
"vitepress": "^1.6.3",
|
||||
"vitest": "^0.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20 || ^18 || ^16",
|
||||
"npm": ">= 8.1.2",
|
||||
"yarn": ">= 1.21.1",
|
||||
"bun": ">= 1.0.25"
|
||||
},
|
||||
"overrides": {
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"vite": "^6.0.11",
|
||||
"vitest": "^0.31.1"
|
||||
}
|
||||
"name": "salix-front",
|
||||
"version": "25.08.0",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@8.15.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"resetDatabase": "cd ../salix && gulp docker",
|
||||
"lint": "eslint --ext .js,.vue ./",
|
||||
"format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
|
||||
"test:e2e": "cypress open",
|
||||
"test:e2e:ci": "npm run resetDatabase && cd ../salix-front && cypress run",
|
||||
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
||||
"test:unit": "vitest",
|
||||
"test:unit:ci": "vitest run",
|
||||
"commitlint": "commitlint --edit",
|
||||
"prepare": "npx husky install",
|
||||
"addReferenceTag": "node .husky/addReferenceTag.js",
|
||||
"docs:dev": "vitepress dev docs",
|
||||
"docs:build": "vitepress build docs",
|
||||
"docs:preview": "vitepress preview docs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@quasar/cli": "^2.4.1",
|
||||
"@quasar/extras": "^1.16.16",
|
||||
"axios": "^1.4.0",
|
||||
"chromium": "^3.0.3",
|
||||
"croppie": "^2.6.5",
|
||||
"moment": "^2.30.1",
|
||||
"pinia": "^2.1.3",
|
||||
"quasar": "^2.17.7",
|
||||
"validator": "^13.9.0",
|
||||
"vue": "^3.5.13",
|
||||
"vue-i18n": "^9.3.0",
|
||||
"vue-router": "^4.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.2.1",
|
||||
"@commitlint/config-conventional": "^19.1.0",
|
||||
"@intlify/unplugin-vue-i18n": "^0.8.2",
|
||||
"@pinia/testing": "^0.1.2",
|
||||
"@quasar/app-vite": "^2.0.8",
|
||||
"@quasar/quasar-app-extension-qcalendar": "^4.0.2",
|
||||
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
|
||||
"@vue/test-utils": "^2.4.4",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"cypress": "^13.6.6",
|
||||
"cypress-mochawesome-reporter": "^3.8.2",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-plugin-cypress": "^4.1.0",
|
||||
"eslint-plugin-vue": "^9.32.0",
|
||||
"husky": "^8.0.0",
|
||||
"postcss": "^8.4.23",
|
||||
"prettier": "^3.4.2",
|
||||
"sass": "^1.83.4",
|
||||
"vitepress": "^1.6.3",
|
||||
"vitest": "^0.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20 || ^18 || ^16",
|
||||
"npm": ">= 8.1.2",
|
||||
"yarn": ">= 1.21.1",
|
||||
"bun": ">= 1.0.25"
|
||||
},
|
||||
"overrides": {
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"vite": "^6.0.11",
|
||||
"vitest": "^0.31.1"
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
export default {
|
||||
mounted: function (el, binding) {
|
||||
const shortcut = binding.value ?? '+';
|
||||
mounted(el, binding) {
|
||||
const shortcut = binding.value || '+';
|
||||
|
||||
const { key, ctrl, alt, callback } =
|
||||
typeof shortcut === 'string'
|
||||
|
@ -8,25 +8,24 @@ export default {
|
|||
key: shortcut,
|
||||
ctrl: true,
|
||||
alt: true,
|
||||
callback: () =>
|
||||
document
|
||||
.querySelector(`button[shortcut="${shortcut}"]`)
|
||||
?.click(),
|
||||
callback: () => el?.click(),
|
||||
}
|
||||
: binding.value;
|
||||
|
||||
if (!el.hasAttribute('shortcut')) {
|
||||
el.setAttribute('shortcut', key);
|
||||
}
|
||||
|
||||
const handleKeydown = (event) => {
|
||||
if (event.key === key && (!ctrl || event.ctrlKey) && (!alt || event.altKey)) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
// Attach the event listener to the window
|
||||
window.addEventListener('keydown', handleKeydown);
|
||||
|
||||
el._handleKeydown = handleKeydown;
|
||||
},
|
||||
unmounted: function (el) {
|
||||
unmounted(el) {
|
||||
if (el._handleKeydown) {
|
||||
window.removeEventListener('keydown', el._handleKeydown);
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ const setCategoryList = (data) => {
|
|||
<QItem class="q-mt-lg">
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
class="fill-icon-on-hover q-px-xs"
|
||||
color="primary"
|
||||
|
|
|
@ -10,12 +10,13 @@ import routes from 'src/router/modules';
|
|||
import LeftMenuItem from './LeftMenuItem.vue';
|
||||
import LeftMenuItemGroup from './LeftMenuItemGroup.vue';
|
||||
import VnInput from './common/VnInput.vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const quasar = useQuasar();
|
||||
const navigation = useNavigationStore();
|
||||
|
||||
const router = useRouter();
|
||||
const props = defineProps({
|
||||
source: {
|
||||
type: String,
|
||||
|
@ -174,6 +175,10 @@ function normalize(text) {
|
|||
.replace(/[\u0300-\u036f]/g, '')
|
||||
.toLowerCase();
|
||||
}
|
||||
const searchModule = () => {
|
||||
const [item] = filteredItems.value;
|
||||
if (item) router.push({ name: item.name });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -188,10 +193,11 @@ function normalize(text) {
|
|||
filled
|
||||
dense
|
||||
autofocus
|
||||
@keyup.enter.stop="searchModule()"
|
||||
/>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
<template v-if="filteredPinnedModules.size">
|
||||
<template v-if="filteredPinnedModules.size && !search">
|
||||
<LeftMenuItem
|
||||
v-for="[key, pinnedModule] of filteredPinnedModules"
|
||||
:key="key"
|
||||
|
@ -215,11 +221,11 @@ function normalize(text) {
|
|||
</LeftMenuItem>
|
||||
<QSeparator />
|
||||
</template>
|
||||
<template v-for="item in filteredItems" :key="item.name">
|
||||
<template v-for="(item, index) in filteredItems" :key="item.name">
|
||||
<template
|
||||
v-if="item.children && !filteredPinnedModules.has(item.name)"
|
||||
v-if="search ||item.children && !filteredPinnedModules.has(item.name)"
|
||||
>
|
||||
<LeftMenuItem :item="item" group="modules">
|
||||
<LeftMenuItem :item="item" group="modules" :class="search && index === 0 ? 'searched' : ''">
|
||||
<template #side>
|
||||
<QBtn
|
||||
v-if="item.isPinned === true"
|
||||
|
@ -336,6 +342,9 @@ function normalize(text) {
|
|||
.header {
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
.searched{
|
||||
background-color: var(--vn-section-hover-color);
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
|
|
|
@ -2,26 +2,9 @@
|
|||
defineProps({ row: { type: Object, required: true } });
|
||||
</script>
|
||||
<template>
|
||||
<span>
|
||||
<span class="q-gutter-x-xs">
|
||||
<QIcon
|
||||
v-if="row.isTaxDataChecked === 0"
|
||||
name="vn:no036"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row.hasTicketRequest" name="vn:buyrequest" color="primary" size="xs">
|
||||
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row.itemShortage" name="vn:unavailable" color="primary" size="xs">
|
||||
<QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
|
||||
<QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.risk"
|
||||
v-if="row?.risk"
|
||||
name="vn:risk"
|
||||
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
||||
size="xs"
|
||||
|
@ -30,10 +13,57 @@ defineProps({ row: { type: Object, required: true } });
|
|||
{{ $t('salesTicketsTable.risk') }}: {{ row.risk - row.credit }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row.hasComponentLack" name="vn:components" color="primary" size="xs">
|
||||
<QIcon
|
||||
v-if="row?.hasComponentLack"
|
||||
name="vn:components"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ $t('salesTicketsTable.componentLack') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row.isTooLittle" name="vn:isTooLittle" color="primary" size="xs">
|
||||
<QIcon v-if="row?.hasItemDelay" color="primary" size="xs" name="vn:hasItemDelay">
|
||||
<QTooltip>
|
||||
{{ $t('ticket.summary.hasItemDelay') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row?.hasItemLost" color="primary" size="xs" name="vn:hasItemLost">
|
||||
<QTooltip>
|
||||
{{ $t('salesTicketsTable.hasItemLost') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row?.hasItemShortage"
|
||||
name="vn:unavailable"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row?.hasRounding" color="primary" name="sync_problem" size="xs">
|
||||
<QTooltip>
|
||||
{{ $t('ticketList.rounding') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row?.hasTicketRequest"
|
||||
name="vn:buyrequest"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="!row?.isTaxDataChecked === 0"
|
||||
name="vn:no036"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row?.isFreezed" name="vn:frozen" color="primary" size="xs">
|
||||
<QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row?.isTooLittle" name="vn:isTooLittle" color="primary" size="xs">
|
||||
<QTooltip>{{ $t('salesTicketsTable.tooLittle') }}</QTooltip>
|
||||
</QIcon>
|
||||
</span>
|
||||
|
|
|
@ -500,7 +500,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
<QCard
|
||||
bordered
|
||||
flat
|
||||
class="row no-wrap justify-between cursor-pointer"
|
||||
class="row no-wrap justify-between cursor-pointer q-pa-sm"
|
||||
@click="
|
||||
(_, row) => {
|
||||
$props.rowClick && $props.rowClick(row);
|
||||
|
@ -581,7 +581,6 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
<!-- Actions -->
|
||||
<QCardSection
|
||||
v-if="colsMap.tableActions"
|
||||
class="column flex-center w-10 no-margin q-pa-xs q-gutter-y-xs"
|
||||
@click="stopEventPropagation($event)"
|
||||
>
|
||||
<QBtn
|
||||
|
@ -630,7 +629,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
size="md"
|
||||
round
|
||||
flat
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
:disabled="!disabledAttr"
|
||||
/>
|
||||
<QTooltip>
|
||||
|
@ -648,7 +647,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
data-cy="vnTableCreateBtn"
|
||||
/>
|
||||
<QTooltip self="top right">
|
||||
|
@ -807,12 +806,15 @@ es:
|
|||
|
||||
.grid-two {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
overflow: scroll;
|
||||
white-space: wrap;
|
||||
width: 100%;
|
||||
grid-template-columns: 2fr 2fr;
|
||||
.vn-label-value {
|
||||
flex-direction: column;
|
||||
white-space: nowrap;
|
||||
.fields {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.w-80 {
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
import { vi, describe, expect, it, beforeEach, beforeAll, afterEach } from 'vitest';
|
||||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
import UserPanel from 'src/components/UserPanel.vue';
|
||||
import axios from 'axios';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
describe('UserPanel', () => {
|
||||
let wrapper;
|
||||
let vm;
|
||||
let state;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = createWrapper(UserPanel, {});
|
||||
state = useState();
|
||||
state.setUser({
|
||||
id: 115,
|
||||
name: 'itmanagement',
|
||||
nickname: 'itManagementNick',
|
||||
lang: 'en',
|
||||
darkMode: false,
|
||||
companyFk: 442,
|
||||
warehouseFk: 1,
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should fetch warehouses data on mounted', async () => {
|
||||
const fetchData = wrapper.findComponent({ name: 'FetchData' });
|
||||
expect(fetchData.props('url')).toBe('Warehouses');
|
||||
expect(fetchData.props('autoLoad')).toBe(true);
|
||||
});
|
||||
|
||||
it('should toggle dark mode correctly and update preferences', async () => {
|
||||
await vm.saveDarkMode(true);
|
||||
expect(axios.patch).toHaveBeenCalledWith('/UserConfigs/115', { darkMode: true });
|
||||
expect(vm.user.darkMode).toBe(true);
|
||||
vm.updatePreferences();
|
||||
expect(vm.darkMode).toBe(true);
|
||||
});
|
||||
|
||||
it('should change user language and update preferences', async () => {
|
||||
const userLanguage = 'es';
|
||||
await vm.saveLanguage(userLanguage);
|
||||
expect(axios.patch).toHaveBeenCalledWith('/VnUsers/115', { lang: userLanguage });
|
||||
expect(vm.user.lang).toBe(userLanguage);
|
||||
vm.updatePreferences();
|
||||
expect(vm.locale).toBe(userLanguage);
|
||||
});
|
||||
|
||||
it('should update user data', async () => {
|
||||
const key = 'name';
|
||||
const value = 'itboss';
|
||||
await vm.saveUserData(key, value);
|
||||
expect(axios.post).toHaveBeenCalledWith('UserConfigs/setUserConfig', { [key]: value });
|
||||
});
|
||||
});
|
|
@ -17,7 +17,7 @@ import { useSession } from 'src/composables/useSession';
|
|||
const route = useRoute();
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
const rows = ref();
|
||||
const rows = ref([]);
|
||||
const dmsRef = ref();
|
||||
const formDialog = ref({});
|
||||
const token = useSession().getTokenMultimedia();
|
||||
|
@ -389,6 +389,14 @@ defineExpose({
|
|||
</div>
|
||||
</template>
|
||||
</QTable>
|
||||
<div
|
||||
v-else
|
||||
class="info-row q-pa-md text-center"
|
||||
>
|
||||
<h5>
|
||||
{{ t('No data to display') }}
|
||||
</h5>
|
||||
</div>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
<QDialog v-model="formDialog.show">
|
||||
|
@ -405,7 +413,7 @@ defineExpose({
|
|||
fab
|
||||
color="primary"
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut
|
||||
@click="showFormDialog()"
|
||||
class="fill-icon"
|
||||
>
|
||||
|
|
|
@ -268,7 +268,7 @@ async function applyFilter() {
|
|||
filter.where.and.push(selectedFilters.value);
|
||||
}
|
||||
|
||||
paginate.value.fetch(filter);
|
||||
paginate.value.fetch({ filter });
|
||||
}
|
||||
|
||||
function setDate(type) {
|
||||
|
@ -404,7 +404,7 @@ watch(
|
|||
ref="paginate"
|
||||
:data-key="`${model}Log`"
|
||||
:url="`${model}Logs`"
|
||||
:filter="filter"
|
||||
:user-filter="filter"
|
||||
:skeleton="false"
|
||||
auto-load
|
||||
@on-fetch="setLogTree"
|
||||
|
|
|
@ -53,6 +53,7 @@ const url = computed(() => {
|
|||
:fields="['id', 'name', 'nickname', 'code']"
|
||||
:filter-options="['id', 'name', 'nickname', 'code']"
|
||||
sort-by="nickname ASC"
|
||||
data-cy="vnWorkerSelect"
|
||||
>
|
||||
<template #prepend v-if="$props.hasAvatar">
|
||||
<VnAvatar :worker-id="value" color="primary" v-bind="$attrs" />
|
||||
|
|
|
@ -1,51 +1,78 @@
|
|||
import { describe, it, expect, vi, beforeAll, afterEach, beforeEach } from 'vitest';
|
||||
import {
|
||||
describe,
|
||||
it,
|
||||
expect,
|
||||
vi,
|
||||
beforeAll,
|
||||
afterEach,
|
||||
beforeEach,
|
||||
afterAll,
|
||||
} from 'vitest';
|
||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||
import vnDate from 'src/boot/vnDate';
|
||||
|
||||
describe('VnNotes', () => {
|
||||
let vm;
|
||||
let wrapper;
|
||||
let spyFetch;
|
||||
let postMock;
|
||||
let expectedBody;
|
||||
const mockData= {name: 'Tony', lastName: 'Stark', text: 'Test Note', observationTypeFk: 1};
|
||||
|
||||
function generateExpectedBody() {
|
||||
expectedBody = {...vm.$props.body, ...{ text: vm.newNote.text, observationTypeFk: vm.newNote.observationTypeFk }};
|
||||
}
|
||||
|
||||
async function setTestParams(text, observationType, type){
|
||||
vm.newNote.text = text;
|
||||
vm.newNote.observationTypeFk = observationType;
|
||||
wrapper.setProps({ selectType: type });
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
vi.spyOn(axios, 'get').mockReturnValue({ data: [] });
|
||||
|
||||
let patchMock;
|
||||
let expectedInsertBody;
|
||||
let expectedUpdateBody;
|
||||
const defaultOptions = {
|
||||
url: '/test',
|
||||
body: { name: 'Tony', lastName: 'Stark' },
|
||||
selectType: false,
|
||||
saveUrl: null,
|
||||
justInput: false,
|
||||
};
|
||||
function generateWrapper(
|
||||
options = defaultOptions,
|
||||
text = null,
|
||||
observationType = null,
|
||||
) {
|
||||
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
|
||||
wrapper = createWrapper(VnNotes, {
|
||||
propsData: {
|
||||
url: '/test',
|
||||
body: { name: 'Tony', lastName: 'Stark' },
|
||||
}
|
||||
propsData: options,
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
});
|
||||
vm.newNote.text = text;
|
||||
vm.newNote.observationTypeFk = observationType;
|
||||
}
|
||||
|
||||
function createSpyFetch() {
|
||||
spyFetch = vi.spyOn(vm.$refs.vnPaginateRef, 'fetch');
|
||||
}
|
||||
|
||||
function generateExpectedBody() {
|
||||
expectedInsertBody = {
|
||||
...vm.$props.body,
|
||||
...{ text: vm.newNote.text, observationTypeFk: vm.newNote.observationTypeFk },
|
||||
};
|
||||
expectedUpdateBody = { ...vm.$props.body, ...{ notes: vm.newNote.text } };
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
postMock = vi.spyOn(axios, 'post').mockResolvedValue(mockData);
|
||||
spyFetch = vi.spyOn(vm.vnPaginateRef, 'fetch').mockImplementation(() => vi.fn());
|
||||
postMock = vi.spyOn(axios, 'post');
|
||||
patchMock = vi.spyOn(axios, 'patch');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
expectedBody = {};
|
||||
expectedInsertBody = {};
|
||||
expectedUpdateBody = {};
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe('insert', () => {
|
||||
it('should not call axios.post and vnPaginateRef.fetch if newNote.text is null', async () => {
|
||||
await setTestParams( null, null, true );
|
||||
it('should not call axios.post and vnPaginateRef.fetch when newNote.text is null', async () => {
|
||||
generateWrapper({ selectType: true });
|
||||
createSpyFetch();
|
||||
|
||||
await vm.insert();
|
||||
|
||||
|
@ -53,8 +80,9 @@ describe('VnNotes', () => {
|
|||
expect(spyFetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not call axios.post and vnPaginateRef.fetch if newNote.text is empty', async () => {
|
||||
await setTestParams( "", null, false );
|
||||
it('should not call axios.post and vnPaginateRef.fetch when newNote.text is empty', async () => {
|
||||
generateWrapper(null, '');
|
||||
createSpyFetch();
|
||||
|
||||
await vm.insert();
|
||||
|
||||
|
@ -62,8 +90,9 @@ describe('VnNotes', () => {
|
|||
expect(spyFetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is true', async () => {
|
||||
await setTestParams( "Test Note", null, true );
|
||||
it('should not call axios.post and vnPaginateRef.fetch when observationTypeFk is null and selectType is true', async () => {
|
||||
generateWrapper({ selectType: true }, 'Test Note');
|
||||
createSpyFetch();
|
||||
|
||||
await vm.insert();
|
||||
|
||||
|
@ -71,37 +100,57 @@ describe('VnNotes', () => {
|
|||
expect(spyFetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is false', async () => {
|
||||
await setTestParams( "Test Note", null, false );
|
||||
|
||||
it('should call axios.post and vnPaginateRef.fetch when observationTypeFk is missing and selectType is false', async () => {
|
||||
generateWrapper(null, 'Test Note');
|
||||
createSpyFetch();
|
||||
generateExpectedBody();
|
||||
|
||||
await vm.insert();
|
||||
|
||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
||||
expect(spyFetch).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is setted and selectType is false', async () => {
|
||||
await setTestParams( "Test Note", 1, false );
|
||||
|
||||
generateExpectedBody();
|
||||
|
||||
await vm.insert();
|
||||
|
||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedInsertBody);
|
||||
expect(spyFetch).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call axios.post and vnPaginateRef.fetch when newNote is valid', async () => {
|
||||
await setTestParams( "Test Note", 1, true );
|
||||
|
||||
generateWrapper({ selectType: true }, 'Test Note', 1);
|
||||
createSpyFetch();
|
||||
generateExpectedBody();
|
||||
|
||||
|
||||
await vm.insert();
|
||||
|
||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedInsertBody);
|
||||
expect(spyFetch).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('update', () => {
|
||||
it('should call axios.patch with saveUrl when saveUrl is set and justInput is true', async () => {
|
||||
generateWrapper({
|
||||
url: '/business',
|
||||
justInput: true,
|
||||
saveUrl: '/saveUrlTest',
|
||||
});
|
||||
generateExpectedBody();
|
||||
|
||||
await vm.update();
|
||||
|
||||
expect(patchMock).toHaveBeenCalledWith(vm.$props.saveUrl, expectedUpdateBody);
|
||||
});
|
||||
|
||||
it('should call axios.patch with url when saveUrl is not set and justInput is true', async () => {
|
||||
generateWrapper({
|
||||
url: '/business',
|
||||
body: { workerFk: 1110 },
|
||||
justInput: true,
|
||||
});
|
||||
generateExpectedBody();
|
||||
|
||||
await vm.update();
|
||||
|
||||
expect(patchMock).toHaveBeenCalledWith(
|
||||
`${vm.$props.url}/${vm.$props.body.workerFk}`,
|
||||
expectedUpdateBody,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -74,7 +74,7 @@ onBeforeMount(async () => {
|
|||
() => [$props.url, $props.filter],
|
||||
async () => {
|
||||
if (!isSameDataKey.value) await getData();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -109,7 +109,7 @@ const iconModule = computed(() => route.matched[1].meta.icon);
|
|||
const toModule = computed(() =>
|
||||
route.matched[1].path.split('/').length > 2
|
||||
? route.matched[1].redirect
|
||||
: route.matched[1].children[0].redirect
|
||||
: route.matched[1].children[0].redirect,
|
||||
);
|
||||
</script>
|
||||
|
||||
|
|
|
@ -15,6 +15,10 @@ const props = defineProps({
|
|||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
userFilter: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
entityId: {
|
||||
type: [Number, String],
|
||||
default: null,
|
||||
|
@ -34,6 +38,7 @@ const isSummary = ref();
|
|||
const arrayData = useArrayData(props.dataKey, {
|
||||
url: props.url,
|
||||
filter: props.filter,
|
||||
userFilter: props.userFilter,
|
||||
skip: 0,
|
||||
oneRecord: true,
|
||||
});
|
||||
|
@ -204,4 +209,13 @@ async function fetch() {
|
|||
.summaryHeader {
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.cardSummary :deep(.q-card__section[content]) {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 0;
|
||||
> * {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -114,7 +114,7 @@ async function clearFilters() {
|
|||
arrayData.resetPagination();
|
||||
// Filtrar los params no removibles
|
||||
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
||||
$props.unremovableParams.includes(param)
|
||||
$props.unremovableParams.includes(param),
|
||||
);
|
||||
const newParams = {};
|
||||
// Conservar solo los params que no son removibles
|
||||
|
@ -162,13 +162,13 @@ const formatTags = (tags) => {
|
|||
|
||||
const tags = computed(() => {
|
||||
const filteredTags = tagsList.value.filter(
|
||||
(tag) => !($props.customTags || []).includes(tag.label)
|
||||
(tag) => !($props.customTags || []).includes(tag.label),
|
||||
);
|
||||
return formatTags(filteredTags);
|
||||
});
|
||||
|
||||
const customTags = computed(() =>
|
||||
tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.label))
|
||||
tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.label)),
|
||||
);
|
||||
|
||||
async function remove(key) {
|
||||
|
@ -188,10 +188,13 @@ function formatValue(value) {
|
|||
const getLocale = (label) => {
|
||||
const param = label.split('.').at(-1);
|
||||
const globalLocale = `globals.params.${param}`;
|
||||
const moduleName = route.meta.moduleName;
|
||||
const moduleLocale = `${moduleName.toLowerCase()}.${param}`;
|
||||
if (te(globalLocale)) return t(globalLocale);
|
||||
else if (te(t(`params.${param}`)));
|
||||
else if (te(moduleLocale)) return t(moduleLocale);
|
||||
else {
|
||||
const camelCaseModuleName = route.meta.moduleName.charAt(0).toLowerCase() + route.meta.moduleName.slice(1);
|
||||
const camelCaseModuleName =
|
||||
moduleName.charAt(0).toLowerCase() + moduleName.slice(1);
|
||||
return t(`${camelCaseModuleName}.params.${param}`);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { ref, reactive, useAttrs, computed } from 'vue';
|
||||
import { onBeforeRouteLeave } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
@ -16,12 +16,22 @@ import VnSelect from 'components/common/VnSelect.vue';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
||||
const $attrs = useAttrs();
|
||||
|
||||
const isRequired = computed(() => {
|
||||
return Object.keys($attrs).includes('required')
|
||||
});
|
||||
|
||||
const $props = defineProps({
|
||||
url: { type: String, default: null },
|
||||
saveUrl: {type: String, default: null},
|
||||
filter: { type: Object, default: () => {} },
|
||||
body: { type: Object, default: () => {} },
|
||||
addNote: { type: Boolean, default: false },
|
||||
selectType: { type: Boolean, default: false },
|
||||
justInput: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -29,6 +39,13 @@ const quasar = useQuasar();
|
|||
const newNote = reactive({ text: null, observationTypeFk: null });
|
||||
const observationTypes = ref([]);
|
||||
const vnPaginateRef = ref();
|
||||
let originalText;
|
||||
|
||||
function handleClick(e) {
|
||||
if (e.shiftKey && e.key === 'Enter') return;
|
||||
if ($props.justInput) confirmAndUpdate();
|
||||
else insert();
|
||||
}
|
||||
|
||||
async function insert() {
|
||||
if (!newNote.text || ($props.selectType && !newNote.observationTypeFk)) return;
|
||||
|
@ -41,8 +58,36 @@ async function insert() {
|
|||
await axios.post($props.url, newBody);
|
||||
await vnPaginateRef.value.fetch();
|
||||
}
|
||||
|
||||
function confirmAndUpdate() {
|
||||
if(!newNote.text && originalText)
|
||||
quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('New note is empty'),
|
||||
message: t('Are you sure remove this note?'),
|
||||
},
|
||||
})
|
||||
.onOk(update)
|
||||
.onCancel(() => {
|
||||
newNote.text = originalText;
|
||||
});
|
||||
else update();
|
||||
}
|
||||
|
||||
async function update() {
|
||||
originalText = newNote.text;
|
||||
const body = $props.body;
|
||||
const newBody = {
|
||||
...body,
|
||||
...{ notes: newNote.text },
|
||||
};
|
||||
await axios.patch(`${$props.saveUrl ?? `${$props.url}/${$props.body.workerFk}`}`, newBody);
|
||||
}
|
||||
|
||||
onBeforeRouteLeave((to, from, next) => {
|
||||
if (newNote.text)
|
||||
if ((newNote.text && !$props.justInput) || (newNote.text !== originalText) && $props.justInput)
|
||||
quasar.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
|
@ -53,6 +98,13 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
});
|
||||
else next();
|
||||
});
|
||||
|
||||
function fetchData([ data ]) {
|
||||
newNote.text = data?.notes;
|
||||
originalText = data?.notes;
|
||||
emit('onFetch', data);
|
||||
}
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -62,8 +114,19 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
auto-load
|
||||
@on-fetch="(data) => (observationTypes = data)"
|
||||
/>
|
||||
<QCard class="q-pa-xs q-mb-lg full-width" v-if="$props.addNote">
|
||||
<QCardSection horizontal>
|
||||
<FetchData
|
||||
v-if="justInput"
|
||||
:url="url"
|
||||
:filter="filter"
|
||||
@on-fetch="fetchData"
|
||||
auto-load
|
||||
/>
|
||||
<QCard
|
||||
class="q-pa-xs q-mb-lg full-width"
|
||||
:class="{ 'just-input': $props.justInput }"
|
||||
v-if="$props.addNote || $props.justInput"
|
||||
>
|
||||
<QCardSection horizontal v-if="!$props.justInput">
|
||||
{{ t('New note') }}
|
||||
</QCardSection>
|
||||
<QCardSection class="q-px-xs q-my-none q-py-none">
|
||||
|
@ -75,19 +138,19 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
v-model="newNote.observationTypeFk"
|
||||
option-label="description"
|
||||
style="flex: 0.15"
|
||||
:required="true"
|
||||
:required="isRequired"
|
||||
@keyup.enter.stop="insert"
|
||||
/>
|
||||
<VnInput
|
||||
v-model.trim="newNote.text"
|
||||
type="textarea"
|
||||
:label="t('Add note here...')"
|
||||
:label="$props.justInput && newNote.text ? '' : t('Add note here...')"
|
||||
filled
|
||||
size="lg"
|
||||
autogrow
|
||||
@keyup.enter.stop="insert"
|
||||
@keyup.enter.stop="handleClick"
|
||||
:required="isRequired"
|
||||
clearable
|
||||
:required="true"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
|
@ -95,7 +158,7 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
icon="save"
|
||||
color="primary"
|
||||
flat
|
||||
@click="insert"
|
||||
@click="handleClick"
|
||||
class="q-mb-xs"
|
||||
dense
|
||||
data-cy="saveNote"
|
||||
|
@ -106,6 +169,7 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
</QCardSection>
|
||||
</QCard>
|
||||
<VnPaginate
|
||||
v-if="!$props.justInput"
|
||||
:data-key="$props.url"
|
||||
:url="$props.url"
|
||||
order="created DESC"
|
||||
|
@ -198,6 +262,11 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
.just-input {
|
||||
padding-right: 18px;
|
||||
margin-bottom: 2px;
|
||||
box-shadow: none;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
|
@ -205,4 +274,6 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
New note: Nueva nota
|
||||
Save (Enter): Guardar (Intro)
|
||||
Observation type: Tipo de observación
|
||||
New note is empty: La nueva nota esta vacia
|
||||
Are you sure remove this note?: Estas seguro de quitar esta nota?
|
||||
</i18n>
|
||||
|
|
|
@ -123,7 +123,7 @@ watch(
|
|||
() => props.data,
|
||||
() => {
|
||||
store.data = props.data;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
|
@ -132,12 +132,12 @@ watch(
|
|||
if (!mounted.value) return;
|
||||
emit('onChange', data);
|
||||
},
|
||||
{ immediate: true }
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
watch(
|
||||
() => [props.url, props.filter],
|
||||
([url, filter]) => mounted.value && fetch({ url, filter })
|
||||
([url, filter]) => mounted.value && fetch({ url, filter }),
|
||||
);
|
||||
const addFilter = async (filter, params) => {
|
||||
await arrayData.addFilter({ filter, params });
|
||||
|
@ -198,7 +198,7 @@ function endPagination() {
|
|||
async function onLoad(index, done) {
|
||||
if (!store.data || !mounted.value) return done();
|
||||
|
||||
if (store.data.length === 0 || !props.url) return done(false);
|
||||
if (store.data.length === 0 || !arrayData.store.url) return done(false);
|
||||
|
||||
pagination.value.page = pagination.value.page + 1;
|
||||
|
||||
|
|
|
@ -19,23 +19,26 @@ onMounted(() => {
|
|||
const observer = new MutationObserver(
|
||||
() =>
|
||||
(hasContent.value =
|
||||
actions.value?.childNodes?.length + data.value?.childNodes?.length)
|
||||
actions.value?.childNodes?.length + data.value?.childNodes?.length),
|
||||
);
|
||||
if (actions.value) observer.observe(actions.value, opts);
|
||||
if (data.value) observer.observe(data.value, opts);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => stateStore.toggleSubToolbar());
|
||||
const actionsChildCount = () => !!actions.value?.childNodes?.length;
|
||||
|
||||
onBeforeUnmount(() => stateStore.toggleSubToolbar() && hasSubToolbar);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QToolbar
|
||||
id="subToolbar"
|
||||
class="justify-end sticky"
|
||||
v-show="hasContent || $slots['st-actions'] || $slots['st-data']"
|
||||
class="justify-end sticky"
|
||||
>
|
||||
<slot name="st-data">
|
||||
<div id="st-data"></div>
|
||||
<div id="st-data" :class="{ 'full-width': !actionsChildCount() }">
|
||||
</div>
|
||||
</slot>
|
||||
<QSpace />
|
||||
<slot name="st-actions">
|
||||
|
|
|
@ -94,6 +94,9 @@ export function useArrayData(key, userOptions) {
|
|||
|
||||
if (params.filter.where || exprFilter)
|
||||
params.filter.where = { ...params.filter.where, ...exprFilter };
|
||||
|
||||
if (!params?.filter?.order?.length) delete params?.filter?.order;
|
||||
|
||||
params.filter = JSON.stringify(params.filter);
|
||||
|
||||
store.isLoading = true;
|
||||
|
|
|
@ -212,6 +212,10 @@ select:-webkit-autofill {
|
|||
justify-content: center;
|
||||
}
|
||||
|
||||
.q-card__section[dense] {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
input[type='number'] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
|
|
@ -332,10 +332,13 @@ globals:
|
|||
wasteRecalc: Waste recaclulate
|
||||
operator: Operator
|
||||
parking: Parking
|
||||
vehicleList: Vehicles
|
||||
vehicle: Vehicle
|
||||
unsavedPopup:
|
||||
title: Unsaved changes will be lost
|
||||
subtitle: Are you sure exit without saving?
|
||||
params:
|
||||
description: Description
|
||||
clientFk: Client id
|
||||
salesPersonFk: Sales person
|
||||
warehouseFk: Warehouse
|
||||
|
@ -358,7 +361,13 @@ globals:
|
|||
correctingFk: Rectificative
|
||||
daysOnward: Days onward
|
||||
countryFk: Country
|
||||
countryCodeFk: Country
|
||||
companyFk: Company
|
||||
model: Model
|
||||
fuel: Fuel
|
||||
active: Active
|
||||
inactive: Inactive
|
||||
deliveryPoint: Delivery point
|
||||
errors:
|
||||
statusUnauthorized: Access denied
|
||||
statusInternalServerError: An internal server error has ocurred
|
||||
|
@ -378,7 +387,7 @@ login:
|
|||
loginError: Invalid username or password
|
||||
fieldRequired: This field is required
|
||||
twoFactorRequired: Two-factor verification required
|
||||
twoFactorRequired:
|
||||
twoFactor:
|
||||
validate: Validate
|
||||
insert: Enter the verification code
|
||||
explanation: >-
|
||||
|
@ -457,48 +466,6 @@ ticket:
|
|||
consigneeStreet: Street
|
||||
create:
|
||||
address: Address
|
||||
invoiceOut:
|
||||
card:
|
||||
issued: Issued
|
||||
customerCard: Customer card
|
||||
ticketList: Ticket List
|
||||
summary:
|
||||
issued: Issued
|
||||
dued: Due
|
||||
booked: Booked
|
||||
taxBreakdown: Tax breakdown
|
||||
taxableBase: Taxable base
|
||||
rate: Rate
|
||||
fee: Fee
|
||||
tickets: Tickets
|
||||
totalWithVat: Amount
|
||||
globalInvoices:
|
||||
errors:
|
||||
chooseValidClient: Choose a valid client
|
||||
chooseValidCompany: Choose a valid company
|
||||
chooseValidPrinter: Choose a valid printer
|
||||
chooseValidSerialType: Choose a serial type
|
||||
fillDates: Invoice date and the max date should be filled
|
||||
invoiceDateLessThanMaxDate: Invoice date can not be less than max date
|
||||
invoiceWithFutureDate: Exists an invoice with a future date
|
||||
noTicketsToInvoice: There are not tickets to invoice
|
||||
criticalInvoiceError: 'Critical invoicing error, process stopped'
|
||||
invalidSerialTypeForAll: The serial type must be global when invoicing all clients
|
||||
table:
|
||||
addressId: Address id
|
||||
streetAddress: Street
|
||||
statusCard:
|
||||
percentageText: '{getPercentage}% {getAddressNumber} of {getNAddresses}'
|
||||
pdfsNumberText: '{nPdfs} of {totalPdfs} PDFs'
|
||||
negativeBases:
|
||||
clientId: Client Id
|
||||
base: Base
|
||||
active: Active
|
||||
hasToInvoice: Has to Invoice
|
||||
verifiedData: Verified Data
|
||||
comercial: Comercial
|
||||
errors:
|
||||
downloadCsvFailed: CSV download failed
|
||||
department:
|
||||
chat: Chat
|
||||
bossDepartment: Boss Department
|
||||
|
|
|
@ -332,10 +332,13 @@ globals:
|
|||
wasteRecalc: Recalcular mermas
|
||||
operator: Operario
|
||||
parking: Parking
|
||||
vehicleList: Vehículos
|
||||
vehicle: Vehículo
|
||||
unsavedPopup:
|
||||
title: Los cambios que no haya guardado se perderán
|
||||
subtitle: ¿Seguro que quiere salir sin guardar?
|
||||
params:
|
||||
description: Descripción
|
||||
clientFk: Id cliente
|
||||
salesPersonFk: Comercial
|
||||
warehouseFk: Almacén
|
||||
|
@ -356,6 +359,7 @@ globals:
|
|||
daysOnward: Días adelante
|
||||
packing: ITP
|
||||
countryFk: País
|
||||
countryCodeFk: País
|
||||
companyFk: Empresa
|
||||
errors:
|
||||
statusUnauthorized: Acceso denegado
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import Navbar from 'src/components/NavBar.vue';
|
||||
</script>
|
||||
<template>
|
||||
<QLayout view="hHh LpR fFf" v-shortcut>
|
||||
<QLayout view="hHh LpR fFf">
|
||||
<Navbar />
|
||||
<RouterView></RouterView>
|
||||
<QFooter v-if="$q.platform.is.mobile"></QFooter>
|
||||
|
|
|
@ -86,7 +86,7 @@ watch(
|
|||
() => route.params.id,
|
||||
() => {
|
||||
getAccountData();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
onMounted(async () => await getAccountData(false));
|
||||
|
@ -130,7 +130,8 @@ onMounted(async () => await getAccountData(false));
|
|||
openConfirmationModal(
|
||||
t('User will be removed from alias'),
|
||||
t('¿Seguro que quieres continuar?'),
|
||||
() => deleteMailAlias(row, rows, rowIndex)
|
||||
() =>
|
||||
deleteMailAlias(row, rows, rowIndex),
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -157,7 +158,7 @@ onMounted(async () => await getAccountData(false));
|
|||
icon="add"
|
||||
color="primary"
|
||||
@click="openCreateMailAliasForm()"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
>
|
||||
<QTooltip>{{ t('warehouses.add') }}</QTooltip>
|
||||
</QBtn>
|
||||
|
|
|
@ -63,7 +63,7 @@ watch(
|
|||
store.url = urlPath.value;
|
||||
store.filter = filter.value;
|
||||
fetchSubRoles();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const fetchSubRoles = () => paginateRef.value.fetch();
|
||||
|
@ -109,7 +109,7 @@ const redirectToRoleSummary = (id) =>
|
|||
openConfirmationModal(
|
||||
t('El rol va a ser eliminado'),
|
||||
t('¿Seguro que quieres continuar?'),
|
||||
() => deleteSubRole(row, rows, rowIndex)
|
||||
() => deleteSubRole(row, rows, rowIndex),
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -131,7 +131,7 @@ const redirectToRoleSummary = (id) =>
|
|||
<QBtn
|
||||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
color="primary"
|
||||
@click="openCreateSubRoleForm()"
|
||||
>
|
||||
|
|
|
@ -57,7 +57,6 @@ function onFetch(rows, newRows) {
|
|||
const price = row.quantity * sale.price;
|
||||
const discount = (sale.discount * price) / 100;
|
||||
amountClaimed.value = amountClaimed.value + (price - discount);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,7 +207,6 @@ async function saveWhenHasChanges() {
|
|||
selection="multiple"
|
||||
v-model:selected="selected"
|
||||
:grid="$q.screen.lt.md"
|
||||
|
||||
>
|
||||
<template #body-cell-claimed="{ row }">
|
||||
<QTd auto-width align="right" class="text-primary shrink">
|
||||
|
@ -319,7 +317,13 @@ async function saveWhenHasChanges() {
|
|||
</div>
|
||||
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<QBtn fab color="primary" shortcut="+" icon="add" @click="showImportDialog()" />
|
||||
<QBtn
|
||||
fab
|
||||
color="primary"
|
||||
v-shortcut="'+'"
|
||||
icon="add"
|
||||
@click="showImportDialog()"
|
||||
/>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
|
@ -330,9 +334,10 @@ async function saveWhenHasChanges() {
|
|||
width: 100%;
|
||||
}
|
||||
.grid-style-transition {
|
||||
transition: transform 0.28s, background-color 0.28s;
|
||||
transition:
|
||||
transform 0.28s,
|
||||
background-color 0.28s;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -61,7 +61,7 @@ watch(
|
|||
() => {
|
||||
claimDmsFilter.value.where.id = router.currentRoute.value.params.id;
|
||||
claimDmsRef.value.fetch();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
function openDialog(dmsId) {
|
||||
|
@ -249,7 +249,7 @@ function onDrag() {
|
|||
<QBtn
|
||||
fab
|
||||
@click="inputFile.nativeEl.click()"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
icon="add"
|
||||
color="primary"
|
||||
>
|
||||
|
|
|
@ -61,7 +61,7 @@ watch(
|
|||
(newValue) => {
|
||||
if (!newValue) return;
|
||||
getClientData(newValue);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const getClientData = async (id) => {
|
||||
|
@ -137,7 +137,7 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
<QIcon
|
||||
:style="{
|
||||
'font-variation-settings': `'FILL' ${isDefaultAddress(
|
||||
item
|
||||
item,
|
||||
)}`,
|
||||
}"
|
||||
color="primary"
|
||||
|
@ -150,7 +150,7 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
t(
|
||||
isDefaultAddress(item)
|
||||
? 'Default address'
|
||||
: 'Set as default'
|
||||
: 'Set as default',
|
||||
)
|
||||
}}
|
||||
</QTooltip>
|
||||
|
@ -216,7 +216,7 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ t('New consignee') }}
|
||||
|
|
|
@ -158,7 +158,7 @@ const columns = computed(() => [
|
|||
openConfirmationModal(
|
||||
t('Send compensation'),
|
||||
t('Do you want to report compensation to the client by mail?'),
|
||||
() => sendEmail(`Receipts/${id}/balance-compensation-email`)
|
||||
() => sendEmail(`Receipts/${id}/balance-compensation-email`),
|
||||
),
|
||||
},
|
||||
],
|
||||
|
@ -291,7 +291,7 @@ const showBalancePdf = ({ id }) => {
|
|||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ t('New payment') }}
|
||||
|
|
|
@ -62,7 +62,7 @@ const customerContactsRef = ref(null);
|
|||
color="primary"
|
||||
flat
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Add contact') }}
|
||||
|
|
|
@ -195,7 +195,7 @@ const updateData = () => {
|
|||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ t('New contract') }}
|
||||
|
|
|
@ -199,6 +199,7 @@ const debtWarning = computed(() => {
|
|||
query: {
|
||||
createForm: JSON.stringify({
|
||||
clientFk: entity.id,
|
||||
addressId: entity.defaultAddressFk,
|
||||
}),
|
||||
},
|
||||
}"
|
||||
|
|
|
@ -236,7 +236,7 @@ const toCustomerFileManagementCreate = () => {
|
|||
@click.stop="toCustomerFileManagementCreate()"
|
||||
color="primary"
|
||||
fab
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
icon="add"
|
||||
/>
|
||||
<QTooltip>
|
||||
|
|
|
@ -23,5 +23,6 @@ const noteFilter = computed(() => {
|
|||
:body="{ clientFk: route.params.id }"
|
||||
style="overflow-y: auto"
|
||||
:select-type="true"
|
||||
required
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -104,7 +104,7 @@ const tableRef = ref();
|
|||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ t('Send sample') }}
|
||||
|
|
|
@ -49,7 +49,7 @@ const getData = async (observations) => {
|
|||
notes.value = originalNotes
|
||||
.map((observation) => {
|
||||
const type = observationTypes.value.find(
|
||||
(type) => type.id === observation.observationTypeFk
|
||||
(type) => type.id === observation.observationTypeFk,
|
||||
);
|
||||
return type
|
||||
? {
|
||||
|
@ -112,8 +112,8 @@ function getPayload() {
|
|||
(oNote) =>
|
||||
oNote.id === note.id &&
|
||||
(note.description !== oNote.description ||
|
||||
note.observationTypeFk !== oNote.observationTypeFk)
|
||||
)
|
||||
note.observationTypeFk !== oNote.observationTypeFk),
|
||||
),
|
||||
)
|
||||
.map((note) => ({
|
||||
data: note,
|
||||
|
@ -130,9 +130,7 @@ async function handleDialog(data) {
|
|||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t(
|
||||
'confirmTicket'
|
||||
),
|
||||
title: t('confirmTicket'),
|
||||
message: t('confirmDeletionMessage'),
|
||||
},
|
||||
})
|
||||
|
@ -341,7 +339,7 @@ function handleLocation(data, location) {
|
|||
class="cursor-pointer add-icon q-mt-md"
|
||||
flat
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Add note') }}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import axios from 'axios';
|
||||
|
||||
export async function getAddresses(clientId) {
|
||||
export async function getAddresses(clientId, _filter = {}) {
|
||||
if (!clientId) return;
|
||||
const filter = {
|
||||
..._filter,
|
||||
fields: ['nickname', 'street', 'city', 'id'],
|
||||
where: { isActive: true },
|
||||
order: 'nickname ASC',
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import axios from 'axios';
|
||||
|
||||
export async function getClient(clientId) {
|
||||
export async function getClient(clientId, _filter = {}) {
|
||||
const filter = {
|
||||
..._filter,
|
||||
include: {
|
||||
relation: 'defaultAddress',
|
||||
scope: {
|
||||
|
|
|
@ -56,7 +56,7 @@ const { openConfirmationModal } = useVnConfirm();
|
|||
openConfirmationModal(
|
||||
t('Are you sure you want to delete it?'),
|
||||
t('Delete department'),
|
||||
removeDepartment
|
||||
removeDepartment,
|
||||
)
|
||||
"
|
||||
>
|
||||
|
|
|
@ -17,7 +17,7 @@ const selected = ref([]);
|
|||
|
||||
const sortEntryObservationOptions = (data) => {
|
||||
entryObservationsOptions.value = [...data].sort((a, b) =>
|
||||
a.description.localeCompare(b.description)
|
||||
a.description.localeCompare(b.description),
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -142,7 +142,7 @@ const columns = computed(() => [
|
|||
fab
|
||||
color="primary"
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
@click="entryObservationsRef.insert()"
|
||||
/>
|
||||
</QPageSticky>
|
||||
|
|
|
@ -134,6 +134,7 @@ function downloadCSV(rows) {
|
|||
@click="
|
||||
openReport(`Entries/${entityId}/labelSupplier`)
|
||||
"
|
||||
data-cy="printLabelsBtn"
|
||||
/>
|
||||
</template>
|
||||
<template #body="props">
|
||||
|
|
|
@ -215,7 +215,7 @@ function deleteFile(dmsFk) {
|
|||
v-else
|
||||
icon="add_circle"
|
||||
round
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
padding="xs"
|
||||
@click="
|
||||
() => {
|
||||
|
|
|
@ -232,7 +232,7 @@ async function insert() {
|
|||
<QBtn
|
||||
color="primary"
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
size="lg"
|
||||
round
|
||||
@click="!areRows ? insert() : invoiceInFormRef.insert()"
|
||||
|
|
|
@ -218,7 +218,7 @@ const columns = computed(() => [
|
|||
<QBtn
|
||||
color="primary"
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
size="lg"
|
||||
round
|
||||
@click="invoiceInFormRef.insert()"
|
||||
|
|
|
@ -117,7 +117,7 @@ const isNotEuro = (code) => code != 'EUR';
|
|||
function taxRate(invoiceInTax) {
|
||||
const sageTaxTypeId = invoiceInTax.taxTypeSageFk;
|
||||
const taxRateSelection = sageTaxTypes.value.find(
|
||||
(transaction) => transaction.id == sageTaxTypeId
|
||||
(transaction) => transaction.id == sageTaxTypeId,
|
||||
);
|
||||
const taxTypeSage = taxRateSelection?.rate ?? 0;
|
||||
const taxableBase = invoiceInTax?.taxableBase ?? 0;
|
||||
|
@ -131,14 +131,14 @@ function autocompleteExpense(evt, row, col) {
|
|||
|
||||
const param = isNaN(val) ? row[col.model] : val;
|
||||
const lookup = expenses.value.find(
|
||||
({ id }) => id == useAccountShortToStandard(param)
|
||||
({ id }) => id == useAccountShortToStandard(param),
|
||||
);
|
||||
|
||||
expenseRef.value.vnSelectDialogRef.vnSelectRef.toggleOption(lookup);
|
||||
}
|
||||
|
||||
const taxableBaseTotal = computed(() => {
|
||||
return getTotal(invoiceInFormRef.value.formData, 'taxableBase', );
|
||||
const taxableBaseTotal = computed(() => {
|
||||
return getTotal(invoiceInFormRef.value.formData, 'taxableBase');
|
||||
});
|
||||
|
||||
const taxRateTotal = computed(() => {
|
||||
|
@ -147,13 +147,9 @@ const taxRateTotal = computed(() => {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
const combinedTotal = computed(() => {
|
||||
return +taxableBaseTotal.value + +taxRateTotal.value;
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -283,7 +279,7 @@ const combinedTotal = computed(() => {
|
|||
row.taxableBase = await getExchange(
|
||||
val,
|
||||
row.currencyFk,
|
||||
invoiceIn.issued
|
||||
invoiceIn.issued,
|
||||
);
|
||||
}
|
||||
"
|
||||
|
@ -426,7 +422,7 @@ const combinedTotal = computed(() => {
|
|||
color="primary"
|
||||
icon="add"
|
||||
size="lg"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
round
|
||||
@click="invoiceInFormRef.insert()"
|
||||
>
|
||||
|
|
|
@ -177,7 +177,7 @@ const cols = computed(() => [
|
|||
:required="true"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('invoicein.list.supplierRef')"
|
||||
:label="t('invoiceIn.list.supplierRef')"
|
||||
v-model="data.supplierRef"
|
||||
/>
|
||||
<VnSelect
|
||||
|
@ -190,7 +190,7 @@ const cols = computed(() => [
|
|||
:required="true"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('invoicein.summary.issued')"
|
||||
:label="t('invoiceIn.summary.issued')"
|
||||
v-model="data.issued"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -92,7 +92,7 @@ const submit = async (rows) => {
|
|||
class="cursor-pointer fill-icon-on-hover"
|
||||
color="primary"
|
||||
icon="add_circle"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
>
|
||||
<QTooltip>
|
||||
|
|
|
@ -125,7 +125,7 @@ onMounted(async () => {
|
|||
inventoriedDate.value =
|
||||
(await axios.get('Configs/findOne')).data?.inventoried || today;
|
||||
|
||||
if (query.warehouseFk) ref.warehouseFk = query.warehouseFk;
|
||||
if (query.warehouseFk) ref.warehouseFk = +query.warehouseFk;
|
||||
else if (!ref.warehouseFk && user.value) ref.warehouseFk = user.value.warehouseFk;
|
||||
if (ref.date) showWhatsBeforeInventory.value = true;
|
||||
ref.itemFk = route.params.id;
|
||||
|
@ -143,7 +143,7 @@ onMounted(async () => {
|
|||
const fetchItemBalances = async () => await arrayDataItemBalances.fetch({});
|
||||
|
||||
const getBadgeAttrs = (_date) => {
|
||||
const isSameDate = date.isSameDate(today.value, _date);
|
||||
const isSameDate = date.isSameDate(today, _date);
|
||||
const attrs = {
|
||||
'text-color': isSameDate ? 'black' : 'white',
|
||||
color: isSameDate ? 'warning' : 'transparent',
|
||||
|
@ -153,8 +153,6 @@ const getBadgeAttrs = (_date) => {
|
|||
|
||||
const scrollToToday = async () => {
|
||||
await nextTick();
|
||||
const today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const todayCell = document.querySelector(`td[data-date="${today.toISOString()}"]`);
|
||||
if (todayCell) {
|
||||
todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
|
|
|
@ -175,7 +175,7 @@ const insertTag = (rows) => {
|
|||
@click="insertTag(rows)"
|
||||
color="primary"
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
fab
|
||||
>
|
||||
<QTooltip>
|
||||
|
|
|
@ -5,6 +5,9 @@ import VnTable from 'components/VnTable/VnTable.vue';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
|
@ -60,20 +63,17 @@ const columns = computed(() => [
|
|||
label: t('code'),
|
||||
isTitle: true,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'name',
|
||||
label: t('globals.name'),
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('worker'),
|
||||
name: 'workerFk',
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/search',
|
||||
|
@ -100,7 +100,6 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
name: 'categoryFk',
|
||||
label: t('ItemCategory'),
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
options: itemCategoriesOptions.value,
|
||||
|
@ -112,7 +111,6 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
name: 'Temperature',
|
||||
label: t('Temperature'),
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
options: temperatureOptions.value,
|
||||
|
@ -180,6 +178,29 @@ const columns = computed(() => [
|
|||
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnInput v-model="data.code" :label="t('code')" data-cy="codeInput" />
|
||||
<VnInput
|
||||
v-model="data.name"
|
||||
:label="t('globals.name')"
|
||||
data-cy="nameInput"
|
||||
/>
|
||||
<VnSelectWorker v-model="data.workerFk" />
|
||||
<VnSelect
|
||||
:label="t('ItemCategory')"
|
||||
v-model="data.categoryFk"
|
||||
:options="itemCategoriesOptions"
|
||||
hide-selected
|
||||
data-cy="itemCategorySelect"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('Temperature')"
|
||||
v-model="data.temperatureFk"
|
||||
:options="temperatureOptions"
|
||||
hide-selected
|
||||
data-cy="temperatureSelect"
|
||||
/>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
</VnSection>
|
||||
|
|
|
@ -293,7 +293,7 @@ const columns = computed(() => [
|
|||
title: t('globals.preview'),
|
||||
icon: 'preview',
|
||||
color: 'primary',
|
||||
action: (row) => viewSummary(row.id, TicketSummary),
|
||||
action: (row) => viewSummary(row.id, TicketSummary, 'lg-width'),
|
||||
isPrimary: true,
|
||||
attrs: {
|
||||
flat: true,
|
||||
|
|
|
@ -38,6 +38,7 @@ salesTicketsTable:
|
|||
payMethod: Pay method
|
||||
department: Department
|
||||
packing: ITP
|
||||
hasItemLost: Item lost
|
||||
searchBar:
|
||||
label: Search tickets
|
||||
info: Search tickets by id or alias
|
||||
|
|
|
@ -39,6 +39,7 @@ salesTicketsTable:
|
|||
payMethod: Método de pago
|
||||
department: Departamento
|
||||
packing: ITP
|
||||
hasItemLost: Artículo perdido
|
||||
searchBar:
|
||||
label: Buscar tickets
|
||||
info: Buscar tickets por identificador o alias
|
||||
|
|
|
@ -110,7 +110,7 @@ const getSelectedTagValues = async (tag) => {
|
|||
</div>
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
class="filter-icon q-mb-md"
|
||||
size="md"
|
||||
|
|
|
@ -22,7 +22,6 @@ const catalogParams = {
|
|||
};
|
||||
const arrayData = useArrayData(dataKey, {
|
||||
url: 'Orders/CatalogFilter',
|
||||
limit: 50,
|
||||
userParams: catalogParams,
|
||||
});
|
||||
const store = arrayData.store;
|
||||
|
@ -66,7 +65,7 @@ function extractValueTags(items) {
|
|||
.filter((k) => /^value\d+$/.test(k))
|
||||
.map((v) => x[v])
|
||||
.filter((v) => v)
|
||||
.sort()
|
||||
.sort(),
|
||||
);
|
||||
tagValue.value = resultValueTags;
|
||||
}
|
||||
|
@ -76,7 +75,7 @@ watch(
|
|||
(val) => {
|
||||
extractTags(val);
|
||||
},
|
||||
{ immediate: true }
|
||||
{ immediate: true },
|
||||
);
|
||||
</script>
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ function addOrder(value, field, params) {
|
|||
{{
|
||||
t(
|
||||
categoryList.find((c) => c.id == customTag.value)?.name ||
|
||||
''
|
||||
'',
|
||||
)
|
||||
}}
|
||||
</strong>
|
||||
|
@ -296,7 +296,7 @@ function addOrder(value, field, params) {
|
|||
<template #append>
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
color="primary"
|
||||
size="md"
|
||||
|
|
|
@ -81,7 +81,7 @@ const columns = computed(() => [
|
|||
label: t('module.created'),
|
||||
component: 'date',
|
||||
cardVisible: true,
|
||||
format: (row) => toDateTimeFormat(row?.landed),
|
||||
format: (row) => toDateTimeFormat(row?.created),
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
|
|
|
@ -88,7 +88,7 @@ async function deleteWorCenter(id) {
|
|||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky :offset="[18, 18]">
|
||||
<QBtn @click.stop="dialog.show()" color="primary" fab shortcut="+" icon="add">
|
||||
<QBtn @click.stop="dialog.show()" color="primary" fab v-shortcut="'+'" icon="add">
|
||||
<QDialog ref="dialog">
|
||||
<FormModelPopup
|
||||
:title="t('Add work center')"
|
||||
|
|
|
@ -3,14 +3,17 @@ import axios from 'axios';
|
|||
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
|
||||
|
||||
vi.mock('axios');
|
||||
const response = { data: [{ agencyModeFk: 'Agency1' }, { agencyModeFk: 'Agency2' }] };
|
||||
axios.get.mockResolvedValue(response);
|
||||
|
||||
describe('getAgencies', () => {
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
const generateParams = (formData) => ({
|
||||
const generateParams = (formData, filter = {}) => ({
|
||||
params: {
|
||||
filter: JSON.stringify(filter),
|
||||
warehouseFk: formData.warehouseId,
|
||||
addressFk: formData.addressId,
|
||||
landed: formData.landed,
|
||||
|
@ -23,10 +26,15 @@ describe('getAgencies', () => {
|
|||
addressId: '456',
|
||||
landed: 'true',
|
||||
};
|
||||
const filter = {
|
||||
fields: ['nickname', 'street', 'city', 'id'],
|
||||
where: { isActive: true },
|
||||
order: 'nickname ASC',
|
||||
};
|
||||
|
||||
await getAgencies(formData);
|
||||
await getAgencies(formData, null, filter);
|
||||
|
||||
expect(axios.get).toHaveBeenCalledWith('Agencies/getAgenciesWithWarehouse', generateParams(formData));
|
||||
expect(axios.get).toHaveBeenCalledWith('Agencies/getAgenciesWithWarehouse', generateParams(formData, filter));
|
||||
});
|
||||
|
||||
it('should not call API when formData is missing required landed field', async () => {
|
||||
|
@ -52,4 +60,23 @@ describe('getAgencies', () => {
|
|||
|
||||
expect(axios.get).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should return options and agency when default agency is found', async () => {
|
||||
const formData = { warehouseId: '123', addressId: '456', landed: 'true' };
|
||||
const client = { defaultAddress: { agencyModeFk: 'Agency1' } };
|
||||
|
||||
const { options, agency } = await getAgencies(formData, client);
|
||||
|
||||
expect(options).toEqual(response.data);
|
||||
expect(agency).toEqual(response.data[0]);
|
||||
});
|
||||
|
||||
it('should return options and agency when client is not provided', async () => {
|
||||
const formData = { warehouseId: '123', addressId: '456', landed: 'true' };
|
||||
|
||||
const { options, agency } = await getAgencies(formData);
|
||||
|
||||
expect(options).toEqual(response.data);
|
||||
expect(agency).toBeNull();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,12 +1,26 @@
|
|||
import axios from 'axios';
|
||||
import agency from 'src/router/modules/agency';
|
||||
|
||||
export async function getAgencies(formData) {
|
||||
export async function getAgencies(formData, client, _filter = {}) {
|
||||
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
|
||||
|
||||
const filter = {
|
||||
..._filter
|
||||
};
|
||||
|
||||
let defaultAgency = null;
|
||||
let params = {
|
||||
filter: JSON.stringify(filter),
|
||||
warehouseFk: formData.warehouseId,
|
||||
addressFk: formData.addressId,
|
||||
landed: formData.landed,
|
||||
};
|
||||
|
||||
return await axios.get('Agencies/getAgenciesWithWarehouse', { params });
|
||||
const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params });
|
||||
|
||||
if(data && client) {
|
||||
defaultAgency = data.find((agency) => agency.agencyModeFk === client.defaultAddress.agencyModeFk );
|
||||
};
|
||||
|
||||
return {options: data, agency: defaultAgency}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ const emit = defineEmits(['search']);
|
|||
<VnSelect
|
||||
:label="t('Vehicle')"
|
||||
v-model="params.vehicleFk"
|
||||
url="Vehicles"
|
||||
url="Vehicles/active"
|
||||
sort-by="numberPlate ASC"
|
||||
option-value="id"
|
||||
option-label="numberPlate"
|
||||
|
|
|
@ -59,7 +59,7 @@ const onSave = (data, response) => {
|
|||
<VnSelect
|
||||
:label="t('Vehicle')"
|
||||
v-model="data.vehicleFk"
|
||||
url="Vehicles"
|
||||
url="Vehicles/active"
|
||||
sort-by="numberPlate ASC"
|
||||
option-value="id"
|
||||
option-label="numberPlate"
|
||||
|
|
|
@ -68,7 +68,7 @@ const updateDefaultStop = (data) => {
|
|||
<QBtn
|
||||
flat
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="roadmapStopsCrudRef.insert()"
|
||||
|
|
|
@ -96,8 +96,7 @@ const columns = computed(() => [
|
|||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'vehicles',
|
||||
fields: ['id', 'numberPlate'],
|
||||
url: 'vehicles/active',
|
||||
optionLabel: 'numberPlate',
|
||||
optionFilterValue: 'numberPlate',
|
||||
find: {
|
||||
|
|
|
@ -120,8 +120,8 @@ const deletePriorities = async () => {
|
|||
try {
|
||||
await Promise.all(
|
||||
selectedRows.value.map((ticket) =>
|
||||
axios.patch(`Tickets/${ticket?.id}/`, { priority: null })
|
||||
)
|
||||
axios.patch(`Tickets/${ticket?.id}/`, { priority: null }),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
refreshKey.value++;
|
||||
|
@ -132,8 +132,8 @@ const setOrderedPriority = async () => {
|
|||
try {
|
||||
await Promise.all(
|
||||
ticketList.value.map((ticket, index) =>
|
||||
axios.patch(`Tickets/${ticket?.id}/`, { priority: index + 1 })
|
||||
)
|
||||
axios.patch(`Tickets/${ticket?.id}/`, { priority: index + 1 }),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
refreshKey.value++;
|
||||
|
@ -162,7 +162,7 @@ const setHighestPriority = async (ticket, ticketList) => {
|
|||
const goToBuscaman = async (ticket = null) => {
|
||||
await openBuscaman(
|
||||
routeEntity.value?.vehicleFk,
|
||||
ticket ? [ticket] : selectedRows.value
|
||||
ticket ? [ticket] : selectedRows.value,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -393,7 +393,13 @@ const openSmsDialog = async () => {
|
|||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn fab icon="add" shortcut="+" color="primary" @click="openTicketsDialog">
|
||||
<QBtn
|
||||
fab
|
||||
icon="add"
|
||||
v-shortcut="'+'"
|
||||
color="primary"
|
||||
@click="openTicketsDialog"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Add ticket') }}
|
||||
</QTooltip>
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
|
||||
const warehouses = ref([]);
|
||||
const companies = ref([]);
|
||||
const countries = ref([]);
|
||||
const fuelTypes = ref([]);
|
||||
const bankPolicies = ref([]);
|
||||
const deliveryPoints = ref([]);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
@on-fetch="(data) => (warehouses = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Companies"
|
||||
:filter="{ fields: ['id', 'code'] }"
|
||||
@on-fetch="(data) => (companies = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Countries"
|
||||
:filter="{ fields: ['code'] }"
|
||||
@on-fetch="(data) => (countries = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="FuelTypes"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
@on-fetch="(data) => (fuelTypes = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="DeliveryPoints"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
@on-fetch="(data) => (deliveryPoints = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FormModel model="Vehicle" :url-update="`Vehicles/${$route.params.id}`">
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
<VnInput v-model="data.description" :label="$t('globals.description')" />
|
||||
<VnInput v-model="data.numberPlate" :label="$t('vehicle.numberPlate')" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
v-model="data.model"
|
||||
:label="$t('globals.model')"
|
||||
:required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
url="VehicleTypes"
|
||||
v-model="data.vehicleTypeFk"
|
||||
:label="$t('globals.type')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
v-model="data.tradeMark"
|
||||
:label="$t('vehicle.tradeMark')"
|
||||
:required="true"
|
||||
/>
|
||||
<VnInput v-model="data.chassis" :label="$t('vehicle.chassis')" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
v-model="data.fuelTypeFk"
|
||||
:label="$t('globals.fuel')"
|
||||
:options="fuelTypes"
|
||||
/>
|
||||
<VnSelect
|
||||
v-model="data.deliveryPointFk"
|
||||
:label="$t('globals.deliveryPoint')"
|
||||
:options="deliveryPoints"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
v-model="data.companyFk"
|
||||
:label="$t('globals.company')"
|
||||
:options="companies"
|
||||
option-label="code"
|
||||
/>
|
||||
<VnSelect
|
||||
v-model="data.warehouseFk"
|
||||
:label="$t('globals.warehouse')"
|
||||
:options="warehouses"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
url="Suppliers"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
v-model="data.supplierFk"
|
||||
:label="$t('globals.supplier')"
|
||||
/>
|
||||
<VnSelect
|
||||
url="Suppliers"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
v-model="data.supplierCoolerFk"
|
||||
:label="$t('vehicle.supplierCooler')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
url="BankPolicies"
|
||||
:filter="{ fields: ['id', 'ref'] }"
|
||||
v-model="data.bankPolicyFk"
|
||||
:label="$t('vehicle.leasing')"
|
||||
:options="bankPolicies"
|
||||
option-label="ref"
|
||||
option-value="id"
|
||||
/>
|
||||
<VnInput v-model="data.leasing" :label="$t('vehicle.nLeasing')" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInputNumber v-model="data.import" :label="$t('globals.amount')" />
|
||||
<VnInputNumber
|
||||
v-model="data.importCooler"
|
||||
:label="$t('vehicle.amountCooler')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
url="Ppes"
|
||||
option-label="id"
|
||||
v-model="data.ppeFk"
|
||||
:label="$t('vehicle.ppe')"
|
||||
/>
|
||||
<VnSelect
|
||||
v-model="data.countryCodeFk"
|
||||
:label="$t('globals.country')"
|
||||
:options="countries"
|
||||
option-label="code"
|
||||
option-value="code"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput v-model="data.vin" :label="$t('vehicle.vin')" />
|
||||
<span :style="{ 'align-self': $q.screen.gt.xs ? 'end' : 'unset' }">
|
||||
<QCheckbox
|
||||
v-model="data.isActive"
|
||||
:label="$t('vehicle.isActive')"
|
||||
:false-value="0"
|
||||
:true-value="1"
|
||||
dense
|
||||
class="q-mt-sm"
|
||||
/>
|
||||
</span>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
</template>
|
|
@ -0,0 +1,13 @@
|
|||
<script setup>
|
||||
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||
import VehicleDescriptor from './VehicleDescriptor.vue';
|
||||
import VehicleFilter from '../VehicleFilter.js';
|
||||
</script>
|
||||
<template>
|
||||
<VnCardBeta
|
||||
data-key="Vehicle"
|
||||
base-url="Vehicles"
|
||||
:filter="VehicleFilter"
|
||||
:descriptor="VehicleDescriptor"
|
||||
/>
|
||||
</template>
|
|
@ -0,0 +1,50 @@
|
|||
<script setup>
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
const { notify } = useNotify();
|
||||
</script>
|
||||
<template>
|
||||
<CardDescriptor
|
||||
:url="`Vehicles/${$route.params.id}`"
|
||||
module="Vehicle"
|
||||
data-key="Vehicle"
|
||||
title="numberPlate"
|
||||
:to-module="{ name: 'VehicleList' }"
|
||||
>
|
||||
<template #menu="{ entity }">
|
||||
<QItem
|
||||
data-cy="delete"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="
|
||||
async () => {
|
||||
try {
|
||||
await axios.delete(`Vehicles/${entity.id}`);
|
||||
notify('vehicle.remove', 'positive');
|
||||
$router.push({ name: 'VehicleList' });
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
"
|
||||
>
|
||||
<QItemSection>
|
||||
{{ $t('vehicle.delete') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="$t('vehicle.numberPlate')" :value="entity.numberPlate" />
|
||||
<VnLv :label="$t('vehicle.tradeMark')" :value="entity.tradeMark" />
|
||||
<VnLv :label="$t('globals.model')" :value="entity.model" />
|
||||
<VnLv :label="$t('globals.country')" :value="entity.countryCodeFk" />
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
Vehicle removed: Vehículo eliminado
|
||||
</i18n>
|
|
@ -0,0 +1,127 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
import VehicleFilter from '../VehicleFilter.js';
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
|
||||
const props = defineProps({ id: { type: [Number, String], default: null } });
|
||||
|
||||
const route = useRoute();
|
||||
const entityId = computed(() => props.id || +route.params.id);
|
||||
const links = {
|
||||
'basic-data': `#/vehicle/${entityId.value}/basic-data`,
|
||||
notes: `#/vehicle/${entityId.value}/notes`,
|
||||
dms: `#/vehicle/${entityId.value}/dms`,
|
||||
'invoice-in': `#/vehicle/${entityId.value}/invoice-in`,
|
||||
events: `#/vehicle/${entityId.value}/events`,
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<CardSummary data-key="Vehicle" :url="`Vehicles/${entityId}`" :filter="VehicleFilter">
|
||||
<template #header="{ entity }">
|
||||
<div>{{ entity.id }} - {{ entity.numberPlate }}</div>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<QCard class="vn-one">
|
||||
<QCardSection dense>
|
||||
<VnTitle
|
||||
:url="links['basic-data']"
|
||||
:text="$t('globals.pageTitles.basicData')"
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardSection content>
|
||||
<QList dense>
|
||||
<VnLv
|
||||
:label="$t('globals.description')"
|
||||
:value="entity.description"
|
||||
/>
|
||||
<VnLv
|
||||
:label="$t('vehicle.tradeMark')"
|
||||
:value="entity.tradeMark"
|
||||
/>
|
||||
<VnLv :label="$t('globals.model')" :value="entity.model" />
|
||||
<VnLv :label="$t('globals.supplier')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
{{ entity.supplier?.name }}
|
||||
<SupplierDescriptorProxy :id="entity.supplierFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="$t('vehicle.supplierCooler')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
{{ entity.supplierCooler?.name }}
|
||||
<SupplierDescriptorProxy
|
||||
:id="entity.supplierCoolerFk"
|
||||
/>
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="$t('vehicle.vin')" :value="entity.vin" />
|
||||
</QList>
|
||||
<QList dense>
|
||||
<VnLv :label="$t('vehicle.chassis')" :value="entity.chassis" />
|
||||
<VnLv
|
||||
:label="$t('globals.fuel')"
|
||||
:value="entity.fuelType?.name"
|
||||
/>
|
||||
<VnLv :label="$t('vehicle.ppe')" :value="entity.ppeFk" />
|
||||
<VnLv :label="$t('vehicle.nLeasing')" :value="entity.leasing" />
|
||||
<VnLv
|
||||
:label="$t('vehicle.leasing')"
|
||||
:value="entity.bankPolicy?.ref"
|
||||
>
|
||||
<template #value>
|
||||
<span v-text="dashIfEmpty(entity.bankPolicy?.name)" />
|
||||
<QBtn
|
||||
v-if="entity.bankPolicy?.dmsFk"
|
||||
class="q-ml-xs"
|
||||
color="primary"
|
||||
flat
|
||||
dense
|
||||
icon="cloud_download"
|
||||
@click="downloadFile(entity.bankPolicy?.dmsFk)"
|
||||
>
|
||||
<QTooltip>{{ $t('globals.download') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="$t('globals.amount')" :value="entity.import" />
|
||||
</QList>
|
||||
<QList dense>
|
||||
<VnLv
|
||||
:label="$t('globals.warehouse')"
|
||||
:value="entity.warehouse?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="$t('globals.company')"
|
||||
:value="entity.company?.code"
|
||||
/>
|
||||
<VnLv
|
||||
:label="$t('globals.deliveryPoint')"
|
||||
:value="entity.deliveryPoint?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="$t('globals.country')"
|
||||
:value="entity.countryCodeFk"
|
||||
/>
|
||||
<VnLv
|
||||
:label="$t('vehicle.isKmTruckRate')"
|
||||
:value="!!entity.isKmTruckRate"
|
||||
/>
|
||||
<VnLv
|
||||
:label="$t('vehicle.isActive')"
|
||||
:value="!!entity.isActive"
|
||||
/>
|
||||
</QList>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
|
@ -0,0 +1,76 @@
|
|||
export default {
|
||||
fields: [
|
||||
'id',
|
||||
'description',
|
||||
'isActive',
|
||||
'isKmTruckRate',
|
||||
'warehouseFk',
|
||||
'companyFk',
|
||||
'numberPlate',
|
||||
'chassis',
|
||||
'supplierFk',
|
||||
'supplierCoolerFk',
|
||||
'tradeMark',
|
||||
'fuelTypeFk',
|
||||
'import',
|
||||
'importCooler',
|
||||
'vin',
|
||||
'model',
|
||||
'ppeFk',
|
||||
'countryCodeFk',
|
||||
'leasing',
|
||||
'bankPolicyFk',
|
||||
'vehicleTypeFk',
|
||||
'deliveryPointFk',
|
||||
],
|
||||
include: [
|
||||
{
|
||||
relation: 'warehouse',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'company',
|
||||
scope: {
|
||||
fields: ['id', 'code'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'supplier',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'supplierCooler',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'fuelType',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'bankPolicy',
|
||||
scope: {
|
||||
fields: ['id', 'ref', 'dmsFk'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'ppe',
|
||||
scope: {
|
||||
fields: ['id'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'deliveryPoint',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
|
@ -0,0 +1,224 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import VehicleSummary from 'src/pages/Route/Vehicle/Card/VehicleSummary.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const warehouses = ref([]);
|
||||
const companies = ref([]);
|
||||
const countries = ref([]);
|
||||
const vehicleStates = ref([]);
|
||||
const vehicleTypes = ref([]);
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'isActive',
|
||||
columnFilter: false,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'id',
|
||||
label: t('globals.id'),
|
||||
isId: true,
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
label: t('globals.description'),
|
||||
},
|
||||
{
|
||||
name: 'tradeMark',
|
||||
label: t('vehicle.tradeMark'),
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'numberPlate',
|
||||
label: t('vehicle.numberPlate'),
|
||||
isTitle: true,
|
||||
},
|
||||
{
|
||||
name: 'vehicleTypeFk',
|
||||
label: t('globals.type'),
|
||||
format: (row) => row.type,
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
name: 'vehicleTypeFk',
|
||||
options: vehicleTypes.value,
|
||||
},
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'vehicleStateFk',
|
||||
label: t('globals.state'),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
name: 'vehicleStateFk',
|
||||
optionLabel: 'state',
|
||||
options: vehicleStates.value,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.state),
|
||||
},
|
||||
{
|
||||
name: 'chassis',
|
||||
label: t('vehicle.chassis'),
|
||||
},
|
||||
{
|
||||
name: 'leasing',
|
||||
label: t('vehicle.leasing'),
|
||||
},
|
||||
{
|
||||
name: 'warehouseFk',
|
||||
label: t('globals.warehouse'),
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.warehouse),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
name: 'warehouseFk',
|
||||
options: warehouses.value,
|
||||
},
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'companyFk',
|
||||
label: t('globals.company'),
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.company),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
name: 'companyFk',
|
||||
optionLabel: 'code',
|
||||
options: companies.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'countryCodeFk',
|
||||
label: t('globals.country'),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
name: 'countryCodeFk',
|
||||
optionValue: 'code',
|
||||
optionLabel: 'code',
|
||||
options: countries.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('components.smartCard.openSummary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row.id, VehicleSummary),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
@on-fetch="(data) => (warehouses = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Companies"
|
||||
:filter="{ fields: ['id', 'code'] }"
|
||||
@on-fetch="(data) => (companies = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Countries"
|
||||
:filter="{ fields: ['code'] }"
|
||||
@on-fetch="(data) => (countries = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="VehicleStates"
|
||||
:filter="{ fields: ['id', 'state'] }"
|
||||
@on-fetch="(data) => (vehicleStates = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="VehicleTypes"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
@on-fetch="(data) => (vehicleTypes = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnSection
|
||||
data-key="VehicleList"
|
||||
:columns="columns"
|
||||
prefix="vehicle"
|
||||
:array-data-props="{
|
||||
url: 'Vehicles/filter',
|
||||
}"
|
||||
>
|
||||
<template #body>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="VehicleList"
|
||||
:columns="columns"
|
||||
redirect="route/vehicle"
|
||||
:create="{
|
||||
urlCreate: 'Vehicles',
|
||||
title: t('vehicle.create'),
|
||||
onDataSaved: ({ id }) => $refs.tableRef.redirect(id),
|
||||
formInitialData: { isActive: true, isKmTruckRate: false },
|
||||
}"
|
||||
:use-model="true"
|
||||
:right-search="false"
|
||||
>
|
||||
<template #column-isActive="{ row }">
|
||||
<span>
|
||||
<QIcon
|
||||
v-if="!row.isActive"
|
||||
name="vn:inactive-car"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ $t('globals.inactive') }}</QTooltip>
|
||||
</QIcon>
|
||||
</span>
|
||||
</template>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnInput
|
||||
v-model="data.numberPlate"
|
||||
:label="$t('vehicle.numberPlate')"
|
||||
:uppercase="true"
|
||||
/>
|
||||
<VnInput v-model="data.tradeMark" :label="$t('vehicle.tradeMark')" />
|
||||
<VnInput v-model="data.model" :label="$t('globals.model')" />
|
||||
<VnSelect
|
||||
v-model="data.vehicleTypeFk"
|
||||
:label="$t('globals.type')"
|
||||
:options="vehicleTypes"
|
||||
/>
|
||||
<VnSelect
|
||||
v-model="data.warehouseFk"
|
||||
:label="$t('globals.warehouse')"
|
||||
:options="warehouses"
|
||||
/>
|
||||
<VnSelect
|
||||
v-model="data.countryCodeFk"
|
||||
:label="$t('globals.country')"
|
||||
option-value="code"
|
||||
option-label="code"
|
||||
:options="countries"
|
||||
/>
|
||||
<VnInput
|
||||
v-model="data.description"
|
||||
:label="$t('globals.description')"
|
||||
/>
|
||||
<QCheckbox to v-model="data.isActive" :label="$t('globals.active')" />
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
</VnSection>
|
||||
</template>
|
|
@ -0,0 +1,20 @@
|
|||
vehicle:
|
||||
tradeMark: Trade Mark
|
||||
numberPlate: Nº Plate
|
||||
chassis: Chassis
|
||||
leasing: Leasing
|
||||
isKmTruckRate: Trailer
|
||||
delete: Delete Vehicle
|
||||
supplierCooler: Supplier Cooler
|
||||
vin: VIN
|
||||
ppe: Ppe
|
||||
isActive: Active
|
||||
nLeasing: Nº Leasing
|
||||
create: Create Vehicle
|
||||
amountCooler: Amount cooler
|
||||
remove: Vehicle removed
|
||||
search: Search Vehicle
|
||||
searchInfo: Search by id or number plate
|
||||
params:
|
||||
vehicleTypeFk: Type
|
||||
vehicleStateFk: State
|
|
@ -0,0 +1,20 @@
|
|||
vehicle:
|
||||
tradeMark: Marca
|
||||
numberPlate: Matrícula
|
||||
chassis: Nº de bastidor
|
||||
leasing: Leasing
|
||||
isKmTruckRate: Trailer
|
||||
delete: Eliminar vehículo
|
||||
supplierCooler: Proveedor Frío
|
||||
vin: VIN
|
||||
ppe: Nº Inmovilizado
|
||||
create: Crear vehículo
|
||||
amountCooler: Importe frío
|
||||
isActive: Activo
|
||||
nLeasing: Nº leasing
|
||||
remove: Vehículo eliminado
|
||||
search: Buscar Vehículo
|
||||
searchInfo: Buscar por id o matrícula
|
||||
params:
|
||||
vehicleTypeFk: Tipo
|
||||
vehicleStateFk: Estado
|
|
@ -72,7 +72,7 @@ function navigate(id) {
|
|||
</div>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<RouterLink :to="{ name: 'ShelvingCreate' }">
|
||||
<QBtn fab icon="add" color="primary" shortcut="+" />
|
||||
<QBtn fab icon="add" color="primary" v-shortcut="'+'" />
|
||||
<QTooltip>
|
||||
{{ $t('shelving.list.newShelving') }}
|
||||
</QTooltip>
|
||||
|
|
|
@ -71,7 +71,7 @@ function bankEntityFilter(val, update) {
|
|||
filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
|
||||
(bank) =>
|
||||
bank.bic.toLowerCase().startsWith(needle) ||
|
||||
bank.name.toLowerCase().includes(needle)
|
||||
bank.name.toLowerCase().includes(needle),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ function bankEntityFilter(val, update) {
|
|||
<QIcon name="info" class="cursor-pointer">
|
||||
<QTooltip>{{
|
||||
t(
|
||||
'Name of the bank account holder if different from the provider'
|
||||
'Name of the bank account holder if different from the provider',
|
||||
)
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
|
@ -194,7 +194,7 @@ function bankEntityFilter(val, update) {
|
|||
<QBtn
|
||||
flat
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="supplierAccountRef.insert()"
|
||||
|
|
|
@ -89,7 +89,7 @@ const redirectToUpdateView = (addressData) => {
|
|||
icon="add"
|
||||
color="primary"
|
||||
@click="redirectToCreateView()"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ t('New address') }}
|
||||
|
|
|
@ -114,7 +114,7 @@ const redirectToCreateView = () => {
|
|||
icon="add"
|
||||
color="primary"
|
||||
@click="redirectToCreateView()"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ t('supplier.agencyTerms.addRow') }}
|
||||
|
|
|
@ -78,7 +78,7 @@ const insertRow = () => {
|
|||
<QBtn
|
||||
flat
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="insertRow()"
|
||||
|
|
|
@ -9,6 +9,9 @@ import VnLv from 'src/components/ui/VnLv.vue';
|
|||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
import filter from './TicketFilter.js';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
|
@ -27,6 +30,7 @@ const { t } = useI18n();
|
|||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
const problems = ref({});
|
||||
|
||||
function ticketFilter(ticket) {
|
||||
return JSON.stringify({ clientFk: ticket.clientFk });
|
||||
|
@ -34,6 +38,11 @@ function ticketFilter(ticket) {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
:url="`Tickets/${entityId}/getTicketProblems`"
|
||||
auto-load
|
||||
@on-fetch="(data) => ([problems] = data)"
|
||||
/>
|
||||
<CardDescriptor
|
||||
module="Ticket"
|
||||
:url="`Tickets/${entityId}`"
|
||||
|
@ -85,48 +94,9 @@ function ticketFilter(ticket) {
|
|||
<VnLv :label="t('globals.warehouse')" :value="entity.warehouse?.name" />
|
||||
<VnLv :label="t('globals.alias')" :value="entity.nickname" />
|
||||
</template>
|
||||
<template #icons="{ entity }">
|
||||
<QCardActions class="q-gutter-x-md">
|
||||
<QIcon
|
||||
v-if="entity.client?.isActive == false"
|
||||
name="vn:disabled"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client inactive') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.client?.isFreezed == true"
|
||||
name="vn:frozen"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity?.problem?.includes('hasRisk')"
|
||||
name="vn:risk"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client has debt') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.client?.isTaxDataChecked == false"
|
||||
name="vn:no036"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client not checked') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.isDeleted == true"
|
||||
name="vn:deletedTicket"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('This ticket is deleted') }}</QTooltip>
|
||||
</QIcon>
|
||||
<template #icons>
|
||||
<QCardActions class="q-gutter-x-xs">
|
||||
<TicketProblems :row="problems" />
|
||||
</QCardActions>
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
|
|
|
@ -69,14 +69,16 @@ const onAddressSelected = (addressId) => {
|
|||
}
|
||||
|
||||
const fetchClient = async () => {
|
||||
const { data } = await getClient(client.value)
|
||||
const [retrievedClient] = data;
|
||||
const response = await getClient(client.value)
|
||||
if (!response) return;
|
||||
const [retrievedClient] = response.data;
|
||||
selectedClient.value = retrievedClient;
|
||||
};
|
||||
|
||||
const fetchAddresses = async () => {
|
||||
const { data } = await getAddresses(client.value);
|
||||
addressesOptions.value = data;
|
||||
const response = await getAddresses(client.value);
|
||||
if (!response) return;
|
||||
addressesOptions.value = response.data;
|
||||
|
||||
const { defaultAddress } = selectedClient.value;
|
||||
address.value = defaultAddress.id;
|
||||
|
|
|
@ -32,7 +32,7 @@ watch(
|
|||
crudModelFilter.where.ticketFk = route.params.id;
|
||||
store.filter = crudModelFilter;
|
||||
await ticketNotesCrudRef.value.reload();
|
||||
}
|
||||
},
|
||||
);
|
||||
function handleDelete(row) {
|
||||
ticketNotesCrudRef.value.remove([row]);
|
||||
|
@ -105,7 +105,7 @@ async function handleSave() {
|
|||
<VnRow v-if="observationTypes.length > rows.length">
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
class="fill-icon-on-hover q-ml-md"
|
||||
color="primary"
|
||||
|
|
|
@ -41,7 +41,7 @@ watch(
|
|||
crudModelFilter.where.ticketFk = route.params.id;
|
||||
store.filter = crudModelFilter;
|
||||
await ticketPackagingsCrudRef.value.reload();
|
||||
}
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
|
@ -118,7 +118,7 @@ watch(
|
|||
<VnRow>
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
class="fill-icon-on-hover q-ml-md"
|
||||
color="primary"
|
||||
|
|
|
@ -24,6 +24,7 @@ import axios from 'axios';
|
|||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import VnUsesMana from 'src/components/ui/VnUsesMana.vue';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -56,7 +57,7 @@ const canProceed = ref();
|
|||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
() => tableRef.value.reload()
|
||||
() => tableRef.value.reload(),
|
||||
);
|
||||
|
||||
const columns = computed(() => [
|
||||
|
@ -199,7 +200,7 @@ const changeQuantity = async (sale) => {
|
|||
await updateQuantity(sale);
|
||||
} catch (e) {
|
||||
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
|
||||
(s) => s.id === sale.id
|
||||
(s) => s.id === sale.id,
|
||||
);
|
||||
sale.quantity = quantity;
|
||||
throw e;
|
||||
|
@ -503,7 +504,7 @@ async function isSalePrepared(item) {
|
|||
componentProps: {
|
||||
title: t('Item prepared'),
|
||||
message: t(
|
||||
'This item is already prepared. Do you want to continue?'
|
||||
'This item is already prepared. Do you want to continue?',
|
||||
),
|
||||
data: item,
|
||||
},
|
||||
|
@ -525,7 +526,7 @@ watch(
|
|||
if (newItemFk) {
|
||||
updateItem(newRow.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
|
@ -595,7 +596,7 @@ watch(
|
|||
openConfirmationModal(
|
||||
t('Continue anyway?'),
|
||||
t('You are going to delete lines of the ticket'),
|
||||
removeSales
|
||||
removeSales,
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -679,53 +680,7 @@ watch(
|
|||
:disabled-attr="isTicketEditable"
|
||||
>
|
||||
<template #column-statusIcons="{ row }">
|
||||
<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"
|
||||
data-cy="ticketSaleReservedIcon"
|
||||
>
|
||||
<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>
|
||||
<TicketProblems :row="row" />
|
||||
</template>
|
||||
<template #body-cell-picture="{ row }">
|
||||
<QTd>
|
||||
|
@ -856,7 +811,7 @@ watch(
|
|||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
data-cy="ticketSaleAddToBasketBtn"
|
||||
/>
|
||||
<QTooltip class="text-no-wrap">
|
||||
|
|
|
@ -40,7 +40,7 @@ watch(
|
|||
async () => {
|
||||
store.filter = crudModelFilter.value;
|
||||
await ticketServiceCrudRef.value.reload();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
onMounted(async () => await getDefaultTaxClass());
|
||||
|
@ -59,7 +59,7 @@ const createRefund = async () => {
|
|||
t('service.createRefundSuccess', {
|
||||
ticketId: refundTicket.id,
|
||||
}),
|
||||
'positive'
|
||||
'positive',
|
||||
);
|
||||
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||
};
|
||||
|
@ -225,7 +225,7 @@ async function handleSave() {
|
|||
color="primary"
|
||||
icon="add"
|
||||
@click="ticketServiceCrudRef.insert()"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
|
|
@ -20,6 +20,7 @@ import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
|||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
|
||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { notify } = useNotify();
|
||||
|
@ -243,7 +244,7 @@ onMounted(async () => {
|
|||
<QCard class="vn-one" v-if="entity.notes.length">
|
||||
<VnTitle
|
||||
:url="toTicketUrl('observation')"
|
||||
:text="t('ticket.pageTitles.notes')"
|
||||
:text="t('globals.pageTitles.notes')"
|
||||
/>
|
||||
<QVirtualScroll
|
||||
:items="entity.notes"
|
||||
|
@ -311,83 +312,7 @@ onMounted(async () => {
|
|||
<template #body="props">
|
||||
<QTr :props="props">
|
||||
<QTd class="q-gutter-x-xs">
|
||||
<QBtn
|
||||
flat
|
||||
round
|
||||
icon="vn:claims"
|
||||
v-if="props.row.claim"
|
||||
color="primary"
|
||||
:to="{
|
||||
name: 'ClaimCard',
|
||||
params: {
|
||||
id: props.row.claim.claimFk,
|
||||
},
|
||||
}"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.claim') }}:
|
||||
{{ props.row.claim.claimFk }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
flat
|
||||
round
|
||||
icon="vn:claims"
|
||||
v-if="props.row.claimBeginning"
|
||||
color="primary"
|
||||
:to="{
|
||||
name: 'ClaimCard',
|
||||
params: {
|
||||
id: props.row.claimBeginning.claimFk,
|
||||
},
|
||||
}"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.claim') }}:
|
||||
{{ props.row.claimBeginning.claimFk }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QIcon
|
||||
name="warning"
|
||||
v-show="props.row.visible < 0"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('globals.visible') }}:
|
||||
{{ props.row.visible }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
name="vn:reserved"
|
||||
v-show="props.row.reserved"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.reserved') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
name="vn:unavailable"
|
||||
v-show="props.row.itemShortage"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.itemShortage') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
name="vn:components"
|
||||
v-show="props.row.hasComponentLack"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.hasComponentLack') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<TicketProblems :row="props.row" />
|
||||
</QTd>
|
||||
<QTd>
|
||||
<QBtn class="link" flat>
|
||||
|
|
|
@ -19,7 +19,7 @@ watch(
|
|||
async (val) => {
|
||||
paginateFilter.where.ticketFk = val;
|
||||
paginateRef.value.fetch();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const paginateFilter = reactive({
|
||||
|
@ -119,7 +119,7 @@ const openCreateModal = () => createTrackingDialogRef.value.show();
|
|||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('tracking.addState') }}
|
||||
|
|
|
@ -38,35 +38,43 @@ onBeforeMount(async () => {
|
|||
await onClientSelected(initialFormState);
|
||||
});
|
||||
|
||||
function resetAgenciesSelector(formData) {
|
||||
agenciesOptions.value = [];
|
||||
formData.agencyModeId = null;
|
||||
}
|
||||
|
||||
const fetchClient = async (formData) => {
|
||||
const { data } = await getClient(formData.clientId);
|
||||
const [client] = data;
|
||||
const response = await getClient(formData.clientId);
|
||||
if (!response) return;
|
||||
const [client] = response.data;
|
||||
selectedClient.value = client;
|
||||
};
|
||||
|
||||
const fetchAddresses = async (formData) => {
|
||||
const { data } = await getAddresses(formData.clientId);
|
||||
addressesOptions.value = data;
|
||||
const response = await getAddresses(formData.clientId);
|
||||
if (!response) return;
|
||||
addressesOptions.value = response.data;
|
||||
|
||||
const { defaultAddress } = selectedClient.value;
|
||||
formData.addressId = defaultAddress.id;
|
||||
};
|
||||
|
||||
const onClientSelected = async (formData) => {
|
||||
resetAgenciesSelector(formData);
|
||||
await fetchClient(formData);
|
||||
await fetchAddresses(formData);
|
||||
};
|
||||
|
||||
const fetchAvailableAgencies = async (formData) => {
|
||||
const { data } = await getAgencies(formData);
|
||||
agenciesOptions.value = data;
|
||||
|
||||
const defaultAgency = agenciesOptions.value.find(
|
||||
(agency) =>
|
||||
agency.agencyModeFk === selectedClient.value.defaultAddress.agencyModeFk
|
||||
);
|
||||
|
||||
if (defaultAgency) formData.agencyModeId = defaultAgency.agencyModeFk;
|
||||
resetAgenciesSelector(formData);
|
||||
const response= await getAgencies(formData, selectedClient.value);
|
||||
if (!response) return;
|
||||
|
||||
const { options, agency } = response
|
||||
if(options)
|
||||
agenciesOptions.value = options;
|
||||
if(agency)
|
||||
formData.agencyModeId = agency;
|
||||
};
|
||||
|
||||
const redirectToTicketList = (_, { id }) => {
|
||||
|
|
|
@ -38,35 +38,43 @@ onBeforeMount(async () => {
|
|||
await onClientSelected(initialFormState);
|
||||
});
|
||||
|
||||
function resetAgenciesSelector(formData) {
|
||||
agenciesOptions.value = [];
|
||||
if(formData) formData.agencyModeId = null;
|
||||
}
|
||||
|
||||
const fetchClient = async (formData) => {
|
||||
const { data } = await getClient(formData.clientId);
|
||||
const [client] = data;
|
||||
const response = await getClient(formData.clientId);
|
||||
if (!response) return;
|
||||
const [client] = response.data;
|
||||
selectedClient.value = client;
|
||||
};
|
||||
|
||||
const fetchAddresses = async (formData) => {
|
||||
const { data } = await getAddresses(formData.clientId);
|
||||
addressesOptions.value = data;
|
||||
const response = await getAddresses(formData.clientId);
|
||||
if (!response) return;
|
||||
addressesOptions.value = response.data;
|
||||
|
||||
const { defaultAddress } = selectedClient.value;
|
||||
formData.addressId = defaultAddress.id;
|
||||
};
|
||||
|
||||
const onClientSelected = async (formData) => {
|
||||
resetAgenciesSelector(formData);
|
||||
await fetchClient(formData);
|
||||
await fetchAddresses(formData);
|
||||
};
|
||||
|
||||
const fetchAvailableAgencies = async (formData) => {
|
||||
const { data } = await getAgencies(formData);
|
||||
agenciesOptions.value = data;
|
||||
|
||||
const defaultAgency = agenciesOptions.value.find(
|
||||
(agency) =>
|
||||
agency.agencyModeFk === selectedClient.value.defaultAddress.agencyModeFk
|
||||
);
|
||||
|
||||
if (defaultAgency) formData.agencyModeId = defaultAgency.agencyModeFk;
|
||||
resetAgenciesSelector(formData);
|
||||
const response= await getAgencies(formData, selectedClient.value);
|
||||
if (!response) return;
|
||||
|
||||
const { options, agency } = response
|
||||
if(options)
|
||||
agenciesOptions.value = options;
|
||||
if(agency)
|
||||
formData.agencyModeId = agency;
|
||||
};
|
||||
|
||||
const redirectToTicketList = (_, { id }) => {
|
||||
|
|
|
@ -229,37 +229,46 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function resetAgenciesSelector(formData) {
|
||||
agenciesOptions.value = [];
|
||||
if(formData) formData.agencyModeId = null;
|
||||
}
|
||||
|
||||
function redirectToLines(id) {
|
||||
const url = `#/ticket/${id}/sale`;
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
const onClientSelected = async (formData) => {
|
||||
const onClientSelected = async (formData) => {
|
||||
resetAgenciesSelector(formData);
|
||||
await fetchClient(formData);
|
||||
await fetchAddresses(formData);
|
||||
};
|
||||
|
||||
const fetchAvailableAgencies = async (formData) => {
|
||||
const { data } = await getAgencies(formData);
|
||||
agenciesOptions.value = data;
|
||||
|
||||
const defaultAgency = agenciesOptions.value.find(
|
||||
(agency) =>
|
||||
agency.agencyModeFk === selectedClient.value.defaultAddress.agencyModeFk
|
||||
);
|
||||
|
||||
if (defaultAgency) formData.agencyModeId = defaultAgency.agencyModeFk;
|
||||
resetAgenciesSelector(formData);
|
||||
const response= await getAgencies(formData, selectedClient.value);
|
||||
if (!response) return;
|
||||
|
||||
const { options, agency } = response
|
||||
if(options)
|
||||
agenciesOptions.value = options;
|
||||
if(agency)
|
||||
formData.agencyModeId = agency;
|
||||
};
|
||||
|
||||
const fetchClient = async (formData) => {
|
||||
const { data } = await getClient(formData.clientId);
|
||||
const [client] = data;
|
||||
const response = await getClient(formData.clientId);
|
||||
if (!response) return;
|
||||
const [client] = response.data;
|
||||
selectedClient.value = client;
|
||||
};
|
||||
|
||||
const fetchAddresses = async (formData) => {
|
||||
const { data } = await getAddresses(formData.clientId);
|
||||
addressesOptions.value = data;
|
||||
const response = await getAddresses(formData.clientId);
|
||||
if (!response) return;
|
||||
addressesOptions.value = response.data;
|
||||
|
||||
const { defaultAddress } = selectedClient.value;
|
||||
formData.addressId = defaultAddress.id;
|
||||
|
|
|
@ -208,3 +208,9 @@ ticketList:
|
|||
toLines: Go to lines
|
||||
addressNickname: Address nickname
|
||||
ref: Reference
|
||||
rounding: Rounding
|
||||
noVerifiedData: No verified data
|
||||
purchaseRequest: Purchase request
|
||||
notVisible: Not visible
|
||||
clientFrozen: Client frozen
|
||||
componentLack: Component lack
|
||||
|
|
|
@ -213,3 +213,9 @@ ticketList:
|
|||
toLines: Ir a lineas
|
||||
addressNickname: Alias consignatario
|
||||
ref: Referencia
|
||||
rounding: Redondeo
|
||||
noVerifiedData: Sin datos comprobados
|
||||
purchaseRequest: Petición de compra
|
||||
notVisible: No visible
|
||||
clientFrozen: Cliente congelado
|
||||
componentLack: Faltan componentes
|
||||
|
|
|
@ -217,7 +217,7 @@ const removeThermograph = async (id) => {
|
|||
icon="add"
|
||||
color="primary"
|
||||
@click="redirectToThermographForm('create')"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('Add thermograph') }}
|
||||
|
|
|
@ -113,7 +113,7 @@ warehouses();
|
|||
<template #append>
|
||||
<QBtn
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
dense
|
||||
size="12px"
|
||||
|
|
|
@ -96,7 +96,13 @@ async function remove(row) {
|
|||
>
|
||||
</VnTable>
|
||||
<QPageSticky :offset="[18, 18]">
|
||||
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add" shortcut="+">
|
||||
<QBtn
|
||||
@click.stop="dialog.show()"
|
||||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
v-shortcut="'+'"
|
||||
>
|
||||
<QDialog ref="dialog">
|
||||
<FormModelPopup
|
||||
:title="t('Create new Wagon type')"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<script setup>
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import { nextTick, ref, watch, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
|
||||
import WorkerCalendarFilter from 'pages/Worker/Card/WorkerCalendarFilter.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -9,10 +10,17 @@ import WorkerCalendarItem from 'pages/Worker/Card/WorkerCalendarItem.vue';
|
|||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||
import { useStateStore } from 'src/stores/useStateStore';
|
||||
const stateStore = useStateStore();
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const acl = useAcl();
|
||||
const canSeeNotes = computed(() =>
|
||||
acl.hasAny([{ model: 'Worker', props: '__get__business', accessType: 'READ' }]),
|
||||
);
|
||||
const workerIsFreelance = ref();
|
||||
const WorkerFreelanceRef = ref();
|
||||
const workerCalendarFilterRef = ref(null);
|
||||
|
@ -26,6 +34,10 @@ const contractHolidays = ref(null);
|
|||
const yearHolidays = ref(null);
|
||||
const eventsMap = ref({});
|
||||
const festiveEventsMap = ref({});
|
||||
const saveUrl = ref();
|
||||
const body = {
|
||||
workerFk: route.params.id,
|
||||
};
|
||||
|
||||
const onFetchActiveContract = (data) => {
|
||||
if (!data) return;
|
||||
|
@ -67,7 +79,7 @@ const onFetchAbsences = (data) => {
|
|||
name: holidayName,
|
||||
isFestive: true,
|
||||
},
|
||||
true
|
||||
true,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -146,7 +158,7 @@ watch(
|
|||
async () => {
|
||||
await nextTick();
|
||||
await activeContractRef.value.fetch();
|
||||
}
|
||||
},
|
||||
);
|
||||
watch([year, businessFk], () => refreshData());
|
||||
</script>
|
||||
|
@ -181,6 +193,20 @@ watch([year, businessFk], () => refreshData());
|
|||
/>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown() && canSeeNotes">
|
||||
<VnNotes
|
||||
:just-input="true"
|
||||
:url="`Workers/${route.params.id}/business`"
|
||||
:filter="{ fields: ['id', 'notes', 'workerFk'] }"
|
||||
:save-url="saveUrl"
|
||||
@on-fetch="
|
||||
(data) => {
|
||||
saveUrl = `Businesses/${data.id}`;
|
||||
}
|
||||
"
|
||||
:body="body"
|
||||
/>
|
||||
</Teleport>
|
||||
<QPage class="column items-center">
|
||||
<QCard v-if="workerIsFreelance">
|
||||
<QCardSection class="text-center">
|
||||
|
|
|
@ -180,8 +180,6 @@ const yearList = ref(generateYears());
|
|||
:is-clearable="false"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('Contract')"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
@ -19,6 +19,7 @@ const trainsData = ref([]);
|
|||
const machinesData = ref([]);
|
||||
const route = useRoute();
|
||||
const routeId = computed(() => route.params.id);
|
||||
const selected = ref([]);
|
||||
|
||||
const initialData = computed(() => {
|
||||
return {
|
||||
|
@ -41,6 +42,21 @@ async function insert() {
|
|||
await axios.post('Operators', initialData.value);
|
||||
crudModelRef.value.reload();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => crudModelRef.value?.formData,
|
||||
(formData) => {
|
||||
if (formData && formData.length) {
|
||||
if (JSON.stringify(selected.value) !== JSON.stringify(formData)) {
|
||||
selected.value = formData;
|
||||
}
|
||||
} else if (selected.value.length > 0) {
|
||||
selected.value = [];
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -67,6 +83,7 @@ async function insert() {
|
|||
:data-required="{ workerFk: route.params.id }"
|
||||
ref="crudModelRef"
|
||||
search-url="operator"
|
||||
:selected="selected"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
|
|
|
@ -101,7 +101,7 @@ function reloadData() {
|
|||
openConfirmationModal(
|
||||
t(`Remove PDA`),
|
||||
t('Do you want to remove this PDA?'),
|
||||
() => deallocatePDA(row.deviceProductionFk)
|
||||
() => deallocatePDA(row.deviceProductionFk),
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -114,7 +114,13 @@ function reloadData() {
|
|||
</template>
|
||||
</VnPaginate>
|
||||
<QPageSticky :offset="[18, 18]">
|
||||
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add" shortcut="+">
|
||||
<QBtn
|
||||
@click.stop="dialog.show()"
|
||||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
v-shortcut="'+'"
|
||||
>
|
||||
<QDialog ref="dialog">
|
||||
<FormModelPopup
|
||||
:title="t('Add new device')"
|
||||
|
|
|
@ -221,7 +221,7 @@ const deleteRelative = async (id) => {
|
|||
color="primary"
|
||||
flat
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
style="flex: 0"
|
||||
data-cy="addRelative"
|
||||
/>
|
||||
|
|
|
@ -12,7 +12,6 @@ import RoleDescriptorProxy from 'src/pages/Account/Role/Card/RoleDescriptorProxy
|
|||
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
import { useAdvancedSummary } from 'src/composables/useAdvancedSummary';
|
||||
import WorkerDescriptorMenu from './WorkerDescriptorMenu.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -28,76 +27,6 @@ const entityId = computed(() => $props.id || route.params.id);
|
|||
const basicDataUrl = ref(null);
|
||||
const advancedSummary = ref();
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name', 'nickname', 'roleFk'],
|
||||
|
||||
include: [
|
||||
{
|
||||
relation: 'role',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'emailUser',
|
||||
scope: {
|
||||
fields: ['email'],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'department',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'department',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'boss',
|
||||
},
|
||||
{
|
||||
relation: 'client',
|
||||
},
|
||||
{
|
||||
relation: 'sip',
|
||||
},
|
||||
{
|
||||
relation: 'business',
|
||||
scope: {
|
||||
include: [
|
||||
{
|
||||
relation: 'department',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'reasonEnd',
|
||||
scope: {
|
||||
fields: ['id', 'reason'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'workerBusinessProfessionalCategory',
|
||||
scope: {
|
||||
fields: ['id', 'description'],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
onBeforeMount(async () => {
|
||||
advancedSummary.value = await useAdvancedSummary('Workers', entityId.value);
|
||||
basicDataUrl.value = `#/worker/${entityId.value}/basic-data`;
|
||||
|
@ -107,8 +36,8 @@ onBeforeMount(async () => {
|
|||
<template>
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`Workers/summary`"
|
||||
:user-filter="{ where: { id: entityId }, filter }"
|
||||
url="Workers/summary"
|
||||
:user-filter="{ where: { id: entityId } }"
|
||||
data-key="Worker"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
|
|
|
@ -69,12 +69,12 @@ const acl = useAcl();
|
|||
const selectedDateYear = computed(() => moment(selectedDate.value).isoWeekYear());
|
||||
const worker = computed(() => arrayData.store?.data);
|
||||
const canSend = computed(() =>
|
||||
acl.hasAny([{ model: 'WorkerTimeControl', props: 'sendMail', accessType: 'WRITE' }])
|
||||
acl.hasAny([{ model: 'WorkerTimeControl', props: 'sendMail', accessType: 'WRITE' }]),
|
||||
);
|
||||
const canUpdate = computed(() =>
|
||||
acl.hasAny([
|
||||
{ model: 'WorkerTimeControl', props: 'updateMailState', accessType: 'WRITE' },
|
||||
])
|
||||
]),
|
||||
);
|
||||
const isHimself = computed(() => user.value.id === Number(route.params.id));
|
||||
|
||||
|
@ -100,7 +100,7 @@ const getHeaderFormattedDate = (date) => {
|
|||
};
|
||||
|
||||
const formattedWeekTotalHours = computed(() =>
|
||||
secondsToHoursMinutes(weekTotalHours.value)
|
||||
secondsToHoursMinutes(weekTotalHours.value),
|
||||
);
|
||||
|
||||
const onInputChange = async (date) => {
|
||||
|
@ -320,7 +320,7 @@ const getFinishTime = () => {
|
|||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
let todayInWeek = weekDays.value.find(
|
||||
(day) => day.dated.getTime() === today.getTime()
|
||||
(day) => day.dated.getTime() === today.getTime(),
|
||||
);
|
||||
|
||||
if (todayInWeek && todayInWeek.hours && todayInWeek.hours.length) {
|
||||
|
@ -472,7 +472,7 @@ onMounted(async () => {
|
|||
openConfirmationModal(
|
||||
t('Send time control email'),
|
||||
t('Are you sure you want to send it?'),
|
||||
resendEmail
|
||||
resendEmail,
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -561,7 +561,7 @@ onMounted(async () => {
|
|||
@show-worker-time-form="
|
||||
showWorkerTimeForm(
|
||||
{ id: hour.id, entryCode: hour.direction },
|
||||
'edit'
|
||||
'edit',
|
||||
)
|
||||
"
|
||||
class="hour-chip"
|
||||
|
@ -577,7 +577,7 @@ onMounted(async () => {
|
|||
</span>
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
color="primary"
|
||||
class="fill-icon cursor-pointer"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue