Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7119-createVehicle
This commit is contained in:
commit
017f435da6
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"
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -629,7 +629,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
size="md"
|
||||
round
|
||||
flat
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
:disabled="!disabledAttr"
|
||||
/>
|
||||
<QTooltip>
|
||||
|
@ -647,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">
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
const { store } = arrayData;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -93,6 +93,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;
|
||||
|
|
|
@ -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') }}
|
||||
|
|
|
@ -192,6 +192,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') }}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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')"
|
||||
|
|
|
@ -68,7 +68,7 @@ const updateDefaultStop = (data) => {
|
|||
<QBtn
|
||||
flat
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="roadmapStopsCrudRef.insert()"
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -84,7 +84,7 @@ function exprBuilder(param, value) {
|
|||
</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,8 @@ import VnLv from 'src/components/ui/VnLv.vue';
|
|||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -28,6 +30,7 @@ const { t } = useI18n();
|
|||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
const problems = ref({});
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
|
@ -113,6 +116,11 @@ const setData = (entity) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
:url="`Tickets/${entityId}/getTicketProblems`"
|
||||
auto-load
|
||||
@on-fetch="(data) => ([problems] = data)"
|
||||
/>
|
||||
<CardDescriptor
|
||||
module="Ticket"
|
||||
:url="`Tickets/${entityId}`"
|
||||
|
@ -167,48 +175,9 @@ const setData = (entity) => {
|
|||
<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 }">
|
||||
|
|
|
@ -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') }}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -173,7 +173,7 @@ function handleEvent(type, event, node) {
|
|||
color="primary"
|
||||
flat
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
class="cursor-pointer"
|
||||
@click.stop="showCreateNodeForm(node.id)"
|
||||
>
|
||||
|
|
|
@ -78,13 +78,13 @@ const onZoneEventFormClose = () => {
|
|||
{
|
||||
isNewMode: true,
|
||||
},
|
||||
true
|
||||
true,
|
||||
)
|
||||
"
|
||||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('eventsInclusionForm.addEvent') }}
|
||||
|
|
|
@ -49,7 +49,7 @@ watch(
|
|||
store.url = urlPath.value;
|
||||
store.filter.include = 'warehouse';
|
||||
fetchWarehouses();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const fetchWarehouses = () => paginateRef.value.fetch();
|
||||
|
@ -84,7 +84,8 @@ const openCreateWarehouseForm = () => createWarehouseDialogRef.value.show();
|
|||
openConfirmationModal(
|
||||
t('zone.deleteTitle'),
|
||||
t('zone.deleteSubtitle'),
|
||||
() => deleteWarehouse(row, rows, rowIndex)
|
||||
() =>
|
||||
deleteWarehouse(row, rows, rowIndex),
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -108,7 +109,7 @@ const openCreateWarehouseForm = () => createWarehouseDialogRef.value.show();
|
|||
icon="add"
|
||||
color="primary"
|
||||
@click="openCreateWarehouseForm()"
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
>
|
||||
<QTooltip>{{ t('warehouses.add') }}</QTooltip>
|
||||
</QBtn>
|
||||
|
|
|
@ -74,7 +74,7 @@ async function remove(row) {
|
|||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky position="bottom-right" :offset="[18, 18]">
|
||||
<QBtn @click="create" fab icon="add" shortcut="+" color="primary" />
|
||||
<QBtn @click="create" fab icon="add" v-shortcut="'+'" color="primary" />
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
|
|
|
@ -74,7 +74,7 @@ async function remove(row) {
|
|||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky position="bottom-right" :offset="[18, 18]">
|
||||
<QBtn @click="create" fab icon="add" shortcut="+" color="primary" />
|
||||
<QBtn @click="create" fab icon="add" v-shortcut="'+'" color="primary" />
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
|
|
|
@ -44,6 +44,7 @@ const shelvingCard = {
|
|||
path: ':id',
|
||||
component: () => import('pages/Shelving/Card/ShelvingCard.vue'),
|
||||
redirect: { name: 'ShelvingSummary' },
|
||||
meta: { menu: ['ShelvingBasicData', 'ShelvingLog'] },
|
||||
children: [
|
||||
{
|
||||
name: 'ShelvingSummary',
|
||||
|
@ -81,13 +82,10 @@ export default {
|
|||
title: 'shelving',
|
||||
icon: 'vn:inventory',
|
||||
moduleName: 'Shelving',
|
||||
menu: ['ShelvingList', 'ParkingMain'],
|
||||
},
|
||||
component: RouterView,
|
||||
redirect: { name: 'ShelvingMain' },
|
||||
menus: {
|
||||
main: ['ShelvingList', 'ParkingMain'],
|
||||
card: ['ShelvingBasicData', 'ShelvingLog'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
|
|
|
@ -62,10 +62,9 @@ describe('Client list', () => {
|
|||
it('Client founded create order', () => {
|
||||
const search = 'Jessica Jones';
|
||||
cy.searchByLabel('Name', search);
|
||||
cy.openActionDescriptor('New order');
|
||||
cy.clickButtonWith('icon', 'icon-basketadd');
|
||||
cy.waitForElement('#formModel');
|
||||
cy.waitForElement('.q-form');
|
||||
cy.checkValueForm(1, search);
|
||||
cy.checkValueForm(2, search);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,6 +7,5 @@ describe('Client notes', () => {
|
|||
});
|
||||
it('Should load layout', () => {
|
||||
cy.get('.q-page').should('be.visible');
|
||||
cy.get('.q-page > :nth-child(2) > :nth-child(1)').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,12 +8,12 @@ describe('EntryMy when is supplier', () => {
|
|||
},
|
||||
});
|
||||
});
|
||||
// https://redmine.verdnatura.es/issues/8418
|
||||
it.skip('should open buyLabel when is supplier', () => {
|
||||
|
||||
it('should open buyLabel when is supplier', () => {
|
||||
cy.get(
|
||||
'[to="/null/3"] > .q-card > .column > .q-btn > .q-btn__content > .q-icon'
|
||||
'[to="/null/3"] > .q-card > :nth-child(2) > .q-btn > .q-btn__content > .q-icon'
|
||||
).click();
|
||||
cy.get('.q-card__actions > .q-btn').click();
|
||||
cy.dataCy('printLabelsBtn').click();
|
||||
cy.window().its('open').should('be.called');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,28 +12,22 @@ describe('Item tag', () => {
|
|||
cy.get('.q-page-sticky > div').click();
|
||||
cy.dataCy('Tag_select').eq(7).type('Tallos');
|
||||
cy.get('.q-menu .q-item').contains('Tallos').click();
|
||||
cy.get(
|
||||
':nth-child(8) > [label="Value"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Value_input"]'
|
||||
).type('1');
|
||||
cy.get(':nth-child(8) > [label="Value"]').type('1');
|
||||
+cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
cy.checkNotification("The tag or priority can't be repeated for an item");
|
||||
});
|
||||
// https://redmine.verdnatura.es/issues/8422
|
||||
it.skip('should add a new tag', () => {
|
||||
|
||||
it('should add a new tag', () => {
|
||||
cy.get('.q-page').should('be.visible');
|
||||
cy.get('.q-page-sticky > div').click();
|
||||
cy.get('.q-page-sticky > div').click();
|
||||
cy.dataCy('Tag_select').eq(7).click();
|
||||
cy.get('.q-menu .q-item').contains('Ancho de la base').click();
|
||||
cy.get(
|
||||
':nth-child(8) > [label="Value"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Value_input"]'
|
||||
).type('50');
|
||||
cy.get('.q-menu .q-item').contains('Ancho de la base').type('{enter}');
|
||||
cy.get(':nth-child(8) > [label="Value"]').type('50');
|
||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
cy.checkNotification('Data saved');
|
||||
cy.get(
|
||||
'[data-cy="itemTags"] > :nth-child(7) > .justify-center > .q-icon'
|
||||
).click();
|
||||
cy.dataCy('itemTags').children(':nth-child(8)').find('.justify-center > .q-icon').click();
|
||||
cy.dataCy('VnConfirm_confirm').click();
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -5,7 +5,7 @@ describe('ParkingBasicData', () => {
|
|||
const sectorOpt = '.q-menu .q-item';
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/parking/1/basic-data`);
|
||||
cy.visit(`/#/shelving/parking/1/basic-data`);
|
||||
});
|
||||
|
||||
it('should edit the code and sector', () => {
|
||||
|
|
|
@ -11,7 +11,7 @@ describe('ParkingList', () => {
|
|||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/parking/list`);
|
||||
cy.visit(`/#/shelving/parking/list`);
|
||||
});
|
||||
|
||||
it('should redirect on clicking a parking', () => {
|
||||
|
|
|
@ -53,4 +53,29 @@ describe('TicketList', () => {
|
|||
cy.checkNotification('Data created');
|
||||
cy.url().should('match', /\/ticket\/\d+\/summary/);
|
||||
});
|
||||
|
||||
it('should show the corerct problems', () => {
|
||||
cy.intercept('GET', '**/api/Tickets/filter*', (req) => {
|
||||
req.headers['cache-control'] = 'no-cache';
|
||||
req.headers['pragma'] = 'no-cache';
|
||||
req.headers['expires'] = '0';
|
||||
|
||||
req.on('response', (res) => {
|
||||
delete res.headers['if-none-match'];
|
||||
delete res.headers['if-modified-since'];
|
||||
});
|
||||
}).as('ticket');
|
||||
|
||||
cy.get('[data-cy="Warehouse_select"]').type('Warehouse Five');
|
||||
cy.get('.q-menu .q-item').contains('Warehouse Five').click();
|
||||
cy.wait('@ticket').then((interception) => {
|
||||
const data = interception.response.body[1];
|
||||
expect(data.hasComponentLack).to.equal(1);
|
||||
expect(data.isTooLittle).to.equal(1);
|
||||
expect(data.hasItemShortage).to.equal(1);
|
||||
});
|
||||
cy.get('.icon-components').should('exist');
|
||||
cy.get('.icon-unavailable').should('exist');
|
||||
cy.get('.icon-isTooLittle').should('exist');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('VnSearchBar', () => {
|
||||
const employeeId = ' #1';
|
||||
const salesPersonId = ' #18';
|
||||
const idGap = '.q-item > .q-item__label';
|
||||
const vnTableRow = '.q-virtual-scroll__content';
|
||||
beforeEach(() => {
|
||||
|
@ -12,11 +11,10 @@ describe('VnSearchBar', () => {
|
|||
|
||||
it('should redirect to account summary page', () => {
|
||||
searchAndCheck('1', employeeId);
|
||||
searchAndCheck('salesPerson', salesPersonId);
|
||||
searchAndCheck('employee', employeeId);
|
||||
});
|
||||
|
||||
it('should stay on the list page if there are several results or none', () => {
|
||||
cy.typeSearchbar('salesA{enter}');
|
||||
cy.typeSearchbar('salesA{enter}');
|
||||
checkTableLength(2);
|
||||
|
||||
|
@ -29,7 +27,6 @@ describe('VnSearchBar', () => {
|
|||
const searchAndCheck = (searchTerm, expectedText) => {
|
||||
cy.clearSearchbar();
|
||||
cy.typeSearchbar(`${searchTerm}{enter}`);
|
||||
cy.typeSearchbar(`${searchTerm}{enter}`);
|
||||
cy.get(idGap).should('have.text', expectedText);
|
||||
};
|
||||
|
||||
|
|
|
@ -28,6 +28,17 @@ describe('VnShortcuts', () => {
|
|||
});
|
||||
|
||||
cy.url().should('include', module);
|
||||
if (['monitor', 'claim'].includes(module)) {
|
||||
return;
|
||||
}
|
||||
cy.waitForElement('.q-page').should('exist');
|
||||
cy.dataCy('vnTableCreateBtn').should('exist');
|
||||
cy.get('.q-page').trigger('keydown', {
|
||||
ctrlKey: true,
|
||||
altKey: true,
|
||||
key: '+',
|
||||
});
|
||||
cy.get('#formModel').should('exist');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -8,16 +8,16 @@ describe('WagonCreate', () => {
|
|||
it('should create and delete a new wagon', () => {
|
||||
cy.dataCy('vnTableCreateBtn').click();
|
||||
cy.get(
|
||||
'.grid-create > [label="Label"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Label_input"]'
|
||||
'.grid-create > [label="Label"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Label_input"]',
|
||||
).type('1234');
|
||||
cy.get(
|
||||
'.grid-create > [label="Plate"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Plate_input"]'
|
||||
'.grid-create > [label="Plate"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Plate_input"]',
|
||||
).type('1234ABCD');
|
||||
cy.get(
|
||||
'.grid-create > [label="Volume"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Volume_input"]'
|
||||
'.grid-create > [label="Volume"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Volume_input"]',
|
||||
).type('100');
|
||||
cy.dataCy('Type_select').type('{downarrow}{enter}');
|
||||
// // Delete wagon type created
|
||||
cy.get('[to="/null/1"] > .q-card > .column > [title="Remove"]').click();
|
||||
|
||||
cy.get('[title="Remove"] > .q-btn__content > .q-icon').click();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,14 +6,10 @@ describe('WagonTypeCreate', () => {
|
|||
cy.waitForElement('.q-page', 6000);
|
||||
});
|
||||
|
||||
it('should create a new wagon type', () => {
|
||||
it('should create a new wagon type and then delete it', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn').click();
|
||||
cy.get('input').first().type('Example for testing');
|
||||
cy.get('button[type="submit"]').click();
|
||||
});
|
||||
it('delete a wagon type', () => {
|
||||
cy.get(
|
||||
'[to="/null/2"] > .q-card > .column > [title="Remove"] > .q-btn__content > .q-icon'
|
||||
).click();
|
||||
cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -289,40 +289,13 @@ Cypress.Commands.add('openActionDescriptor', (opt) => {
|
|||
cy.openActionsDescriptor();
|
||||
const listItem = '[role="menu"] .q-list .q-item';
|
||||
cy.contains(listItem, opt).click();
|
||||
1;
|
||||
});
|
||||
|
||||
Cypress.Commands.add('openActionsDescriptor', () => {
|
||||
cy.get('[data-cy="descriptor-more-opts"]').click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('clickButtonsDescriptor', (id) => {
|
||||
cy.get(`.actions > .q-card__actions> .q-btn:nth-child(${id})`)
|
||||
.invoke('removeAttr', 'target')
|
||||
.click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('openActionDescriptor', (opt) => {
|
||||
cy.openActionsDescriptor();
|
||||
const listItem = '[role="menu"] .q-list .q-item';
|
||||
cy.contains(listItem, opt).click();
|
||||
1;
|
||||
});
|
||||
|
||||
Cypress.Commands.add('clickButtonsDescriptor', (id) => {
|
||||
cy.get(`.actions > .q-card__actions> .q-btn:nth-child(${id})`)
|
||||
.invoke('removeAttr', 'target')
|
||||
.click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('openActionDescriptor', (opt) => {
|
||||
cy.openActionsDescriptor();
|
||||
const listItem = '[role="menu"] .q-list .q-item';
|
||||
cy.contains(listItem, opt).click();
|
||||
1;
|
||||
});
|
||||
|
||||
Cypress.Commands.add('clickButtonsDescriptor', (id) => {
|
||||
Cypress.Commands.add('clickButtonDescriptor', (id) => {
|
||||
cy.get(`.actions > .q-card__actions> .q-btn:nth-child(${id})`)
|
||||
.invoke('removeAttr', 'target')
|
||||
.click();
|
||||
|
@ -374,3 +347,21 @@ Cypress.Commands.add('addBtnClick', () => {
|
|||
.and('be.visible')
|
||||
.click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('clickButtonWith', (type, value) => {
|
||||
switch (type) {
|
||||
case 'icon':
|
||||
cy.clickButtonWithIcon(value);
|
||||
break;
|
||||
|
||||
default:
|
||||
cy.clickButtonWithText(value);
|
||||
break;
|
||||
}
|
||||
});
|
||||
Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
|
||||
cy.get(`.q-icon.${iconClass}`).parent().click();
|
||||
});
|
||||
Cypress.Commands.add('clickButtonWithText', (buttonText) => {
|
||||
cy.get('.q-btn').contains(buttonText).click();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue