Merge branch 'dev' of https: refs #8322//gitea.verdnatura.es/verdnatura/salix-front into 8322-Supplier
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
1a420abfb2
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
export default {
|
||||
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
|
||||
// This option interrupts the configuration hierarchy at this file
|
||||
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
|
||||
|
@ -58,7 +58,7 @@ module.exports = {
|
|||
rules: {
|
||||
'prefer-promise-reject-errors': 'off',
|
||||
'no-unused-vars': 'warn',
|
||||
"vue/no-multiple-template-root": "off" ,
|
||||
'vue/no-multiple-template-root': 'off',
|
||||
// allow debugger during development only
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||
},
|
|
@ -29,5 +29,9 @@ yarn-error.log*
|
|||
*.sln
|
||||
|
||||
# Cypress directories and files
|
||||
/tests/cypress/videos
|
||||
/tests/cypress/screenshots
|
||||
/test/cypress/videos
|
||||
/test/cypress/screenshots
|
||||
|
||||
# VitePress directories and files
|
||||
/docs/.vitepress/cache
|
||||
/docs/.vuepress
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
||||
import { join, resolve } from 'path';
|
||||
|
||||
function getCurrentBranchName(p = process.cwd()) {
|
||||
if (!fs.existsSync(p)) return false;
|
||||
if (!existsSync(p)) return false;
|
||||
|
||||
const gitHeadPath = path.join(p, '.git', 'HEAD');
|
||||
const gitHeadPath = join(p, '.git', 'HEAD');
|
||||
|
||||
if (!fs.existsSync(gitHeadPath))
|
||||
return getCurrentBranchName(path.resolve(p, '..'));
|
||||
if (!existsSync(gitHeadPath)) {
|
||||
return getCurrentBranchName(resolve(p, '..'));
|
||||
}
|
||||
|
||||
const headContent = fs.readFileSync(gitHeadPath, 'utf-8');
|
||||
const headContent = readFileSync(gitHeadPath, 'utf-8');
|
||||
return headContent.trim().split('/')[2];
|
||||
}
|
||||
|
||||
const branchName = getCurrentBranchName();
|
||||
|
||||
if (branchName) {
|
||||
const msgPath = `.git/COMMIT_EDITMSG`;
|
||||
const msg = fs.readFileSync(msgPath, 'utf-8');
|
||||
const msgPath = '.git/COMMIT_EDITMSG';
|
||||
const msg = readFileSync(msgPath, 'utf-8');
|
||||
const reference = branchName.match(/^\d+/);
|
||||
|
||||
const referenceTag = `refs #${reference}`;
|
||||
|
@ -26,8 +27,7 @@ if (branchName) {
|
|||
|
||||
if (splitedMsg.length > 1) {
|
||||
const finalMsg = splitedMsg[0] + ': ' + referenceTag + splitedMsg.slice(1).join(':');
|
||||
fs.writeFileSync(msgPath, finalMsg);
|
||||
writeFileSync(msgPath, finalMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
export default {
|
||||
singleQuote: true,
|
||||
printWidth: 90,
|
||||
tabWidth: 4,
|
||||
|
|
154
CHANGELOG.md
154
CHANGELOG.md
|
@ -1,3 +1,157 @@
|
|||
# Version 25.04 - 2025-01-28
|
||||
|
||||
### Added 🆕
|
||||
|
||||
- chore: add task comment by:jorgep
|
||||
- chore: refs #8198 rollback by:jorgep
|
||||
- chore: refs #8322 unnecessary prop by:alexm
|
||||
- feat: refs #7055 added new test case by:provira
|
||||
- feat: refs #7055 created FilterItemForm test by:provira
|
||||
- feat: refs #7077 created test for VnInputTime by:provira
|
||||
- feat: refs #7078 created test for VnJsonValue by:provira
|
||||
- feat: refs #7087 added more test cases by:provira
|
||||
- feat: refs #7087 added new test by:provira
|
||||
- feat: refs #7087 created CardSummary test by:provira
|
||||
- feat: refs #7088 created test for FetchedTags by:provira
|
||||
- feat: refs #7202 added new field by:Jon
|
||||
- feat: refs #7882 Added coords to create a address by:guillermo
|
||||
- feat: refs #7957 add tooltip and i18n support for search link in VnSearchbar component by:jorgep
|
||||
- feat: refs #7957 enhance search functionality and improve data filtering logic by:jorgep
|
||||
- feat: refs #7957 open in new tab by:jorgep
|
||||
- feat: refs #7957 simplify fn to by:jorgep
|
||||
- feat: refs #7957 update VnSearchbar component with improved search URL handling and styling enhancements by:jorgep
|
||||
- feat: refs #8117 filters and values added as needed by:jtubau
|
||||
- feat: refs #8197 useHasContent and use in VnSection and RightMenu by:alexm
|
||||
- feat: refs #8219 added invoice out e2e tests by:Jon
|
||||
- feat: refs #8219 global invoicing e2e by:Jon
|
||||
- feat: refs #8220 added barcodes e2e test by:Jon
|
||||
- feat: refs #8220 created items e2e by:Jon
|
||||
- feat: refs #8220 modified create item form and added respective e2e by:Jon
|
||||
- feat: refs #8225 added account and invoiceOut modules by:Jon
|
||||
- feat: refs #8225 added entry module and fixed translations by:Jon
|
||||
- feat: refs #8225 added invoiceIn and travel module by:Jon
|
||||
- feat: refs #8225 added moreOptions and use it in customer and ticket summary by:Jon
|
||||
- feat: refs #8225 added route and shelving module by:Jon
|
||||
- feat: refs #8225 added worker and zone modules by:Jon
|
||||
- feat: refs #8225 use it in claim, item and order modules by:Jon
|
||||
- feat: refs #8258 added button to pass to uppercase by:provira
|
||||
- feat: refs #8258 added uppercase option to VnInput by:provira
|
||||
- feat: refs #8258 added uppercase validation on supplier create by:provira
|
||||
- feat: refs #8298 add price optimum input and update translations for bonus and price optimum by:jgallego
|
||||
- feat: refs #8316 add entryFilter prop to VnTable component in EntryList by:jtubau
|
||||
- feat: refs #8322 added department changes by:provira
|
||||
- feat: refs #8372 workerPBX by:robert
|
||||
- feat: refs #8381 add initial and final temperature fields to entry forms and summaries by:jgallego
|
||||
- feat: refs #8381 add initial and final temperature labels in English and Spanish locales by:jgallego
|
||||
- feat: refs #8381 add toCelsius filter and update temperature fields in entry forms and summaries by:jgallego
|
||||
- feat: skip tests by:jorgep
|
||||
- style: refs #7957 update VnSearchbar padding for improved layout by:jorgep
|
||||
|
||||
### Changed 📦
|
||||
|
||||
- perf: refs #8219 #8219 minor change by:Javier Segarra
|
||||
- perf: refs #8220 on-fetch and added missing translations by:Jon
|
||||
- perf: refs #8220 on-fetch by:Jon
|
||||
- perf: refs #8220 translations by:Jon
|
||||
- perf: refs #8220 use searchbar selector in e2e tests by:Jon
|
||||
- perf: remove warning default value by:Javier Segarra
|
||||
- refactor: redirect using params by:Jon
|
||||
- refactor: refs #7077 removed some comments by:provira
|
||||
- refactor: refs #7087 removed unused imports by:provira
|
||||
- refactor: refs #7100 added const mockData by:jtubau
|
||||
- refactor: refs #7100 delete unnecesary set prop by:jtubau
|
||||
- refactor: refs #7100 refactorized with methods by:jtubau
|
||||
- refactor: refs #7957 remove blank by:jorgep
|
||||
- refactor: refs #8198 simplify data fetching and filtering logic by:jorgep
|
||||
- refactor: refs #8198 simplify state management and data fetching in ItemDiary component by:jorgep
|
||||
- refactor: refs #8219 modified e2e tests and fixed some translations by:Jon
|
||||
- refactor: refs #8219 modified list test, created cypress download folder and added to gitignore by:Jon
|
||||
- refactor: refs #8219 requested changes by:Jon
|
||||
- refactor: refs #8219 use checkNotification command by:Jon
|
||||
- refactor: refs #8220 added data-cy for e2e tests by:Jon
|
||||
- refactor: refs #8220 requested changes by:Jon
|
||||
- refactor: refs #8220 skip failling test and modifed tag test by:Jon
|
||||
- refactor: refs #8225 requested changes by:Jon
|
||||
- refactor: refs #8247 use new acl for sysadmin by:Jon
|
||||
- refactor: refs #8316 added claimFilter by:jtubau
|
||||
- refactor: refs #8316 added entryFilter by:jtubau
|
||||
- refactor: refs #8316 add new localization keys and update existing ones for entry components by:jtubau
|
||||
- refactor: refs #8316 moved localizations to local locale by:jtubau
|
||||
- refactor: refs #8316 move order localization by:jtubau
|
||||
- refactor: refs #8316 remove unused OrderSearchbar component by:jtubau
|
||||
- refactor: refs #8316 update EntryCard to use user-filter prop and remove exprBuilder from EntryList by:jtubau
|
||||
- refactor: refs #8316 used VnSection and VnCardBeta by:jtubau
|
||||
- refactor: refs #8322 changed translations by:provira
|
||||
- refactor: refs #8322 changed Worker component to use VnSection/VnCardBeta by:provira
|
||||
- refactor: refs #8322 set department inside worker by:alexm
|
||||
- refactor: skip intermitent failing test by:Jon
|
||||
|
||||
### Fixed 🛠️
|
||||
|
||||
- feat: refs #8225 added entry module and fixed translations by:Jon
|
||||
- fix: added missing translations in InvoiceIn by:provira
|
||||
- fix: changed invoiceIn for InvoiceIn by:provira
|
||||
- fix: changed translations to only use "invoicein" by:provira
|
||||
- fix: department descriptor link by:Jon
|
||||
- fix: e2e tests by:Jon
|
||||
- fix: entry summary view and build warnings by:Jon
|
||||
- fix: fixed InvoiceIn filter translations by:provira
|
||||
- fix: modified setData in customerDescriptor to show the icons by:Jon
|
||||
- fix: redirect to TicketSale from OrderLines (origin/Fix-RedirectToTicketSale) by:Jon
|
||||
- fix: redirect when confirming lines by:Jon
|
||||
- fix: refs #7055 #7055 #7055 fixed some tests by:provira
|
||||
- fix: refs #7077 removed unused imports by:provira
|
||||
- fix: refs #7078 added missing case with array by:provira
|
||||
- fix: refs #7087 fixed some tests by:provira
|
||||
- fix: refs #7088 changed "vm.vm" to "vm" by:provira
|
||||
- fix: refs #7088 changed wrapper to vm by:provira
|
||||
- fix: refs #7699 add icons and hint by:carlossa
|
||||
- fix: refs #7699 add pwd vnInput by:carlossa
|
||||
- fix: refs #7699 fix component by:carlossa
|
||||
- fix: refs #7699 fix password visibility by:carlossa
|
||||
- fix: refs #7699 fix tfront clean code by:carlossa
|
||||
- fix: refs #7699 fix vnChangePassword, clean VnInput by:carlossa
|
||||
- fix: refs #7699 fix vnInputPassword by:carlossa
|
||||
- fix: refs #7957 add missing closing brace by:jorgep
|
||||
- fix: refs #7957 css by:jorgep
|
||||
- fix: refs #7957 rollback by:jorgep
|
||||
- fix: refs #7957 update data-cy by:jorgep
|
||||
- fix: refs #7957 update visibility handling for clear icon in VnInput component by:jorgep
|
||||
- fix: refs #7957 vn-searchbar test by:jorgep
|
||||
- fix: refs #8117 update salesPersonFk filter options and URL for improved data retrieval by:jtubau
|
||||
- fix: refs #8197 not use yet by:alexm
|
||||
- fix: refs #8198 update query param by:jorgep
|
||||
- fix: refs #8219 fixed e2e tests by:Jon
|
||||
- fix: refs #8219 fixed summary and global tests by:Jon
|
||||
- fix: refs #8219 forgotten dataCy by:Jon
|
||||
- fix: refs #8219 global e2e by:Jon
|
||||
- fix: refs #8219 requested changes by:Jon
|
||||
- fix: refs #8220 itemTag test by:Javier Segarra
|
||||
- fix: refs #8225 invoice in translations by:Jon
|
||||
- fix: refs #8243 fixed SkeletonSummary by:provira
|
||||
- fix: refs #8247 conflicts by:Jon
|
||||
- fix: refs #8247 fixed acls and added lost options by:Jon
|
||||
- fix: refs #8316 ref="claimFilterRef" by:alexm
|
||||
- fix: refs #8316 userFilter by:alexm
|
||||
- fix: refs #8316 use rightMenu by:alexm
|
||||
- fix: refs #8316 use section-searchbar by:alexm
|
||||
- fix: refs #8317 disable action buttons when no rows are selected in ItemFixedPrice by:jtubau
|
||||
- fix: refs #8322 unnecessary section by:alexm
|
||||
- fix: refs #8338 fixed VnTable translations by:provira
|
||||
- fix: refs #8338 removed chipLocale property/added more translations by:provira
|
||||
- fix: refs #8448 e2e by:Jon
|
||||
- fix: refs #8448 not use croppie by:alexm
|
||||
- fix: remove departmentCode by:Javier Segarra
|
||||
- fix: removed unused searchbar by:PAU ROVIRA ROSALENY
|
||||
- fix: skip failling e2e by:Jon
|
||||
- fix: sort by name in description by:Jon
|
||||
- fix: translations by:Jon
|
||||
- fix: use entryFilter by:alexm
|
||||
- fix(VnCardBeta): add userFilter by:alexm
|
||||
- refactor: refs #8219 modified e2e tests and fixed some translations by:Jon
|
||||
- revert: revert header by:alexm
|
||||
- test: fix expedition e2e by:alexm
|
||||
|
||||
# Version 25.00 - 2025-01-14
|
||||
|
||||
### Added 🆕
|
||||
|
|
|
@ -1 +1 @@
|
|||
module.exports = { extends: ['@commitlint/config-conventional'] };
|
||||
export default { extends: ['@commitlint/config-conventional'] };
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const { defineConfig } = require('cypress');
|
||||
import { defineConfig } from 'cypress';
|
||||
// https://docs.cypress.io/app/tooling/reporters
|
||||
// https://docs.cypress.io/app/references/configuration
|
||||
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
||||
|
||||
module.exports = defineConfig({
|
||||
export default defineConfig({
|
||||
e2e: {
|
||||
baseUrl: 'http://localhost:9000/',
|
||||
experimentalStudio: true,
|
||||
|
@ -30,9 +30,13 @@ module.exports = defineConfig({
|
|||
testFiles: '**/*.spec.js',
|
||||
supportFile: 'test/cypress/support/unit.js',
|
||||
},
|
||||
setupNodeEvents(on, config) {
|
||||
require('cypress-mochawesome-reporter/plugin')(on);
|
||||
// implement node event listeners here
|
||||
setupNodeEvents: async (on, config) => {
|
||||
const plugin = await import('cypress-mochawesome-reporter/plugin');
|
||||
plugin.default(on);
|
||||
|
||||
return config;
|
||||
},
|
||||
viewportWidth: 1280,
|
||||
viewportHeight: 720,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
import { defineConfig } from 'vitepress';
|
||||
|
||||
// https://vitepress.dev/reference/site-config
|
||||
export default defineConfig({
|
||||
title: 'Lilium',
|
||||
description: 'Lilium docs',
|
||||
themeConfig: {
|
||||
// https://vitepress.dev/reference/default-theme-config
|
||||
nav: [
|
||||
{ text: 'Home', link: '/' },
|
||||
{ text: 'Components', link: '/components/vnInput' },
|
||||
{ text: 'Composables', link: '/composables/useArrayData' },
|
||||
],
|
||||
|
||||
sidebar: [
|
||||
{
|
||||
items: [
|
||||
{
|
||||
text: 'Components',
|
||||
collapsible: true,
|
||||
collapsed: true,
|
||||
items: [{ text: 'VnInput', link: '/components/vnInput' }],
|
||||
},
|
||||
{
|
||||
text: 'Composables',
|
||||
collapsible: true,
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: 'useArrayData', link: '/composables/useArrayData' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
socialLinks: [{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }],
|
||||
},
|
||||
});
|
|
@ -0,0 +1,136 @@
|
|||
# VnInput
|
||||
|
||||
`VnInput` is a custom input component that provides various useful features such as validation, input clearing, and more.
|
||||
|
||||
## Props
|
||||
|
||||
### `modelValue`
|
||||
|
||||
- **Type:** `String | Number`
|
||||
- **Default:** `null`
|
||||
- **Description:** The value of the model bound to the component.
|
||||
|
||||
### `isOutlined`
|
||||
|
||||
- **Type:** `Boolean`
|
||||
- **Default:** `false`
|
||||
- **Description:** If `true`, the component is rendered with an outlined style.
|
||||
|
||||
### `info`
|
||||
|
||||
- **Type:** `String`
|
||||
- **Default:** `''`
|
||||
- **Description:** Additional information displayed alongside the component.
|
||||
|
||||
### `clearable`
|
||||
|
||||
- **Type:** `Boolean`
|
||||
- **Default:** `true`
|
||||
- **Description:** If `true`, the component shows a button to clear the input.
|
||||
|
||||
### `emptyToNull`
|
||||
|
||||
- **Type:** `Boolean`
|
||||
- **Default:** `true`
|
||||
- **Description:** If `true`, converts empty inputs to `null`.
|
||||
|
||||
### `insertable`
|
||||
|
||||
- **Type:** `Boolean`
|
||||
- **Default:** `false`
|
||||
- **Description:** If `true`, allows the insertion of new values.
|
||||
|
||||
### `maxlength`
|
||||
|
||||
- **Type:** `Number`
|
||||
- **Default:** `null`
|
||||
- **Description:** The maximum number of characters allowed in the input.
|
||||
|
||||
### `uppercase`
|
||||
|
||||
- **Type:** `Boolean`
|
||||
- **Default:** `false`
|
||||
- **Description:** If `true`, converts the input text to uppercase.
|
||||
|
||||
## Emits
|
||||
|
||||
### `update:modelValue`
|
||||
|
||||
- **Description:** Emits the updated model value.
|
||||
- **Behavior:** This event is emitted whenever the input value changes. It is used to update the model value bound to the component.
|
||||
|
||||
### `update:options`
|
||||
|
||||
- **Description:** Emits the updated options.
|
||||
- **Behavior:** This event is emitted when the component's options change. It is useful for components with dynamic options.
|
||||
|
||||
### `keyup.enter`
|
||||
|
||||
- **Description:** Emits an event when the Enter key is pressed.
|
||||
- **Behavior:** This event is emitted whenever the Enter key is pressed while the input is focused. It can be used to handle specific actions when the input is confirmed.
|
||||
|
||||
### `remove`
|
||||
|
||||
- **Description:** Emits an event to remove the current value.
|
||||
- **Behavior:** This event is emitted when the clear button (close icon) is clicked. It is used to handle the removal of the current input value.
|
||||
|
||||
## Functions
|
||||
|
||||
### `focus`
|
||||
|
||||
- **Description:** Focuses the input.
|
||||
- **Behavior:** This function is exposed so it can be called from outside the component. It uses `vnInputRef.value.focus()` to focus the input.
|
||||
|
||||
### `handleKeydown`
|
||||
|
||||
- **Description:** Handles the `keydown` event of the input.
|
||||
- **Behavior:** This function is called whenever a key is pressed while the input is focused. If the pressed key is `Backspace`, it does nothing. If `insertable` is `true` and the pressed key is a number, it calls `handleInsertMode`.
|
||||
|
||||
### `handleInsertMode`
|
||||
|
||||
- **Description:** Handles the insertion mode of values.
|
||||
- **Behavior:** This function is called when `insertable` is `true` and a numeric key is pressed. It inserts the value at the cursor position and updates the input value. Then, it moves the cursor to the correct position.
|
||||
|
||||
### `handleUppercase`
|
||||
|
||||
- **Description:** Converts the input value to uppercase.
|
||||
- **Behavior:** This function is called when the uppercase icon is clicked. It converts the current input value to uppercase.
|
||||
|
||||
## Usage
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<VnInput
|
||||
v-model="inputValue"
|
||||
:isOutlined="true"
|
||||
info="Additional information"
|
||||
:clearable="true"
|
||||
:emptyToNull="true"
|
||||
:insertable="false"
|
||||
:maxlength="50"
|
||||
:uppercase="true"
|
||||
@update:modelValue="handleUpdate"
|
||||
@keyup.enter="handleEnter"
|
||||
@remove="handleRemove"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
const inputValue = ref('');
|
||||
|
||||
const handleUpdate = (value) => {
|
||||
console.log('Updated value:', value);
|
||||
};
|
||||
|
||||
const handleEnter = () => {
|
||||
console.log('Enter pressed');
|
||||
};
|
||||
|
||||
const handleRemove = () => {
|
||||
console.log('Value removed');
|
||||
};
|
||||
</script>
|
||||
```
|
|
@ -0,0 +1,215 @@
|
|||
# useArrayData
|
||||
|
||||
`useArrayData` is a composable function that provides a set of utilities for managing array data in a Vue component. It leverages Pinia for state management and provides various methods for fetching, filtering, and manipulating data.
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const {
|
||||
fetch,
|
||||
applyFilter,
|
||||
addFilter,
|
||||
getCurrentFilter,
|
||||
setCurrentFilter,
|
||||
addFilterWhere,
|
||||
addOrder,
|
||||
deleteOrder,
|
||||
refresh,
|
||||
destroy,
|
||||
loadMore,
|
||||
store,
|
||||
totalRows,
|
||||
updateStateParams,
|
||||
isLoading,
|
||||
deleteOption,
|
||||
reset,
|
||||
resetPagination,
|
||||
} = useArrayData('myKey', userOptions);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### `key`
|
||||
|
||||
- **Type:** `String`
|
||||
- **Description:** A unique key to identify the data store.
|
||||
|
||||
### `userOptions`
|
||||
|
||||
- **Type:** `Object`
|
||||
- **Description:** An object containing user-defined options for configuring the data store.
|
||||
|
||||
## Methods
|
||||
|
||||
### `fetch`
|
||||
|
||||
Fetches data from the server.
|
||||
|
||||
#### Parameters
|
||||
|
||||
- **`options`** : An object with the following properties:
|
||||
- `append` (Boolean): Whether to append the fetched data to the existing data.
|
||||
- `updateRouter` (Boolean): Whether to update the router with the current filter.
|
||||
|
||||
#### Returns
|
||||
|
||||
- **`Promise`** : A promise that resolves with the fetched data.
|
||||
|
||||
### `applyFilter`
|
||||
|
||||
Applies a filter to the data.
|
||||
|
||||
#### Parameters
|
||||
|
||||
- **`filter`** : An object containing the filter criteria.
|
||||
- **`params`** : Additional parameters for the filter.
|
||||
- **`fetchOptions`** : Options for the fetch method.
|
||||
|
||||
#### Returns
|
||||
|
||||
- **`Promise`** : A promise that resolves with the filtered data.
|
||||
|
||||
### `addFilter`
|
||||
|
||||
Adds a filter to the existing filters.
|
||||
|
||||
#### Parameters
|
||||
|
||||
- **`filter`** : An object containing the filter criteria.
|
||||
- **`params`** : Additional parameters for the filter.
|
||||
|
||||
#### Returns
|
||||
|
||||
- **`Promise`** : A promise that resolves with the updated filter and parameters.
|
||||
|
||||
### `getCurrentFilter`
|
||||
|
||||
Gets the current filter applied to the data.
|
||||
|
||||
#### Returns
|
||||
|
||||
- **`Object`** : The current filter and parameters.
|
||||
|
||||
### `setCurrentFilter`
|
||||
|
||||
Sets the current filter for the data.
|
||||
|
||||
#### Returns
|
||||
|
||||
- **`Object`** : The current filter and parameters.
|
||||
|
||||
### `addFilterWhere`
|
||||
|
||||
Adds a `where` clause to the existing filters.
|
||||
|
||||
#### Parameters
|
||||
|
||||
- **`where`** : An object containing the `where` clause.
|
||||
|
||||
#### Returns
|
||||
|
||||
- **`Promise`** : A promise that resolves when the filter is applied.
|
||||
|
||||
### `addOrder`
|
||||
|
||||
Adds an order to the existing orders.
|
||||
|
||||
#### Parameters
|
||||
|
||||
- **`field`** : The field to order by.
|
||||
- **`direction`** : The direction of the order (`ASC` or `DESC`).
|
||||
|
||||
#### Returns
|
||||
|
||||
- **`Promise`** : A promise that resolves with the updated order.
|
||||
|
||||
### `deleteOrder`
|
||||
|
||||
Deletes an order from the existing orders.
|
||||
|
||||
#### Parameters
|
||||
|
||||
- **`field`** : The field to delete the order for.
|
||||
|
||||
#### Returns
|
||||
|
||||
- **`Promise`** : A promise that resolves when the order is deleted.
|
||||
|
||||
### `refresh`
|
||||
|
||||
Refreshes the data by re-fetching it from the server.
|
||||
|
||||
#### Returns
|
||||
|
||||
- **`Promise`** : A promise that resolves with the refreshed data.
|
||||
|
||||
### `destroy`
|
||||
|
||||
Destroys the data store for the given key.
|
||||
|
||||
### `loadMore`
|
||||
|
||||
Loads more data by incrementing the pagination.
|
||||
|
||||
#### Returns
|
||||
|
||||
- **`Promise`** : A promise that resolves with the additional data.
|
||||
|
||||
### `updateStateParams`
|
||||
|
||||
Updates the state parameters with the given data.
|
||||
|
||||
#### Parameters
|
||||
|
||||
- **`data`** : The data to update the state parameters with.
|
||||
|
||||
### `deleteOption`
|
||||
|
||||
Deletes an option from the store.
|
||||
|
||||
#### Parameters
|
||||
|
||||
- **`option`** : The option to delete.
|
||||
|
||||
### `reset`
|
||||
|
||||
Resets the store to its default state.
|
||||
|
||||
#### Parameters
|
||||
|
||||
- **`opts`** : An array of options to reset.
|
||||
|
||||
### `resetPagination`
|
||||
|
||||
Resets the pagination for the store.
|
||||
|
||||
## Computed Properties
|
||||
|
||||
### `totalRows`
|
||||
|
||||
- **Description:** The total number of rows in the data.
|
||||
- **Type:** `Number`
|
||||
|
||||
### `isLoading`
|
||||
|
||||
- **Description:** Whether the data is currently being loaded.
|
||||
- **Type:** `Boolean`
|
||||
|
||||
```vue
|
||||
<script setup>
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const userOptions = {
|
||||
url: '/api/data',
|
||||
limit: 10,
|
||||
};
|
||||
|
||||
const arrayData = useArrayData('myKey', userOptions);
|
||||
</script>
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
```
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
# https://vitepress.dev/reference/default-theme-home-page
|
||||
layout: home
|
||||
|
||||
hero:
|
||||
name: 'Lilium'
|
||||
text: 'Lilium docs'
|
||||
tagline: Powered by Verdnatura
|
||||
actions:
|
||||
- theme: brand
|
||||
text: Docs
|
||||
link: /components/vnInput
|
||||
---
|
46
package.json
46
package.json
|
@ -1,11 +1,12 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "25.04.0",
|
||||
"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 ./",
|
||||
|
@ -17,42 +18,47 @@
|
|||
"test:unit:ci": "vitest run",
|
||||
"commitlint": "commitlint --edit",
|
||||
"prepare": "npx husky install",
|
||||
"addReferenceTag": "node .husky/addReferenceTag.js"
|
||||
"addReferenceTag": "node .husky/addReferenceTag.js",
|
||||
"docs:dev": "vitepress dev docs",
|
||||
"docs:build": "vitepress build docs",
|
||||
"docs:preview": "vitepress preview docs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@quasar/cli": "^2.3.0",
|
||||
"@quasar/extras": "^1.16.9",
|
||||
"@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.14.5",
|
||||
"quasar": "^2.17.7",
|
||||
"validator": "^13.9.0",
|
||||
"vue": "^3.3.4",
|
||||
"vue-i18n": "^9.2.2",
|
||||
"vue-router": "^4.2.1"
|
||||
"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.1",
|
||||
"@intlify/unplugin-vue-i18n": "^0.8.2",
|
||||
"@pinia/testing": "^0.1.2",
|
||||
"@quasar/app-vite": "^1.7.3",
|
||||
"@quasar/quasar-app-extension-qcalendar": "4.0.0-beta.15",
|
||||
"@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": "^8.41.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-plugin-cypress": "^2.13.3",
|
||||
"eslint-plugin-vue": "^9.14.1",
|
||||
"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": "^2.8.8",
|
||||
"vitest": "^0.31.1"
|
||||
"prettier": "^3.4.2",
|
||||
"sass": "^1.83.4",
|
||||
"vitepress": "^1.6.3",
|
||||
"vitest": "^0.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20 || ^18 || ^16",
|
||||
|
@ -61,8 +67,8 @@
|
|||
"bun": ">= 1.0.25"
|
||||
},
|
||||
"overrides": {
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"vite": "^5.1.4",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"vite": "^6.0.11",
|
||||
"vitest": "^0.31.1"
|
||||
}
|
||||
}
|
||||
}
|
4809
pnpm-lock.yaml
4809
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,14 @@
|
|||
/* eslint-disable */
|
||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||
|
||||
module.exports = {
|
||||
import autoprefixer from 'autoprefixer';
|
||||
// Uncomment the following line if you want to support RTL CSS
|
||||
// import rtlcss from 'postcss-rtlcss';
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
// https://github.com/postcss/autoprefixer
|
||||
require('autoprefixer')({
|
||||
autoprefixer({
|
||||
overrideBrowserslist: [
|
||||
'last 4 Chrome versions',
|
||||
'last 4 Firefox versions',
|
||||
|
@ -18,10 +22,7 @@ module.exports = {
|
|||
}),
|
||||
|
||||
// https://github.com/elchininet/postcss-rtlcss
|
||||
// If you want to support RTL css, then
|
||||
// 1. yarn/npm install postcss-rtlcss
|
||||
// 2. optionally set quasar.config.js > framework > lang to an RTL language
|
||||
// 3. uncomment the following line:
|
||||
// require('postcss-rtlcss')
|
||||
// If you want to support RTL CSS, uncomment the following line:
|
||||
// rtlcss(),
|
||||
],
|
||||
};
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
export default [
|
||||
{
|
||||
path: '/api',
|
||||
rule: { target: 'http://0.0.0.0:3000' },
|
||||
},
|
||||
];
|
|
@ -8,11 +8,11 @@
|
|||
// Configuration for your app
|
||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js
|
||||
|
||||
const { configure } = require('quasar/wrappers');
|
||||
const VueI18nPlugin = require('@intlify/unplugin-vue-i18n/vite');
|
||||
const path = require('path');
|
||||
import { configure } from 'quasar/wrappers';
|
||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
||||
import path from 'path';
|
||||
|
||||
module.exports = configure(function (/* ctx */) {
|
||||
export default configure(function (/* ctx */) {
|
||||
return {
|
||||
eslint: {
|
||||
// fix: true,
|
||||
|
@ -179,7 +179,6 @@ module.exports = configure(function (/* ctx */) {
|
|||
'render', // keep this as last one
|
||||
],
|
||||
},
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli/developing-pwa/configuring-pwa
|
||||
pwa: {
|
||||
workboxMode: 'generateSW', // or 'injectManifest'
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"@quasar/testing-unit-vitest": {
|
||||
"options": ["scripts"]
|
||||
"options": [
|
||||
"scripts"
|
||||
]
|
||||
},
|
||||
"@quasar/qcalendar": {}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ describe('Axios boot', () => {
|
|||
describe('onRequest()', async () => {
|
||||
it('should set the "Authorization" property on the headers', async () => {
|
||||
const config = { headers: {} };
|
||||
|
||||
localStorage.setItem('token', 'DEFAULT_TOKEN');
|
||||
const resultConfig = onRequest(config);
|
||||
|
||||
expect(resultConfig).toEqual(
|
||||
|
|
|
@ -3,9 +3,9 @@ import { useSession } from 'src/composables/useSession';
|
|||
import { Router } from 'src/router';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
||||
import { getToken, isLoggedIn } from 'src/utils/session';
|
||||
import { i18n } from 'src/boot/i18n';
|
||||
|
||||
const session = useSession();
|
||||
const { notify } = useNotify();
|
||||
const stateQuery = useStateQueryStore();
|
||||
const baseUrl = '/api/';
|
||||
|
@ -13,7 +13,7 @@ axios.defaults.baseURL = baseUrl;
|
|||
const axiosNoError = axios.create({ baseURL: baseUrl });
|
||||
|
||||
const onRequest = (config) => {
|
||||
const token = session.getToken();
|
||||
const token = getToken();
|
||||
if (token.length && !config.headers.Authorization) {
|
||||
config.headers.Authorization = token;
|
||||
config.headers['Accept-Language'] = i18n.global.locale.value;
|
||||
|
@ -37,15 +37,15 @@ const onResponse = (response) => {
|
|||
return response;
|
||||
};
|
||||
|
||||
const onResponseError = (error) => {
|
||||
const onResponseError = async (error) => {
|
||||
stateQuery.remove(error.config);
|
||||
|
||||
if (session.isLoggedIn() && error.response?.status === 401) {
|
||||
session.destroy(false);
|
||||
if (isLoggedIn() && error.response?.status === 401) {
|
||||
await useSession().destroy(false);
|
||||
const hash = window.location.hash;
|
||||
const url = hash.slice(1);
|
||||
Router.push(`/login?redirect=${url}`);
|
||||
} else if (!session.isLoggedIn()) {
|
||||
} else if (!isLoggedIn()) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ const { t } = useI18n();
|
|||
const bicInputRef = ref(null);
|
||||
const state = useState();
|
||||
|
||||
const customer = computed(() => state.get('customer'));
|
||||
const customer = computed(() => state.get('Customer'));
|
||||
|
||||
const countriesFilter = {
|
||||
fields: ['id', 'name', 'code'],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { computed, ref, useAttrs, watch } from 'vue';
|
||||
import { useRouter, onBeforeRouteLeave } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
@ -17,6 +17,7 @@ const quasar = useQuasar();
|
|||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { validate } = useValidator();
|
||||
const $attrs = useAttrs();
|
||||
|
||||
const $props = defineProps({
|
||||
model: {
|
||||
|
@ -113,9 +114,11 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
});
|
||||
|
||||
async function fetch(data) {
|
||||
resetData(data);
|
||||
emit('onFetch', data);
|
||||
return data;
|
||||
const keyData = $attrs['key-data'];
|
||||
const rows = keyData ? data[keyData] : data;
|
||||
resetData(rows);
|
||||
emit('onFetch', rows);
|
||||
return rows;
|
||||
}
|
||||
|
||||
function resetData(data) {
|
||||
|
@ -146,7 +149,7 @@ function filter(value, update, filterOptions) {
|
|||
(ref) => {
|
||||
ref.setOptionIndex(-1);
|
||||
ref.moveOptionSelection(1, true);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -212,7 +215,7 @@ async function remove(data) {
|
|||
|
||||
if (preRemove.length) {
|
||||
newData = newData.filter(
|
||||
(form) => !preRemove.some((index) => index == form.$index)
|
||||
(form) => !preRemove.some((index) => index == form.$index),
|
||||
);
|
||||
const changes = getChanges();
|
||||
if (!changes.creates?.length && !changes.updates?.length)
|
||||
|
|
|
@ -84,7 +84,7 @@ const $props = defineProps({
|
|||
},
|
||||
reload: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
default: true,
|
||||
},
|
||||
defaultTrim: {
|
||||
type: Boolean,
|
||||
|
@ -97,7 +97,7 @@ const $props = defineProps({
|
|||
});
|
||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||
const modelValue = computed(
|
||||
() => $props.model ?? `formModel_${route?.meta?.title ?? route.name}`
|
||||
() => $props.model ?? `formModel_${route?.meta?.title ?? route.name}`,
|
||||
).value;
|
||||
const componentIsRendered = ref(false);
|
||||
const arrayData = useArrayData(modelValue);
|
||||
|
@ -105,8 +105,8 @@ const isLoading = ref(false);
|
|||
// Si elegimos observar los cambios del form significa que inicialmente las actions estaran deshabilitadas
|
||||
const isResetting = ref(false);
|
||||
const hasChanges = ref(!$props.observeFormChanges);
|
||||
const originalData = ref({});
|
||||
const formData = computed(() => state.get(modelValue));
|
||||
const originalData = computed(() => state.get(modelValue));
|
||||
const formData = ref({});
|
||||
const defaultButtons = computed(() => ({
|
||||
save: {
|
||||
dataCy: 'saveDefaultBtn',
|
||||
|
@ -127,8 +127,6 @@ const defaultButtons = computed(() => ({
|
|||
}));
|
||||
|
||||
onMounted(async () => {
|
||||
originalData.value = JSON.parse(JSON.stringify($props.formInitialData ?? {}));
|
||||
|
||||
nextTick(() => (componentIsRendered.value = true));
|
||||
|
||||
// Podemos enviarle al form la estructura de data inicial sin necesidad de fetchearla
|
||||
|
@ -148,7 +146,7 @@ onMounted(async () => {
|
|||
JSON.stringify(newVal) !== JSON.stringify(originalData.value);
|
||||
isResetting.value = false;
|
||||
},
|
||||
{ deep: true }
|
||||
{ deep: true },
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -156,16 +154,24 @@ onMounted(async () => {
|
|||
if (!$props.url)
|
||||
watch(
|
||||
() => arrayData.store.data,
|
||||
(val) => updateAndEmit('onFetch', val)
|
||||
(val) => updateAndEmit('onFetch', val),
|
||||
);
|
||||
|
||||
watch(
|
||||
originalData,
|
||||
(val) => {
|
||||
if (val) formData.value = JSON.parse(JSON.stringify(val));
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
watch(
|
||||
() => [$props.url, $props.filter],
|
||||
async () => {
|
||||
originalData.value = null;
|
||||
state.set(modelValue, null);
|
||||
reset();
|
||||
await fetch();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
onBeforeRouteLeave((to, from, next) => {
|
||||
|
@ -197,7 +203,6 @@ async function fetch() {
|
|||
updateAndEmit('onFetch', data);
|
||||
} catch (e) {
|
||||
state.set(modelValue, {});
|
||||
originalData.value = {};
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -236,6 +241,7 @@ async function saveAndGo() {
|
|||
}
|
||||
|
||||
function reset() {
|
||||
formData.value = JSON.parse(JSON.stringify(originalData.value));
|
||||
updateAndEmit('onFetch', originalData.value);
|
||||
if ($props.observeFormChanges) {
|
||||
hasChanges.value = false;
|
||||
|
@ -254,13 +260,12 @@ function filter(value, update, filterOptions) {
|
|||
(ref) => {
|
||||
ref.setOptionIndex(-1);
|
||||
ref.moveOptionSelection(1, true);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
function updateAndEmit(evt, val, res) {
|
||||
state.set(modelValue, val);
|
||||
originalData.value = val && JSON.parse(JSON.stringify(val));
|
||||
if (!$props.url) arrayData.store.data = val;
|
||||
|
||||
emit(evt, state.get(modelValue), res);
|
||||
|
|
|
@ -31,7 +31,6 @@ const props = defineProps({
|
|||
const route = useRoute();
|
||||
|
||||
const itemTypesOptions = ref([]);
|
||||
const suppliersOptions = ref([]);
|
||||
const tagOptions = ref([]);
|
||||
const tagValues = ref([]);
|
||||
const categoryList = ref(null);
|
||||
|
@ -40,13 +39,13 @@ const selectedTypeFk = ref(getParamWhere(route.query.table, 'typeFk', false));
|
|||
|
||||
const selectedCategory = computed(() => {
|
||||
return (categoryList.value || []).find(
|
||||
(category) => category?.id === selectedCategoryFk.value
|
||||
(category) => category?.id === selectedCategoryFk.value,
|
||||
);
|
||||
});
|
||||
|
||||
const selectedType = computed(() => {
|
||||
return (itemTypesOptions.value || []).find(
|
||||
(type) => type?.id === selectedTypeFk.value
|
||||
(type) => type?.id === selectedTypeFk.value,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -134,13 +133,6 @@ const setCategoryList = (data) => {
|
|||
|
||||
<template>
|
||||
<FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" />
|
||||
<FetchData
|
||||
url="Suppliers"
|
||||
limit="30"
|
||||
auto-load
|
||||
:filter="{ fields: ['id', 'name', 'nickname'], order: 'name ASC', limit: 30 }"
|
||||
@on-fetch="(data) => (suppliersOptions = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Tags"
|
||||
:filter="{ fields: ['id', 'name', 'isFree'] }"
|
||||
|
@ -290,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"
|
||||
|
@ -349,4 +341,11 @@ es:
|
|||
floramondo: Floramondo
|
||||
salesPersonFk: Comprador
|
||||
categoryFk: Categoría
|
||||
Plant: Planta natural
|
||||
Flower: Flor fresca
|
||||
Handmade: Hecho a mano
|
||||
Artificial: Artificial
|
||||
Green: Verdes frescos
|
||||
Accessories: Complementos florales
|
||||
Fruit: Fruta
|
||||
</i18n>
|
||||
|
|
|
@ -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,
|
||||
|
@ -40,7 +41,6 @@ const filteredItems = computed(() => {
|
|||
return locale.includes(normalizedSearch);
|
||||
});
|
||||
});
|
||||
|
||||
const filteredPinnedModules = computed(() => {
|
||||
if (!search.value) return pinnedModules.value;
|
||||
const normalizedSearch = search.value
|
||||
|
@ -71,7 +71,7 @@ watch(
|
|||
items.value = [];
|
||||
getRoutes();
|
||||
},
|
||||
{ deep: true }
|
||||
{ deep: true },
|
||||
);
|
||||
|
||||
function findMatches(search, item) {
|
||||
|
@ -103,33 +103,40 @@ function addChildren(module, route, parent) {
|
|||
}
|
||||
|
||||
function getRoutes() {
|
||||
if (props.source === 'main') {
|
||||
const modules = Object.assign([], navigation.getModules().value);
|
||||
|
||||
for (const item of modules) {
|
||||
const moduleDef = routes.find(
|
||||
(route) => toLowerCamel(route.name) === item.module
|
||||
);
|
||||
if (!moduleDef) continue;
|
||||
item.children = [];
|
||||
|
||||
addChildren(item.module, moduleDef, item.children);
|
||||
}
|
||||
|
||||
items.value = modules;
|
||||
const handleRoutes = {
|
||||
main: getMainRoutes,
|
||||
card: getCardRoutes,
|
||||
};
|
||||
try {
|
||||
handleRoutes[props.source]();
|
||||
} catch (error) {
|
||||
throw new Error(`Method is not defined`);
|
||||
}
|
||||
}
|
||||
function getMainRoutes() {
|
||||
const modules = Object.assign([], navigation.getModules().value);
|
||||
|
||||
if (props.source === 'card') {
|
||||
const currentRoute = route.matched[1];
|
||||
const currentModule = toLowerCamel(currentRoute.name);
|
||||
let moduleDef = routes.find(
|
||||
(route) => toLowerCamel(route.name) === currentModule
|
||||
for (const item of modules) {
|
||||
const moduleDef = routes.find(
|
||||
(route) => toLowerCamel(route.name) === item.module,
|
||||
);
|
||||
if (!moduleDef) continue;
|
||||
item.children = [];
|
||||
|
||||
if (!moduleDef) return;
|
||||
if (!moduleDef?.menus) moduleDef = betaGetRoutes();
|
||||
addChildren(currentModule, moduleDef, items.value);
|
||||
addChildren(item.module, moduleDef, item.children);
|
||||
}
|
||||
|
||||
items.value = modules;
|
||||
}
|
||||
|
||||
function getCardRoutes() {
|
||||
const currentRoute = route.matched[1];
|
||||
const currentModule = toLowerCamel(currentRoute.name);
|
||||
let moduleDef = routes.find((route) => toLowerCamel(route.name) === currentModule);
|
||||
|
||||
if (!moduleDef) return;
|
||||
if (!moduleDef?.menus) moduleDef = betaGetRoutes();
|
||||
addChildren(currentModule, moduleDef, items.value);
|
||||
}
|
||||
|
||||
function betaGetRoutes() {
|
||||
|
@ -174,6 +181,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 +199,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 +227,18 @@ 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 +355,9 @@ function normalize(text) {
|
|||
.header {
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
.searched {
|
||||
background-color: var(--vn-section-hover-color);
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
|
|
|
@ -20,6 +20,7 @@ const appName = 'Lilium';
|
|||
const pinnedModulesRef = ref();
|
||||
|
||||
onMounted(() => stateStore.setMounted());
|
||||
const refresh = () => window.location.reload();
|
||||
</script>
|
||||
<template>
|
||||
<QHeader color="white" elevated>
|
||||
|
@ -64,6 +65,13 @@ onMounted(() => stateStore.setMounted());
|
|||
<QSpace />
|
||||
<div class="q-pl-sm q-gutter-sm row items-center no-wrap">
|
||||
<div id="actions-prepend"></div>
|
||||
<QIcon
|
||||
name="refresh"
|
||||
size="md"
|
||||
color="red"
|
||||
v-if="state.get('error')"
|
||||
@click="refresh"
|
||||
/>
|
||||
<QBtn
|
||||
:class="{ 'q-pa-none': quasar.platform.is.mobile }"
|
||||
id="pinnedModules"
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<script setup>
|
||||
import quasarLang from 'src/utils/quasarLang';
|
||||
|
||||
import { onMounted, computed, ref } from 'vue';
|
||||
import { Dark, Quasar } from 'quasar';
|
||||
|
||||
import { Dark } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
|
@ -31,14 +34,7 @@ const userLocale = computed({
|
|||
|
||||
value = localeEquivalence[value] ?? value;
|
||||
|
||||
try {
|
||||
/* @vite-ignore */
|
||||
import(`../../node_modules/quasar/lang/${value}.mjs`).then((lang) => {
|
||||
Quasar.lang.set(lang.default);
|
||||
});
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
quasarLang(value);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ onMounted(() => {
|
|||
watch(
|
||||
() => $props.columns,
|
||||
(value) => splitColumns(value),
|
||||
{ immediate: true }
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
||||
|
@ -212,7 +212,7 @@ function splitColumns(columns) {
|
|||
// Status column
|
||||
if (splittedColumns.value.chips.length) {
|
||||
splittedColumns.value.columnChips = splittedColumns.value.chips.filter(
|
||||
(c) => !c.isId
|
||||
(c) => !c.isId,
|
||||
);
|
||||
if (splittedColumns.value.columnChips.length)
|
||||
splittedColumns.value.columns.unshift({
|
||||
|
@ -314,7 +314,19 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
show-if-above
|
||||
>
|
||||
<QScrollArea class="fit">
|
||||
<VnTableFilter :data-key="$attrs['data-key']" :columns="columns" :redirect="redirect" />
|
||||
<VnTableFilter
|
||||
:data-key="$attrs['data-key']"
|
||||
:columns="columns"
|
||||
:redirect="redirect"
|
||||
>
|
||||
<template
|
||||
v-for="(_, slotName) in $slots"
|
||||
#[slotName]="slotData"
|
||||
:key="slotName"
|
||||
>
|
||||
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||
</template>
|
||||
</VnTableFilter>
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<CrudModel
|
||||
|
@ -472,7 +484,9 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
btn.isPrimary ? 'text-primary-light' : 'color-vn-text '
|
||||
"
|
||||
:style="`visibility: ${
|
||||
(btn.show && btn.show(row)) ?? true ? 'visible' : 'hidden'
|
||||
((btn.show && btn.show(row)) ?? true)
|
||||
? 'visible'
|
||||
: 'hidden'
|
||||
}`"
|
||||
@click="btn.action(row)"
|
||||
/>
|
||||
|
@ -486,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);
|
||||
|
@ -567,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
|
||||
|
@ -616,7 +629,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
size="md"
|
||||
round
|
||||
flat
|
||||
shortcut="+"
|
||||
v-shortcut="'+'"
|
||||
:disabled="!disabledAttr"
|
||||
/>
|
||||
<QTooltip>
|
||||
|
@ -634,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">
|
||||
|
@ -793,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 {
|
||||
|
|
|
@ -62,5 +62,8 @@ function columnName(col) {
|
|||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
||||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
import VnVisibleColumn from '../VnVisibleColumn.vue';
|
||||
import { axios } from 'app/test/vitest/helper';
|
||||
|
||||
describe('VnVisibleColumns', () => {
|
||||
let wrapper;
|
||||
let vm;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = createWrapper(VnVisibleColumn, {
|
||||
propsData: {
|
||||
tableCode: 'testTable',
|
||||
skip: ['skippedColumn'],
|
||||
},
|
||||
});
|
||||
vm = wrapper.vm;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('setUserConfigViewData()', () => {
|
||||
it('should initialize localColumns with visible configuration', () => {
|
||||
vm.columns = [
|
||||
{ name: 'columnMockName', label: undefined },
|
||||
{ name: 'columnMockAddress', label: undefined },
|
||||
{ name: 'columnMockId', label: undefined },
|
||||
];
|
||||
const configuration = {
|
||||
columnMockName: true,
|
||||
columnMockAddress: false,
|
||||
columnMockId: true,
|
||||
};
|
||||
const expectedColumns = [
|
||||
{ name: 'columnMockName', label: undefined, visible: true },
|
||||
{ name: 'columnMockAddress', label: undefined, visible: false },
|
||||
{ name: 'columnMockId', label: undefined, visible: true },
|
||||
];
|
||||
|
||||
vm.setUserConfigViewData(configuration, false);
|
||||
|
||||
expect(vm.localColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('should skip columns based on props', () => {
|
||||
vm.columns = [
|
||||
{ name: 'columnMockName', label: undefined },
|
||||
{ name: 'columnMockId', label: undefined },
|
||||
{ name: 'skippedColumn', label: 'Skipped Column' },
|
||||
];
|
||||
const configuration = {
|
||||
columnMockName: true,
|
||||
skippedColumn: false,
|
||||
columnMockId: true,
|
||||
};
|
||||
const expectedColumns = [
|
||||
{ name: 'columnMockName', label: undefined, visible: true },
|
||||
{ name: 'columnMockId', label: undefined, visible: true },
|
||||
];
|
||||
|
||||
vm.setUserConfigViewData(configuration, false);
|
||||
|
||||
expect(vm.localColumns).toEqual(expectedColumns);
|
||||
});
|
||||
});
|
||||
|
||||
describe('toggleMarkAll()', () => {
|
||||
it('should set all localColumns to visible=true', () => {
|
||||
vm.localColumns = [
|
||||
{ name: 'columnMockName', visible: false },
|
||||
{ name: 'columnMockId', visible: false },
|
||||
];
|
||||
|
||||
vm.toggleMarkAll(true);
|
||||
|
||||
expect(vm.localColumns.every((col) => col.visible)).toBe(true);
|
||||
});
|
||||
|
||||
it('should set all localColumns to visible=false', () => {
|
||||
vm.localColumns = [
|
||||
{ name: 'columnMockName', visible: true },
|
||||
{ name: 'columnMockId', visible: true },
|
||||
];
|
||||
|
||||
vm.toggleMarkAll(false);
|
||||
|
||||
expect(vm.localColumns.every((col) => col.visible)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('saveConfig()', () => {
|
||||
it('should call setUserConfigViewData and axios.post with correct params', async () => {
|
||||
const mockAxiosPost = vi.spyOn(axios, 'post').mockResolvedValue({
|
||||
data: [{ id: 1 }],
|
||||
});
|
||||
|
||||
vm.localColumns = [
|
||||
{ name: 'columnMockName', visible: true },
|
||||
{ name: 'columnMockId', visible: false },
|
||||
];
|
||||
|
||||
await vm.saveConfig();
|
||||
|
||||
expect(mockAxiosPost).toHaveBeenCalledWith('UserConfigViews/crud', {
|
||||
creates: [
|
||||
{
|
||||
userFk: vm.user.id,
|
||||
tableCode: vm.tableCode,
|
||||
tableConfig: vm.tableCode,
|
||||
configuration: {
|
||||
columnMockName: true,
|
||||
columnMockId: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
export default function (initialFooter, data) {
|
||||
const footer = data.reduce(
|
||||
(acc, row) => {
|
||||
Object.entries(initialFooter).forEach(([key, initialValue]) => {
|
||||
acc[key] += row?.[key] !== undefined ? row[key] : initialValue;
|
||||
});
|
||||
return acc;
|
||||
},
|
||||
{ ...initialFooter }
|
||||
);
|
||||
return footer;
|
||||
}
|
|
@ -93,7 +93,7 @@ describe('FormModel', () => {
|
|||
|
||||
it('should call axios.patch with the right data', async () => {
|
||||
const spy = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
||||
const { vm } = mount({ propsData: { url, model, formInitialData } });
|
||||
const { vm } = mount({ propsData: { url, model } });
|
||||
vm.formData.mockKey = 'newVal';
|
||||
await vm.$nextTick();
|
||||
await vm.save();
|
||||
|
@ -106,6 +106,7 @@ describe('FormModel', () => {
|
|||
const { vm } = mount({
|
||||
propsData: { url, model, formInitialData, urlCreate: 'mockUrlCreate' },
|
||||
});
|
||||
await vm.$nextTick();
|
||||
vm.formData.mockKey = 'newVal';
|
||||
await vm.$nextTick();
|
||||
await vm.save();
|
||||
|
@ -119,7 +120,7 @@ describe('FormModel', () => {
|
|||
});
|
||||
const spyPatch = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
||||
const spySaveFn = vi.spyOn(vm.$props, 'saveFn');
|
||||
|
||||
await vm.$nextTick();
|
||||
vm.formData.mockKey = 'newVal';
|
||||
await vm.$nextTick();
|
||||
await vm.save();
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import { vi, describe, expect, it, beforeAll } from 'vitest';
|
||||
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
|
||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||
import Leftmenu from 'components/LeftMenu.vue';
|
||||
|
||||
import * as vueRouter from 'vue-router';
|
||||
import { useNavigationStore } from 'src/stores/useNavigationStore';
|
||||
|
||||
let vm;
|
||||
let navigation;
|
||||
|
||||
vi.mock('src/router/modules', () => ({
|
||||
default: [
|
||||
{
|
||||
|
@ -21,6 +24,16 @@ vi.mock('src/router/modules', () => ({
|
|||
{
|
||||
path: '',
|
||||
name: 'CustomerMain',
|
||||
meta: {
|
||||
menu: 'Customer',
|
||||
menuChildren: [
|
||||
{
|
||||
name: 'CustomerCreditContracts',
|
||||
title: 'creditContracts',
|
||||
icon: 'vn:solunion',
|
||||
},
|
||||
],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
|
@ -28,6 +41,13 @@ vi.mock('src/router/modules', () => ({
|
|||
meta: {
|
||||
title: 'list',
|
||||
icon: 'view_list',
|
||||
menuChildren: [
|
||||
{
|
||||
name: 'CustomerCreditContracts',
|
||||
title: 'creditContracts',
|
||||
icon: 'vn:solunion',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -44,51 +64,325 @@ vi.mock('src/router/modules', () => ({
|
|||
},
|
||||
],
|
||||
}));
|
||||
|
||||
describe('Leftmenu', () => {
|
||||
let vm;
|
||||
let navigation;
|
||||
beforeAll(() => {
|
||||
vi.spyOn(axios, 'get').mockResolvedValue({
|
||||
data: [],
|
||||
});
|
||||
|
||||
vm = createWrapper(Leftmenu, {
|
||||
propsData: {
|
||||
source: 'main',
|
||||
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
|
||||
matched: [
|
||||
{
|
||||
path: '/',
|
||||
redirect: {
|
||||
name: 'Dashboard',
|
||||
},
|
||||
}).vm;
|
||||
|
||||
navigation = useNavigationStore();
|
||||
navigation.fetchPinned = vi.fn().mockReturnValue(Promise.resolve(true));
|
||||
navigation.getModules = vi.fn().mockReturnValue({
|
||||
value: [
|
||||
name: 'Main',
|
||||
meta: {},
|
||||
props: {
|
||||
default: false,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'customer',
|
||||
title: 'customer.pageTitles.customers',
|
||||
icon: 'vn:customer',
|
||||
module: 'customer',
|
||||
path: '/dashboard',
|
||||
name: 'Dashboard',
|
||||
meta: {
|
||||
title: 'dashboard',
|
||||
icon: 'dashboard',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/customer',
|
||||
redirect: {
|
||||
name: 'CustomerMain',
|
||||
},
|
||||
name: 'Customer',
|
||||
meta: {
|
||||
title: 'customers',
|
||||
icon: 'vn:client',
|
||||
moduleName: 'Customer',
|
||||
keyBinding: 'c',
|
||||
menu: 'customer',
|
||||
},
|
||||
},
|
||||
],
|
||||
query: {},
|
||||
params: {},
|
||||
meta: { moduleName: 'mockName' },
|
||||
path: 'mockName/1',
|
||||
name: 'Customer',
|
||||
});
|
||||
function mount(source = 'main') {
|
||||
vi.spyOn(axios, 'get').mockResolvedValue({
|
||||
data: [],
|
||||
});
|
||||
const wrapper = createWrapper(Leftmenu, {
|
||||
propsData: {
|
||||
source,
|
||||
},
|
||||
});
|
||||
|
||||
navigation = useNavigationStore();
|
||||
navigation.fetchPinned = vi.fn().mockReturnValue(Promise.resolve(true));
|
||||
navigation.getModules = vi.fn().mockReturnValue({
|
||||
value: [
|
||||
{
|
||||
name: 'customer',
|
||||
title: 'customer.pageTitles.customers',
|
||||
icon: 'vn:customer',
|
||||
module: 'customer',
|
||||
},
|
||||
],
|
||||
});
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
describe('getRoutes', () => {
|
||||
afterEach(() => vi.clearAllMocks());
|
||||
const getRoutes = vi.fn().mockImplementation((props, getMethodA, getMethodB) => {
|
||||
const handleRoutes = {
|
||||
methodA: getMethodA,
|
||||
methodB: getMethodB,
|
||||
};
|
||||
try {
|
||||
handleRoutes[props.source]();
|
||||
} catch (error) {
|
||||
throw Error('Method not defined');
|
||||
}
|
||||
});
|
||||
|
||||
const getMethodA = vi.fn();
|
||||
const getMethodB = vi.fn();
|
||||
const fn = (props) => getRoutes(props, getMethodA, getMethodB);
|
||||
|
||||
it('should call getMethodB when source is card', () => {
|
||||
let props = { source: 'methodB' };
|
||||
fn(props);
|
||||
|
||||
expect(getMethodB).toHaveBeenCalled();
|
||||
expect(getMethodA).not.toHaveBeenCalled();
|
||||
});
|
||||
it('should call getMethodA when source is main', () => {
|
||||
let props = { source: 'methodA' };
|
||||
fn(props);
|
||||
|
||||
expect(getMethodA).toHaveBeenCalled();
|
||||
expect(getMethodB).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call getMethodA when source is not exists or undefined', () => {
|
||||
let props = { source: 'methodC' };
|
||||
expect(() => fn(props)).toThrowError('Method not defined');
|
||||
|
||||
expect(getMethodA).not.toHaveBeenCalled();
|
||||
expect(getMethodB).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Leftmenu as card', () => {
|
||||
beforeAll(() => {
|
||||
vm = mount('card').vm;
|
||||
});
|
||||
|
||||
it('should get routes for card source', async () => {
|
||||
vm.getRoutes();
|
||||
});
|
||||
});
|
||||
describe('Leftmenu as main', () => {
|
||||
beforeEach(() => {
|
||||
vm = mount().vm;
|
||||
});
|
||||
|
||||
it('should initialize with default props', () => {
|
||||
expect(vm.source).toBe('main');
|
||||
});
|
||||
|
||||
it('should filter items based on search input', async () => {
|
||||
vm.search = 'cust';
|
||||
await vm.$nextTick();
|
||||
expect(vm.filteredItems[0].name).toEqual('customer');
|
||||
expect(vm.filteredItems[0].module).toEqual('customer');
|
||||
});
|
||||
it('should filter items based on search input', async () => {
|
||||
vm.search = 'Rou';
|
||||
await vm.$nextTick();
|
||||
expect(vm.filteredItems).toEqual([]);
|
||||
});
|
||||
|
||||
it('should return pinned items', () => {
|
||||
vm.items = [
|
||||
{ name: 'Item 1', isPinned: false },
|
||||
{ name: 'Item 2', isPinned: true },
|
||||
];
|
||||
expect(vm.pinnedModules).toEqual(
|
||||
new Map([['Item 2', { name: 'Item 2', isPinned: true }]]),
|
||||
);
|
||||
});
|
||||
|
||||
it('should find matches in routes', () => {
|
||||
const search = 'child1';
|
||||
const item = {
|
||||
children: [
|
||||
{ name: 'child1', children: [] },
|
||||
{ name: 'child2', children: [] },
|
||||
],
|
||||
};
|
||||
const matches = vm.findMatches(search, item);
|
||||
expect(matches).toEqual([{ name: 'child1', children: [] }]);
|
||||
});
|
||||
it('should not proceed if event is already prevented', async () => {
|
||||
const item = { module: 'testModule', isPinned: false };
|
||||
const event = {
|
||||
preventDefault: vi.fn(),
|
||||
stopPropagation: vi.fn(),
|
||||
defaultPrevented: true,
|
||||
};
|
||||
|
||||
await vm.togglePinned(item, event);
|
||||
|
||||
expect(event.preventDefault).not.toHaveBeenCalled();
|
||||
expect(event.stopPropagation).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call quasar.notify with success message', async () => {
|
||||
const item = { module: 'testModule', isPinned: false };
|
||||
const event = {
|
||||
preventDefault: vi.fn(),
|
||||
stopPropagation: vi.fn(),
|
||||
defaultPrevented: false,
|
||||
};
|
||||
const response = { data: { id: 1 } };
|
||||
|
||||
vi.spyOn(axios, 'post').mockResolvedValue(response);
|
||||
vi.spyOn(vm.quasar, 'notify');
|
||||
|
||||
await vm.togglePinned(item, event);
|
||||
|
||||
expect(vm.quasar.notify).toHaveBeenCalledWith({
|
||||
message: 'Data saved',
|
||||
type: 'positive',
|
||||
});
|
||||
});
|
||||
|
||||
it('should return a proper formated object with two child items', async () => {
|
||||
const expectedMenuItem = [
|
||||
{
|
||||
children: null,
|
||||
name: 'CustomerList',
|
||||
title: 'globals.pageTitles.list',
|
||||
icon: 'view_list',
|
||||
},
|
||||
{
|
||||
children: null,
|
||||
name: 'CustomerCreate',
|
||||
title: 'globals.pageTitles.createCustomer',
|
||||
icon: 'vn:addperson',
|
||||
},
|
||||
];
|
||||
const firstMenuItem = vm.items[0];
|
||||
expect(firstMenuItem.children).toEqual(expect.arrayContaining(expectedMenuItem));
|
||||
it('should handle a single matched route with a menu', () => {
|
||||
const route = {
|
||||
matched: [{ meta: { menu: 'customer' } }],
|
||||
};
|
||||
|
||||
const result = vm.betaGetRoutes();
|
||||
|
||||
expect(result.meta.menu).toEqual(route.matched[0].meta.menu);
|
||||
});
|
||||
it('should get routes for main source', () => {
|
||||
vm.props.source = 'main';
|
||||
vm.getRoutes();
|
||||
expect(navigation.getModules).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should find direct child matches', () => {
|
||||
const search = 'child1';
|
||||
const item = {
|
||||
children: [{ name: 'child1' }, { name: 'child2' }],
|
||||
};
|
||||
const result = vm.findMatches(search, item);
|
||||
expect(result).toEqual([{ name: 'child1' }]);
|
||||
});
|
||||
|
||||
it('should find nested child matches', () => {
|
||||
const search = 'child3';
|
||||
const item = {
|
||||
children: [
|
||||
{ name: 'child1' },
|
||||
{
|
||||
name: 'child2',
|
||||
children: [{ name: 'child3' }],
|
||||
},
|
||||
],
|
||||
};
|
||||
const result = vm.findMatches(search, item);
|
||||
expect(result).toEqual([{ name: 'child3' }]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('normalize', () => {
|
||||
beforeAll(() => {
|
||||
vm = mount('card').vm;
|
||||
});
|
||||
it('should normalize and lowercase text', () => {
|
||||
const input = 'ÁÉÍÓÚáéíóú';
|
||||
const expected = 'aeiouaeiou';
|
||||
expect(vm.normalize(input)).toBe(expected);
|
||||
});
|
||||
|
||||
it('should handle empty string', () => {
|
||||
const input = '';
|
||||
const expected = '';
|
||||
expect(vm.normalize(input)).toBe(expected);
|
||||
});
|
||||
|
||||
it('should handle text without diacritics', () => {
|
||||
const input = 'hello';
|
||||
const expected = 'hello';
|
||||
expect(vm.normalize(input)).toBe(expected);
|
||||
});
|
||||
|
||||
it('should handle mixed text', () => {
|
||||
const input = 'Héllo Wórld!';
|
||||
const expected = 'hello world!';
|
||||
expect(vm.normalize(input)).toBe(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('addChildren', () => {
|
||||
const module = 'testModule';
|
||||
beforeEach(() => {
|
||||
vm = mount().vm;
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should add menu items to parent if matches are found', () => {
|
||||
const parent = 'testParent';
|
||||
const route = {
|
||||
meta: {
|
||||
menu: 'testMenu',
|
||||
},
|
||||
children: [{ name: 'child1' }, { name: 'child2' }],
|
||||
};
|
||||
vm.addChildren(module, route, parent);
|
||||
|
||||
expect(navigation.addMenuItem).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should handle routes with no meta menu', () => {
|
||||
const route = {
|
||||
meta: {},
|
||||
menus: {},
|
||||
};
|
||||
|
||||
const parent = [];
|
||||
|
||||
vm.addChildren(module, route, parent);
|
||||
expect(navigation.addMenuItem).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should handle empty parent array', () => {
|
||||
const parent = [];
|
||||
const route = {
|
||||
meta: {
|
||||
menu: 'child11',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'child1',
|
||||
meta: {
|
||||
menuChildren: [
|
||||
{
|
||||
name: 'CustomerCreditContracts',
|
||||
title: 'creditContracts',
|
||||
icon: 'vn:solunion',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
vm.addChildren(module, route, parent);
|
||||
expect(navigation.addMenuItem).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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 });
|
||||
});
|
||||
});
|
|
@ -0,0 +1,53 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useHasContent } from 'src/composables/useHasContent';
|
||||
import { watch } from 'vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
const hasContent = useHasContent('#advanced-menu');
|
||||
|
||||
const $props = defineProps({
|
||||
isMainSection: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
watch(
|
||||
() => $props.isMainSection,
|
||||
(val) => {
|
||||
if (stateStore) stateStore.rightAdvancedDrawer = val;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#searchbar-after" v-if="stateStore.isHeaderMounted()">
|
||||
<QBtn
|
||||
v-if="hasContent || $slots['advanced-menu']"
|
||||
flat
|
||||
@click="stateStore.toggleRightAdvancedDrawer()"
|
||||
round
|
||||
icon="tune"
|
||||
color="white"
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('globals.advancedMenu') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</Teleport>
|
||||
<QDrawer
|
||||
v-model="stateStore.rightAdvancedDrawer"
|
||||
side="right"
|
||||
:width="256"
|
||||
:overlay="!isMainSection"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<QScrollArea class="fit">
|
||||
<div id="advanced-menu"></div>
|
||||
<slot v-if="!hasContent" name="advanced-menu" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
</template>
|
|
@ -17,7 +17,7 @@ onMounted(() => {
|
|||
});
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#actions-append" v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#actions-prepend" v-if="stateStore.isHeaderMounted()">
|
||||
<div class="row q-gutter-x-sm">
|
||||
<QBtn
|
||||
v-if="hasContent || $slots['right-panel']"
|
||||
|
@ -26,6 +26,7 @@ onMounted(() => {
|
|||
round
|
||||
dense
|
||||
icon="dock_to_left"
|
||||
data-cy="toggle-right-drawer"
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('globals.collapseMenu') }}
|
||||
|
|
|
@ -10,11 +10,11 @@ import LeftMenu from 'components/LeftMenu.vue';
|
|||
import RightMenu from 'components/common/RightMenu.vue';
|
||||
const props = defineProps({
|
||||
dataKey: { type: String, required: true },
|
||||
baseUrl: { type: String, default: undefined },
|
||||
customUrl: { type: String, default: undefined },
|
||||
url: { type: String, default: undefined },
|
||||
filter: { type: Object, default: () => {} },
|
||||
descriptor: { type: Object, required: true },
|
||||
filterPanel: { type: Object, default: undefined },
|
||||
idInWhere: { type: Boolean, default: false },
|
||||
searchDataKey: { type: String, default: undefined },
|
||||
searchbarProps: { type: Object, default: undefined },
|
||||
redirectOnError: { type: Boolean, default: false },
|
||||
|
@ -23,25 +23,20 @@ const props = defineProps({
|
|||
const stateStore = useStateStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const url = computed(() => {
|
||||
if (props.baseUrl) {
|
||||
return `${props.baseUrl}/${route.params.id}`;
|
||||
}
|
||||
return props.customUrl;
|
||||
});
|
||||
const searchRightDataKey = computed(() => {
|
||||
if (!props.searchDataKey) return route.name;
|
||||
return props.searchDataKey;
|
||||
});
|
||||
|
||||
const arrayData = useArrayData(props.dataKey, {
|
||||
url: url.value,
|
||||
filter: props.filter,
|
||||
url: props.url,
|
||||
userFilter: props.filter,
|
||||
oneRecord: true,
|
||||
});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
try {
|
||||
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
||||
await arrayData.fetch({ append: false, updateRouter: false });
|
||||
await fetch(route.params.id);
|
||||
} catch {
|
||||
const { matched: matches } = router.currentRoute.value;
|
||||
const { path } = matches.at(-1);
|
||||
|
@ -49,13 +44,17 @@ onBeforeMount(async () => {
|
|||
}
|
||||
});
|
||||
|
||||
if (props.baseUrl) {
|
||||
onBeforeRouteUpdate(async (to, from) => {
|
||||
if (to.params.id !== from.params.id) {
|
||||
arrayData.store.url = `${props.baseUrl}/${to.params.id}`;
|
||||
await arrayData.fetch({ append: false, updateRouter: false });
|
||||
}
|
||||
});
|
||||
onBeforeRouteUpdate(async (to, from) => {
|
||||
const id = to.params.id;
|
||||
if (id !== from.params.id) await fetch(id, true);
|
||||
});
|
||||
|
||||
async function fetch(id, append = false) {
|
||||
const regex = /\/(\d+)/;
|
||||
if (props.idInWhere) arrayData.store.filter.where = { id };
|
||||
else if (!regex.test(props.url)) arrayData.store.url = `${props.url}/${id}`;
|
||||
else arrayData.store.url = props.url.replace(regex, `/${id}`);
|
||||
await arrayData.fetch({ append, updateRouter: false });
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
@ -83,7 +82,7 @@ if (props.baseUrl) {
|
|||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<div :class="[useCardSize(), $attrs.class]">
|
||||
<RouterView :key="route.path" />
|
||||
<RouterView :key="$route.path" />
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { onBeforeMount, computed } from 'vue';
|
||||
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
|
||||
import { onBeforeMount } from 'vue';
|
||||
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
@ -9,8 +9,8 @@ import VnSubToolbar from '../ui/VnSubToolbar.vue';
|
|||
|
||||
const props = defineProps({
|
||||
dataKey: { type: String, required: true },
|
||||
baseUrl: { type: String, default: undefined },
|
||||
customUrl: { type: String, default: undefined },
|
||||
url: { type: String, default: undefined },
|
||||
idInWhere: { type: Boolean, default: false },
|
||||
filter: { type: Object, default: () => {} },
|
||||
descriptor: { type: Object, required: true },
|
||||
filterPanel: { type: Object, default: undefined },
|
||||
|
@ -20,38 +20,35 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const url = computed(() => {
|
||||
if (props.baseUrl) {
|
||||
return `${props.baseUrl}/${route.params.id}`;
|
||||
}
|
||||
return props.customUrl;
|
||||
});
|
||||
|
||||
const arrayData = useArrayData(props.dataKey, {
|
||||
url: url.value,
|
||||
filter: props.filter,
|
||||
url: props.url,
|
||||
userFilter: props.filter,
|
||||
oneRecord: true,
|
||||
});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const route = router.currentRoute.value;
|
||||
try {
|
||||
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
||||
await arrayData.fetch({ append: false, updateRouter: false });
|
||||
await fetch(route.params.id);
|
||||
} catch {
|
||||
const { matched: matches } = router.currentRoute.value;
|
||||
const { matched: matches } = route;
|
||||
const { path } = matches.at(-1);
|
||||
router.push({ path: path.replace(/:id.*/, '') });
|
||||
}
|
||||
});
|
||||
|
||||
if (props.baseUrl) {
|
||||
onBeforeRouteUpdate(async (to, from) => {
|
||||
if (to.params.id !== from.params.id) {
|
||||
arrayData.store.url = `${props.baseUrl}/${to.params.id}`;
|
||||
await arrayData.fetch({ append: false, updateRouter: false });
|
||||
}
|
||||
});
|
||||
onBeforeRouteUpdate(async (to, from) => {
|
||||
const id = to.params.id;
|
||||
if (id !== from.params.id) await fetch(id, true);
|
||||
});
|
||||
|
||||
async function fetch(id, append = false) {
|
||||
const regex = /\/(\d+)/;
|
||||
if (props.idInWhere) arrayData.store.filter.where = { id };
|
||||
else if (!regex.test(props.url)) arrayData.store.url = `${props.url}/${id}`;
|
||||
else arrayData.store.url = props.url.replace(regex, `/${id}`);
|
||||
await arrayData.fetch({ append, updateRouter: false });
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
@ -62,6 +59,6 @@ if (props.baseUrl) {
|
|||
</Teleport>
|
||||
<VnSubToolbar />
|
||||
<div :class="[useCardSize(), $attrs.class]">
|
||||
<RouterView :key="route.path" />
|
||||
<RouterView :key="$route.path" />
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -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();
|
||||
|
@ -102,7 +102,7 @@ const columns = computed(() => [
|
|||
storage: 'dms',
|
||||
collection: null,
|
||||
resolution: null,
|
||||
id: prop.row.file.split('.')[0],
|
||||
id: Number(prop.row.file.split('.')[0]),
|
||||
token: token,
|
||||
class: 'rounded',
|
||||
ratio: 1,
|
||||
|
@ -202,7 +202,7 @@ const columns = computed(() => [
|
|||
prop.row.id,
|
||||
$props.downloadModel,
|
||||
undefined,
|
||||
prop.row.download
|
||||
prop.row.download,
|
||||
),
|
||||
},
|
||||
{
|
||||
|
@ -299,11 +299,12 @@ defineExpose({
|
|||
:url="$props.model"
|
||||
:user-filter="dmsFilter"
|
||||
:order="['dmsFk DESC']"
|
||||
:auto-load="true"
|
||||
auto-load
|
||||
@on-fetch="setData"
|
||||
>
|
||||
<template #body>
|
||||
<QTable
|
||||
v-if="rows"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
class="full-width q-mt-md"
|
||||
|
@ -373,7 +374,7 @@ defineExpose({
|
|||
v-if="
|
||||
shouldRenderButton(
|
||||
button.name,
|
||||
props.row.isDocuware
|
||||
props.row.isDocuware,
|
||||
)
|
||||
"
|
||||
:is="button.component"
|
||||
|
@ -388,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">
|
||||
|
@ -404,7 +413,7 @@ defineExpose({
|
|||
fab
|
||||
color="primary"
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
v-shortcut
|
||||
@click="showFormDialog()"
|
||||
class="fill-icon"
|
||||
>
|
||||
|
|
|
@ -42,10 +42,13 @@ const $props = defineProps({
|
|||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
uppercase: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const vnInputRef = ref(null);
|
||||
const showPassword = ref(false);
|
||||
const value = computed({
|
||||
get() {
|
||||
return $props.modelValue;
|
||||
|
@ -72,6 +75,7 @@ const focus = () => {
|
|||
|
||||
defineExpose({
|
||||
focus,
|
||||
vnInputRef,
|
||||
});
|
||||
|
||||
const mixinRules = [
|
||||
|
@ -117,6 +121,10 @@ const handleInsertMode = (e) => {
|
|||
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
|
||||
});
|
||||
};
|
||||
|
||||
const handleUppercase = () => {
|
||||
value.value = value.value?.toUpperCase() || '';
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -159,7 +167,20 @@ const handleInsertMode = (e) => {
|
|||
emit('remove');
|
||||
}
|
||||
"
|
||||
/>
|
||||
></QIcon>
|
||||
|
||||
<QIcon
|
||||
name="match_case"
|
||||
size="xs"
|
||||
v-if="!$attrs.disabled && !($attrs.readonly) && $props.uppercase"
|
||||
@click="handleUppercase"
|
||||
class="uppercase-icon"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Convert to uppercase') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
|
||||
<slot name="append" v-if="$slots.append && !$attrs.disabled" />
|
||||
<QIcon v-if="info" name="info">
|
||||
<QTooltip max-width="350px">
|
||||
|
@ -170,3 +191,27 @@ const handleInsertMode = (e) => {
|
|||
</QInput>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.uppercase-icon {
|
||||
transition: color 0.3s, transform 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.uppercase-icon:hover {
|
||||
color: #ed9937;
|
||||
transform: scale(1.2);
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
en:
|
||||
inputMin: Must be more than {value}
|
||||
maxLength: The value exceeds {value} characters
|
||||
inputMax: Must be less than {value}
|
||||
|
||||
es:
|
||||
inputMin: Debe ser mayor a {value}
|
||||
maxLength: El valor excede los {value} carácteres
|
||||
inputMax: Debe ser menor a {value}
|
||||
Convert to uppercase: Convertir a mayúsculas
|
||||
</i18n>
|
|
@ -105,6 +105,7 @@ const manageDate = (date) => {
|
|||
:rules="mixinRules"
|
||||
:clearable="false"
|
||||
@click="isPopupOpen = !isPopupOpen"
|
||||
@keydown="isPopupOpen = false"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #append>
|
||||
|
|
|
@ -79,6 +79,7 @@ function dateToTime(newDate) {
|
|||
style="min-width: 100px"
|
||||
:rules="mixinRules"
|
||||
@click="isPopupOpen = !isPopupOpen"
|
||||
@keydown="isPopupOpen = false"
|
||||
type="time"
|
||||
hide-bottom-space
|
||||
>
|
||||
|
|
|
@ -15,6 +15,7 @@ import FetchData from '../FetchData.vue';
|
|||
import VnSelect from './VnSelect.vue';
|
||||
import VnUserLink from '../ui/VnUserLink.vue';
|
||||
import VnPaginate from '../ui/VnPaginate.vue';
|
||||
import RightMenu from './RightMenu.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const validationsStore = useValidator();
|
||||
|
@ -130,7 +131,7 @@ const actionsIcon = {
|
|||
};
|
||||
const validDate = new RegExp(
|
||||
/^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])/.source +
|
||||
/T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/.source
|
||||
/T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/.source,
|
||||
);
|
||||
|
||||
function castJsonValue(value) {
|
||||
|
@ -192,7 +193,7 @@ function getLogTree(data) {
|
|||
user: log.user,
|
||||
userFk: log.userFk,
|
||||
logs: [],
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
// Model
|
||||
|
@ -210,7 +211,7 @@ function getLogTree(data) {
|
|||
id: log.changedModelId,
|
||||
showValue: log.changedModelValue,
|
||||
logs: [],
|
||||
})
|
||||
}),
|
||||
);
|
||||
nLogs = 0;
|
||||
}
|
||||
|
@ -267,7 +268,7 @@ async function applyFilter() {
|
|||
filter.where.and.push(selectedFilters.value);
|
||||
}
|
||||
|
||||
paginate.value.fetch(filter);
|
||||
paginate.value.fetch({ filter });
|
||||
}
|
||||
|
||||
function setDate(type) {
|
||||
|
@ -282,7 +283,7 @@ function setDate(type) {
|
|||
to = date.adjustDate(
|
||||
to,
|
||||
{ hour: 21, minute: 59, second: 59, millisecond: 999 },
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
switch (type) {
|
||||
|
@ -365,7 +366,7 @@ async function clearFilter() {
|
|||
dateTo.value = undefined;
|
||||
userRadio.value = undefined;
|
||||
Object.keys(checkboxOptions.value).forEach(
|
||||
(opt) => (checkboxOptions.value[opt].selected = false)
|
||||
(opt) => (checkboxOptions.value[opt].selected = false),
|
||||
);
|
||||
await applyFilter();
|
||||
}
|
||||
|
@ -378,7 +379,7 @@ watch(
|
|||
() => router.currentRoute.value.params.id,
|
||||
() => {
|
||||
applyFilter();
|
||||
}
|
||||
},
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
|
@ -391,7 +392,7 @@ watch(
|
|||
const changedModel = item.changedModel;
|
||||
return {
|
||||
locale: useCapitalize(
|
||||
validations[changedModel]?.locale?.name ?? changedModel
|
||||
validations[changedModel]?.locale?.name ?? changedModel,
|
||||
),
|
||||
value: changedModel,
|
||||
};
|
||||
|
@ -403,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"
|
||||
|
@ -507,7 +508,7 @@ watch(
|
|||
:title="
|
||||
date.formatDate(
|
||||
log.creationDate,
|
||||
'DD/MM/YYYY hh:mm:ss'
|
||||
'DD/MM/YYYY hh:mm:ss',
|
||||
) ?? `date:'dd/MM/yyyy HH:mm:ss'`
|
||||
"
|
||||
>
|
||||
|
@ -577,7 +578,7 @@ watch(
|
|||
t(
|
||||
`actions.${
|
||||
actionsText[log.action]
|
||||
}`
|
||||
}`,
|
||||
)
|
||||
"
|
||||
/>
|
||||
|
@ -677,139 +678,144 @@ watch(
|
|||
</div>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
|
||||
<QList dense>
|
||||
<QSeparator />
|
||||
<QItem class="q-mt-sm">
|
||||
<QInput
|
||||
:label="t('globals.search')"
|
||||
v-model="searchInput"
|
||||
class="full-width"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
@keyup.enter="() => selectFilter('search')"
|
||||
@focusout="() => selectFilter('search')"
|
||||
@clear="() => selectFilter('search')"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-pointer">
|
||||
<QTooltip>{{ t('tooltips.search') }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnSelect
|
||||
class="full-width"
|
||||
:label="t('globals.entity')"
|
||||
v-model="selectedFilters.changedModel"
|
||||
option-label="locale"
|
||||
option-value="value"
|
||||
:options="actions"
|
||||
@update:model-value="selectFilter('action')"
|
||||
hide-selected
|
||||
/>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QOptionGroup
|
||||
size="sm"
|
||||
v-model="userRadio"
|
||||
:options="userTypes"
|
||||
color="primary"
|
||||
@update:model-value="selectFilter('userRadio')"
|
||||
right-label
|
||||
>
|
||||
<template #label="{ label }">
|
||||
{{ t(`Users.${label}`) }}
|
||||
</template>
|
||||
</QOptionGroup>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QItemSection v-if="userRadio !== null">
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<QList dense>
|
||||
<QSeparator />
|
||||
<QItem class="q-mt-sm">
|
||||
<QInput
|
||||
:label="t('globals.search')"
|
||||
v-model="searchInput"
|
||||
class="full-width"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
@keyup.enter="() => selectFilter('search')"
|
||||
@focusout="() => selectFilter('search')"
|
||||
@clear="() => selectFilter('search')"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-pointer">
|
||||
<QTooltip>{{ t('tooltips.search') }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnSelect
|
||||
class="full-width"
|
||||
:label="t('globals.user')"
|
||||
v-model="userSelect"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:url="`${model}Logs/${$route.params.id}/editors`"
|
||||
:fields="['id', 'nickname', 'name', 'image']"
|
||||
sort-by="nickname"
|
||||
@update:model-value="selectFilter('userSelect')"
|
||||
:label="t('globals.entity')"
|
||||
v-model="selectedFilters.changedModel"
|
||||
option-label="locale"
|
||||
option-value="value"
|
||||
:options="actions"
|
||||
@update:model-value="selectFilter('action')"
|
||||
hide-selected
|
||||
/>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QOptionGroup
|
||||
size="sm"
|
||||
v-model="userRadio"
|
||||
:options="userTypes"
|
||||
color="primary"
|
||||
@update:model-value="selectFilter('userRadio')"
|
||||
right-label
|
||||
>
|
||||
<template #option="{ opt, itemProps }">
|
||||
<QItem v-bind="itemProps" class="q-pa-xs row items-center">
|
||||
<QItemSection class="col-3 items-center">
|
||||
<VnAvatar :worker-id="opt.id" />
|
||||
</QItemSection>
|
||||
<QItemSection class="col-9 justify-center">
|
||||
<span>{{ opt.name }}</span>
|
||||
<span class="text-grey">{{ opt.nickname }}</span>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<template #label="{ label }">
|
||||
{{ t(`Users.${label}`) }}
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QInput
|
||||
:label="t('globals.changes')"
|
||||
v-model="changeInput"
|
||||
class="full-width"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
@keyup.enter="selectFilter('change')"
|
||||
@focusout="selectFilter('change')"
|
||||
@clear="selectFilter('change')"
|
||||
</QOptionGroup>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QItemSection v-if="userRadio !== null">
|
||||
<VnSelect
|
||||
class="full-width"
|
||||
:label="t('globals.user')"
|
||||
v-model="userSelect"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:url="`${model}Logs/${route.params.id}/editors`"
|
||||
:fields="['id', 'nickname', 'name', 'image']"
|
||||
sort-by="nickname"
|
||||
@update:model-value="selectFilter('userSelect')"
|
||||
hide-selected
|
||||
>
|
||||
<template #option="{ opt, itemProps }">
|
||||
<QItem
|
||||
v-bind="itemProps"
|
||||
class="q-pa-xs row items-center"
|
||||
>
|
||||
<QItemSection class="col-3 items-center">
|
||||
<VnAvatar :worker-id="opt.id" />
|
||||
</QItemSection>
|
||||
<QItemSection class="col-9 justify-center">
|
||||
<span>{{ opt.name }}</span>
|
||||
<span class="text-grey">{{ opt.nickname }}</span>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QInput
|
||||
:label="t('globals.changes')"
|
||||
v-model="changeInput"
|
||||
class="full-width"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
@keyup.enter="selectFilter('change')"
|
||||
@focusout="selectFilter('change')"
|
||||
@clear="selectFilter('change')"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-pointer">
|
||||
<QTooltip max-width="250px">{{
|
||||
t('tooltips.changes')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItem>
|
||||
<QItem
|
||||
:class="index == 'create' ? 'q-mt-md' : 'q-mt-xs'"
|
||||
v-for="(checkboxOption, index) in checkboxOptions"
|
||||
:key="index"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-pointer">
|
||||
<QTooltip max-width="250px">{{
|
||||
t('tooltips.changes')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItem>
|
||||
<QItem
|
||||
:class="index == 'create' ? 'q-mt-md' : 'q-mt-xs'"
|
||||
v-for="(checkboxOption, index) in checkboxOptions"
|
||||
:key="index"
|
||||
>
|
||||
<QCheckbox
|
||||
size="sm"
|
||||
v-model="checkboxOption.selected"
|
||||
:label="t(`actions.${checkboxOption.label}`)"
|
||||
@update:model-value="selectFilter"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QInput
|
||||
class="full-width"
|
||||
:label="t('globals.date')"
|
||||
@click="dateFromDialog = true"
|
||||
@focus="(evt) => evt.target.blur()"
|
||||
@clear="selectFilter('date', 'to')"
|
||||
v-model="dateFrom"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QInput
|
||||
class="full-width"
|
||||
:label="t('to')"
|
||||
@click="dateToDialog = true"
|
||||
@focus="(evt) => evt.target.blur()"
|
||||
@clear="selectFilter('date', 'from')"
|
||||
v-model="dateTo"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</QItem>
|
||||
</QList>
|
||||
</Teleport>
|
||||
<QCheckbox
|
||||
size="sm"
|
||||
v-model="checkboxOption.selected"
|
||||
:label="t(`actions.${checkboxOption.label}`)"
|
||||
@update:model-value="selectFilter"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QInput
|
||||
class="full-width"
|
||||
:label="t('globals.date')"
|
||||
@click="dateFromDialog = true"
|
||||
@focus="(evt) => evt.target.blur()"
|
||||
@clear="selectFilter('date', 'to')"
|
||||
v-model="dateFrom"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QInput
|
||||
class="full-width"
|
||||
:label="t('globals.to')"
|
||||
@click="dateToDialog = true"
|
||||
@focus="(evt) => evt.target.blur()"
|
||||
@clear="selectFilter('date', 'from')"
|
||||
v-model="dateTo"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QDialog v-model="dateFromDialog">
|
||||
<QDate
|
||||
:years-in-month-view="false"
|
||||
|
@ -1053,9 +1059,9 @@ en:
|
|||
Deletes: Deletes
|
||||
Accesses: Accesses
|
||||
Users:
|
||||
User: Usuario
|
||||
All: Todo
|
||||
System: Sistema
|
||||
User: User
|
||||
All: All
|
||||
System: System
|
||||
properties:
|
||||
id: ID
|
||||
claimFk: Claim ID
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<script setup>
|
||||
import RightMenu from './RightMenu.vue';
|
||||
import RightAdvancedMenu from './RightAdvancedMenu.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import VnTableFilter from '../VnTable/VnTableFilter.vue';
|
||||
import { onBeforeMount, computed, ref } from 'vue';
|
||||
import { onBeforeMount, onMounted, onUnmounted, computed, ref } from 'vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useHasContent } from 'src/composables/useHasContent';
|
||||
|
||||
const $props = defineProps({
|
||||
|
@ -47,16 +47,14 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
let arrayData;
|
||||
const sectionValue = computed(() => $props.section ?? $props.dataKey);
|
||||
const isMainSection = computed(() => {
|
||||
const isSame = sectionValue.value == route.name;
|
||||
if (!isSame && arrayData) {
|
||||
arrayData.reset(['userParams', 'userFilter']);
|
||||
}
|
||||
return isSame;
|
||||
});
|
||||
const isMainSection = ref(false);
|
||||
|
||||
const searchbarId = 'section-searchbar';
|
||||
const advancedMenuSlot = 'advanced-menu';
|
||||
const hasContent = useHasContent(`#${searchbarId}`);
|
||||
|
||||
onBeforeMount(() => {
|
||||
|
@ -67,7 +65,27 @@ onBeforeMount(() => {
|
|||
...$props.arrayDataProps,
|
||||
navigate: $props.redirect,
|
||||
});
|
||||
checkIsMain();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
const unsubscribe = router.afterEach(() => {
|
||||
checkIsMain();
|
||||
});
|
||||
onUnmounted(unsubscribe);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (arrayData) arrayData.destroy();
|
||||
});
|
||||
|
||||
function checkIsMain() {
|
||||
isMainSection.value = sectionValue.value == route.name;
|
||||
if (!isMainSection.value && arrayData) {
|
||||
arrayData.reset(['userParams', 'filter']);
|
||||
arrayData.setCurrentFilter();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<slot name="searchbar">
|
||||
|
@ -80,9 +98,9 @@ onBeforeMount(() => {
|
|||
/>
|
||||
<div :id="searchbarId"></div>
|
||||
</slot>
|
||||
<RightMenu>
|
||||
<template #right-panel v-if="$slots['rightMenu'] || rightFilter">
|
||||
<slot name="rightMenu">
|
||||
<RightAdvancedMenu :is-main-section="isMainSection">
|
||||
<template #advanced-menu v-if="$slots[advancedMenuSlot] || rightFilter">
|
||||
<slot :name="advancedMenuSlot">
|
||||
<VnTableFilter
|
||||
v-if="rightFilter && columns"
|
||||
:data-key="dataKey"
|
||||
|
@ -91,7 +109,7 @@ onBeforeMount(() => {
|
|||
/>
|
||||
</slot>
|
||||
</template>
|
||||
</RightMenu>
|
||||
</RightAdvancedMenu>
|
||||
<slot name="body" v-if="isMainSection" />
|
||||
<RouterView v-else />
|
||||
</template>
|
||||
|
|
|
@ -27,7 +27,7 @@ const $props = defineProps({
|
|||
default: () => [],
|
||||
},
|
||||
optionLabel: {
|
||||
type: [String],
|
||||
type: [String, Function],
|
||||
default: 'name',
|
||||
},
|
||||
optionValue: {
|
||||
|
@ -232,12 +232,15 @@ async function fetchFilter(val) {
|
|||
} else defaultWhere = { [key]: getVal(val) };
|
||||
const where = { ...(val ? defaultWhere : {}), ...$props.where };
|
||||
$props.exprBuilder && Object.assign(where, $props.exprBuilder(key, val));
|
||||
const fetchOptions = { where, include, limit };
|
||||
if (fields) fetchOptions.fields = fields;
|
||||
if (sortBy) fetchOptions.order = sortBy;
|
||||
const filterOptions = { where, include, limit };
|
||||
if (fields) filterOptions.fields = fields;
|
||||
if (sortBy) filterOptions.order = sortBy;
|
||||
arrayData.resetPagination();
|
||||
|
||||
const { data } = await arrayData.applyFilter({ filter: fetchOptions });
|
||||
const { data } = await arrayData.applyFilter(
|
||||
{ filter: filterOptions },
|
||||
{ updateRouter: false }
|
||||
);
|
||||
setOptions(data);
|
||||
return data;
|
||||
}
|
||||
|
@ -294,7 +297,7 @@ async function onScroll({ to, direction, from, index }) {
|
|||
}
|
||||
}
|
||||
|
||||
defineExpose({ opts: myOptions });
|
||||
defineExpose({ opts: myOptions, vnSelectRef });
|
||||
|
||||
function handleKeyDown(event) {
|
||||
if (event.key === 'Tab' && !event.shiftKey) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
|
||||
|
@ -7,6 +7,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
|||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
const value = defineModel({ type: [String, Number, Object] });
|
||||
const select = ref(null);
|
||||
const $props = defineProps({
|
||||
rolesAllowedToCreate: {
|
||||
type: Array,
|
||||
|
@ -33,10 +34,13 @@ const isAllowedToCreate = computed(() => {
|
|||
if ($props.acls.length) return acl.hasAny($props.acls);
|
||||
return role.hasAny($props.rolesAllowedToCreate);
|
||||
});
|
||||
|
||||
defineExpose({ vnSelectDialogRef: select });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSelect
|
||||
ref="select"
|
||||
v-model="value"
|
||||
v-bind="$attrs"
|
||||
@update:model-value="(...args) => emit('update:modelValue', ...args)"
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
|
||||
const model = defineModel({ type: [String, Number, Object] });
|
||||
const url = 'Suppliers';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSelect
|
||||
:label="$t('globals.supplier')"
|
||||
v-bind="$attrs"
|
||||
v-model="model"
|
||||
:url="url"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
:fields="['id', 'name', 'nickname', 'nif']"
|
||||
sort-by="name ASC"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.name }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{
|
||||
`#${scope.opt?.id} , ${scope.opt?.nickname} (${scope.opt?.nif})`
|
||||
}}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
|
@ -9,9 +9,9 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
hasInfo: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
info: {
|
||||
type: String,
|
||||
default: undefined,
|
||||
},
|
||||
modelValue: {
|
||||
type: [String, Number, Object],
|
||||
|
@ -53,13 +53,14 @@ 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" :title="title" />
|
||||
<VnAvatar :worker-id="value" color="primary" v-bind="$attrs" />
|
||||
</template>
|
||||
<template #append v-if="$props.hasInfo">
|
||||
<template #append v-if="$props.info">
|
||||
<QIcon name="info" class="cursor-pointer">
|
||||
<QTooltip>{{ $t($props.hasInfo) }}</QTooltip>
|
||||
<QTooltip>{{ $t($props.info) }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
|
@ -72,7 +73,8 @@ const url = computed(() => {
|
|||
{{ scope.opt.nickname }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption v-else>
|
||||
#{{ scope.opt.id }}, {{ scope.opt.nickname }}, {{ scope.opt.code }}
|
||||
#{{ scope.opt.id }}, {{ scope.opt.nickname }},
|
||||
{{ scope.opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -10,6 +10,10 @@ defineProps({
|
|||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: 'md-width',
|
||||
},
|
||||
});
|
||||
|
||||
defineEmits([...useDialogPluginComponent.emits]);
|
||||
|
@ -17,7 +21,19 @@ defineEmits([...useDialogPluginComponent.emits]);
|
|||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
||||
</script>
|
||||
<template>
|
||||
<QDialog ref="dialogRef" @hide="onDialogHide" full-width>
|
||||
<component :is="summary" :id="id" />
|
||||
<QDialog ref="dialogRef" @hide="onDialogHide">
|
||||
<component :is="summary" :id="id" :class="width" />
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.md-width {
|
||||
max-width: $width-md;
|
||||
}
|
||||
.lg-width {
|
||||
max-width: $width-lg;
|
||||
}
|
||||
.xlg-width {
|
||||
max-width: $width-xl;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -0,0 +1,146 @@
|
|||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
|
||||
import VnDms from 'src/components/common/VnDms.vue';
|
||||
|
||||
class MockFormData {
|
||||
constructor() {
|
||||
this.entries = {};
|
||||
}
|
||||
|
||||
append(key, value) {
|
||||
if (!key) {
|
||||
throw new Error('Key is required for FormData.append');
|
||||
}
|
||||
this.entries[key] = value;
|
||||
}
|
||||
|
||||
get(key) {
|
||||
return this.entries[key] || null;
|
||||
}
|
||||
|
||||
getAll() {
|
||||
return this.entries;
|
||||
}
|
||||
}
|
||||
|
||||
global.FormData = MockFormData;
|
||||
|
||||
describe('VnDms', () => {
|
||||
let wrapper;
|
||||
let vm;
|
||||
let postMock;
|
||||
|
||||
const postResponseMock = { data: { success: true } };
|
||||
|
||||
const data = {
|
||||
hasFile: true,
|
||||
hasFileAttached: true,
|
||||
reference: 'DMS-test',
|
||||
warehouseFk: 1,
|
||||
companyFk: 2,
|
||||
dmsTypeFk: 3,
|
||||
description: 'This is a test description',
|
||||
files: { name: 'example.txt', content: new Blob(['file content'], { type: 'text/plain' })},
|
||||
};
|
||||
|
||||
const expectedBody = {
|
||||
hasFile: true,
|
||||
hasFileAttached: true,
|
||||
reference: 'DMS-test',
|
||||
warehouseId: 1,
|
||||
companyId: 2,
|
||||
dmsTypeId: 3,
|
||||
description: 'This is a test description',
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
wrapper = createWrapper(VnDms, {
|
||||
propsData: {
|
||||
url: '/test',
|
||||
formInitialData: { id: 1, reference: 'test' },
|
||||
model: 'Worker',
|
||||
}
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
vi.spyOn(vm, '$emit');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
postMock = vi.spyOn(axios, 'post').mockResolvedValue(postResponseMock);
|
||||
vm.dms = data;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('mapperDms', () => {
|
||||
it('should map DMS data correctly and add file to FormData', () => {
|
||||
const [formData, params] = vm.mapperDms(data);
|
||||
|
||||
expect(formData.get('example.txt')).toBe(data.files);
|
||||
expect(expectedBody).toEqual(params.params);
|
||||
});
|
||||
|
||||
it('should map DMS data correctly without file', () => {
|
||||
delete data.files;
|
||||
|
||||
const [formData, params] = vm.mapperDms(data);
|
||||
|
||||
expect(formData.getAll()).toEqual({});
|
||||
expect(expectedBody).toEqual(params.params);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getUrl', () => {
|
||||
it('should returns prop url when is set', async () => {
|
||||
expect(vm.getUrl()).toBe('/test');
|
||||
});
|
||||
|
||||
it('should returns url dms/"props.formInitialData.id"/updateFile when prop url is null', async () => {
|
||||
await wrapper.setProps({ url: null });
|
||||
expect(vm.getUrl()).toBe('dms/1/updateFile');
|
||||
});
|
||||
|
||||
it('should returns url "props.model"/"route.params.id"/uploadFile when formInitialData is null', async () => {
|
||||
await wrapper.setProps({ formInitialData: null });
|
||||
vm.route.params.id = '123';
|
||||
expect(vm.getUrl()).toBe('Worker/123/uploadFile');
|
||||
});
|
||||
});
|
||||
|
||||
describe('save', () => {
|
||||
it('should save data correctly', async () => {
|
||||
await vm.save();
|
||||
expect(postMock).toHaveBeenCalledWith(vm.getUrl(), expect.any(FormData), { params: expectedBody });
|
||||
expect(wrapper.emitted('onDataSaved')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('defaultData', () => {
|
||||
it('should set dms with formInitialData', async () => {
|
||||
const testData = {
|
||||
hasFile: false,
|
||||
hasFileAttached: false,
|
||||
reference: 'defaultData-test',
|
||||
warehouseFk: 2,
|
||||
companyFk: 3,
|
||||
dmsTypeFk: 2,
|
||||
description: 'This is a test description'
|
||||
}
|
||||
await wrapper.setProps({ formInitialData: testData });
|
||||
vm.defaultData();
|
||||
|
||||
expect(vm.dms).toEqual(testData);
|
||||
});
|
||||
|
||||
it('should add reference with "route.params.id" to dms if formInitialData is null', async () => {
|
||||
await wrapper.setProps({ formInitialData: null });
|
||||
vm.route.params.id= '111';
|
||||
vm.defaultData();
|
||||
|
||||
expect(vm.dms.reference).toBe('111');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,91 @@
|
|||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
import { vi, describe, expect, it } from 'vitest';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
|
||||
describe('VnInput', () => {
|
||||
let vm;
|
||||
let wrapper;
|
||||
let input;
|
||||
|
||||
function generateWrapper(value, isOutlined, emptyToNull, insertable) {
|
||||
wrapper = createWrapper(VnInput, {
|
||||
props: {
|
||||
modelValue: value,
|
||||
isOutlined, emptyToNull, insertable,
|
||||
maxlength: 101
|
||||
},
|
||||
attrs: {
|
||||
label: 'test',
|
||||
required: true,
|
||||
maxlength: 101,
|
||||
maxLength: 10,
|
||||
'max-length':20
|
||||
},
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
input = wrapper.find('[data-cy="test_input"]');
|
||||
};
|
||||
|
||||
describe('value', () => {
|
||||
it('should emit update:modelValue when value changes', async () => {
|
||||
generateWrapper('12345', false, false, true)
|
||||
await input.setValue('123');
|
||||
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
|
||||
expect(wrapper.emitted('update:modelValue')[0]).toEqual(['123']);
|
||||
});
|
||||
|
||||
it('should emit update:modelValue with null when input is empty', async () => {
|
||||
generateWrapper('12345', false, true, true);
|
||||
await input.setValue('');
|
||||
expect(wrapper.emitted('update:modelValue')[0]).toEqual([null]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('styleAttrs', () => {
|
||||
it('should return empty styleAttrs when isOutlined is false', async () => {
|
||||
generateWrapper('123', false, false, false);
|
||||
expect(vm.styleAttrs).toEqual({});
|
||||
});
|
||||
|
||||
it('should set styleAttrs when isOutlined is true', async () => {
|
||||
generateWrapper('123', true, false, false);
|
||||
expect(vm.styleAttrs.outlined).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('handleKeydown', () => {
|
||||
it('should do nothing when "Backspace" key is pressed', async () => {
|
||||
generateWrapper('12345', false, false, true);
|
||||
await input.trigger('keydown', { key: 'Backspace' });
|
||||
expect(wrapper.emitted('update:modelValue')).toBeUndefined();
|
||||
const spyhandler = vi.spyOn(vm, 'handleInsertMode');
|
||||
expect(spyhandler).not.toHaveBeenCalled();
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
TODO: #8399 REDMINE
|
||||
*/
|
||||
it.skip('handleKeydown respects insertable behavior', async () => {
|
||||
const expectedValue = '12345';
|
||||
generateWrapper('1234', false, false, true);
|
||||
vm.focus()
|
||||
await input.trigger('keydown', { key: '5' });
|
||||
await vm.$nextTick();
|
||||
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
|
||||
expect(wrapper.emitted('update:modelValue')[0]).toEqual([expectedValue ]);
|
||||
expect(vm.value).toBe( expectedValue);
|
||||
});
|
||||
});
|
||||
|
||||
describe('focus', () => {
|
||||
it('should call focus method when input is focused', async () => {
|
||||
generateWrapper('123', false, false, true);
|
||||
const focusSpy = vi.spyOn(input.element, 'focus');
|
||||
vm.focus();
|
||||
expect(focusSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -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,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -37,6 +37,10 @@ const $props = defineProps({
|
|||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: 'md-width',
|
||||
},
|
||||
});
|
||||
|
||||
const state = useState();
|
||||
|
@ -55,10 +59,11 @@ onBeforeMount(async () => {
|
|||
url: $props.url,
|
||||
filter: $props.filter,
|
||||
skip: 0,
|
||||
oneRecord: true,
|
||||
});
|
||||
store = arrayData.store;
|
||||
entity = computed(() => {
|
||||
const data = (Array.isArray(store.data) ? store.data[0] : store.data) ?? {};
|
||||
const data = store.data ?? {};
|
||||
if (data) emit('onFetch', data);
|
||||
return data;
|
||||
});
|
||||
|
@ -69,7 +74,7 @@ onBeforeMount(async () => {
|
|||
() => [$props.url, $props.filter],
|
||||
async () => {
|
||||
if (!isSameDataKey.value) await getData();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -80,7 +85,7 @@ async function getData() {
|
|||
try {
|
||||
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
||||
state.set($props.dataKey, data);
|
||||
emit('onFetch', Array.isArray(data) ? data[0] : data);
|
||||
emit('onFetch', data);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
@ -104,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>
|
||||
|
||||
|
@ -128,9 +133,8 @@ const toModule = computed(() =>
|
|||
</QTooltip>
|
||||
</QBtn></slot
|
||||
>
|
||||
|
||||
<QBtn
|
||||
@click.stop="viewSummary(entity.id, $props.summary)"
|
||||
@click.stop="viewSummary(entity.id, $props.summary, $props.width)"
|
||||
round
|
||||
flat
|
||||
dense
|
||||
|
|
|
@ -15,6 +15,10 @@ const props = defineProps({
|
|||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
userFilter: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
entityId: {
|
||||
type: [Number, String],
|
||||
default: null,
|
||||
|
@ -34,10 +38,12 @@ const isSummary = ref();
|
|||
const arrayData = useArrayData(props.dataKey, {
|
||||
url: props.url,
|
||||
filter: props.filter,
|
||||
userFilter: props.userFilter,
|
||||
skip: 0,
|
||||
oneRecord: true,
|
||||
});
|
||||
const { store } = arrayData;
|
||||
const entity = computed(() => (Array.isArray(store.data) ? store.data[0] : store.data));
|
||||
const entity = computed(() => store.data);
|
||||
const isLoading = ref(false);
|
||||
|
||||
defineExpose({
|
||||
|
@ -56,7 +62,7 @@ async function fetch() {
|
|||
store.filter = props.filter ?? {};
|
||||
isLoading.value = true;
|
||||
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
||||
emit('onFetch', Array.isArray(data) ? data[0] : data);
|
||||
emit('onFetch', data);
|
||||
isLoading.value = false;
|
||||
}
|
||||
</script>
|
||||
|
@ -175,7 +181,7 @@ async function fetch() {
|
|||
display: inline-block;
|
||||
}
|
||||
.header.link:hover {
|
||||
color: lighten($primary, 20%);
|
||||
color: rgba(var(--q-primary), 0.8);
|
||||
}
|
||||
.q-checkbox {
|
||||
& .q-checkbox__label {
|
||||
|
@ -203,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>
|
||||
|
|
|
@ -41,7 +41,7 @@ const card = toRef(props, 'item');
|
|||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<span class="link">
|
||||
<span class="link" @click.stop>
|
||||
{{ card.name }}
|
||||
<ItemDescriptorProxy :id="card.id" />
|
||||
</span>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.sass';
|
||||
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.scss';
|
||||
|
||||
const $props = defineProps({
|
||||
bordered: {
|
||||
|
|
|
@ -1,38 +1,49 @@
|
|||
<template>
|
||||
<div class="header bg-primary q-pa-sm q-mb-md">
|
||||
<QSkeleton type="rect" square />
|
||||
<QSkeleton type="rect" square />
|
||||
</div>
|
||||
<div class="row q-pa-md q-col-gutter-md q-mb-md">
|
||||
<QSkeleton type="rect" class="q-mb-md" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="rect" class="q-mb-md" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="rect" class="q-mb-md" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="rect" class="q-mb-md" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="rect" class="q-mb-md" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<div class="col">
|
||||
<QSkeleton type="rect" class="q-mb-md" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
</div>
|
||||
<div class="col">
|
||||
<QSkeleton type="rect" class="q-mb-md" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
</div>
|
||||
<div class="col">
|
||||
<QSkeleton type="rect" class="q-mb-md" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
</div>
|
||||
<div class="col">
|
||||
<QSkeleton type="rect" class="q-mb-md" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
</div>
|
||||
<div class="col">
|
||||
<QSkeleton type="rect" class="q-mb-md" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
<QSkeleton type="text" square />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -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,9 +188,15 @@ 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 return t(`${route.meta.moduleName.toLowerCase()}.params.${param}`);
|
||||
else if (te(moduleLocale)) return t(moduleLocale);
|
||||
else {
|
||||
const camelCaseModuleName =
|
||||
moduleName.charAt(0).toLowerCase() + moduleName.slice(1);
|
||||
return t(`${camelCaseModuleName}.params.${param}`);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -78,6 +78,10 @@ const props = defineProps({
|
|||
type: String,
|
||||
default: '',
|
||||
},
|
||||
keyData: {
|
||||
type: String,
|
||||
default: undefined,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['onFetch', 'onPaginate', 'onChange']);
|
||||
|
@ -119,7 +123,7 @@ watch(
|
|||
() => props.data,
|
||||
() => {
|
||||
store.data = props.data;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
|
@ -128,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 });
|
||||
|
@ -166,7 +170,7 @@ function emitStoreData() {
|
|||
async function paginate() {
|
||||
const { page, rowsPerPage, sortBy, descending } = pagination.value;
|
||||
|
||||
if (!props.url) return;
|
||||
if (!arrayData.store.url) return;
|
||||
|
||||
isLoading.value = true;
|
||||
await arrayData.loadMore();
|
||||
|
@ -194,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;
|
||||
|
||||
|
@ -255,7 +259,7 @@ defineExpose({
|
|||
:disable="disableInfiniteScroll || !store.hasMoreData"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<slot name="body" :rows="store.data"></slot>
|
||||
<slot name="body" :rows="keyData ? store.data[keyData] : store.data"></slot>
|
||||
<div v-if="isLoading" class="spinner info-row q-pa-md text-center">
|
||||
<QSpinner color="primary" size="md" />
|
||||
</div>
|
||||
|
|
|
@ -102,7 +102,7 @@ watch(
|
|||
(val) => {
|
||||
arrayData = useArrayData(val, { ...props });
|
||||
store = arrayData.store;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
|
@ -113,23 +113,20 @@ onMounted(() => {
|
|||
});
|
||||
|
||||
async function search() {
|
||||
const staticParams = Object.keys(store.userParams ?? {}).length
|
||||
? store.userParams
|
||||
: store.defaultParams;
|
||||
arrayData.resetPagination();
|
||||
|
||||
const filter = {
|
||||
params: {
|
||||
search: searchText.value,
|
||||
},
|
||||
filter: props.filter,
|
||||
};
|
||||
let filter = { params: { search: searchText.value } };
|
||||
|
||||
if (!props.searchRemoveParams || !searchText.value) {
|
||||
filter.params = {
|
||||
...staticParams,
|
||||
search: searchText.value,
|
||||
filter = {
|
||||
params: {
|
||||
...store.userParams,
|
||||
search: searchText.value,
|
||||
},
|
||||
filter: store.filter,
|
||||
};
|
||||
} else {
|
||||
arrayData.reset(['currentFilter', 'userParams']);
|
||||
}
|
||||
|
||||
if (props.whereFilter) {
|
||||
|
@ -179,6 +176,7 @@ async function search() {
|
|||
>
|
||||
<QTooltip>{{ t(props.info) }}</QTooltip>
|
||||
</QIcon>
|
||||
<div id="searchbar-after"></div>
|
||||
</template>
|
||||
</VnInput>
|
||||
</QForm>
|
||||
|
|
|
@ -49,7 +49,7 @@ function formatNumber(number) {
|
|||
<VnPaginate
|
||||
:data-key="$props.url"
|
||||
:url="$props.url"
|
||||
:filter="filter"
|
||||
:user-filter="filter"
|
||||
order="smsFk DESC"
|
||||
:offset="100"
|
||||
:limit="5"
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { defineProps, ref } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
|
|
@ -51,16 +51,6 @@ describe('CardSummary', () => {
|
|||
expect(vm.store.filter).toEqual('cardFilter');
|
||||
});
|
||||
|
||||
it('should compute entity correctly from store data', () => {
|
||||
vm.store.data = [{ id: 1, name: 'Entity 1' }];
|
||||
expect(vm.entity).toEqual({ id: 1, name: 'Entity 1' });
|
||||
});
|
||||
|
||||
it('should handle empty data gracefully', () => {
|
||||
vm.store.data = [];
|
||||
expect(vm.entity).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should respond to prop changes and refetch data', async () => {
|
||||
const newUrl = 'CardSummary/35';
|
||||
const newKey = 'cardSummaryKey/35';
|
||||
|
@ -72,7 +62,7 @@ describe('CardSummary', () => {
|
|||
expect(vm.store.filter).toEqual({ key: newKey });
|
||||
});
|
||||
|
||||
it('should return true if route path ends with /summary' , () => {
|
||||
it('should return true if route path ends with /summary', () => {
|
||||
expect(vm.isSummary).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
import { vi, describe, expect, it, beforeEach, afterEach } from 'vitest';
|
||||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
let wrapper;
|
||||
let vm;
|
||||
const isEmployeeMock = vi.fn();
|
||||
|
||||
function generateWrapper(storage = 'images') {
|
||||
wrapper = createWrapper(VnImg, {
|
||||
props: {
|
||||
id: 123,
|
||||
zoomResolution: '400x400',
|
||||
storage,
|
||||
}
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
vm.timeStamp = 'timestamp';
|
||||
};
|
||||
|
||||
vi.mock('src/composables/useSession', () => ({
|
||||
useSession: () => ({
|
||||
getTokenMultimedia: () => 'token',
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('src/composables/useRole', () => ({
|
||||
useRole: () => ({
|
||||
isEmployee: isEmployeeMock,
|
||||
}),
|
||||
}));
|
||||
|
||||
|
||||
describe('VnImg', () => {
|
||||
beforeEach(() => {
|
||||
isEmployeeMock.mockReset();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('getUrl', () => {
|
||||
it('should return /api/{storage}/{id}/downloadFile?access_token={token} when storage is dms', async () => {
|
||||
isEmployeeMock.mockReturnValue(false);
|
||||
generateWrapper('dms');
|
||||
await vm.$nextTick();
|
||||
const url = vm.getUrl();
|
||||
expect(url).toBe('/api/dms/123/downloadFile?access_token=token');
|
||||
});
|
||||
|
||||
it('should return /no-user.png when role is not employee and storage is not dms', async () => {
|
||||
isEmployeeMock.mockReturnValue(false);
|
||||
generateWrapper();
|
||||
await vm.$nextTick();
|
||||
const url = vm.getUrl();
|
||||
expect(url).toBe('/no-user.png');
|
||||
});
|
||||
|
||||
it('should return /api/{storage}/{collection}/{curResolution}/{id}/download?access_token={token}&{timeStamp} when zoom is false and role is employee and storage is not dms', async () => {
|
||||
isEmployeeMock.mockReturnValue(true);
|
||||
generateWrapper();
|
||||
await vm.$nextTick();
|
||||
const url = vm.getUrl();
|
||||
expect(url).toBe('/api/images/catalog/200x200/123/download?access_token=token×tamp');
|
||||
});
|
||||
|
||||
it('should return /api/{storage}/{collection}/{curResolution}/{id}/download?access_token={token}&{timeStamp} when zoom is true and role is employee and storage is not dms', async () => {
|
||||
isEmployeeMock.mockReturnValue(true);
|
||||
generateWrapper();
|
||||
await vm.$nextTick();
|
||||
const url = vm.getUrl(true);
|
||||
expect(url).toBe('/api/images/catalog/400x400/123/download?access_token=token×tamp');
|
||||
});
|
||||
});
|
||||
|
||||
describe('reload', () => {
|
||||
it('should update the timestamp', async () => {
|
||||
generateWrapper();
|
||||
const initialTimestamp = wrapper.vm.timeStamp;
|
||||
|
||||
wrapper.vm.reload();
|
||||
const newTimestamp = wrapper.vm.timeStamp;
|
||||
|
||||
expect(initialTimestamp).not.toEqual(newTimestamp);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,71 @@
|
|||
import { vi, describe, expect, it, beforeEach, afterEach } from 'vitest';
|
||||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
describe('VnSearchbar', () => {
|
||||
let vm;
|
||||
let wrapper;
|
||||
let applyFilterSpy;
|
||||
const searchText = 'Bolas de madera';
|
||||
const userParams = {staticKey: 'staticValue'};
|
||||
|
||||
beforeEach(async () => {
|
||||
wrapper = createWrapper(VnSearchbar, {
|
||||
propsData: {
|
||||
dataKey: 'testKey',
|
||||
filter: null,
|
||||
whereFilter: null,
|
||||
searchRemoveParams: true,
|
||||
},
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
|
||||
vm.searchText = searchText;
|
||||
vm.arrayData.store.userParams = userParams;
|
||||
applyFilterSpy = vi.spyOn(vm.arrayData, 'applyFilter').mockImplementation(() => {});
|
||||
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('search resets pagination and applies filter', async () => {
|
||||
const resetPaginationSpy = vi.spyOn(vm.arrayData, 'resetPagination').mockImplementation(() => {});
|
||||
await vm.search();
|
||||
|
||||
expect(resetPaginationSpy).toHaveBeenCalled();
|
||||
expect(applyFilterSpy).toHaveBeenCalledWith({
|
||||
params: { search: searchText },
|
||||
});
|
||||
});
|
||||
|
||||
it('search includes static params if searchRemoveParams is false', async () => {
|
||||
wrapper.setProps({ searchRemoveParams: false });
|
||||
await vm.$nextTick();
|
||||
await vm.search();
|
||||
|
||||
expect(applyFilterSpy).toHaveBeenCalledWith({
|
||||
params: { staticKey: 'staticValue', search: searchText },
|
||||
filter: {skip: 0},
|
||||
});
|
||||
});
|
||||
|
||||
it('updates store when dataKey changes', async () => {
|
||||
expect(vm.store.userParams).toEqual(userParams);
|
||||
wrapper.setProps({ dataKey: 'newTestKey' });
|
||||
await vm.$nextTick();
|
||||
expect(vm.store.userParams).toEqual({});
|
||||
});
|
||||
|
||||
it('computes the "to" property correctly for redirection', () => {
|
||||
vm.arrayData.store.searchUrl = 'searchParam';
|
||||
vm.arrayData.store.currentFilter = { category: 'plants' };
|
||||
const expectedQuery = JSON.stringify({
|
||||
...vm.arrayData.store.currentFilter,
|
||||
search: searchText,
|
||||
});
|
||||
expect(vm.to.query.searchParam).toBe(expectedQuery);
|
||||
});
|
||||
});
|
|
@ -16,7 +16,7 @@ describe('useArrayData', () => {
|
|||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should fetch and repalce url with new params', async () => {
|
||||
it('should fetch and replace url with new params', async () => {
|
||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [] });
|
||||
|
||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl' });
|
||||
|
@ -33,11 +33,11 @@ describe('useArrayData', () => {
|
|||
});
|
||||
expect(routerReplace.path).toEqual('mockSection/list');
|
||||
expect(JSON.parse(routerReplace.query.params)).toEqual(
|
||||
expect.objectContaining(params)
|
||||
expect.objectContaining(params),
|
||||
);
|
||||
});
|
||||
|
||||
it('Should get data and send new URL without keeping parameters, if there is only one record', async () => {
|
||||
it('should get data and send new URL without keeping parameters, if there is only one record', async () => {
|
||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [{ id: 1 }] });
|
||||
|
||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', navigate: {} });
|
||||
|
@ -56,7 +56,7 @@ describe('useArrayData', () => {
|
|||
expect(routerPush.query).toBeUndefined();
|
||||
});
|
||||
|
||||
it('Should get data and send new URL keeping parameters, if you have more than one record', async () => {
|
||||
it('should get data and send new URL keeping parameters, if you have more than one record', async () => {
|
||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [{ id: 1 }, { id: 2 }] });
|
||||
|
||||
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
|
||||
|
@ -95,4 +95,25 @@ describe('useArrayData', () => {
|
|||
expect(routerPush.path).toEqual('mockName/');
|
||||
expect(routerPush.query.params).toBeDefined();
|
||||
});
|
||||
|
||||
it('should return one record', async () => {
|
||||
vi.spyOn(axios, 'get').mockReturnValueOnce({
|
||||
data: [
|
||||
{ id: 1, name: 'Entity 1' },
|
||||
{ id: 2, name: 'Entity 2' },
|
||||
],
|
||||
});
|
||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', oneRecord: true });
|
||||
await arrayData.fetch({});
|
||||
|
||||
expect(arrayData.store.data).toEqual({ id: 1, name: 'Entity 1' });
|
||||
});
|
||||
|
||||
it('should handle empty data gracefully if has to return one record', async () => {
|
||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [] });
|
||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', oneRecord: true });
|
||||
await arrayData.fetch({});
|
||||
|
||||
expect(arrayData.store.data).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,7 +7,9 @@ import { isDialogOpened } from 'src/filters';
|
|||
|
||||
const arrayDataStore = useArrayDataStore();
|
||||
|
||||
export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||
export function useArrayData(key, userOptions) {
|
||||
key ??= useRoute().meta.moduleName;
|
||||
|
||||
if (!key) throw new Error('ArrayData: A key is required to use this composable');
|
||||
|
||||
if (!arrayDataStore.get(key)) arrayDataStore.set(key);
|
||||
|
@ -31,10 +33,11 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
: JSON.parse(params?.filter ?? '{}');
|
||||
delete params.filter;
|
||||
|
||||
store.userParams = { ...store.userParams, ...params };
|
||||
store.userParams = params;
|
||||
store.filter = { ...filter, ...store.userFilter };
|
||||
if (filter?.order) store.order = filter.order;
|
||||
}
|
||||
setCurrentFilter();
|
||||
});
|
||||
|
||||
if (key && userOptions) setOptions();
|
||||
|
@ -54,6 +57,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
'navigate',
|
||||
'mapKey',
|
||||
'keepData',
|
||||
'oneRecord',
|
||||
];
|
||||
if (typeof userOptions === 'object') {
|
||||
for (const option in userOptions) {
|
||||
|
@ -76,11 +80,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
|
||||
cancelRequest();
|
||||
canceller = new AbortController();
|
||||
const { params, limit } = getCurrentFilter();
|
||||
|
||||
store.currentFilter = JSON.parse(JSON.stringify(params));
|
||||
delete store.currentFilter.filter.include;
|
||||
store.currentFilter.filter = JSON.stringify(store.currentFilter.filter);
|
||||
const { params, limit } = setCurrentFilter();
|
||||
|
||||
let exprFilter;
|
||||
if (store?.exprBuilder) {
|
||||
|
@ -94,6 +94,9 @@ export function useArrayData(key = useRoute().meta.moduleName, 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;
|
||||
|
@ -105,12 +108,16 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
store.hasMoreData = limit && response.data.length >= limit;
|
||||
|
||||
if (!append && !isDialogOpened() && updateRouter) {
|
||||
if (updateStateParams(response.data)?.redirect) return;
|
||||
if (updateStateParams(response.data)?.redirect && !store.keepData) return;
|
||||
}
|
||||
store.isLoading = false;
|
||||
canceller = null;
|
||||
|
||||
processData(response.data, { map: !!store.mapKey, append });
|
||||
processData(response.data, {
|
||||
map: !!store.mapKey,
|
||||
append,
|
||||
oneRecord: store.oneRecord,
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -140,12 +147,12 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
}
|
||||
}
|
||||
|
||||
async function applyFilter({ filter, params }) {
|
||||
async function applyFilter({ filter, params }, fetchOptions = {}) {
|
||||
if (filter) store.userFilter = filter;
|
||||
store.filter = {};
|
||||
if (params) store.userParams = { ...params };
|
||||
|
||||
const response = await fetch({});
|
||||
const response = await fetch(fetchOptions);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -171,10 +178,9 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
|
||||
async function addOrder(field, direction = 'ASC') {
|
||||
const newOrder = field + ' ' + direction;
|
||||
let order = store.order || [];
|
||||
if (typeof order == 'string') order = [order];
|
||||
const order = toArray(store.order);
|
||||
|
||||
let index = order.findIndex((o) => o.split(' ')[0] === field);
|
||||
let index = getOrderIndex(order, field);
|
||||
if (index > -1) {
|
||||
order[index] = newOrder;
|
||||
} else {
|
||||
|
@ -191,16 +197,24 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
}
|
||||
|
||||
async function deleteOrder(field) {
|
||||
let order = store.order ?? [];
|
||||
if (typeof order == 'string') order = [order];
|
||||
|
||||
const index = order.findIndex((o) => o.split(' ')[0] === field);
|
||||
const order = toArray(store.order);
|
||||
const index = getOrderIndex(order, field);
|
||||
if (index > -1) order.splice(index, 1);
|
||||
|
||||
store.order = order;
|
||||
fetch({});
|
||||
}
|
||||
|
||||
function getOrderIndex(order, field) {
|
||||
return order.findIndex((o) => o.split(' ')[0] === field);
|
||||
}
|
||||
|
||||
function toArray(str = []) {
|
||||
if (!str) return [];
|
||||
if (Array.isArray(str)) return str;
|
||||
if (typeof str === 'string') return str.split(',').map((item) => item.trim());
|
||||
}
|
||||
|
||||
function sanitizerParams(params, exprBuilder) {
|
||||
for (const param in params) {
|
||||
if (params[param] === '' || params[param] === null) {
|
||||
|
@ -274,14 +288,14 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
}
|
||||
|
||||
function getCurrentFilter() {
|
||||
if (!Object.keys(store.userParams).length)
|
||||
store.userParams = store.defaultParams ?? {};
|
||||
|
||||
const filter = {
|
||||
limit: store.limit,
|
||||
...store.userFilter,
|
||||
};
|
||||
|
||||
let userParams = { ...store.userParams };
|
||||
|
||||
Object.assign(filter, store.userFilter);
|
||||
|
||||
let where;
|
||||
if (filter?.where || store.filter?.where)
|
||||
where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
|
||||
|
@ -289,16 +303,27 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
filter.where = where;
|
||||
const params = { filter };
|
||||
|
||||
Object.assign(params, userParams);
|
||||
Object.assign(params, store.userParams);
|
||||
if (params.filter) params.filter.skip = store.skip;
|
||||
if (store?.order && typeof store?.order == 'string') store.order = [store.order];
|
||||
if (store.order?.length) params.filter.order = [...store.order];
|
||||
if (store.order) params.filter.order = toArray(store.order);
|
||||
else delete params.filter.order;
|
||||
|
||||
return { filter, params, limit: filter.limit };
|
||||
}
|
||||
|
||||
function processData(data, { map = true, append = true }) {
|
||||
function setCurrentFilter() {
|
||||
const { params, limit } = getCurrentFilter();
|
||||
store.currentFilter = JSON.parse(JSON.stringify(params));
|
||||
delete store.currentFilter.filter.include;
|
||||
store.currentFilter.filter = JSON.stringify(store.currentFilter.filter);
|
||||
return { params, limit };
|
||||
}
|
||||
|
||||
function processData(data, { map = true, append = true, oneRecord = false }) {
|
||||
if (oneRecord) {
|
||||
store.data = Array.isArray(data) ? data[0] : data;
|
||||
return;
|
||||
}
|
||||
if (!append) {
|
||||
store.data = [];
|
||||
store.map = new Map();
|
||||
|
@ -331,6 +356,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
applyFilter,
|
||||
addFilter,
|
||||
getCurrentFilter,
|
||||
setCurrentFilter,
|
||||
addFilterWhere,
|
||||
addOrder,
|
||||
deleteOrder,
|
||||
|
|
|
@ -29,8 +29,12 @@ export function useFilterParams(key) {
|
|||
orders.value = orderObject;
|
||||
}
|
||||
|
||||
function setUserParams(watchedParams) {
|
||||
if (!watchedParams || Object.keys(watchedParams).length == 0) return;
|
||||
function setUserParams(watchedParams = {}) {
|
||||
if (Object.keys(watchedParams).length == 0) {
|
||||
params.value = {};
|
||||
orders.value = {};
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
|
||||
if (typeof watchedParams?.filter == 'string')
|
||||
|
|
|
@ -5,7 +5,7 @@ export function useHasContent(selector) {
|
|||
const hasContent = ref();
|
||||
|
||||
onMounted(() => {
|
||||
container.value = document.querySelector(selector);
|
||||
container.value = document?.querySelector(selector);
|
||||
if (!container.value) return;
|
||||
|
||||
const observer = new MutationObserver(() => {
|
||||
|
|
|
@ -6,6 +6,7 @@ import axios from 'axios';
|
|||
import { useRouter } from 'vue-router';
|
||||
import useNotify from './useNotify';
|
||||
import { useTokenConfig } from './useTokenConfig';
|
||||
import { getToken, getTokenMultimedia } from 'src/utils/session';
|
||||
const TOKEN_MULTIMEDIA = 'tokenMultimedia';
|
||||
const TOKEN = 'token';
|
||||
|
||||
|
@ -15,19 +16,6 @@ export function useSession() {
|
|||
let isCheckingToken = false;
|
||||
let intervalId = null;
|
||||
|
||||
function getToken() {
|
||||
const localToken = localStorage.getItem(TOKEN);
|
||||
const sessionToken = sessionStorage.getItem(TOKEN);
|
||||
|
||||
return localToken || sessionToken || '';
|
||||
}
|
||||
function getTokenMultimedia() {
|
||||
const localTokenMultimedia = localStorage.getItem(TOKEN_MULTIMEDIA);
|
||||
const sessionTokenMultimedia = sessionStorage.getItem(TOKEN_MULTIMEDIA);
|
||||
|
||||
return localTokenMultimedia || sessionTokenMultimedia || '';
|
||||
}
|
||||
|
||||
function setSession(data) {
|
||||
let keepLogin = data.keepLogin;
|
||||
const storage = keepLogin ? localStorage : sessionStorage;
|
||||
|
|
|
@ -4,10 +4,10 @@ import { useQuasar } from 'quasar';
|
|||
export function useSummaryDialog() {
|
||||
const quasar = useQuasar();
|
||||
|
||||
function viewSummary(id, summary) {
|
||||
function viewSummary(id, summary, width) {
|
||||
quasar.dialog({
|
||||
component: VnSummaryDialog,
|
||||
componentProps: { id, summary },
|
||||
componentProps: { id, summary, width },
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// app global css in SCSS form
|
||||
@import './icons.scss';
|
||||
@import '@quasar/quasar-ui-qcalendar/src/QCalendarMonth.sass';
|
||||
@import '@quasar/quasar-ui-qcalendar/src/QCalendarMonth.scss';
|
||||
|
||||
body.body--light {
|
||||
--vn-header-color: #cecece;
|
||||
|
@ -212,6 +212,10 @@ select:-webkit-autofill {
|
|||
justify-content: center;
|
||||
}
|
||||
|
||||
.q-card__section[dense] {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
input[type='number'] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
@ -310,6 +314,14 @@ input::-webkit-inner-spin-button {
|
|||
.no-visible {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.q-item > .q-item__section:has(.q-checkbox) {
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
.row > .column:has(.q-checkbox) {
|
||||
max-width: fit-content;
|
||||
}
|
||||
.q-field__inner {
|
||||
.q-field__control {
|
||||
min-height: auto !important;
|
||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 186 KiB |
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -1,10 +1,10 @@
|
|||
@font-face {
|
||||
font-family: 'icon';
|
||||
src: url('fonts/icon.eot?y0x93o');
|
||||
src: url('fonts/icon.eot?y0x93o#iefix') format('embedded-opentype'),
|
||||
url('fonts/icon.ttf?y0x93o') format('truetype'),
|
||||
url('fonts/icon.woff?y0x93o') format('woff'),
|
||||
url('fonts/icon.svg?y0x93o#icon') format('svg');
|
||||
src: url('fonts/icon.eot?uocffs');
|
||||
src: url('fonts/icon.eot?uocffs#iefix') format('embedded-opentype'),
|
||||
url('fonts/icon.ttf?uocffs') format('truetype'),
|
||||
url('fonts/icon.woff?uocffs') format('woff'),
|
||||
url('fonts/icon.svg?uocffs#icon') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
|
@ -25,8 +25,17 @@
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-entry_lastbuys:before {
|
||||
content: "\e91a";
|
||||
.icon-inactive-car:before {
|
||||
content: "\e978";
|
||||
}
|
||||
.icon-hasItemLost:before {
|
||||
content: "\e957";
|
||||
}
|
||||
.icon-hasItemDelay:before {
|
||||
content: "\e96d";
|
||||
}
|
||||
.icon-add_entries:before {
|
||||
content: "\e953";
|
||||
}
|
||||
.icon-100:before {
|
||||
content: "\e901";
|
||||
|
@ -52,6 +61,9 @@
|
|||
.icon-addperson:before {
|
||||
content: "\e908";
|
||||
}
|
||||
.icon-agencia_tributaria:before {
|
||||
content: "\e948";
|
||||
}
|
||||
.icon-agency:before {
|
||||
content: "\e92a";
|
||||
}
|
||||
|
@ -189,6 +201,9 @@
|
|||
.icon-entry:before {
|
||||
content: "\e937";
|
||||
}
|
||||
.icon-entry_lastbuys:before {
|
||||
content: "\e91a";
|
||||
}
|
||||
.icon-exit:before {
|
||||
content: "\e938";
|
||||
}
|
||||
|
|
|
@ -33,6 +33,11 @@ $dark-shadow-color: black;
|
|||
$layout-shadow-dark: 0 0 10px 2px #00000033, 0 0px 10px #0000003d;
|
||||
$spacing-md: 16px;
|
||||
$color-font-secondary: #777;
|
||||
$width-xs: 400px;
|
||||
$width-sm: 544px;
|
||||
$width-md: 800px;
|
||||
$width-lg: 1280px;
|
||||
$width-xl: 1600px;
|
||||
.bg-success {
|
||||
background-color: $positive;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import getUpdatedValues from './getUpdatedValues';
|
|||
import getParamWhere from './getParamWhere';
|
||||
import parsePhone from './parsePhone';
|
||||
import isDialogOpened from './isDialogOpened';
|
||||
import toCelsius from './toCelsius';
|
||||
|
||||
export {
|
||||
getUpdatedValues,
|
||||
|
@ -36,4 +37,5 @@ export {
|
|||
dashIfEmpty,
|
||||
dateRange,
|
||||
getParamWhere,
|
||||
toCelsius,
|
||||
};
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
export default function toCelsius(value) {
|
||||
return value ? `${value}°C` : '';
|
||||
}
|
|
@ -2,12 +2,14 @@ globals:
|
|||
lang:
|
||||
es: Spanish
|
||||
en: English
|
||||
quantity: Quantity
|
||||
language: Language
|
||||
quantity: Quantity
|
||||
entity: Entity
|
||||
preview: Preview
|
||||
user: User
|
||||
details: Details
|
||||
collapseMenu: Collapse left menu
|
||||
collapseMenu: Collapse lateral menu
|
||||
advancedMenu: Advanced menu
|
||||
backToDashboard: Return to dashboard
|
||||
notifications: Notifications
|
||||
userPanel: User panel
|
||||
|
@ -35,7 +37,6 @@ globals:
|
|||
confirm: Confirm
|
||||
assign: Assign
|
||||
back: Back
|
||||
downloadPdf: Download PDF
|
||||
yes: 'Yes'
|
||||
no: 'No'
|
||||
noChanges: No changes to save
|
||||
|
@ -59,6 +60,7 @@ globals:
|
|||
downloadCSVSuccess: CSV downloaded successfully
|
||||
reference: Reference
|
||||
agency: Agency
|
||||
entry: Entry
|
||||
warehouseOut: Warehouse Out
|
||||
warehouseIn: Warehouse In
|
||||
landed: Landed
|
||||
|
@ -67,11 +69,11 @@ globals:
|
|||
amount: Amount
|
||||
packages: Packages
|
||||
download: Download
|
||||
downloadPdf: Download PDF
|
||||
selectRows: 'Select all { numberRows } row(s)'
|
||||
allRows: 'All { numberRows } row(s)'
|
||||
markAll: Mark all
|
||||
requiredField: Required field
|
||||
valueCantBeEmpty: Value cannot be empty
|
||||
class: clase
|
||||
type: Type
|
||||
reason: reason
|
||||
|
@ -81,6 +83,9 @@ globals:
|
|||
warehouse: Warehouse
|
||||
company: Company
|
||||
fieldRequired: Field required
|
||||
valueCantBeEmpty: Value cannot be empty
|
||||
Value can't be blank: Value cannot be blank
|
||||
Value can't be null: Value cannot be null
|
||||
allowedFilesText: 'Allowed file types: { allowedContentTypes }'
|
||||
smsSent: SMS sent
|
||||
confirmDeletion: Confirm deletion
|
||||
|
@ -130,6 +135,26 @@ globals:
|
|||
medium: Medium
|
||||
big: Big
|
||||
email: Email
|
||||
supplier: Supplier
|
||||
ticketList: Ticket List
|
||||
created: Created
|
||||
worker: Worker
|
||||
now: Now
|
||||
name: Name
|
||||
new: New
|
||||
comment: Comment
|
||||
observations: Observations
|
||||
goToModuleIndex: Go to module index
|
||||
createInvoiceIn: Create invoice in
|
||||
myAccount: My account
|
||||
noOne: No one
|
||||
maxTemperature: Max
|
||||
minTemperature: Min
|
||||
changePass: Change password
|
||||
deleteConfirmTitle: Delete selected elements
|
||||
changeState: Change state
|
||||
raid: 'Raid {daysInForward} days'
|
||||
isVies: Vies
|
||||
pageTitles:
|
||||
logIn: Login
|
||||
addressEdit: Update address
|
||||
|
@ -151,13 +176,14 @@ globals:
|
|||
subRoles: Subroles
|
||||
inheritedRoles: Inherited Roles
|
||||
customers: Customers
|
||||
customerCreate: New customer
|
||||
createCustomer: Create customer
|
||||
createOrder: New order
|
||||
list: List
|
||||
webPayments: Web Payments
|
||||
extendedList: Extended list
|
||||
notifications: Notifications
|
||||
defaulter: Defaulter
|
||||
customerCreate: New customer
|
||||
createOrder: New order
|
||||
fiscalData: Fiscal data
|
||||
billingData: Billing data
|
||||
consignees: Consignees
|
||||
|
@ -193,27 +219,28 @@ globals:
|
|||
claims: Claims
|
||||
claimCreate: New claim
|
||||
lines: Lines
|
||||
photos: Photos
|
||||
development: Development
|
||||
photos: Photos
|
||||
action: Action
|
||||
invoiceOuts: Invoice out
|
||||
negativeBases: Negative Bases
|
||||
globalInvoicing: Global invoicing
|
||||
invoiceOutCreate: Create invoice out
|
||||
order: Orders
|
||||
orderList: List
|
||||
orderCreate: New order
|
||||
catalog: Catalog
|
||||
volume: Volume
|
||||
shelving: Shelving
|
||||
shelvingList: Shelving List
|
||||
shelvingCreate: New shelving
|
||||
invoiceIns: Invoices In
|
||||
invoiceInCreate: Create invoice in
|
||||
vat: VAT
|
||||
labeler: Labeler
|
||||
dueDay: Due day
|
||||
intrastat: Intrastat
|
||||
corrective: Corrective
|
||||
order: Orders
|
||||
orderList: List
|
||||
orderCreate: New order
|
||||
catalog: Catalog
|
||||
volume: Volume
|
||||
workers: Workers
|
||||
workerCreate: New worker
|
||||
department: Department
|
||||
|
@ -226,10 +253,10 @@ globals:
|
|||
wagonsList: Wagons List
|
||||
wagonCreate: Create wagon
|
||||
wagonEdit: Edit wagon
|
||||
wagonCounter: Trolley counter
|
||||
typesList: Types List
|
||||
typeCreate: Create type
|
||||
typeEdit: Edit type
|
||||
wagonCounter: Trolley counter
|
||||
roadmap: Roadmap
|
||||
stops: Stops
|
||||
routes: Routes
|
||||
|
@ -238,21 +265,16 @@ globals:
|
|||
routeCreate: New route
|
||||
RouteRoadmap: Roadmaps
|
||||
RouteRoadmapCreate: Create roadmap
|
||||
RouteExtendedList: Router
|
||||
autonomous: Autonomous
|
||||
suppliers: Suppliers
|
||||
supplier: Supplier
|
||||
expedition: Expedition
|
||||
services: Service
|
||||
components: Components
|
||||
pictures: Pictures
|
||||
packages: Packages
|
||||
tracking: Tracking
|
||||
labeler: Labeler
|
||||
supplierCreate: New supplier
|
||||
accounts: Accounts
|
||||
addresses: Addresses
|
||||
agencyTerm: Agency agreement
|
||||
travel: Travels
|
||||
create: Create
|
||||
extraCommunity: Extra community
|
||||
travelCreate: New travel
|
||||
history: Log
|
||||
|
@ -260,14 +282,13 @@ globals:
|
|||
items: Items
|
||||
diary: Diary
|
||||
tags: Tags
|
||||
create: Create
|
||||
buyRequest: Buy requests
|
||||
fixedPrice: Fixed prices
|
||||
buyRequest: Buy requests
|
||||
wasteBreakdown: Waste breakdown
|
||||
itemCreate: New item
|
||||
barcode: Barcodes
|
||||
tax: Tax
|
||||
botanical: Botanical
|
||||
barcode: Barcodes
|
||||
itemTypeCreate: New item type
|
||||
family: Item Type
|
||||
lastEntries: Last entries
|
||||
|
@ -283,13 +304,20 @@ globals:
|
|||
formation: Formation
|
||||
locations: Locations
|
||||
warehouses: Warehouses
|
||||
saleTracking: Sale tracking
|
||||
roles: Roles
|
||||
connections: Connections
|
||||
acls: ACLs
|
||||
mailForwarding: Mail forwarding
|
||||
mailAlias: Mail alias
|
||||
privileges: Privileges
|
||||
observation: Notes
|
||||
expedition: Expedition
|
||||
saleTracking: Sale tracking
|
||||
services: Service
|
||||
tracking: Tracking
|
||||
components: Components
|
||||
pictures: Pictures
|
||||
packages: Packages
|
||||
ldap: LDAP
|
||||
samba: Samba
|
||||
twoFactor: Two factor
|
||||
|
@ -298,30 +326,19 @@ globals:
|
|||
ticketsMonitor: Tickets monitor
|
||||
clientsActionsMonitor: Clients and actions
|
||||
serial: Serial
|
||||
business: Business
|
||||
medical: Mutual
|
||||
pit: IRPF
|
||||
RouteExtendedList: Router
|
||||
wasteRecalc: Waste recaclulate
|
||||
operator: Operator
|
||||
parking: Parking
|
||||
supplier: Supplier
|
||||
created: Created
|
||||
worker: Worker
|
||||
now: Now
|
||||
name: Name
|
||||
new: New
|
||||
comment: Comment
|
||||
observations: Observations
|
||||
goToModuleIndex: Go to module index
|
||||
vehicleList: Vehicles
|
||||
vehicle: Vehicle
|
||||
unsavedPopup:
|
||||
title: Unsaved changes will be lost
|
||||
subtitle: Are you sure exit without saving?
|
||||
createInvoiceIn: Create invoice in
|
||||
myAccount: My account
|
||||
noOne: No one
|
||||
maxTemperature: Max
|
||||
minTemperature: Min
|
||||
params:
|
||||
description: Description
|
||||
clientFk: Client id
|
||||
salesPersonFk: Sales person
|
||||
warehouseFk: Warehouse
|
||||
|
@ -338,19 +355,19 @@ globals:
|
|||
supplierFk: Supplier
|
||||
supplierRef: Supplier ref
|
||||
serial: Serial
|
||||
amount: Importe
|
||||
amount: Amount
|
||||
awbCode: AWB
|
||||
correctedFk: Rectified
|
||||
correctingFk: Rectificative
|
||||
daysOnward: Days onward
|
||||
countryFk: Country
|
||||
countryCodeFk: Country
|
||||
companyFk: Company
|
||||
changePass: Change password
|
||||
setPass: Set password
|
||||
deleteConfirmTitle: Delete selected elements
|
||||
changeState: Change state
|
||||
raid: 'Raid {daysInForward} days'
|
||||
isVies: Vies
|
||||
model: Model
|
||||
fuel: Fuel
|
||||
active: Active
|
||||
inactive: Inactive
|
||||
deliveryPoint: Delivery point
|
||||
errors:
|
||||
statusUnauthorized: Access denied
|
||||
statusInternalServerError: An internal server error has ocurred
|
||||
|
@ -370,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: >-
|
||||
|
@ -389,80 +406,6 @@ cau:
|
|||
subtitle: By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.
|
||||
inputLabel: Explain why this error should not appear
|
||||
askPrivileges: Ask for privileges
|
||||
entry:
|
||||
list:
|
||||
newEntry: New entry
|
||||
tableVisibleColumns:
|
||||
created: Creation
|
||||
supplierFk: Supplier
|
||||
isBooked: Booked
|
||||
isConfirmed: Confirmed
|
||||
isOrdered: Ordered
|
||||
companyFk: Company
|
||||
travelFk: Travel
|
||||
isExcludedFromAvailable: Inventory
|
||||
invoiceAmount: Import
|
||||
summary:
|
||||
commission: Commission
|
||||
currency: Currency
|
||||
invoiceNumber: Invoice number
|
||||
ordered: Ordered
|
||||
booked: Booked
|
||||
excludedFromAvailable: Inventory
|
||||
travelReference: Reference
|
||||
travelAgency: Agency
|
||||
travelShipped: Shipped
|
||||
travelDelivered: Delivered
|
||||
travelLanded: Landed
|
||||
travelReceived: Received
|
||||
buys: Buys
|
||||
stickers: Stickers
|
||||
package: Package
|
||||
packing: Pack.
|
||||
grouping: Group.
|
||||
buyingValue: Buying value
|
||||
import: Import
|
||||
pvp: PVP
|
||||
basicData:
|
||||
travel: Travel
|
||||
currency: Currency
|
||||
commission: Commission
|
||||
observation: Observation
|
||||
booked: Booked
|
||||
excludedFromAvailable: Inventory
|
||||
buys:
|
||||
observations: Observations
|
||||
packagingFk: Box
|
||||
color: Color
|
||||
printedStickers: Printed stickers
|
||||
notes:
|
||||
observationType: Observation type
|
||||
latestBuys:
|
||||
tableVisibleColumns:
|
||||
image: Picture
|
||||
itemFk: Item ID
|
||||
weightByPiece: Weight/Piece
|
||||
isActive: Active
|
||||
family: Family
|
||||
entryFk: Entry
|
||||
freightValue: Freight value
|
||||
comissionValue: Commission value
|
||||
packageValue: Package value
|
||||
isIgnored: Is ignored
|
||||
price2: Grouping
|
||||
price3: Packing
|
||||
minPrice: Min
|
||||
ektFk: Ekt
|
||||
packingOut: Package out
|
||||
landing: Landing
|
||||
isExcludedFromAvailable: Es inventory
|
||||
params:
|
||||
toShipped: To
|
||||
fromShipped: From
|
||||
warehouseiNFk: Warehouse
|
||||
daysOnward: Days onward
|
||||
daysAgo: Days ago
|
||||
warehouseInFk: Warehouse in
|
||||
ticket:
|
||||
params:
|
||||
ticketFk: Ticket ID
|
||||
|
@ -520,65 +463,9 @@ ticket:
|
|||
service: Service
|
||||
attender: Attender
|
||||
ok: Ok
|
||||
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
|
||||
shelving:
|
||||
list:
|
||||
parking: Parking
|
||||
priority: Priority
|
||||
newShelving: New Shelving
|
||||
summary:
|
||||
recyclable: Recyclable
|
||||
parking:
|
||||
pickingOrder: Picking order
|
||||
sector: Sector
|
||||
row: Row
|
||||
column: Column
|
||||
searchBar:
|
||||
info: You can search by parking code
|
||||
label: Search parking...
|
||||
department:
|
||||
chat: Chat
|
||||
bossDepartment: Boss Department
|
||||
|
@ -590,6 +477,24 @@ department:
|
|||
hasToSendMail: Send check-ins by email
|
||||
departmentRemoved: Department removed
|
||||
worker:
|
||||
pageTitles:
|
||||
workers: Workers
|
||||
list: List
|
||||
basicData: Basic data
|
||||
summary: Summary
|
||||
notifications: Notifications
|
||||
workerCreate: New worker
|
||||
department: Department
|
||||
pda: PDA
|
||||
notes: Notas
|
||||
dms: My documentation
|
||||
pbx: Private Branch Exchange
|
||||
log: Log
|
||||
calendar: Calendar
|
||||
timeControl: Time control
|
||||
locker: Locker
|
||||
balance: Balance
|
||||
medical: Medical
|
||||
list:
|
||||
department: Department
|
||||
schedule: Schedule
|
||||
|
@ -605,15 +510,24 @@ worker:
|
|||
role: Role
|
||||
sipExtension: Extension
|
||||
locker: Locker
|
||||
fiDueDate: FI due date
|
||||
fiDueDate: DNI expiration date
|
||||
sex: Sex
|
||||
seniority: Seniority
|
||||
seniority: Antiquity
|
||||
fi: DNI/NIE/NIF
|
||||
birth: Birth
|
||||
isFreelance: Freelance
|
||||
isSsDiscounted: SS Bonification
|
||||
hasMachineryAuthorized: Machinery authorized
|
||||
isDisable: Disable
|
||||
business: Business
|
||||
started: Started
|
||||
ended: Ended
|
||||
reasonEnd: Reason End
|
||||
department: Departament
|
||||
workerBusinessCategory: Worker Business Category
|
||||
notes: Notes
|
||||
workCenter: Center
|
||||
professionalCategory: Professional Category
|
||||
notificationsManager:
|
||||
activeNotifications: Active notifications
|
||||
availableNotifications: Available notifications
|
||||
|
@ -672,6 +586,23 @@ worker:
|
|||
sizeLimit: Size limit
|
||||
isOnReservationMode: Reservation mode
|
||||
machine: Machine
|
||||
business:
|
||||
tableVisibleColumns:
|
||||
started: Start Date
|
||||
ended: End Date
|
||||
company: Company
|
||||
reasonEnd: Reason for Termination
|
||||
department: Department
|
||||
professionalCategory: Professional Category
|
||||
calendarType: Work Calendar
|
||||
workCenter: Work Center
|
||||
payrollCategories: Contract Category
|
||||
occupationCode: Contribution Code
|
||||
rate: Rate
|
||||
businessType: Contract Type
|
||||
amount: Salary
|
||||
basicSalary: Transport Workers Salary
|
||||
notes: Notes
|
||||
wagon:
|
||||
type:
|
||||
submit: Submit
|
||||
|
@ -772,6 +703,9 @@ supplier:
|
|||
consumption:
|
||||
entry: Entry
|
||||
travel:
|
||||
search: Search travel
|
||||
searchInfo: You can search by travel id or name
|
||||
id: Id
|
||||
travelList:
|
||||
tableVisibleColumns:
|
||||
ref: Reference
|
||||
|
@ -780,6 +714,7 @@ travel:
|
|||
totalEntries: Total entries
|
||||
totalEntriesTooltip: Total entries
|
||||
daysOnward: Landed days onwards
|
||||
awb: AWB
|
||||
summary:
|
||||
entryId: Entry Id
|
||||
freight: Freight
|
||||
|
@ -801,62 +736,7 @@ travel:
|
|||
destination: Destination
|
||||
thermograph: Thermograph
|
||||
travelFileDescription: 'Travel id { travelId }'
|
||||
item:
|
||||
descriptor:
|
||||
buyer: Buyer
|
||||
color: Color
|
||||
category: Category
|
||||
available: Available
|
||||
warehouseText: 'Calculated on the warehouse of { warehouseName }'
|
||||
itemDiary: Item diary
|
||||
list:
|
||||
id: Identifier
|
||||
stems: Stems
|
||||
category: Category
|
||||
typeName: Type
|
||||
isActive: Active
|
||||
userName: Buyer
|
||||
weightByPiece: Weight/Piece
|
||||
stemMultiplier: Multiplier
|
||||
fixedPrice:
|
||||
itemFk: Item ID
|
||||
groupingPrice: Grouping price
|
||||
packingPrice: Packing price
|
||||
hasMinPrice: Has min price
|
||||
minPrice: Min price
|
||||
started: Started
|
||||
ended: Ended
|
||||
create:
|
||||
priority: Priority
|
||||
buyRequest:
|
||||
requester: Requester
|
||||
requested: Requested
|
||||
attender: Atender
|
||||
achieved: Achieved
|
||||
concept: Concept
|
||||
summary:
|
||||
otherData: Other data
|
||||
tax: Tax
|
||||
botanical: Botanical
|
||||
barcode: Barcode
|
||||
completeName: Complete name
|
||||
family: Familiy
|
||||
stems: Stems
|
||||
multiplier: Multiplier
|
||||
buyer: Buyer
|
||||
doPhoto: Do photo
|
||||
intrastatCode: Intrastat code
|
||||
ref: Reference
|
||||
relevance: Relevance
|
||||
weight: Weight (gram)/stem
|
||||
units: Units/box
|
||||
expense: Expense
|
||||
generic: Generic
|
||||
recycledPlastic: Recycled plastic
|
||||
nonRecycledPlastic: Non recycled plastic
|
||||
minSalesQuantity: Min sales quantity
|
||||
genus: Genus
|
||||
specie: Specie
|
||||
carrier: Carrier
|
||||
components:
|
||||
topbar: {}
|
||||
itemsFilterPanel:
|
||||
|
@ -871,7 +751,10 @@ components:
|
|||
hasMinPrice: Minimum price
|
||||
# LatestBuysFilter
|
||||
salesPersonFk: Buyer
|
||||
supplierFk: Supplier
|
||||
from: From
|
||||
to: To
|
||||
visible: Is visible
|
||||
active: Is active
|
||||
floramondo: Is floramondo
|
||||
showBadDates: Show future items
|
||||
|
|
|
@ -5,9 +5,11 @@ globals:
|
|||
language: Idioma
|
||||
quantity: Cantidad
|
||||
entity: Entidad
|
||||
preview: Vista previa
|
||||
user: Usuario
|
||||
details: Detalles
|
||||
collapseMenu: Contraer menú lateral
|
||||
advancedMenu: Menú avanzado
|
||||
backToDashboard: Volver al tablón
|
||||
notifications: Notificaciones
|
||||
userPanel: Panel de usuario
|
||||
|
@ -53,11 +55,12 @@ globals:
|
|||
today: Hoy
|
||||
yesterday: Ayer
|
||||
dateFormat: es-ES
|
||||
noSelectedRows: No tienes ninguna línea seleccionada
|
||||
microsip: Abrir en MicroSIP
|
||||
noSelectedRows: No tienes ninguna línea seleccionada
|
||||
downloadCSVSuccess: Descarga de CSV exitosa
|
||||
reference: Referencia
|
||||
agency: Agencia
|
||||
entry: Entrada
|
||||
warehouseOut: Alm. salida
|
||||
warehouseIn: Alm. entrada
|
||||
landed: F. entrega
|
||||
|
@ -132,6 +135,26 @@ globals:
|
|||
medium: Mediano/a
|
||||
big: Grande
|
||||
email: Correo
|
||||
supplier: Proveedor
|
||||
ticketList: Listado de tickets
|
||||
created: Fecha creación
|
||||
worker: Trabajador
|
||||
now: Ahora
|
||||
name: Nombre
|
||||
new: Nuevo
|
||||
comment: Comentario
|
||||
observations: Observaciones
|
||||
goToModuleIndex: Ir al índice del módulo
|
||||
createInvoiceIn: Crear factura recibida
|
||||
myAccount: Mi cuenta
|
||||
noOne: Nadie
|
||||
maxTemperature: Máx
|
||||
minTemperature: Mín
|
||||
changePass: Cambiar contraseña
|
||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||
changeState: Cambiar estado
|
||||
raid: 'Redada {daysInForward} días'
|
||||
isVies: Vies
|
||||
pageTitles:
|
||||
logIn: Inicio de sesión
|
||||
addressEdit: Modificar consignatario
|
||||
|
@ -154,17 +177,17 @@ globals:
|
|||
inheritedRoles: Roles heredados
|
||||
customers: Clientes
|
||||
customerCreate: Nuevo cliente
|
||||
createCustomer: Crear cliente
|
||||
createOrder: Nuevo pedido
|
||||
list: Listado
|
||||
webPayments: Pagos Web
|
||||
extendedList: Listado extendido
|
||||
notifications: Notificaciones
|
||||
defaulter: Morosos
|
||||
createCustomer: Crear cliente
|
||||
fiscalData: Datos fiscales
|
||||
billingData: Forma de pago
|
||||
consignees: Consignatarios
|
||||
'address-create': Nuevo consignatario
|
||||
address-create: Nuevo consignatario
|
||||
notes: Notas
|
||||
credits: Créditos
|
||||
greuges: Greuges
|
||||
|
@ -230,10 +253,10 @@ globals:
|
|||
wagonsList: Listado vagones
|
||||
wagonCreate: Crear tipo
|
||||
wagonEdit: Editar tipo
|
||||
wagonCounter: Contador de carros
|
||||
typesList: Listado tipos
|
||||
typeCreate: Crear tipo
|
||||
typeEdit: Editar tipo
|
||||
wagonCounter: Contador de carros
|
||||
roadmap: Troncales
|
||||
stops: Paradas
|
||||
routes: Rutas
|
||||
|
@ -242,8 +265,8 @@ globals:
|
|||
routeCreate: Nueva ruta
|
||||
RouteRoadmap: Troncales
|
||||
RouteRoadmapCreate: Crear troncal
|
||||
autonomous: Autónomos
|
||||
RouteExtendedList: Enrutador
|
||||
autonomous: Autónomos
|
||||
suppliers: Proveedores
|
||||
supplier: Proveedor
|
||||
supplierCreate: Nuevo proveedor
|
||||
|
@ -303,29 +326,19 @@ globals:
|
|||
ticketsMonitor: Monitor de tickets
|
||||
clientsActionsMonitor: Clientes y acciones
|
||||
serial: Facturas por serie
|
||||
business: Contratos
|
||||
medical: Mutua
|
||||
pit: IRPF
|
||||
wasteRecalc: Recalcular mermas
|
||||
operator: Operario
|
||||
parking: Parking
|
||||
supplier: Proveedor
|
||||
created: Fecha creación
|
||||
worker: Trabajador
|
||||
now: Ahora
|
||||
name: Nombre
|
||||
new: Nuevo
|
||||
comment: Comentario
|
||||
observations: Observaciones
|
||||
goToModuleIndex: Ir al índice del módulo
|
||||
vehicleList: Vehículos
|
||||
vehicle: Vehículo
|
||||
unsavedPopup:
|
||||
title: Los cambios que no haya guardado se perderán
|
||||
subtitle: ¿Seguro que quiere salir sin guardar?
|
||||
createInvoiceIn: Crear factura recibida
|
||||
myAccount: Mi cuenta
|
||||
noOne: Nadie
|
||||
maxTemperature: Máx
|
||||
minTemperature: Mín
|
||||
params:
|
||||
description: Descripción
|
||||
clientFk: Id cliente
|
||||
salesPersonFk: Comercial
|
||||
warehouseFk: Almacén
|
||||
|
@ -346,13 +359,8 @@ globals:
|
|||
daysOnward: Días adelante
|
||||
packing: ITP
|
||||
countryFk: País
|
||||
countryCodeFk: País
|
||||
companyFk: Empresa
|
||||
changePass: Cambiar contraseña
|
||||
setPass: Establecer contraseña
|
||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||
changeState: Cambiar estado
|
||||
raid: 'Redada {daysInForward} días'
|
||||
isVies: Vies
|
||||
errors:
|
||||
statusUnauthorized: Acceso denegado
|
||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||
|
@ -389,80 +397,6 @@ cau:
|
|||
subtitle: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc
|
||||
inputLabel: Explique el motivo por el que no deberia aparecer este fallo
|
||||
askPrivileges: Solicitar permisos
|
||||
entry:
|
||||
list:
|
||||
newEntry: Nueva entrada
|
||||
tableVisibleColumns:
|
||||
created: Creación
|
||||
supplierFk: Proveedor
|
||||
isBooked: Asentado
|
||||
isConfirmed: Confirmado
|
||||
isOrdered: Pedida
|
||||
companyFk: Empresa
|
||||
travelFk: Envio
|
||||
isExcludedFromAvailable: Inventario
|
||||
invoiceAmount: Importe
|
||||
summary:
|
||||
commission: Comisión
|
||||
currency: Moneda
|
||||
invoiceNumber: Núm. factura
|
||||
ordered: Pedida
|
||||
booked: Contabilizada
|
||||
excludedFromAvailable: Inventario
|
||||
travelReference: Referencia
|
||||
travelAgency: Agencia
|
||||
travelShipped: F. envio
|
||||
travelWarehouseOut: Alm. salida
|
||||
travelDelivered: Enviada
|
||||
travelLanded: F. entrega
|
||||
travelReceived: Recibida
|
||||
buys: Compras
|
||||
stickers: Etiquetas
|
||||
package: Embalaje
|
||||
packing: Pack.
|
||||
grouping: Group.
|
||||
buyingValue: Coste
|
||||
import: Importe
|
||||
pvp: PVP
|
||||
basicData:
|
||||
travel: Envío
|
||||
currency: Moneda
|
||||
observation: Observación
|
||||
commission: Comisión
|
||||
booked: Asentado
|
||||
excludedFromAvailable: Inventario
|
||||
buys:
|
||||
observations: Observaciónes
|
||||
packagingFk: Embalaje
|
||||
color: Color
|
||||
printedStickers: Etiquetas impresas
|
||||
notes:
|
||||
observationType: Tipo de observación
|
||||
latestBuys:
|
||||
tableVisibleColumns:
|
||||
image: Foto
|
||||
itemFk: Id Artículo
|
||||
weightByPiece: Peso (gramos)/tallo
|
||||
isActive: Activo
|
||||
family: Familia
|
||||
entryFk: Entrada
|
||||
freightValue: Porte
|
||||
comissionValue: Comisión
|
||||
packageValue: Embalaje
|
||||
isIgnored: Ignorado
|
||||
price2: Grouping
|
||||
price3: Packing
|
||||
minPrice: Min
|
||||
ektFk: Ekt
|
||||
packingOut: Embalaje envíos
|
||||
landing: Llegada
|
||||
isExcludedFromAvailable: Es inventario
|
||||
params:
|
||||
toShipped: Hasta
|
||||
fromShipped: Desde
|
||||
warehouseInFk: Alm. entrada
|
||||
daysOnward: Días adelante
|
||||
daysAgo: Días atras
|
||||
ticket:
|
||||
params:
|
||||
ticketFk: ID de ticket
|
||||
|
@ -519,13 +453,18 @@ ticket:
|
|||
purchaseRequest: Petición de compra
|
||||
service: Servicio
|
||||
attender: Consignatario
|
||||
consigneeStreet: Dirección
|
||||
create:
|
||||
address: Dirección
|
||||
invoiceOut:
|
||||
card:
|
||||
issued: Fecha emisión
|
||||
customerCard: Ficha del cliente
|
||||
ticketList: Listado de tickets
|
||||
order:
|
||||
field:
|
||||
salesPersonFk: Comercial
|
||||
form:
|
||||
clientFk: Cliente
|
||||
addressFk: Dirección
|
||||
agencyModeFk: Agencia
|
||||
list:
|
||||
newOrder: Nuevo Pedido
|
||||
summary:
|
||||
issued: Fecha
|
||||
dued: Fecha límite
|
||||
|
@ -536,47 +475,6 @@ invoiceOut:
|
|||
fee: Cuota
|
||||
tickets: Tickets
|
||||
totalWithVat: Importe
|
||||
globalInvoices:
|
||||
errors:
|
||||
chooseValidClient: Selecciona un cliente válido
|
||||
chooseValidCompany: Selecciona una empresa válida
|
||||
chooseValidPrinter: Selecciona una impresora válida
|
||||
chooseValidSerialType: Selecciona una tipo de serie válida
|
||||
fillDates: La fecha de la factura y la fecha máxima deben estar completas
|
||||
invoiceDateLessThanMaxDate: La fecha de la factura no puede ser menor que la fecha máxima
|
||||
invoiceWithFutureDate: Existe una factura con una fecha futura
|
||||
noTicketsToInvoice: No existen tickets para facturar
|
||||
criticalInvoiceError: Error crítico en la facturación proceso detenido
|
||||
invalidSerialTypeForAll: El tipo de serie debe ser global cuando se facturan todos los clientes
|
||||
table:
|
||||
addressId: Id dirección
|
||||
streetAddress: Dirección fiscal
|
||||
statusCard:
|
||||
percentageText: '{getPercentage}% {getAddressNumber} de {getNAddresses}'
|
||||
pdfsNumberText: '{nPdfs} de {totalPdfs} PDFs'
|
||||
negativeBases:
|
||||
clientId: Id cliente
|
||||
base: Base
|
||||
active: Activo
|
||||
hasToInvoice: Facturar
|
||||
verifiedData: Datos comprobados
|
||||
comercial: Comercial
|
||||
errors:
|
||||
downloadCsvFailed: Error al descargar CSV
|
||||
shelving:
|
||||
list:
|
||||
parking: Parking
|
||||
priority: Prioridad
|
||||
newShelving: Nuevo Carro
|
||||
summary:
|
||||
recyclable: Reciclable
|
||||
parking:
|
||||
pickingOrder: Orden de recogida
|
||||
row: Fila
|
||||
column: Columna
|
||||
searchBar:
|
||||
info: Puedes buscar por código de parking
|
||||
label: Buscar parking...
|
||||
department:
|
||||
chat: Chat
|
||||
bossDepartment: Jefe de departamento
|
||||
|
@ -588,6 +486,26 @@ department:
|
|||
hasToSendMail: Enviar fichadas por mail
|
||||
departmentRemoved: Departamento eliminado
|
||||
worker:
|
||||
pageTitles:
|
||||
workers: Trabajadores
|
||||
list: Listado
|
||||
basicData: Datos básicos
|
||||
summary: Resumen
|
||||
notifications: Notificaciones
|
||||
workerCreate: Nuevo trabajador
|
||||
department: Departamentos
|
||||
pda: PDA
|
||||
notes: Notas
|
||||
dms: Mi documentación
|
||||
pbx: Centralita
|
||||
log: Historial
|
||||
calendar: Calendario
|
||||
timeControl: Control de horario
|
||||
locker: Taquilla
|
||||
balance: Balance
|
||||
business: Contrato
|
||||
formation: Formación
|
||||
medical: Mutua
|
||||
list:
|
||||
department: Departamento
|
||||
schedule: Horario
|
||||
|
@ -612,6 +530,15 @@ worker:
|
|||
isSsDiscounted: Bonificación SS
|
||||
hasMachineryAuthorized: Autorizado para maquinaria
|
||||
isDisable: Deshabilitado
|
||||
business: Contrato
|
||||
started: Antigüedad
|
||||
ended: Fin
|
||||
reasonEnd: Motivo finalización
|
||||
department: Departamento
|
||||
workerBusinessCategory: Categoria profesional
|
||||
notes: Notas
|
||||
workCenter: Centro
|
||||
professionalCategory: Categoria profesional
|
||||
notificationsManager:
|
||||
activeNotifications: Notificaciones activas
|
||||
availableNotifications: Notificaciones disponibles
|
||||
|
@ -658,6 +585,23 @@ worker:
|
|||
debit: Debe
|
||||
credit: Haber
|
||||
concept: Concepto
|
||||
business:
|
||||
tableVisibleColumns:
|
||||
started: Fecha inicio
|
||||
ended: Fecha fin
|
||||
company: Empresa
|
||||
reasonEnd: Motivo finalización
|
||||
department: Departamento
|
||||
professionalCategory: Categoria profesional
|
||||
calendarType: Calendario laboral
|
||||
workCenter: Centro
|
||||
payrollCategories: Categoria contrato
|
||||
occupationCode: Cotización
|
||||
rate: Tarifa
|
||||
businessType: Contrato
|
||||
amount: Salario
|
||||
basicSalary: Salario transportistas
|
||||
notes: Notas
|
||||
operator:
|
||||
numberOfWagons: Número de vagones
|
||||
train: tren
|
||||
|
@ -670,7 +614,6 @@ worker:
|
|||
sizeLimit: Tamaño límite
|
||||
isOnReservationMode: Modo de reserva
|
||||
machine: Máquina
|
||||
|
||||
wagon:
|
||||
type:
|
||||
submit: Guardar
|
||||
|
@ -769,6 +712,9 @@ supplier:
|
|||
consumption:
|
||||
entry: Entrada
|
||||
travel:
|
||||
search: Buscar envío
|
||||
searchInfo: Buscar envío por id o nombre
|
||||
id: Id
|
||||
travelList:
|
||||
tableVisibleColumns:
|
||||
ref: Referencia
|
||||
|
@ -777,6 +723,7 @@ travel:
|
|||
totalEntries: ∑
|
||||
totalEntriesTooltip: Entradas totales
|
||||
daysOnward: Días de llegada en adelante
|
||||
awb: AWB
|
||||
summary:
|
||||
entryId: Id entrada
|
||||
freight: Porte
|
||||
|
@ -798,62 +745,7 @@ travel:
|
|||
destination: Destino
|
||||
thermograph: Termógrafo
|
||||
travelFileDescription: 'Id envío { travelId }'
|
||||
item:
|
||||
descriptor:
|
||||
buyer: Comprador
|
||||
color: Color
|
||||
category: Categoría
|
||||
available: Disponible
|
||||
warehouseText: 'Calculado sobre el almacén de { warehouseName }'
|
||||
itemDiary: Registro de compra-venta
|
||||
list:
|
||||
id: Identificador
|
||||
stems: Tallos
|
||||
category: Reino
|
||||
typeName: Tipo
|
||||
isActive: Activo
|
||||
weightByPiece: Peso (gramos)/tallo
|
||||
userName: Comprador
|
||||
stemMultiplier: Multiplicador
|
||||
fixedPrice:
|
||||
itemFk: ID Artículo
|
||||
groupingPrice: Precio grouping
|
||||
packingPrice: Precio packing
|
||||
hasMinPrice: Tiene precio mínimo
|
||||
minPrice: Precio min
|
||||
started: Inicio
|
||||
ended: Fin
|
||||
create:
|
||||
priority: Prioridad
|
||||
summary:
|
||||
otherData: Otros datos
|
||||
tax: IVA
|
||||
botanical: Botánico
|
||||
barcode: Código de barras
|
||||
completeName: Nombre completo
|
||||
family: Familia
|
||||
stems: Tallos
|
||||
multiplier: Multiplicador
|
||||
buyer: Comprador
|
||||
doPhoto: Hacer foto
|
||||
intrastatCode: Código intrastat
|
||||
ref: Referencia
|
||||
relevance: Relevancia
|
||||
weight: Peso (gramos)/tallo
|
||||
units: Unidades/caja
|
||||
expense: Gasto
|
||||
generic: Genérico
|
||||
recycledPlastic: Plástico reciclado
|
||||
nonRecycledPlastic: Plástico no reciclado
|
||||
minSalesQuantity: Cantidad mínima de venta
|
||||
genus: Genus
|
||||
specie: Specie
|
||||
buyRequest:
|
||||
requester: Solicitante
|
||||
requested: Solicitado
|
||||
attender: Comprador
|
||||
achieved: Conseguido
|
||||
concept: Concepto
|
||||
carrier: Transportista
|
||||
components:
|
||||
topbar: {}
|
||||
itemsFilterPanel:
|
||||
|
@ -869,7 +761,11 @@ components:
|
|||
wareHouseFk: Almacén
|
||||
# LatestBuysFilter
|
||||
salesPersonFk: Comprador
|
||||
supplierFk: Proveedor
|
||||
visible: Visible
|
||||
active: Activo
|
||||
from: Desde
|
||||
to: Hasta
|
||||
floramondo: Floramondo
|
||||
showBadDates: Ver items a futuro
|
||||
userPanel:
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
import { Dark, Quasar } from 'quasar';
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { localeEquivalence } from 'src/i18n/index';
|
||||
import quasarLang from 'src/utils/quasarLang';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
|
||||
|
@ -12,18 +14,9 @@ const userLocale = computed({
|
|||
set(value) {
|
||||
locale.value = value;
|
||||
|
||||
if (value === 'en') value = 'en-GB';
|
||||
value = localeEquivalence[value] ?? value;
|
||||
|
||||
// FIXME: Dynamic imports from absolute paths are not compatible with vite:
|
||||
// https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations
|
||||
try {
|
||||
const langList = import.meta.glob('../../node_modules/quasar/lang/*.mjs');
|
||||
langList[`../../node_modules/quasar/lang/${value}.mjs`]().then((lang) => {
|
||||
Quasar.lang.set(lang.default);
|
||||
});
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
quasarLang(value);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import { ref, computed } from 'vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import exprBuilder from './Alias/AliasExprBuilder';
|
||||
|
||||
const tableRef = ref();
|
||||
const { t } = useI18n();
|
||||
|
@ -31,15 +32,6 @@ const columns = computed(() => [
|
|||
create: true,
|
||||
},
|
||||
]);
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return /^\d+$/.test(value)
|
||||
? { id: value }
|
||||
: { alias: { like: `%${value}%` } };
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -46,7 +46,7 @@ const killSession = async ({ userId, created }) => {
|
|||
<VnPaginate
|
||||
:data-key="urlPath"
|
||||
ref="paginateRef"
|
||||
:filter="filter"
|
||||
:user-filter="filter"
|
||||
:url="urlPath"
|
||||
order="created DESC"
|
||||
auto-load
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
export default (param, value) => {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return /^\d+$/.test(value)
|
||||
? { id: value }
|
||||
: {
|
||||
or: [
|
||||
{ name: { like: `%${value}%` } },
|
||||
{ nickname: { like: `%${value}%` } },
|
||||
],
|
||||
};
|
||||
case 'name':
|
||||
case 'nickname':
|
||||
return { [param]: { like: `%${value}%` } };
|
||||
case 'roleFk':
|
||||
return { [param]: value };
|
||||
}
|
||||
};
|
|
@ -4,15 +4,16 @@ import { computed, ref } from 'vue';
|
|||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import AccountSummary from './Card/AccountSummary.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import exprBuilder from './AccountExprBuilder.js';
|
||||
import filter from './Card/AccountFilter.js';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const filter = {
|
||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||
};
|
||||
const tableRef = ref();
|
||||
|
||||
const dataKey = 'AccountList';
|
||||
const roles = ref([]);
|
||||
const columns = computed(() => [
|
||||
|
@ -117,25 +118,6 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function exprBuilder(param, value) {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return /^\d+$/.test(value)
|
||||
? { id: value }
|
||||
: {
|
||||
or: [
|
||||
{ name: { like: `%${value}%` } },
|
||||
{ nickname: { like: `%${value}%` } },
|
||||
],
|
||||
};
|
||||
case 'name':
|
||||
case 'nickname':
|
||||
return { [param]: { like: `%${value}%` } };
|
||||
case 'roleFk':
|
||||
return { [param]: value };
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData url="VnRoles" @on-fetch="(data) => (roles = data)" auto-load />
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
export default (param, value) => {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return /^\d+$/.test(value)
|
||||
? { id: value }
|
||||
: { alias: { like: `%${value}%` } };
|
||||
}
|
||||
};
|
|
@ -1,21 +1,13 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||
import AliasDescriptor from './AliasDescriptor.vue';
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnCardBeta
|
||||
data-key="Alias"
|
||||
base-url="MailAliases"
|
||||
url="MailAliases"
|
||||
:descriptor="AliasDescriptor"
|
||||
search-data-key="AccountAliasList"
|
||||
:searchbar-props="{
|
||||
url: 'MailAliases',
|
||||
info: t('mailAlias.searchInfo'),
|
||||
label: t('mailAlias.search'),
|
||||
searchUrl: 'table',
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -7,7 +7,6 @@ import { useQuasar } from 'quasar';
|
|||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
|
@ -29,9 +28,6 @@ const entityId = computed(() => {
|
|||
return $props.id || route.params.id;
|
||||
});
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => (data.value = useCardDescription(entity.alias, entity.id));
|
||||
|
||||
const removeAlias = () => {
|
||||
quasar
|
||||
.dialog({
|
||||
|
@ -56,10 +52,8 @@ const removeAlias = () => {
|
|||
ref="descriptor"
|
||||
:url="`MailAliases/${entityId}`"
|
||||
module="Alias"
|
||||
@on-fetch="setData"
|
||||
data-key="aliasData"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
data-key="Alias"
|
||||
title="alias"
|
||||
>
|
||||
<template #menu>
|
||||
<QItem v-ripple clickable @click="removeAlias()">
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -18,20 +16,15 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const { store } = useArrayData('Alias');
|
||||
const alias = ref(store.data);
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`MailAliases/${entityId}`"
|
||||
@on-fetch="(data) => (alias = data)"
|
||||
data-key="MailAliasesSummary"
|
||||
>
|
||||
<template #header> {{ alias.id }} - {{ alias.alias }} </template>
|
||||
<template #body>
|
||||
<CardSummary ref="summary" :url="`MailAliases/${entityId}`" data-key="Alias">
|
||||
<template #header="{ entity: alias }">
|
||||
{{ alias.id }} - {{ alias.alias }}
|
||||
</template>
|
||||
<template #body="{ entity: alias }">
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
<router-link
|
||||
|
|
|
@ -69,7 +69,7 @@ const fetchAliases = () => paginateRef.value.fetch();
|
|||
<VnPaginate
|
||||
ref="paginateRef"
|
||||
data-key="AliasUsers"
|
||||
:filter="filter"
|
||||
:user-filter="filter"
|
||||
:url="urlPath"
|
||||
:limit="0"
|
||||
auto-load
|
||||
|
|
|
@ -1,46 +1,20 @@
|
|||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const formModelRef = ref(null);
|
||||
|
||||
const accountFilter = {
|
||||
where: { id: route.params.id },
|
||||
fields: ['id', 'email', 'nickname', 'name', 'accountStateFk', 'packages', 'pickup'],
|
||||
include: [],
|
||||
};
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
() => formModelRef.value.reset()
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<FormModel
|
||||
ref="formModelRef"
|
||||
url="VnUsers/preview"
|
||||
:url-update="`VnUsers/${route.params.id}/update-user`"
|
||||
:filter="accountFilter"
|
||||
model="Accounts"
|
||||
auto-load
|
||||
@on-data-saved="formModelRef.fetch()"
|
||||
>
|
||||
<FormModel :url-update="`VnUsers/${$route.params.id}/update-user`" model="Account">
|
||||
<template #form="{ data }">
|
||||
<div class="q-gutter-y-sm">
|
||||
<VnInput v-model="data.name" :label="t('account.card.nickname')" />
|
||||
<VnInput v-model="data.nickname" :label="t('account.card.alias')" />
|
||||
<VnInput v-model="data.email" :label="t('globals.params.email')" />
|
||||
<VnInput v-model="data.name" :label="$t('account.card.nickname')" />
|
||||
<VnInput v-model="data.nickname" :label="$t('account.card.alias')" />
|
||||
<VnInput v-model="data.email" :label="$t('globals.params.email')" />
|
||||
<VnSelect
|
||||
url="Languages"
|
||||
v-model="data.lang"
|
||||
:label="t('account.card.lang')"
|
||||
:label="$t('account.card.lang')"
|
||||
option-value="code"
|
||||
option-label="code"
|
||||
/>
|
||||
|
@ -49,7 +23,7 @@ watch(
|
|||
table="user"
|
||||
column="twoFactor"
|
||||
v-model="data.twoFactor"
|
||||
:label="t('account.card.twoFactor')"
|
||||
:label="$t('account.card.twoFactor')"
|
||||
option-value="code"
|
||||
option-label="code"
|
||||
/>
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
<script setup>
|
||||
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||
import AccountDescriptor from './AccountDescriptor.vue';
|
||||
import filter from './AccountFilter.js';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnCardBeta data-key="AccountId" :descriptor="AccountDescriptor" />
|
||||
<VnCardBeta
|
||||
url="VnUsers/preview"
|
||||
:id-in-where="true"
|
||||
data-key="Account"
|
||||
:descriptor="AccountDescriptor"
|
||||
:filter="filter"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -1,36 +1,18 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
import filter from './AccountFilter.js';
|
||||
import useHasAccount from 'src/composables/useHasAccount.js';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
const $props = defineProps({ id: { type: Number, default: null } });
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
const data = ref(useCardDescription());
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const hasAccount = ref();
|
||||
const setData = (entity) => (data.value = useCardDescription(entity.nickname, entity.id));
|
||||
|
||||
const filter = {
|
||||
where: { id: entityId },
|
||||
fields: ['id', 'nickname', 'name', 'role'],
|
||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
hasAccount.value = await useHasAccount(entityId.value);
|
||||
|
@ -43,10 +25,8 @@ onMounted(async () => {
|
|||
:url="`VnUsers/preview`"
|
||||
:filter="filter"
|
||||
module="Account"
|
||||
@on-fetch="setData"
|
||||
data-key="AccountId"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
data-key="Account"
|
||||
title="nickname"
|
||||
>
|
||||
<template #menu>
|
||||
<AccountDescriptorMenu :entity-id="entityId" />
|
||||
|
@ -62,7 +42,7 @@ onMounted(async () => {
|
|||
<QIcon name="vn:claims" />
|
||||
</div>
|
||||
<div class="text-grey-5" style="opacity: 0.4">
|
||||
{{ t('account.imageNotFound') }}
|
||||
{{ $t('account.imageNotFound') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -70,8 +50,8 @@ onMounted(async () => {
|
|||
</VnImg>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('account.card.nickname')" :value="entity.name" />
|
||||
<VnLv :label="t('account.card.role')" :value="entity.role.name" />
|
||||
<VnLv :label="$t('account.card.nickname')" :value="entity.name" />
|
||||
<VnLv :label="$t('account.card.role')" :value="entity.role?.name" />
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
<QCardActions class="q-gutter-x-md">
|
||||
|
@ -84,7 +64,7 @@ onMounted(async () => {
|
|||
size="sm"
|
||||
class="fill-icon"
|
||||
>
|
||||
<QTooltip>{{ t('account.card.deactivated') }}</QTooltip>
|
||||
<QTooltip>{{ $t('account.card.deactivated') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
color="primary"
|
||||
|
@ -95,7 +75,7 @@ onMounted(async () => {
|
|||
size="sm"
|
||||
class="fill-icon"
|
||||
>
|
||||
<QTooltip>{{ t('account.card.enabled') }}</QTooltip>
|
||||
<QTooltip>{{ $t('account.card.enabled') }}</QTooltip>
|
||||
</QIcon>
|
||||
</QCardActions>
|
||||
</template>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue