Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7925_fix_cast_param_id
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-10-22 14:21:57 +02:00
commit 1be1efec95
355 changed files with 12114 additions and 6495 deletions

View File

@ -1,3 +1,364 @@
# Version 24.40 - 2024-10-02
### Added 🆕
- chore: refs #4074 admit several acls by:jorgep
- chore: refs #4074 drop workerCreate by:jorgep
- chore: refs #4074 fix tests by:jorgep
- chore: refs #4074 wip replace useRole for useAcl by:jorgep
- chore: refs #7155 remove console.log by:alexm
- chore: refs #7155 typo by:alexm
- chore: refs #7663 add test by:jorgep
- chore: refs #7663 create test wip by:jorgep
- chore: refs #7663 drop useless code (origin/7663-setWeight) by:jorgep
- chore: refs #7828 fix e2e by:jorgep
- feat(AccountBasicData): add twoFactorFk by:alexm
- feat: add max rule by:Javier Segarra
- feat: add shortcut add event in some subSections by:Javier Segarra
- feat: add shortcut more buttons (origin/add_shortcut_add_subSections) by:Javier Segarra
- feat: add tooltip CustomerNewCustomAgent by:Javier Segarra
- feat: apply color when today by:Javier Segarra
- feat: change label because its more natural by:Javier Segarra
- feat: change order by:Javier Segarra
- feat: change QBadge color by:Javier Segarra
- feat: change url CustomerList by:Javier Segarra
- feat: copy customer countryFk by:Javier Segarra
- feat: create VnSelectEnum and add in AccountBasicData and ClaimBasicData by:alexm
- feat: CustomerBalance by:Javier Segarra
- feat: CustomerConsumptionFilter by:Javier Segarra
- feat: customer consumption (origin/7830-customerDesplegables, 7830-customerDesplegables) by:alexm
- feat: CustomerCreateTicket by:Javier Segarra
- feat: CustomerCredit section by:Javier Segarra
- feat: CustomerGreuges by:Javier Segarra
- feat: CustomerSample to VnTable by:Javier Segarra
- feat: global handler (origin/fix_global_handler, fix_global_handler) by:alexm
- feat: goToSupplier by:Javier Segarra
- feat: handle newValue by:Javier Segarra
- feat: handle same multiple CP by:Javier Segarra
- feat: hide menus on small view (origin/hideMenu) by:jorgep
- feat: minor changes by:Javier Segarra
- feat: orderCreateDialog by:Javier Segarra
- feat: refs #4074 drop useless code by:jorgep
- feat: refs #4074 useAcl in vnSelectDialog by:jorgep
- feat: refs #6346 new wagon type section by:Jon
- feat: refs #7404 add m3 and fix detail by:pablone
- feat: refs #7404 add some style to the form and reorganize fields by:pablone
- feat: refs #7404 add travel m3 to reserves form by:pablone
- feat: refs #7404 style dynamic text color by:pablone
- feat: refs #7404 travel m3 form by:pablone
- feat: refs #7500 added VnImg to show files by:Jon
- feat: refs #7663 add setWeight menu opt (wip) by:jorgep
- feat: refs #7663 fine tunning by:jorgep
- feat: refs #7828 create axios instance which no manage errors (origin/7828-makeCorrectCalls) by:jorgep
- feat: refs #7828 useAcl & cherry pick mail data worker by:jorgep
- feat: remove cli warnings by:Javier Segarra
- feat: show preparation field by:Javier Segarra
- feat: stateGroupedFilter by:Javier Segarra
- feat: translations fixed by:jgallego
- feat(TravelList): add daysOnward by:alexm
- feat: travel m3 by:pablone
- feat: use disableInifiniteScroll property by:Javier Segarra
- feat: VnImg draggable by:Javier Segarra
- feat: vnLocation changes by:Javier Segarra
- feat: vnSelect exprBuilder by:Javier Segarra
- fix: refs #7404 remove some style by:pablone
- fix: refs #7404 style non center pop up (origin/7404-fixFront) by:pablone
- fix: refs #7404 translates and some minor style fixes by:pablone
- fix: styles by:Javier Segarra
- perf: improve style by:Javier Segarra
### Changed 📦
- perf: CustomerBalance by:Javier Segarra
- perf: CustomerBasicData by:Javier Segarra
- perf: CustomerBasicData.salesPersonFk by:Javier Segarra
- perf: CustomerSummary by:Javier Segarra
- perf: customerSummaryTable by:Javier Segarra
- perf: disable card option by:Javier Segarra
- perf: i18n by:Javier Segarra
- perf: improve by:Javier Segarra
- perf: improve style by:Javier Segarra
- perf: imrpove exprBuilder by:Javier Segarra
- perf: minor comments by:Javier Segarra
- perf: refs #6346 previous changes by:Jon
- perf: sendEmail customerConsumption by:Javier Segarra
- perf: solve reload CardSummary component by:Javier Segarra
- perf: update CustommerDescriptor by:Javier Segarra
- refactor: refs #4074 accept array by:jorgep
- refactor: refs #4074 rollback by:jorgep
- refactor: refs #4074 use acl & drop useless roles by:jorgep
- refactor: refs #4074 useAcl in navigationStore & router by:jorgep
- refactor: refs #4074 use fn (origin/4074-useAcls) by:jorgep
- refactor: refs #4074 use VnTitle by:jorgep
- refactor: refs #6346 deleted front error checking by:Jon
- refactor: refs #6346 requested changes by:Jon
- refactor: refs #6346 wagons to VnTable by:Jon
- refactor: refs #7500 deleted useless code by:Jon
- refactor: refs #7500 refactor vnimg when storage is dms by:Jon
- refactor: refs #7828 wip by:jorgep
### Fixed 🛠️
- chore: refs #4074 fix tests by:jorgep
- chore: refs #7828 fix e2e by:jorgep
- feat: refs #7404 add m3 and fix detail by:pablone
- feat: translations fixed by:jgallego
- fix: #5938 grouped filter by:Javier Segarra
- fix: #6943 fix customerSummaryTable by:Javier Segarra
- fix: #6943 show nickname salesPerson by:Javier Segarra
- fix: address-create i18n by:Javier Segarra
- fix: comments (origin/6943_fix_customer_module, 6943_fix_customer_module) by:Javier Segarra
- fix: CusomerSummary to Address by:Javier Segarra
- fix: CustomerAddress mobile by:Javier Segarra
- fix: CustomerBillingData by:Javier Segarra
- fix: Customerconsumption by:Javier Segarra
- fix: customer credit opinion by:alexm
- fix: CustomerCreditOpinion workerDescriptor by:Javier Segarra
- fix: CustomerDescriptorAccount by:Javier Segarra
- fix: CustomerDescriptor.bussinessTypeFk by:Javier Segarra
- fix: CustomerFilter by:Javier Segarra
- fix: CustomerGreuges by:Javier Segarra
- fix: CustomerMandates by:Javier Segarra
- fix: Customer module find salesPersons out of first get by:Javier Segarra
- fix: CustomerRecovery transalate label by:Javier Segarra
- fix: CustomerSamples by:Javier Segarra
- fix: customerSummaryToTicketList button by:Javier Segarra
- fix: CustomerWebPayment by:Javier Segarra
- fix: CustommerSummaryTable Proxy by:Javier Segarra
- fix: deleted code by:Jon
- fix: duplicate code by:alexm
- fix: emit:updateModelValue by:Javier Segarra
- fix: fixed wagon tests by:Jon
- fix: fix wagon list reload by:Jon
- fix: i18n en preparation label by:Javier Segarra
- fix: infiniteScroll by:Javier Segarra
- fix: isFullMovable checkbox by:Javier Segarra
- fix: merge conflicts by:Javier Segarra
- fix: merge in dev by:alexm
- fix: missing code by:Jon
- fix: Options VnSelect properties by:Javier Segarra
- fix: refs #4074 await to watch by:jorgep
- fix: refs #4074 drop wrong acl by:jorgep
- fix: refs #4074 workerCard data-key by:jorgep
- fix: refs #6346 fix list and create by:pablone
- fix: refs #6943 prevent null (origin/6943-warmfix-preventNull) by:jorgep
- fix: refs #7155 remove userParams in watcher (7155-travel_daysOnward) by:alexm
- fix: refs #7155 use chip-locale (origin/7155-travel_daysOnward_2, 7155-travel_daysOnward_2) by:alexm
- fix: refs #7404 remove console.log by:pablone
- fix: refs #7404 remove from test by:pablone
- fix: refs #7404 remove some style by:pablone
- fix: refs #7404 revert commit prevent production access by:pablone
- fix: refs #7404 style non center pop up (origin/7404-fixFront) by:pablone
- fix: refs #7404 translates and some minor style fixes by:pablone
- fix: refs #7500 fixed e2e test by:Jon
- fix: refs #7500 fixed showing images wrongly by:Jon
- fix: refs #7830 customer credit by:pablone
- fix: refs #7830 remove console.log by:pablone
- fix: remove console.log by:pablone
- fix: remove FetchData by:Javier Segarra
- fix: remove FIXME (origin/6943_fix_customerSummaryTable) by:Javier Segarra
- fix: remove print variable by:Javier Segarra
- fix: remove promise execution by:Javier Segarra
- fix: reset VnTable scroll properties by:Javier Segarra
- fix: rule by:Javier Segarra
- fix: solve conflicts from master to test by:Javier Segarra
- fix: split params (origin/warmfix-addSearchUrl) by:jorgep
- fix: state cell by:Javier Segarra
- fix: stop call back event hasMoreData by:Javier Segarra
- fix: styles by:Javier Segarra
- fix: SupplierFiscalData VnLocation (origin/fix_supplierFD_location) by:Javier Segarra
- fix: VnLocation test by:Javier Segarra
- fix(VnTable): header background-color by:alexm
- fix(VnTable): sanitizer value is defined by:carlossa
- fix: wagon reload (origin/FixWagonRedirect) by:Jon
- fix: workerDms filter workerFk by:alexm
- fix(WorkerList): add type email by:alexm
- Merge remote-tracking branch 'origin/7830-customerDesplegables' into 6943_fix_customerSummaryTable by:Javier Segarra
- refs #7155 scopeDays fix (origin/7155-scopeDays) by:carlossa
- revert: vnUSerLink change by:Javier Segarra
- test: fix test (7677_vnLocation_perf) by:Javier Segarra
# Version 24.38 - 2024-09-17
### Added 🆕
- chore: refs #6772 fix e2e (origin/6772-warmfix-fixE2e) by:jorgep
- chore: refs #7323 worker changes by:jorgep
- chore: refs #7353 fix warnings by:jorgep
- chore: refs #7353 use Vue component nomenclature by:jorgep
- chore: refs #7356 fix type by:jorgep
- feat(AccountConnections): use VnToken by:alexm
- feat: add key to routerView by:Javier Segarra
- feat: add plus shortcut in VnTable by:Javier Segarra
- feat: add row by:Javier Segarra
- feat: addRow withour dialog by:Javier Segarra
- feat: apply mixin by:Javier Segarra
- feat by:Javier Segarra
- feat: change navBar buttons by:Javier Segarra
- feat: dense rows by:Javier Segarra
- feat: fields with wrong name by:jgallego
- feat: fix bugs and filters by:Javier Segarra
- feat: fix refund parameters by:jgallego
- feat: handle create row by:Javier Segarra
- feat: handle dates by:Javier Segarra
- feat: handle qCheckbox 3rd state by:Javier Segarra
- feat: imrpove VnInputTime to set cursor at start by:Javier Segarra
- feat: keyShortcut directive by:Javier Segarra
- feat: minor fixes by:jgallego
- feat: only filter by isDestiny by:Javier Segarra
- feat: refs #211153 businessDataLinkGrafana by:robert
- feat: refs #7129 add km start and end on create form by:pablone
- feat: refs #7353 add filter & fix customTags by:jorgep
- feat: refs #7353 add locale by:jorgep
- feat: refs #7353 add no one opt by:jorgep
- feat: refs #7353 add right icons by:jorgep
- feat: refs #7353 imporve toDateFormat by:jorgep
- feat: refs #7353 salesPerson nickname & id by:jorgep
- feat: refs #7353 split sections by:jorgep
- feat: refs #7847 remove reload btn by:jorgep
- feat: refs #7847 remove reload fn by:jorgep
- feat: refs #7889 added shortcuts to modules by:Jon
- feat: refs #7911 added shortcut to modules by:Jon
- feat: refuncInvoiceForm component by:jgallego
- feat: remove duplicity by:Javier Segarra
- feat: remove future itemFixedPrices by:Javier Segarra
- feat: replace stickyButtons by subtoolbar by:Javier Segarra
- feat: required validation by:Javier Segarra
- feat: show bad dates by:Javier Segarra
- feat: showdate icons by:Javier Segarra
- feat: solve ItemFixedFilterPanel by:Javier Segarra
- feat: transfer an invoice by:jgallego
- feat: try to fix ItemFixedFilterPanel by:Javier Segarra
- feat: unnecessary changes by:Javier Segarra
- feat: update changelog (origin/7896_down_devToTest_2436) by:Javier Segarra
- feat: updates by:Javier Segarra
- feat: update version and changelog by:Javier Segarra
- feat: vnInput\* by:Javier Segarra
- feat: with VnTable by:Javier Segarra
- refs #6772 feat: fix approach by:Javier Segarra
- refs #6772 feat: refresh shelving.basic-data by:Javier Segarra
- style: show subName value by:Javier Segarra
### Changed 📦
- perf: add v-shortcut in VnCard by:Javier Segarra
- perf: approach by:Javier Segarra
- perf: change directive location by:Javier Segarra
- perf: change slots order by:Javier Segarra
- perf: examples by:Javier Segarra
- perf: hide icon for VnInputDate by:Javier Segarra
- perf: improve ItemFixedPricefilterPanel by:Javier Segarra
- perf: improve mainShrotcutMixin by:Javier Segarra
- perf: minor clean code by:Javier Segarra
- perf: onRowchange by:Javier Segarra
- perf: order by by:Javier Segarra
- perf: order components by:Javier Segarra
- perf: refs #7889 perf shortcut test by:Jon
- perf: remove console.log by:Javier Segarra
- perf: remove icons in header slot by:Javier Segarra
- perf: remove print variables by:Javier Segarra
- perf: restore CustomerBasicData by:Javier Segarra
- refactor: deleted useless prop by:Jon
- refactor: deleted useless prop in FetchedTags by:Jon
- refactor: refs #7323 drop useless code by:jorgep
- refactor: refs #7353 clients correction by:jorgep
- refactor: refs #7353 clients correction wip by:jorgep
- refactor: refs #7353 ease logic by:jorgep
- refactor: refs #7353 order correction by:jorgep
- refactor: refs #7353 simplify code by:jorgep
- refactor: refs #7353 tickets correction by:jorgep
- refactor: refs #7353 use global locales by:jorgep
- refactor: refs #7354 changed descriptor menu options by:Jon
- refactor: refs #7354 changed icon color in table and notification when deleting a zone by:Jon
- refactor: refs #7354 fix tableFilters by:Jon
- refactor: refs #7354 modified VnInputTime by:Jon
- refactor: refs #7354 refactor deliveryPanel by:Jon
- refactor: refs #7354 refactor zones section and fixed e2e tests by:Jon
- refactor: refs #7354 requested changes by:Jon
- refactor: refs #7354 reverse deliveryPanel changes by:Jon
- refactor: refs #7354 Zone migration changes by:Jon
- refactor: refs #7889 deleted subtitle attr and use keyBinding instead by:Jon
- refactor: refs #7889 modified shortcut and dashboard, and added tootlip in LeftMenu by:Jon
- refs #6722 perf: not fetch when id not exists by:Javier Segarra
- refs #6772 perf: change variable name by:JAVIER SEGARRA MARTINEZ
- refs #6772 perf: use ArrayData (6772_reload_sections) by:Javier Segarra
- refs #7283 refactor fix ItemDescriptor by:carlossa
- refs #7283 refactor ItexDescriptor by:carlossa
### Fixed 🛠️
- chore: refs #6772 fix e2e (origin/6772-warmfix-fixE2e) by:jorgep
- chore: refs #7353 fix warnings by:jorgep
- chore: refs #7356 fix type by:jorgep
- feat: fix bugs and filters by:Javier Segarra
- feat: fix refund parameters by:jgallego
- feat: minor fixes by:jgallego
- feat: refs #7353 add filter & fix customTags by:jorgep
- feat: try to fix ItemFixedFilterPanel by:Javier Segarra
- fix: add border-top by:Javier Segarra
- fix: added missing descriptors and small details by:Jon
- fix branch by:carlossa
- fix: call upsert when crudModel haschanges by:Javier Segarra
- fix(ClaimList): fix summary by:alexm
- fix: cli warnings by:Javier Segarra
- fix: editTableOptions by:Javier Segarra
- fix events and descriptor menu by:Jon
- fix: InvoiceIn sections (origin/6772_reload_sections) by:Javier Segarra
- fix: minor changes by:Javier Segarra
- fix: minor error whit dates by:Javier Segarra
- fix: module icon by:Javier Segarra
- fix: options QDate by:Javier Segarra
- fix: refs #6900 e2e error by:jorgep
- fix: refs #6900 rollback by:jorgep
- fix: refs #7353 css by:jorgep
- fix: refs #7353 hide search param (origin/7353-warmfix-fixSearchbar) by:jorgep
- fix: refs #7353 iron out filter by:jorgep
- fix: refs #7353 iron out ticket table by:jorgep
- fix: refs #7353 padding by:jorgep
- fix: refs #7353 salesClientTable by:jorgep
- fix: refs #7353 salesorderTable by:jorgep
- fix: refs #7353 saleTicketMonitors by:jorgep
- fix: refs #7353 use same datakey by:jorgep
- fix: refs #7353 vnTable colors by:jorgep
- fix: refs #7354 e2e tests by:Jon
- fix: refs #7354 fix delivery days by:Jon
- fix: refs #7354 fix list searchbar and filters by:Jon
- fix: refs #7354 fix VnSearchbar search for zone section & finished basic tests by:Jon
- fix: refs #7354 fix VnTable filters and agency field by:Jon
- fix: refs #7354 fix zoneSearchbar by:Jon
- fix: refs #7354 requested changes by:Jon
- fix: refs #7356 colors by:jorgep
- fix: refs #7356 create claim dialog by:jorgep
- fix: refs #7889 fixed shortcut test by:Jon
- fix: refs #7903 fixed ticket's search bar and keybinding tooltip by:Jon
- fix: refs #7911 fixed shortcut and related files by:Jon
- fix: remove condition duplicated by:Javier Segarra
- fix: remove property by:Javier Segarra
- fix tootltip by:carlossa
- fix traduction by:carlossa
- fix(VnSectionMain): add QPage by:alexm
- fix(zone): zoneLocation and the others searchbar by:alexm
- refactor: refs #7354 fix tableFilters by:Jon
- refactor: refs #7354 refactor zones section and fixed e2e tests by:Jon
- refs #6772 feat: fix approach by:Javier Segarra
- refs #6772 fix: claimPhoto reload by:Javier Segarra
- refs #6896 fix searchbar by:carlossa
- refs #6897 fix entry by:carlossa
- refs #6899 fix invoiceFix by:carlossa
- refs #6899 fix order by:carlossa
- refs #7283 fix by:carlossa
- refs #7283 fix ItemDescriptor warehouse by:carlossa
- refs #7283 refactor fix ItemDescriptor by:carlossa
- refs #7355 #7366 fix account, summary, list, travelList, tooltip by:carlossa
- refs #7355 fix accountPrivileges by:carlossa
- refs #7355 fix accounts, vnTable by:carlossa
- refs #7355 fix privileges by:carlossa
- refs #7355 fix roles filters by:carlossa
- refs #7355 fix total by:carlossa
- refs #7355 fix views summarys, entryList, travelList refact by:carlossa
- refs #7366 fix travel hours by:carlossa
- test: fix e2e by:Javier Segarra
# Version 24.36 - 2024-08-27 # Version 24.36 - 2024-08-27
### Added 🆕 ### Added 🆕

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "24.36.0", "version": "24.44.0",
"description": "Salix frontend", "description": "Salix frontend",
"productName": "Salix", "productName": "Salix",
"author": "Verdnatura", "author": "Verdnatura",

View File

@ -2,18 +2,22 @@ import axios from 'axios';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { Router } from 'src/router'; import { Router } from 'src/router';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
const session = useSession(); const session = useSession();
const { notify } = useNotify(); const { notify } = useNotify();
const stateQuery = useStateQueryStore();
const baseUrl = '/api/';
axios.defaults.baseURL = '/api/'; axios.defaults.baseURL = baseUrl;
const axiosNoError = axios.create({ baseURL: baseUrl });
const onRequest = (config) => { const onRequest = (config) => {
const token = session.getToken(); const token = session.getToken();
if (token.length && !config.headers.Authorization) { if (token.length && !config.headers.Authorization) {
config.headers.Authorization = token; config.headers.Authorization = token;
} }
stateQuery.add(config);
return config; return config;
}; };
@ -22,10 +26,10 @@ const onRequestError = (error) => {
}; };
const onResponse = (response) => { const onResponse = (response) => {
const { method } = response.config; const config = response.config;
stateQuery.remove(config);
const isSaveRequest = method === 'patch'; if (config.method === 'patch') {
if (isSaveRequest) {
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
} }
@ -33,6 +37,8 @@ const onResponse = (response) => {
}; };
const onResponseError = (error) => { const onResponseError = (error) => {
stateQuery.remove(error.config);
let message = ''; let message = '';
const response = error.response; const response = error.response;
@ -79,5 +85,7 @@ const onResponseError = (error) => {
axios.interceptors.request.use(onRequest, onRequestError); axios.interceptors.request.use(onRequest, onRequestError);
axios.interceptors.response.use(onResponse, onResponseError); axios.interceptors.response.use(onResponse, onResponseError);
axiosNoError.interceptors.request.use(onRequest);
axiosNoError.interceptors.response.use(onResponse);
export { onRequest, onResponseError }; export { onRequest, onResponseError, axiosNoError };

View File

@ -0,0 +1,4 @@
import { QInput } from 'quasar';
import setDefault from './setDefault';
setDefault(QInput, 'dense', true);

View File

@ -0,0 +1,4 @@
import { QSelect } from 'quasar';
import setDefault from './setDefault';
setDefault(QSelect, 'dense', true);

34
src/boot/keyShortcut.js Normal file
View File

@ -0,0 +1,34 @@
export default {
mounted: function (el, binding) {
const shortcut = binding.value ?? '+';
const { key, ctrl, alt, callback } =
typeof shortcut === 'string'
? {
key: shortcut,
ctrl: true,
alt: true,
callback: () =>
document
.querySelector(`button[shortcut="${shortcut}"]`)
?.click(),
}
: binding.value;
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) {
if (el._handleKeydown) {
window.removeEventListener('keydown', el._handleKeydown);
}
},
};

View File

@ -9,16 +9,16 @@ export default {
const keyBindingMap = routes const keyBindingMap = routes
.filter((route) => route.meta.keyBinding) .filter((route) => route.meta.keyBinding)
.reduce((map, route) => { .reduce((map, route) => {
map[route.meta.keyBinding.toLowerCase()] = route.path; map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
return map; return map;
}, {}); }, {});
const handleKeyDown = (event) => { const handleKeyDown = (event) => {
const { ctrlKey, altKey, key } = event; const { ctrlKey, altKey, code } = event;
if (ctrlKey && altKey && keyBindingMap[key] && !isNotified) { if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
event.preventDefault(); event.preventDefault();
router.push(keyBindingMap[key]); router.push(keyBindingMap[code]);
isNotified = true; isNotified = true;
} }
}; };

View File

@ -1 +1,3 @@
export * from './defaults/qTable'; export * from './defaults/qTable';
export * from './defaults/qInput';
export * from './defaults/qSelect';

View File

@ -1,8 +1,16 @@
import { boot } from 'quasar/wrappers'; import { boot } from 'quasar/wrappers';
import qFormMixin from './qformMixin'; import qFormMixin from './qformMixin';
import mainShortcutMixin from './mainShortcutMixin'; import mainShortcutMixin from './mainShortcutMixin';
import keyShortcut from './keyShortcut';
import useNotify from 'src/composables/useNotify.js';
const { notify } = useNotify();
export default boot(({ app }) => { export default boot(({ app }) => {
app.mixin(qFormMixin); app.mixin(qFormMixin);
app.mixin(mainShortcutMixin); app.mixin(mainShortcutMixin);
app.directive('shortcut', keyShortcut);
app.config.errorHandler = function (err) {
console.error(err);
notify('globals.error', 'negative', 'error');
};
}); });

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { reactive, ref, onMounted, nextTick } from 'vue'; import { reactive, ref, onMounted, nextTick, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
@ -7,16 +7,21 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FormModelPopup from './FormModelPopup.vue'; import FormModelPopup from './FormModelPopup.vue';
import { useState } from 'src/composables/useState';
defineProps({ showEntityField: { type: Boolean, default: true } }); defineProps({ showEntityField: { type: Boolean, default: true } });
const emit = defineEmits(['onDataSaved']); const emit = defineEmits(['onDataSaved']);
const { t } = useI18n(); const { t } = useI18n();
const bicInputRef = ref(null); const bicInputRef = ref(null);
const state = useState();
const customer = computed(() => state.get('customer'));
const bankEntityFormData = reactive({ const bankEntityFormData = reactive({
name: null, name: null,
bic: null, bic: null,
countryFk: null, countryFk: customer.value?.countryFk,
id: null, id: null,
}); });
@ -26,8 +31,8 @@ const countriesFilter = {
const countriesOptions = ref([]); const countriesOptions = ref([]);
const onDataSaved = (formData, requestResponse) => { const onDataSaved = (...args) => {
emit('onDataSaved', formData, requestResponse); emit('onDataSaved', ...args);
}; };
onMounted(async () => { onMounted(async () => {

View File

@ -1,35 +1,42 @@
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelectProvince from 'components/VnSelectProvince.vue'; import VnSelectProvince from 'components/VnSelectProvince.vue';
import VnInput from 'components/common/VnInput.vue'; import VnInput from 'components/common/VnInput.vue';
import FormModelPopup from './FormModelPopup.vue'; import FormModelPopup from './FormModelPopup.vue';
const emit = defineEmits(['onDataSaved']); const emit = defineEmits(['onDataSaved']);
const $props = defineProps({
countryFk: {
type: Number,
default: null,
},
provinceSelected: {
type: Number,
default: null,
},
provinces: {
type: Array,
default: () => [],
},
});
const { t } = useI18n(); const { t } = useI18n();
const cityFormData = reactive({ const cityFormData = ref({
name: null, name: null,
provinceFk: null, provinceFk: null,
}); });
onMounted(() => {
const provincesOptions = ref([]); cityFormData.value.provinceFk = $props.provinceSelected;
});
const onDataSaved = (...args) => { const onDataSaved = (...args) => {
emit('onDataSaved', ...args); emit('onDataSaved', ...args);
}; };
</script> </script>
<template> <template>
<FetchData
@on-fetch="(data) => (provincesOptions = data)"
auto-load
url="Provinces"
/>
<FormModelPopup <FormModelPopup
:title="t('New city')" :title="t('New city')"
:subtitle="t('Please, ensure you put the correct data!')" :subtitle="t('Please, ensure you put the correct data!')"
@ -41,11 +48,16 @@ const onDataSaved = (...args) => {
<template #form-inputs="{ data, validate }"> <template #form-inputs="{ data, validate }">
<VnRow> <VnRow>
<VnInput <VnInput
:label="t('Name')" :label="t('Names')"
v-model="data.name" v-model="data.name"
:rules="validate('city.name')" :rules="validate('city.name')"
/> />
<VnSelectProvince v-model="data.provinceFk" /> <VnSelectProvince
:province-selected="$props.provinceSelected"
:country-fk="$props.countryFk"
v-model="data.provinceFk"
:provinces="$props.provinces"
/>
</VnRow> </VnRow>
</template> </template>
</FormModelPopup> </FormModelPopup>

View File

@ -0,0 +1,50 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FormModelPopup from './FormModelPopup.vue';
const emit = defineEmits(['onDataSaved']);
const { t } = useI18n();
</script>
<template>
<FormModelPopup
url-create="Expenses"
model="Expense"
:title="t('New expense')"
:form-initial-data="{ id: null, isWithheld: false, name: null }"
@on-data-saved="emit('onDataSaved', $event)"
>
<template #form-inputs="{ data, validate }">
<VnRow>
<VnInput
:label="`${t('globals.code')}`"
v-model="data.id"
:required="true"
:rules="validate('expense.code')"
/>
<QCheckbox
dense
size="sm"
:label="`${t('It\'s a withholding')}`"
v-model="data.isWithheld"
:rules="validate('expense.isWithheld')"
/>
</VnRow>
<VnRow>
<VnInput
:label="`${t('globals.description')}`"
v-model="data.name"
:required="true"
:rules="validate('expense.description')"
/>
</VnRow>
</template>
</FormModelPopup>
</template>
<i18n>
es:
New expense: Nuevo gasto
It's a withholding: Es una retención
</i18n>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { reactive, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
@ -22,9 +22,11 @@ const postcodeFormData = reactive({
townFk: null, townFk: null,
}); });
const townsFetchDataRef = ref(null);
const provincesFetchDataRef = ref(null); const provincesFetchDataRef = ref(null);
const countriesOptions = ref([]); const countriesOptions = ref([]);
const provincesOptions = ref([]); const provincesOptions = ref([]);
const townsOptions = ref([]);
const town = ref({}); const town = ref({});
function onDataSaved(formData) { function onDataSaved(formData) {
@ -61,23 +63,94 @@ function setTown(newTown, data) {
} }
async function setProvince(id, data) { async function setProvince(id, data) {
await provincesFetchDataRef.value.fetch();
const newProvince = provincesOptions.value.find((province) => province.id == id); const newProvince = provincesOptions.value.find((province) => province.id == id);
if (!newProvince) return; if (!newProvince) return;
data.countryFk = newProvince.countryFk; data.countryFk = newProvince.countryFk;
} }
async function onProvinceCreated(data) {
await provincesFetchDataRef.value.fetch({
where: { countryFk: postcodeFormData.countryFk },
});
postcodeFormData.provinceFk.value = data.id;
}
watch(
() => [postcodeFormData.countryFk],
async (newCountryFk, oldValueFk) => {
if (Array.isArray(newCountryFk)) {
newCountryFk = newCountryFk[0];
}
if (Array.isArray(oldValueFk)) {
oldValueFk = oldValueFk[0];
}
if (!!oldValueFk && newCountryFk !== oldValueFk) {
postcodeFormData.provinceFk = null;
postcodeFormData.townFk = null;
}
if (oldValueFk !== newCountryFk) {
await provincesFetchDataRef.value.fetch({
where: {
countryFk: newCountryFk,
},
});
await townsFetchDataRef.value.fetch({
where: {
provinceFk: {
inq: provincesOptions.value.map(({ id }) => id),
},
},
});
}
}
);
watch(
() => postcodeFormData.provinceFk,
async (newProvinceFk) => {
if (Array.isArray(newProvinceFk)) {
newProvinceFk = newProvinceFk[0];
}
if (newProvinceFk !== postcodeFormData.provinceFk) {
await townsFetchDataRef.value.fetch({
where: { provinceFk: newProvinceFk },
});
}
}
);
async function handleProvinces(data) {
provincesOptions.value = data;
}
async function handleTowns(data) {
townsOptions.value = data;
}
async function handleCountries(data) {
countriesOptions.value = data;
}
</script> </script>
<template> <template>
<FetchData <FetchData
ref="provincesFetchDataRef" ref="provincesFetchDataRef"
@on-fetch="(data) => (provincesOptions = data)" @on-fetch="handleProvinces"
:sort-by="['name ASC']"
:limit="30"
auto-load auto-load
url="Provinces/location" url="Provinces/location"
/> />
<FetchData <FetchData
@on-fetch="(data) => (countriesOptions = data)" ref="townsFetchDataRef"
:sort-by="['name ASC']"
:limit="30"
@on-fetch="handleTowns"
auto-load
url="Towns/location"
/>
<FetchData
@on-fetch="handleCountries"
:sort-by="['name ASC']"
:limit="30"
auto-load auto-load
url="Countries" url="Countries"
/> />
@ -96,18 +169,20 @@ async function setProvince(id, data) {
:label="t('Postcode')" :label="t('Postcode')"
v-model="data.code" v-model="data.code"
:rules="validate('postcode.code')" :rules="validate('postcode.code')"
clearable
/> />
<VnSelectDialog <VnSelectDialog
:label="t('City')" :label="t('City')"
url="Towns/location"
@update:model-value="(value) => setTown(value, data)" @update:model-value="(value) => setTown(value, data)"
:tooltip="t('Create city')"
v-model="data.townFk" v-model="data.townFk"
:options="townsOptions"
option-label="name" option-label="name"
option-value="id" option-value="id"
:rules="validate('postcode.city')" :rules="validate('postcode.city')"
:roles-allowed-to-create="['deliveryAssistant']" :acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
:emit-value="false" :emit-value="false"
clearable :clearable="true"
> >
<template #option="{ itemProps, opt }"> <template #option="{ itemProps, opt }">
<QItem v-bind="itemProps"> <QItem v-bind="itemProps">
@ -122,6 +197,9 @@ async function setProvince(id, data) {
</template> </template>
<template #form> <template #form>
<CreateNewCityForm <CreateNewCityForm
:country-fk="data.countryFk"
:province-selected="data.provinceFk"
:provinces="provincesOptions"
@on-data-saved=" @on-data-saved="
(_, requestResponse) => (_, requestResponse) =>
onCityCreated(requestResponse, data) onCityCreated(requestResponse, data)
@ -132,8 +210,13 @@ async function setProvince(id, data) {
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnSelectProvince <VnSelectProvince
:country-fk="data.countryFk"
:province-selected="data.provinceFk"
@update:model-value="(value) => setProvince(value, data)" @update:model-value="(value) => setProvince(value, data)"
v-model="data.provinceFk" v-model="data.provinceFk"
:clearable="true"
:provinces="provincesOptions"
@on-province-created="onProvinceCreated"
/> />
<VnSelect <VnSelect
:label="t('Country')" :label="t('Country')"
@ -152,6 +235,7 @@ async function setProvince(id, data) {
<i18n> <i18n>
es: es:
New postcode: Nuevo código postal New postcode: Nuevo código postal
Create city: Crear población
Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos! Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos!
City: Población City: Población
Province: Provincia Province: Provincia

View File

@ -16,7 +16,16 @@ const provinceFormData = reactive({
name: null, name: null,
autonomyFk: null, autonomyFk: null,
}); });
const $props = defineProps({
countryFk: {
type: Number,
default: null,
},
provinces: {
type: Array,
default: () => [],
},
});
const autonomiesOptions = ref([]); const autonomiesOptions = ref([]);
const onDataSaved = (dataSaved, requestResponse) => { const onDataSaved = (dataSaved, requestResponse) => {
@ -31,7 +40,14 @@ const onDataSaved = (dataSaved, requestResponse) => {
<FetchData <FetchData
@on-fetch="(data) => (autonomiesOptions = data)" @on-fetch="(data) => (autonomiesOptions = data)"
auto-load auto-load
:filter="{
where: {
countryFk: $props.countryFk,
},
}"
url="Autonomies/location" url="Autonomies/location"
:sort-by="['name ASC']"
:limit="30"
/> />
<FormModelPopup <FormModelPopup
:title="t('New province')" :title="t('New province')"

View File

@ -50,7 +50,7 @@ const onDataSaved = (dataSaved) => {
model="thermograph" model="thermograph"
:title="t('New thermograph')" :title="t('New thermograph')"
:form-initial-data="thermographFormData" :form-initial-data="thermographFormData"
@on-data-saved="onDataSaved($event)" @on-data-saved="(_, response) => onDataSaved(response)"
> >
<template #form-inputs="{ data, validate }"> <template #form-inputs="{ data, validate }">
<VnRow> <VnRow>

View File

@ -189,11 +189,11 @@ async function saveChanges(data) {
}); });
} }
async function insert() { async function insert(pushData = $props.dataRequired) {
const $index = formData.value.length const $index = formData.value.length
? formData.value[formData.value.length - 1].$index + 1 ? formData.value[formData.value.length - 1].$index + 1
: 0; : 0;
formData.value.push(Object.assign({ $index }, $props.dataRequired)); formData.value.push(Object.assign({ $index }, pushData));
hasChanges.value = true; hasChanges.value = true;
} }
@ -234,6 +234,8 @@ async function remove(data) {
newData = newData.filter((form) => !ids.some((id) => id == form[pk])); newData = newData.filter((form) => !ids.some((id) => id == form[pk]));
fetch(newData); fetch(newData);
}); });
} else {
reset();
} }
emit('update:selected', []); emit('update:selected', []);
} }

View File

@ -44,7 +44,7 @@ onMounted(async () => {
async function fetch(fetchFilter = {}) { async function fetch(fetchFilter = {}) {
try { try {
const filter = Object.assign(fetchFilter, $props.filter); // eslint-disable-line vue/no-dupe-keys const filter = { ...fetchFilter, ...$props.filter }; // eslint-disable-line vue/no-dupe-keys
if ($props.where && !fetchFilter.where) filter.where = $props.where; if ($props.where && !fetchFilter.where) filter.where = $props.where;
if ($props.sortBy) filter.order = $props.sortBy; if ($props.sortBy) filter.order = $props.sortBy;
if ($props.limit) filter.limit = $props.limit; if ($props.limit) filter.limit = $props.limit;

View File

@ -159,8 +159,8 @@ const removeTag = (index, params, search) => {
/> />
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:expr-builder="exprBuilder" :expr-builder="props.exprBuilder"
:custom-tags="customTags" :custom-tags="props.customTags"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<strong v-if="tag.label === 'categoryFk'"> <strong v-if="tag.label === 'categoryFk'">
@ -297,11 +297,12 @@ const removeTag = (index, params, search) => {
/> />
</QItem> </QItem>
<QItem class="q-mt-lg"> <QItem class="q-mt-lg">
<QIcon <QBtn
name="add_circle" icon="add_circle"
shortcut="+"
flat
class="fill-icon-on-hover q-px-xs" class="fill-icon-on-hover q-px-xs"
color="primary" color="primary"
size="sm"
@click="tagValues.push({})" @click="tagValues.push({})"
/> />
</QItem> </QItem>

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { onMounted, ref, reactive } from 'vue'; import { onMounted, watch, ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QSeparator, useQuasar } from 'quasar'; import { QSeparator, useQuasar } from 'quasar';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -29,6 +29,15 @@ onMounted(async () => {
getRoutes(); getRoutes();
}); });
watch(
() => route.matched,
() => {
items.value = [];
getRoutes();
},
{ deep: true }
);
function findMatches(search, item) { function findMatches(search, item) {
const matches = []; const matches = [];
function findRoute(search, item) { function findRoute(search, item) {

View File

@ -33,13 +33,17 @@ const itemComputed = computed(() => {
<QItemSection avatar v-if="!itemComputed.icon"> <QItemSection avatar v-if="!itemComputed.icon">
<QIcon name="disabled_by_default" /> <QIcon name="disabled_by_default" />
</QItemSection> </QItemSection>
<QItemSection>{{ t(itemComputed.title) }}</QItemSection> <QItemSection>
{{ t(itemComputed.title) }}
<QTooltip v-if="item.keyBinding">
{{ 'Ctrl + Alt + ' + item?.keyBinding?.toUpperCase() }}
</QTooltip>
</QItemSection>
<QItemSection side> <QItemSection side>
<slot name="side" :item="itemComputed" /> <slot name="side" :item="itemComputed" />
</QItemSection> </QItemSection>
</QItem> </QItem>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.q-item { .q-item {
min-height: 5vh; min-height: 5vh;

View File

@ -3,6 +3,7 @@ import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import PinnedModules from './PinnedModules.vue'; import PinnedModules from './PinnedModules.vue';
import UserPanel from 'components/UserPanel.vue'; import UserPanel from 'components/UserPanel.vue';
@ -12,6 +13,7 @@ import VnAvatar from './ui/VnAvatar.vue';
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
const quasar = useQuasar(); const quasar = useQuasar();
const stateQuery = useStateQueryStore();
const state = useState(); const state = useState();
const user = state.getUser(); const user = state.getUser();
const appName = 'Lilium'; const appName = 'Lilium';
@ -24,7 +26,13 @@ const pinnedModulesRef = ref();
<template> <template>
<QHeader color="white" elevated> <QHeader color="white" elevated>
<QToolbar class="q-py-sm q-px-md"> <QToolbar class="q-py-sm q-px-md">
<QBtn @click="stateStore.toggleLeftDrawer()" icon="menu" round dense flat> <QBtn
@click="stateStore.toggleLeftDrawer()"
icon="dock_to_right"
round
dense
flat
>
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }} {{ t('globals.collapseMenu') }}
</QTooltip> </QTooltip>
@ -44,6 +52,14 @@ const pinnedModulesRef = ref();
</QBtn> </QBtn>
</RouterLink> </RouterLink>
<VnBreadcrumbs v-if="$q.screen.gt.sm" /> <VnBreadcrumbs v-if="$q.screen.gt.sm" />
<QSpinner
color="primary"
class="q-ml-md"
:class="{
'no-visible': !stateQuery.isLoading().value,
}"
size="xs"
/>
<QSpace /> <QSpace />
<div id="searchbar" class="searchbar"></div> <div id="searchbar" class="searchbar"></div>
<QSpace /> <QSpace />

View File

@ -0,0 +1,174 @@
<script setup>
import { ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { useDialogPluginComponent } from 'quasar';
import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
import VnSelect from 'components/common/VnSelect.vue';
import FormPopup from './FormPopup.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
const $props = defineProps({
invoiceOutData: {
type: Object,
default: () => {},
},
});
const { dialogRef } = useDialogPluginComponent();
const { t } = useI18n();
const router = useRouter();
const { notify } = useNotify();
const rectificativeTypeOptions = ref([]);
const siiTypeInvoiceOutsOptions = ref([]);
const invoiceParams = reactive({
id: $props.invoiceOutData?.id,
inheritWarehouse: true,
});
const invoiceCorrectionTypesOptions = ref([]);
const refund = async () => {
const params = {
id: invoiceParams.id,
withWarehouse: invoiceParams.inheritWarehouse,
cplusRectificationTypeFk: invoiceParams.cplusRectificationTypeFk,
siiTypeInvoiceOutFk: invoiceParams.siiTypeInvoiceOutFk,
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
};
try {
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
notify(t('Refunded invoice'), 'positive');
const [id] = data?.refundId || [];
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
} catch (err) {
console.error('Error refunding invoice', err);
}
};
</script>
<template>
<FetchData
url="CplusRectificationTypes"
:filter="{ order: 'description' }"
@on-fetch="
(data) => (
(rectificativeTypeOptions = data),
(invoiceParams.cplusRectificationTypeFk = data.filter(
(type) => type.description == 'I Por diferencias'
)[0].id)
)
"
auto-load
/>
<FetchData
url="SiiTypeInvoiceOuts"
:filter="{ where: { code: { like: 'R%' } } }"
@on-fetch="
(data) => (
(siiTypeInvoiceOutsOptions = data),
(invoiceParams.siiTypeInvoiceOutFk = data.filter(
(type) => type.code == 'R4'
)[0].id)
)
"
auto-load
/>
<FetchData
url="InvoiceCorrectionTypes"
@on-fetch="(data) => (invoiceCorrectionTypesOptions = data)"
auto-load
/>
<QDialog ref="dialogRef">
<FormPopup
@on-submit="refund()"
:custom-submit-button-label="t('Accept')"
:default-cancel-button="false"
>
<template #form-inputs>
<VnRow>
<VnSelect
:label="t('Rectificative type')"
:options="rectificativeTypeOptions"
hide-selected
option-label="description"
option-value="id"
v-model="invoiceParams.cplusRectificationTypeFk"
:required="true"
/>
</VnRow>
<VnRow>
<VnSelect
:label="t('Class')"
:options="siiTypeInvoiceOutsOptions"
hide-selected
option-label="description"
option-value="id"
v-model="invoiceParams.siiTypeInvoiceOutFk"
:required="true"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt?.code }} -
{{ scope.opt?.description }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</VnRow>
<VnRow>
<VnSelect
:label="t('Type')"
:options="invoiceCorrectionTypesOptions"
hide-selected
option-label="description"
option-value="id"
v-model="invoiceParams.invoiceCorrectionTypeFk"
:required="true"
/> </VnRow
><VnRow>
<div>
<QCheckbox
:label="t('Inherit warehouse')"
v-model="invoiceParams.inheritWarehouse"
/>
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
<QTooltip>{{ t('Inherit warehouse tooltip') }}</QTooltip>
</QIcon>
</div>
</VnRow>
</template>
</FormPopup>
</QDialog>
</template>
<i18n>
en:
Refund invoice: Refund invoice
Rectificative type: Rectificative type
Class: Class
Type: Type
Refunded invoice: Refunded invoice
Inherit warehouse: Inherit the warehouse
Inherit warehouse tooltip: Select this option to inherit the warehouse when refunding the invoice
Accept: Accept
Error refunding invoice: Error refunding invoice
es:
Refund invoice: Abonar factura
Rectificative type: Tipo rectificativa
Class: Clase
Type: Tipo
Refunded invoice: Factura abonada
Inherit warehouse: Heredar el almacén
Inherit warehouse tooltip: Seleccione esta opción para heredar el almacén al abonar la factura.
Accept: Aceptar
Error refunding invoice: Error abonando factura
</i18n>

View File

@ -2,13 +2,12 @@
import { ref, reactive } from 'vue'; import { ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useQuasar } from 'quasar'; import { useQuasar, useDialogPluginComponent } from 'quasar';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
import FormPopup from './FormPopup.vue'; import FormPopup from './FormPopup.vue';
import { useDialogPluginComponent } from 'quasar';
import axios from 'axios'; import axios from 'axios';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
@ -18,19 +17,19 @@ const $props = defineProps({
default: () => {}, default: () => {},
}, },
}); });
const { dialogRef } = useDialogPluginComponent(); const { dialogRef } = useDialogPluginComponent();
const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const router = useRouter(); const router = useRouter();
const { notify } = useNotify(); const { notify } = useNotify();
const checked = ref(true);
const transferInvoiceParams = reactive({
id: $props.invoiceOutData?.id,
refFk: $props.invoiceOutData?.ref,
});
const rectificativeTypeOptions = ref([]); const rectificativeTypeOptions = ref([]);
const siiTypeInvoiceOutsOptions = ref([]); const siiTypeInvoiceOutsOptions = ref([]);
const checked = ref(true);
const transferInvoiceParams = reactive({
id: $props.invoiceOutData?.id,
});
const invoiceCorrectionTypesOptions = ref([]); const invoiceCorrectionTypesOptions = ref([]);
const selectedClient = (client) => { const selectedClient = (client) => {
@ -44,10 +43,9 @@ const makeInvoice = async () => {
const params = { const params = {
id: transferInvoiceParams.id, id: transferInvoiceParams.id,
cplusRectificationTypeFk: transferInvoiceParams.cplusRectificationTypeFk, cplusRectificationTypeFk: transferInvoiceParams.cplusRectificationTypeFk,
siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk,
invoiceCorrectionTypeFk: transferInvoiceParams.invoiceCorrectionTypeFk, invoiceCorrectionTypeFk: transferInvoiceParams.invoiceCorrectionTypeFk,
newClientFk: transferInvoiceParams.newClientFk, newClientFk: transferInvoiceParams.newClientFk,
refFk: transferInvoiceParams.refFk,
siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk,
makeInvoice: checked.value, makeInvoice: checked.value,
}; };
@ -74,7 +72,7 @@ const makeInvoice = async () => {
} }
} }
const { data } = await axios.post('InvoiceOuts/transferInvoice', params); const { data } = await axios.post('InvoiceOuts/transfer', params);
notify(t('Transferred invoice'), 'positive'); notify(t('Transferred invoice'), 'positive');
const id = data?.[0]; const id = data?.[0];
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } }); if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });

View File

@ -13,12 +13,14 @@ import FetchData from 'components/FetchData.vue';
import { useClipboard } from 'src/composables/useClipboard'; import { useClipboard } from 'src/composables/useClipboard';
import { useRole } from 'src/composables/useRole'; import { useRole } from 'src/composables/useRole';
import VnAvatar from './ui/VnAvatar.vue'; import VnAvatar from './ui/VnAvatar.vue';
import useNotify from 'src/composables/useNotify';
const state = useState(); const state = useState();
const session = useSession(); const session = useSession();
const router = useRouter(); const router = useRouter();
const { t, locale } = useI18n(); const { t, locale } = useI18n();
const { copyText } = useClipboard(); const { copyText } = useClipboard();
const { notify } = useNotify();
const userLocale = computed({ const userLocale = computed({
get() { get() {
@ -53,6 +55,7 @@ const user = state.getUser();
const warehousesData = ref(); const warehousesData = ref();
const companiesData = ref(); const companiesData = ref();
const accountBankData = ref(); const accountBankData = ref();
const isEmployee = computed(() => useRole().isEmployee());
onMounted(async () => { onMounted(async () => {
updatePreferences(); updatePreferences();
@ -70,18 +73,28 @@ function updatePreferences() {
async function saveDarkMode(value) { async function saveDarkMode(value) {
const query = `/UserConfigs/${user.value.id}`; const query = `/UserConfigs/${user.value.id}`;
await axios.patch(query, { try {
darkMode: value, await axios.patch(query, {
}); darkMode: value,
user.value.darkMode = value; });
user.value.darkMode = value;
onDataSaved();
} catch (error) {
onDataError();
}
} }
async function saveLanguage(value) { async function saveLanguage(value) {
const query = `/VnUsers/${user.value.id}`; const query = `/VnUsers/${user.value.id}`;
await axios.patch(query, { try {
lang: value, await axios.patch(query, {
}); lang: value,
user.value.lang = value; });
user.value.lang = value;
onDataSaved();
} catch (error) {
onDataError();
}
} }
function logout() { function logout() {
@ -97,11 +110,23 @@ function localUserData() {
state.setUser(user.value); state.setUser(user.value);
} }
function saveUserData(param, value) { async function saveUserData(param, value) {
axios.post('UserConfigs/setUserConfig', { [param]: value }); try {
localUserData(); await axios.post('UserConfigs/setUserConfig', { [param]: value });
localUserData();
onDataSaved();
} catch (error) {
onDataError();
}
} }
const isEmployee = computed(() => useRole().isEmployee());
const onDataSaved = () => {
notify('globals.dataSaved', 'positive');
};
const onDataError = () => {
notify('errors.updateUserConfig', 'negative');
};
</script> </script>
<template> <template>

View File

@ -8,37 +8,59 @@ import FetchData from 'components/FetchData.vue';
import CreateNewProvinceForm from './CreateNewProvinceForm.vue'; import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
const emit = defineEmits(['onProvinceCreated']); const emit = defineEmits(['onProvinceCreated']);
const provinceFk = defineModel({ type: Number }); const $props = defineProps({
watch(provinceFk, async () => await provincesFetchDataRef.value.fetch()); countryFk: {
type: Number,
default: null,
},
provinceSelected: {
type: Number,
default: null,
},
provinces: {
type: Array,
default: () => [],
},
});
const provinceFk = defineModel({ type: Number, default: null });
const { validate } = useValidator(); const { validate } = useValidator();
const { t } = useI18n(); const { t } = useI18n();
const provincesOptions = ref(); const provincesOptions = ref($props.provinces);
provinceFk.value = $props.provinceSelected;
const provincesFetchDataRef = ref(); const provincesFetchDataRef = ref();
async function onProvinceCreated(_, data) { async function onProvinceCreated(_, data) {
await provincesFetchDataRef.value.fetch(); await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
provinceFk.value = data.id; provinceFk.value = data.id;
emit('onProvinceCreated', data); emit('onProvinceCreated', data);
} }
async function handleProvinces(data) {
provincesOptions.value = data;
}
</script> </script>
<template> <template>
<FetchData <FetchData
ref="provincesFetchDataRef" ref="provincesFetchDataRef"
:filter="{ include: { relation: 'country' } }" :filter="{
@on-fetch="(data) => (provincesOptions = data)" include: { relation: 'country' },
auto-load where: {
countryFk: $props.countryFk,
},
}"
@on-fetch="handleProvinces"
url="Provinces" url="Provinces"
/> />
<VnSelectDialog <VnSelectDialog
:label="t('Province')" :label="t('Province')"
:options="provincesOptions" :options="$props.provinces"
:tooltip="t('Create province')"
hide-selected hide-selected
v-model="provinceFk" v-model="provinceFk"
:rules="validate && validate('postcode.provinceFk')" :rules="validate && validate('postcode.provinceFk')"
:roles-allowed-to-create="['deliveryAssistant']" :acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
> >
<template #option="{ itemProps, opt }"> <template #option="{ itemProps, opt }">
<QItem v-bind="itemProps"> <QItem v-bind="itemProps">
@ -49,11 +71,15 @@ async function onProvinceCreated(_, data) {
</QItem> </QItem>
</template> </template>
<template #form> <template #form>
<CreateNewProvinceForm @on-data-saved="onProvinceCreated" /> <CreateNewProvinceForm
:country-fk="$props.countryFk"
@on-data-saved="onProvinceCreated"
/>
</template> </template>
</VnSelectDialog> </VnSelectDialog>
</template> </template>
<i18n> <i18n>
es: es:
Province: Provincia Province: Provincia
Create province: Crear provincia
</i18n> </i18n>

View File

@ -10,8 +10,6 @@ import VnInputDate from 'components/common/VnInputDate.vue';
import VnInputTime from 'components/common/VnInputTime.vue'; import VnInputTime from 'components/common/VnInputTime.vue';
import VnTableColumn from 'components/VnTable/VnColumn.vue'; import VnTableColumn from 'components/VnTable/VnColumn.vue';
defineExpose({ addFilter });
const $props = defineProps({ const $props = defineProps({
column: { column: {
type: Object, type: Object,
@ -30,11 +28,14 @@ const $props = defineProps({
default: 'params', default: 'params',
}, },
}); });
defineExpose({ addFilter, props: $props });
const model = defineModel(undefined, { required: true }); const model = defineModel(undefined, { required: true });
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl }); const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
const columnFilter = computed(() => $props.column?.columnFilter); const columnFilter = computed(() => $props.column?.columnFilter);
const updateEvent = { 'update:modelValue': addFilter, remove: () => addFilter(null) }; const updateEvent = { 'update:modelValue': addFilter };
const enterEvent = { const enterEvent = {
'keyup.enter': () => addFilter(model.value), 'keyup.enter': () => addFilter(model.value),
remove: () => addFilter(null), remove: () => addFilter(null),
@ -115,11 +116,11 @@ const components = {
rawSelect: selectComponent, rawSelect: selectComponent,
}; };
async function addFilter(value) { async function addFilter(value, name) {
value ??= undefined; value ??= undefined;
if (value && typeof value === 'object') value = model.value; if (value && typeof value === 'object') value = model.value;
value = value === '' ? undefined : value; value = value === '' ? undefined : value;
let field = columnFilter.value?.name ?? $props.column.name; let field = columnFilter.value?.name ?? $props.column.name ?? name;
if (columnFilter.value?.inWhere) { if (columnFilter.value?.inWhere) {
if (columnFilter.value.alias) field = columnFilter.value.alias + '.' + field; if (columnFilter.value.alias) field = columnFilter.value.alias + '.' + field;

View File

@ -4,7 +4,7 @@ import { useArrayData } from 'composables/useArrayData';
const model = defineModel({ type: Object }); const model = defineModel({ type: Object });
const $props = defineProps({ const $props = defineProps({
name: { name: {
type: String, type: [String, Boolean],
default: '', default: '',
}, },
label: { label: {

View File

@ -10,7 +10,7 @@ import FormModelPopup from 'components/FormModelPopup.vue';
import VnFilterPanel from 'components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
import VnTableColumn from 'components/VnTable/VnColumn.vue'; import VnTableColumn from 'components/VnTable/VnColumn.vue';
import VnTableFilter from 'components/VnTable/VnFilter.vue'; import VnFilter from 'components/VnTable/VnFilter.vue';
import VnTableChip from 'components/VnTable/VnChip.vue'; import VnTableChip from 'components/VnTable/VnChip.vue';
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue'; import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
@ -49,6 +49,14 @@ const $props = defineProps({
type: Object, type: Object,
default: null, default: null,
}, },
createAsDialog: {
type: Boolean,
default: true,
},
bottom: {
type: Object,
default: null,
},
cardClass: { cardClass: {
type: String, type: String,
default: 'flex-one', default: 'flex-one',
@ -67,7 +75,7 @@ const $props = defineProps({
}, },
hasSubToolbar: { hasSubToolbar: {
type: Boolean, type: Boolean,
default: true, default: null,
}, },
disableOption: { disableOption: {
type: Object, type: Object,
@ -85,10 +93,26 @@ const $props = defineProps({
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
crudModel: {
type: Object,
default: () => ({}),
},
tableHeight: { tableHeight: {
type: String, type: String,
default: '90vh', default: '90vh',
}, },
chipLocale: {
type: String,
default: null,
},
footer: {
type: Boolean,
default: false,
},
disabledAttr: {
type: Boolean,
default: false,
},
}); });
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -109,6 +133,8 @@ const showForm = ref(false);
const splittedColumns = ref({ columns: [] }); const splittedColumns = ref({ columns: [] });
const columnsVisibilitySkipped = ref(); const columnsVisibilitySkipped = ref();
const createForm = ref(); const createForm = ref();
const tableFilterRef = ref([]);
const tableRef = ref();
const tableModes = [ const tableModes = [
{ {
@ -134,7 +160,7 @@ onMounted(() => {
quasar.platform.is.mobile && !$props.disableOption?.card quasar.platform.is.mobile && !$props.disableOption?.card
? CARD_MODE ? CARD_MODE
: $props.defaultMode; : $props.defaultMode;
stateStore.rightDrawer = true; stateStore.rightDrawer = quasar.screen.gt.xs;
columnsVisibilitySkipped.value = [ columnsVisibilitySkipped.value = [
...splittedColumns.value.columns ...splittedColumns.value.columns
.filter((c) => c.visible == false) .filter((c) => c.visible == false)
@ -184,7 +210,7 @@ function setUserParams(watchedParams, watchedOrder) {
function sanitizer(params) { function sanitizer(params) {
for (const [key, value] of Object.entries(params)) { for (const [key, value] of Object.entries(params)) {
if (typeof value == 'object') { if (value && typeof value == 'object') {
const param = Object.values(value)[0]; const param = Object.values(value)[0];
if (typeof param == 'string') params[key] = param.replaceAll('%', ''); if (typeof param == 'string') params[key] = param.replaceAll('%', '');
} }
@ -211,7 +237,7 @@ function splitColumns(columns) {
if (col.cardVisible) splittedColumns.value.cardVisible.push(col); if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
if ($props.isEditable && col.disable == null) col.disable = false; if ($props.isEditable && col.disable == null) col.disable = false;
if ($props.useModel && col.columnFilter != false) if ($props.useModel && col.columnFilter != false)
col.columnFilter = { ...col.columnFilter, inWhere: true }; col.columnFilter = { inWhere: true, ...col.columnFilter };
splittedColumns.value.columns.push(col); splittedColumns.value.columns.push(col);
} }
// Status column // Status column
@ -284,10 +310,25 @@ function parseOrder(urlOrders) {
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
defineExpose({ defineExpose({
create: createForm,
reload, reload,
redirect: redirectFn, redirect: redirectFn,
selected, selected,
CrudModelRef,
params,
}); });
function handleOnDataSaved(_) {
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
else $props.create.onDataSaved(_);
}
function handleScroll() {
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
}
</script> </script>
<template> <template>
<QDrawer <QDrawer
@ -305,6 +346,13 @@ defineExpose({
:search-url="searchUrl" :search-url="searchUrl"
:redirect="!!redirect" :redirect="!!redirect"
@set-user-params="setUserParams" @set-user-params="setUserParams"
:disable-submit-event="true"
@remove="
(key) =>
tableFilterRef
.find((f) => f.props?.column.name == key)
?.addFilter()
"
> >
<template #body> <template #body>
<div <div
@ -314,7 +362,8 @@ defineExpose({
)" )"
:key="col.id" :key="col.id"
> >
<VnTableFilter <VnFilter
ref="tableFilterRef"
:column="col" :column="col"
:data-key="$attrs['data-key']" :data-key="$attrs['data-key']"
v-model="params[columnName(col)]" v-model="params[columnName(col)]"
@ -338,21 +387,25 @@ defineExpose({
:columns="splittedColumns.columns" :columns="splittedColumns.columns"
/> />
</template> </template>
<template #tags="{ tag, formatFn }" v-if="chipLocale">
<div class="q-gutter-x-xs">
<strong>{{ t(`${chipLocale}.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
</VnFilterPanel> </VnFilterPanel>
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<!-- class in div to fix warn-->
<CrudModel <CrudModel
v-bind="$attrs" v-bind="$attrs"
:class="$attrs['class'] ?? 'q-px-md'" :class="$attrs['class'] ?? 'q-px-md'"
:limit="20" :limit="$attrs['limit'] ?? 20"
ref="CrudModelRef" ref="CrudModelRef"
@on-fetch="(...args) => emit('onFetch', ...args)" @on-fetch="(...args) => emit('onFetch', ...args)"
:search-url="searchUrl" :search-url="searchUrl"
:disable-infinite-scroll="isTableMode" :disable-infinite-scroll="isTableMode"
@save-changes="reload" @save-changes="reload"
:has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable" :has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
:auto-load="hasParams || $attrs['auto-load']" :auto-load="hasParams || $attrs['auto-load']"
> >
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName"> <template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
@ -360,6 +413,7 @@ defineExpose({
</template> </template>
<template #body="{ rows }"> <template #body="{ rows }">
<QTable <QTable
ref="tableRef"
v-bind="table" v-bind="table"
class="vnTable" class="vnTable"
:columns="splittedColumns.columns" :columns="splittedColumns.columns"
@ -370,12 +424,8 @@ defineExpose({
card-container-class="grid-three" card-container-class="grid-three"
flat flat
:style="isTableMode && `max-height: ${tableHeight}`" :style="isTableMode && `max-height: ${tableHeight}`"
virtual-scroll :virtual-scroll="isTableMode"
@virtual-scroll=" @virtual-scroll="handleScroll"
(event) =>
event.index > rows.length - 2 &&
CrudModelRef.vnPaginateRef.paginate()
"
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)" @row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
@update:selected="emit('update:selected', $event)" @update:selected="emit('update:selected', $event)"
> >
@ -399,7 +449,7 @@ defineExpose({
<QBtn <QBtn
v-if="$props.rightSearch" v-if="$props.rightSearch"
icon="filter_alt" icon="filter_alt"
class="bg-vn-section-color q-ml-md" class="bg-vn-section-color q-ml-sm"
dense dense
@click="stateStore.toggleRightDrawer()" @click="stateStore.toggleRightDrawer()"
/> />
@ -421,7 +471,7 @@ defineExpose({
:search-url="searchUrl" :search-url="searchUrl"
/> />
</div> </div>
<VnTableFilter <VnFilter
v-if="$props.columnSearch" v-if="$props.columnSearch"
:column="col" :column="col"
:show-title="true" :show-title="true"
@ -451,6 +501,7 @@ defineExpose({
auto-width auto-width
class="no-margin q-px-xs" class="no-margin q-px-xs"
:class="[getColAlign(col), col.columnClass]" :class="[getColAlign(col), col.columnClass]"
:style="col.style"
v-if="col.visible ?? true" v-if="col.visible ?? true"
@click.ctrl=" @click.ctrl="
($event) => ($event) =>
@ -479,14 +530,17 @@ defineExpose({
:class="getColAlign(col)" :class="getColAlign(col)"
class="sticky no-padding" class="sticky no-padding"
@click="stopEventPropagation($event)" @click="stopEventPropagation($event)"
:style="col.style"
> >
<QBtn <QBtn
v-for="(btn, index) of col.actions" v-for="(btn, index) of col.actions"
v-show="btn.show ? btn.show(row) : true"
:key="index" :key="index"
:title="btn.title" :title="btn.title"
:icon="btn.icon" :icon="btn.icon"
class="q-px-sm" class="q-pa-xs"
flat flat
dense
:class=" :class="
btn.isPrimary ? 'text-primary-light' : 'color-vn-text ' btn.isPrimary ? 'text-primary-light' : 'color-vn-text '
" "
@ -497,6 +551,29 @@ defineExpose({
/> />
</QTd> </QTd>
</template> </template>
<template #bottom v-if="bottom">
<slot name="bottom-table">
<QBtn
@click="
() =>
createAsDialog
? (showForm = !showForm)
: handleOnDataSaved(create)
"
class="cursor-pointer fill-icon"
color="primary"
icon="add_circle"
size="md"
round
flat
shortcut="+"
:disabled="!disabledAttr"
/>
<QTooltip>
{{ createForm.title }}
</QTooltip>
</slot>
</template>
<template #item="{ row, colsMap }"> <template #item="{ row, colsMap }">
<component <component
:is="$props.redirect ? 'router-link' : 'span'" :is="$props.redirect ? 'router-link' : 'span'"
@ -613,13 +690,34 @@ defineExpose({
</QCard> </QCard>
</component> </component>
</template> </template>
<template #bottom-row="{ cols }" v-if="$props.footer">
<QTr v-if="rows.length" style="height: 30px">
<QTh
v-for="col of cols.filter((cols) => cols.visible ?? true)"
:key="col?.id"
class="text-center"
:class="getColAlign(col)"
>
<slot :name="`column-footer-${col.name}`" />
</QTh>
</QTr>
</template>
</QTable> </QTable>
</template> </template>
</CrudModel> </CrudModel>
<QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2"> <QPageSticky v-if="$props.create" :offset="[20, 20]" style="z-index: 2">
<QBtn @click="showForm = !showForm" color="primary" fab icon="add" /> <QBtn
<QTooltip> @click="
{{ createForm.title }} () =>
createAsDialog ? (showForm = !showForm) : handleOnDataSaved(create)
"
color="primary"
fab
icon="add"
shortcut="+"
/>
<QTooltip self="top right">
{{ createForm?.title }}
</QTooltip> </QTooltip>
</QPageSticky> </QPageSticky>
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale"> <QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
@ -671,7 +769,7 @@ es:
} }
.bg-header { .bg-header {
background-color: var(--vn-header-color); background-color: var(--vn-accent-color);
color: var(--vn-text-color); color: var(--vn-text-color);
} }
@ -679,18 +777,6 @@ es:
color: var(--vn-text-color); color: var(--vn-text-color);
} }
.q-table--dark .q-table__bottom,
.q-table--dark thead,
.q-table--dark tr,
.q-table--dark th,
.q-table--dark td {
border-color: var(--vn-section-color);
}
.q-table__container > div:first-child {
background-color: var(--vn-page-color);
}
.grid-three { .grid-three {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, max-content)); grid-template-columns: repeat(auto-fit, minmax(400px, max-content));
@ -719,10 +805,16 @@ es:
} }
} }
.q-table th { .q-table {
padding: 0; th {
} padding: 0;
}
&__top {
padding: 12px 0px;
top: 0;
}
}
.vnTable { .vnTable {
thead tr th { thead tr th {
position: sticky; position: sticky;
@ -733,6 +825,7 @@ es:
} }
.q-table__top { .q-table__top {
top: 0; top: 0;
padding: 12px 0;
} }
tbody { tbody {
.q-checkbox { .q-checkbox {
@ -757,6 +850,15 @@ es:
background-color: var(--vn-section-color); background-color: var(--vn-section-color);
z-index: 1; z-index: 1;
} }
table tbody th {
position: relative;
}
tbody:nth-last-child(1) {
@extend .bg-header;
position: sticky;
z-index: 2;
bottom: 0;
}
} }
.vn-label-value { .vn-label-value {
@ -802,4 +904,12 @@ es:
cursor: text; cursor: text;
user-select: all; user-select: all;
} }
.q-table__container {
background-color: transparent;
}
.q-table__middle.q-virtual-scroll.q-virtual-scroll--vertical.scroll {
background-color: var(--vn-section-color);
}
</style> </style>

View File

@ -135,7 +135,7 @@ onMounted(async () => {
}); });
</script> </script>
<template> <template>
<QBtn icon="vn:visible_columns" class="bg-vn-section-color q-mr-md q-px-sm" dense> <QBtn icon="vn:visible_columns" class="bg-vn-section-color q-mr-sm q-px-sm" dense>
<QPopupProxy ref="popupProxyRef"> <QPopupProxy ref="popupProxyRef">
<QCard class="column q-pa-md"> <QCard class="column q-pa-md">
<QIcon name="info" size="sm" class="info-icon"> <QIcon name="info" size="sm" class="info-icon">

View File

@ -37,7 +37,7 @@ const stateStore = useStateStore();
@click="stateStore.toggleRightDrawer()" @click="stateStore.toggleRightDrawer()"
round round
dense dense
icon="menu" icon="dock_to_left"
> >
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }} {{ t('globals.collapseMenu') }}

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { onBeforeMount, computed } from 'vue'; import { onBeforeMount, computed } from 'vue';
import { useRoute, onBeforeRouteUpdate } from 'vue-router'; import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import useCardSize from 'src/composables/useCardSize'; import useCardSize from 'src/composables/useCardSize';
@ -17,12 +17,16 @@ const props = defineProps({
filterPanel: { type: Object, default: undefined }, filterPanel: { type: Object, default: undefined },
searchDataKey: { type: String, default: undefined }, searchDataKey: { type: String, default: undefined },
searchbarProps: { type: Object, default: undefined }, searchbarProps: { type: Object, default: undefined },
redirectOnError: { type: Boolean, default: false },
}); });
const stateStore = useStateStore(); const stateStore = useStateStore();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const url = computed(() => { const url = computed(() => {
if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`; if (props.baseUrl) {
return `${props.baseUrl}/${route.params.id}`;
}
return props.customUrl; return props.customUrl;
}); });
const searchRightDataKey = computed(() => { const searchRightDataKey = computed(() => {
@ -35,8 +39,14 @@ const arrayData = useArrayData(props.dataKey, {
}); });
onBeforeMount(async () => { onBeforeMount(async () => {
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id }; try {
await arrayData.fetch({ append: false, updateRouter: false }); if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
await arrayData.fetch({ append: false, updateRouter: false });
} catch {
const { matched: matches } = router.currentRoute.value;
const { path } = matches.at(-1);
router.push({ path: path.replace(/:id.*/, '') });
}
}); });
if (props.baseUrl) { if (props.baseUrl) {
@ -73,7 +83,7 @@ if (props.baseUrl) {
<QPage> <QPage>
<VnSubToolbar /> <VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]"> <div :class="[useCardSize(), $attrs.class]">
<RouterView :key="route.fullPath" /> <RouterView :key="route.path" />
</div> </div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -0,0 +1,136 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnRow from '../ui/VnRow.vue';
import VnInput from './VnInput.vue';
import FetchData from '../FetchData.vue';
import useNotify from 'src/composables/useNotify';
const props = defineProps({
submitFn: { type: Function, default: () => {} },
askOldPass: { type: Boolean, default: false },
});
const emit = defineEmits(['onSubmit']);
const { t } = useI18n();
const { notify } = useNotify();
const form = ref();
const changePassDialog = ref();
const passwords = ref({ newPassword: null, repeatPassword: null });
const requirements = ref([]);
const isLoading = ref(false);
const validate = async () => {
const { newPassword, repeatPassword, oldPassword } = passwords.value;
if (!newPassword) {
notify(t('You must enter a new password'), 'negative');
return;
}
if (newPassword !== repeatPassword) {
notify(t("Passwords don't match"), 'negative');
return;
}
try {
isLoading.value = true;
await props.submitFn(newPassword, oldPassword);
emit('onSubmit');
} catch (e) {
notify('errors.writeRequest', 'negative');
} finally {
changePassDialog.value.hide();
isLoading.value = false;
}
};
defineExpose({ show: () => changePassDialog.value.show() });
</script>
<template>
<FetchData
url="UserPasswords/findOne"
auto-load
@on-fetch="(data) => (requirements = data)"
/>
<QDialog ref="changePassDialog">
<QCard style="width: 350px">
<QCardSection>
<slot name="header">
<VnRow class="items-center" style="flex-direction: row">
<span class="text-h6" v-text="t('globals.changePass')" />
<QIcon
class="cursor-pointer"
name="close"
size="xs"
style="flex: 0"
v-close-popup
/>
</VnRow>
</slot>
</QCardSection>
<QForm ref="form">
<QCardSection>
<VnInput
v-if="props.askOldPass"
:label="t('Old password')"
v-model="passwords.oldPassword"
type="password"
:required="true"
autofocus
/>
<VnInput
:label="t('New password')"
v-model="passwords.newPassword"
type="password"
:required="true"
:info="
t('passwordRequirements', {
length: requirements.length,
nAlpha: requirements.nAlpha,
nUpper: requirements.nUpper,
nDigits: requirements.nDigits,
nPunct: requirements.nPunct,
})
"
autofocus
/>
<VnInput
:label="t('Repeat password')"
v-model="passwords.repeatPassword"
type="password"
/>
</QCardSection>
</QForm>
<QCardActions>
<slot name="actions">
<QBtn
:disabled="isLoading"
:loading="isLoading"
:label="t('globals.cancel')"
class="q-ml-sm"
color="primary"
flat
type="reset"
v-close-popup
/>
<QBtn
:disabled="isLoading"
:loading="isLoading"
:label="t('globals.confirm')"
color="primary"
@click="validate"
/>
</slot>
</QCardActions>
</QCard>
</QDialog>
</template>
<i18n>
es:
New password: Nueva contraseña
Repeat password: Repetir contraseña
You must enter a new password: Debes introducir la nueva contraseña
Passwords don't match: Las contraseñas no coinciden
</i18n>

View File

@ -17,17 +17,15 @@ const $props = defineProps({
}, },
}); });
let mixed;
const componentArray = computed(() => { const componentArray = computed(() => {
if (typeof $props.prop === 'object') return [$props.prop]; if (typeof $props.prop === 'object') return [$props.prop];
return $props.prop; return $props.prop;
}); });
function mix(toComponent) { function mix(toComponent) {
if (mixed) return mixed;
const { component, attrs, event } = toComponent; const { component, attrs, event } = toComponent;
const customComponent = $props.components[component]; const customComponent = $props.components[component];
mixed = { return {
component: customComponent?.component ?? component, component: customComponent?.component ?? component,
attrs: { attrs: {
...toValueAttrs(attrs), ...toValueAttrs(attrs),
@ -37,7 +35,6 @@ function mix(toComponent) {
}, },
event: { ...customComponent?.event, ...event }, event: { ...customComponent?.event, ...event },
}; };
return mixed;
} }
function toValueAttrs(attrs) { function toValueAttrs(attrs) {

View File

@ -0,0 +1,29 @@
<script setup>
const model = defineModel({ type: [String, Number], required: true });
</script>
<template>
<QDate v-model="model" :today-btn="true" :options="$attrs.options" />
</template>
<style lang="scss" scoped>
.q-date {
width: 245px;
min-width: unset;
:deep(.q-date__calendar) {
padding-bottom: 0;
}
:deep(.q-date__view) {
min-height: 245px;
padding: 8px;
}
:deep(.q-date__calendar-days-container) {
min-height: 160px;
height: unset;
}
:deep(.q-date__header) {
padding: 2px 2px 5px 12px;
height: 60px;
}
}
</style>

View File

@ -5,12 +5,14 @@ import { useRoute } from 'vue-router';
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar'; import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
import axios from 'axios'; import axios from 'axios';
import VnUserLink from '../ui/VnUserLink.vue';
import { downloadFile } from 'src/composables/downloadFile';
import VnImg from 'components/ui/VnImg.vue';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import VnDms from 'src/components/common/VnDms.vue'; import VnDms from 'src/components/common/VnDms.vue';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnUserLink from '../ui/VnUserLink.vue'; import { useSession } from 'src/composables/useSession';
import { downloadFile } from 'src/composables/downloadFile';
const route = useRoute(); const route = useRoute();
const quasar = useQuasar(); const quasar = useQuasar();
@ -18,6 +20,7 @@ const { t } = useI18n();
const rows = ref(); const rows = ref();
const dmsRef = ref(); const dmsRef = ref();
const formDialog = ref({}); const formDialog = ref({});
const token = useSession().getTokenMultimedia();
const $props = defineProps({ const $props = defineProps({
model: { model: {
@ -89,6 +92,23 @@ const dmsFilter = {
}; };
const columns = computed(() => [ const columns = computed(() => [
{
label: '',
name: 'file',
align: 'left',
component: VnImg,
props: (prop) => {
return {
storage: 'dms',
collection: null,
resolution: null,
id: prop.row.file.split('.')[0],
token: token,
class: 'rounded',
ratio: 1,
};
},
},
{ {
align: 'left', align: 'left',
field: 'id', field: 'id',
@ -135,19 +155,13 @@ const columns = computed(() => [
field: 'hasFile', field: 'hasFile',
label: t('globals.original'), label: t('globals.original'),
name: 'hasFile', name: 'hasFile',
toolTip: t('The documentation is available in paper form'),
component: QCheckbox, component: QCheckbox,
props: (prop) => ({ props: (prop) => ({
disable: true, disable: true,
'model-value': Boolean(prop.value), 'model-value': Boolean(prop.value),
}), }),
}, },
{
align: 'left',
field: 'file',
label: t('globals.file'),
name: 'file',
component: 'span',
},
{ {
align: 'left', align: 'left',
field: 'worker', field: 'worker',
@ -297,6 +311,14 @@ defineExpose({
row-key="clientFk" row-key="clientFk"
:grid="$q.screen.lt.sm" :grid="$q.screen.lt.sm"
> >
<template #header="props">
<QTr :props="props" class="bg">
<QTh v-for="col in props.cols" :key="col.name" :props="props">
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip
>{{ col.label }}
</QTh>
</QTr>
</template>
<template #body-cell="props"> <template #body-cell="props">
<QTd :props="props"> <QTd :props="props">
<QTr :props="props"> <QTr :props="props">
@ -378,7 +400,14 @@ defineExpose({
/> />
</QDialog> </QDialog>
<QPageSticky position="bottom-right" :offset="[25, 25]"> <QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn fab color="primary" icon="add" @click="showFormDialog()" class="fill-icon"> <QBtn
fab
color="primary"
icon="add"
shortcut="+"
@click="showFormDialog()"
class="fill-icon"
>
<QTooltip> <QTooltip>
{{ t('Upload file') }} {{ t('Upload file') }}
</QTooltip> </QTooltip>
@ -386,10 +415,6 @@ defineExpose({
</QPageSticky> </QPageSticky>
</template> </template>
<style scoped> <style scoped>
.q-gutter-y-ms {
display: grid;
row-gap: 20px;
}
.labelColor { .labelColor {
color: var(--vn-label-color); color: var(--vn-label-color);
} }
@ -397,8 +422,10 @@ defineExpose({
<i18n> <i18n>
en: en:
contentTypesInfo: Allowed file types {allowedContentTypes} contentTypesInfo: Allowed file types {allowedContentTypes}
The documentation is available in paper form: The documentation is available in paper form
es: es:
contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes} contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes}
Generate identifier for original file: Generar identificador para archivo original Generate identifier for original file: Generar identificador para archivo original
Upload file: Subir fichero Upload file: Subir fichero
the documentation is available in paper form: Se tiene la documentación en papel
</i18n> </i18n>

View File

@ -67,9 +67,13 @@ const mixinRules = [
requiredFieldRule, requiredFieldRule,
...($attrs.rules ?? []), ...($attrs.rules ?? []),
(val) => { (val) => {
const { min } = vnInputRef.value.$attrs; const { min, max } = vnInputRef.value.$attrs;
if (!min) return null; if (!min) return null;
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min }); if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
if (!max) return null;
if (max > 0) {
if (Math.floor(val) > max) return t('inputMax', { value: max });
}
}, },
]; ];
</script> </script>
@ -92,7 +96,6 @@ const mixinRules = [
<slot name="prepend" /> <slot name="prepend" />
</template> </template>
<template #append> <template #append>
<slot name="append" v-if="$slots.append && !$attrs.disabled" />
<QIcon <QIcon
name="close" name="close"
size="xs" size="xs"
@ -100,10 +103,12 @@ const mixinRules = [
@click=" @click="
() => { () => {
value = null; value = null;
vnInputRef.focus();
emit('remove'); emit('remove');
} }
" "
></QIcon> ></QIcon>
<slot name="append" v-if="$slots.append && !$attrs.disabled" />
<QIcon v-if="info" name="info"> <QIcon v-if="info" name="info">
<QTooltip max-width="350px"> <QTooltip max-width="350px">
{{ info }} {{ info }}
@ -116,6 +121,13 @@ const mixinRules = [
<i18n> <i18n>
en: en:
inputMin: Must be more than {value} inputMin: Must be more than {value}
inputMax: Must be less than {value}
es: es:
inputMin: Debe ser mayor a {value} inputMin: Debe ser mayor a {value}
inputMax: Debe ser menor a {value}
</i18n> </i18n>
<style lang="scss">
.q-field__append {
padding-inline: 0;
}
</style>

View File

@ -2,6 +2,8 @@
import { onMounted, watch, computed, ref } from 'vue'; import { onMounted, watch, computed, ref } from 'vue';
import { date } from 'quasar'; import { date } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useAttrs } from 'vue';
import VnDate from './VnDate.vue';
const model = defineModel({ type: [String, Date] }); const model = defineModel({ type: [String, Date] });
const $props = defineProps({ const $props = defineProps({
@ -9,30 +11,25 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
showEvent: {
type: Boolean,
default: true,
},
}); });
import { useValidator } from 'src/composables/useValidator';
const { validations } = useValidator();
const { t } = useI18n(); const { t } = useI18n();
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired'); const requiredFieldRule = (val) => validations().required($attrs.required, val);
const vnInputDateRef = ref(null);
const dateFormat = 'DD/MM/YYYY'; const dateFormat = 'DD/MM/YYYY';
const isPopupOpen = ref(); const isPopupOpen = ref();
const hover = ref(); const hover = ref();
const mask = ref(); const mask = ref();
const $attrs = useAttrs();
onMounted(() => { const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
// fix quasar bug
mask.value = '##/##/####';
});
const styleAttrs = computed(() => {
return $props.isOutlined
? {
dense: true,
outlined: true,
rounded: true,
}
: {};
});
const formattedDate = computed({ const formattedDate = computed({
get() { get() {
@ -44,15 +41,12 @@ const formattedDate = computed({
let newDate; let newDate;
if (value) { if (value) {
// parse input // parse input
if (value.includes('/')) { if (value.includes('/') && value.length >= 10) {
if (value.length == 6) value = value + new Date().getFullYear(); if (value.at(2) == '/') value = value.split('/').reverse().join('/');
if (value.length >= 10) { value = date.formatDate(
if (value.at(2) == '/') value = value.split('/').reverse().join('/'); new Date(value).toISOString(),
value = date.formatDate( 'YYYY-MM-DDTHH:mm:ss.SSSZ'
new Date(value).toISOString(), );
'YYYY-MM-DDTHH:mm:ss.SSSZ'
);
}
} }
const [year, month, day] = value.split('-').map((e) => parseInt(e)); const [year, month, day] = value.split('-').map((e) => parseInt(e));
newDate = new Date(year, month - 1, day); newDate = new Date(year, month - 1, day);
@ -75,25 +69,46 @@ const formattedDate = computed({
const popupDate = computed(() => const popupDate = computed(() =>
model.value ? date.formatDate(new Date(model.value), 'YYYY/MM/DD') : model.value model.value ? date.formatDate(new Date(model.value), 'YYYY/MM/DD') : model.value
); );
onMounted(() => {
// fix quasar bug
mask.value = '##/##/####';
});
watch( watch(
() => model.value, () => model.value,
(val) => (formattedDate.value = val), (val) => (formattedDate.value = val),
{ immediate: true } { immediate: true }
); );
const styleAttrs = computed(() => {
return $props.isOutlined
? {
dense: true,
outlined: true,
rounded: true,
}
: {};
});
const manageDate = (date) => {
formattedDate.value = date;
isPopupOpen.value = false;
};
</script> </script>
<template> <template>
<div @mouseover="hover = true" @mouseleave="hover = false"> <div @mouseover="hover = true" @mouseleave="hover = false">
<QInput <QInput
ref="vnInputDateRef"
v-model="formattedDate" v-model="formattedDate"
class="vn-input-date" class="vn-input-date"
:mask="mask" :mask="mask"
placeholder="dd/mm/aaaa" placeholder="dd/mm/aaaa"
v-bind="{ ...$attrs, ...styleAttrs }" v-bind="{ ...$attrs, ...styleAttrs }"
:class="{ required: $attrs.required }" :class="{ required: $attrs.required }"
:rules="$attrs.required ? [requiredFieldRule] : null" :rules="mixinRules"
:clearable="false" :clearable="false"
@click="isPopupOpen = true"
hide-bottom-space
> >
<template #append> <template #append>
<QIcon <QIcon
@ -106,11 +121,13 @@ watch(
!$attrs.disable !$attrs.disable
" "
@click=" @click="
vnInputDateRef.focus();
model = null; model = null;
isPopupOpen = false; isPopupOpen = false;
" "
/> />
<QIcon <QIcon
v-if="showEvent"
name="event" name="event"
class="cursor-pointer" class="cursor-pointer"
@click="isPopupOpen = !isPopupOpen" @click="isPopupOpen = !isPopupOpen"
@ -118,6 +135,7 @@ watch(
/> />
</template> </template>
<QMenu <QMenu
v-if="$q.screen.gt.xs"
transition-show="scale" transition-show="scale"
transition-hide="scale" transition-hide="scale"
v-model="isPopupOpen" v-model="isPopupOpen"
@ -126,18 +144,11 @@ watch(
:no-focus="true" :no-focus="true"
:no-parent-event="true" :no-parent-event="true"
> >
<QDate <VnDate v-model="popupDate" @update:model-value="manageDate" />
v-model="popupDate"
:landscape="true"
:today-btn="true"
@update:model-value="
(date) => {
formattedDate = date;
isPopupOpen = false;
}
"
/>
</QMenu> </QMenu>
<QDialog v-else v-model="isPopupOpen">
<VnDate v-model="popupDate" @update:model-value="manageDate" />
</QDialog>
</QInput> </QInput>
</div> </div>
</template> </template>

View File

@ -1,8 +1,12 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, ref, useAttrs } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { date } from 'quasar'; import { date } from 'quasar';
import { useValidator } from 'src/composables/useValidator';
import VnTime from './VnTime.vue';
const { validations } = useValidator();
const $attrs = useAttrs();
const model = defineModel({ type: String }); const model = defineModel({ type: String });
const props = defineProps({ const props = defineProps({
timeOnly: { timeOnly: {
@ -14,10 +18,11 @@ const props = defineProps({
default: false, default: false,
}, },
}); });
const vnInputTimeRef = ref(null);
const initialDate = ref(model.value ?? Date.vnNew()); const initialDate = ref(model.value ?? Date.vnNew());
const { t } = useI18n(); const { t } = useI18n();
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired'); const requiredFieldRule = (val) => validations().required($attrs.required, val);
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
const dateFormat = 'HH:mm'; const dateFormat = 'HH:mm';
const isPopupOpen = ref(); const isPopupOpen = ref();
const hover = ref(); const hover = ref();
@ -67,6 +72,7 @@ function dateToTime(newDate) {
<template> <template>
<div @mouseover="hover = true" @mouseleave="hover = false"> <div @mouseover="hover = true" @mouseleave="hover = false">
<QInput <QInput
ref="vnInputTimeRef"
class="vn-input-time" class="vn-input-time"
mask="##:##" mask="##:##"
placeholder="--:--" placeholder="--:--"
@ -74,9 +80,10 @@ function dateToTime(newDate) {
v-bind="{ ...$attrs, ...styleAttrs }" v-bind="{ ...$attrs, ...styleAttrs }"
:class="{ required: $attrs.required }" :class="{ required: $attrs.required }"
style="min-width: 100px" style="min-width: 100px"
:rules="$attrs.required ? [requiredFieldRule] : null" :rules="mixinRules"
@click="isPopupOpen = false" @click="isPopupOpen = false"
type="time" type="time"
hide-bottom-space
> >
<template #append> <template #append>
<QIcon <QIcon
@ -89,6 +96,7 @@ function dateToTime(newDate) {
!$attrs.disable !$attrs.disable
" "
@click=" @click="
vnInputTimeRef.focus();
model = null; model = null;
isPopupOpen = false; isPopupOpen = false;
" "
@ -101,6 +109,7 @@ function dateToTime(newDate) {
/> />
</template> </template>
<QMenu <QMenu
v-if="$q.screen.gt.xs"
transition-show="scale" transition-show="scale"
transition-hide="scale" transition-hide="scale"
v-model="isPopupOpen" v-model="isPopupOpen"
@ -109,8 +118,11 @@ function dateToTime(newDate) {
:no-focus="true" :no-focus="true"
:no-parent-event="true" :no-parent-event="true"
> >
<QTime v-model="formattedTime" mask="HH:mm" landscape now-btn /> <VnTime v-model="formattedTime" />
</QMenu> </QMenu>
<QDialog v-else v-model="isPopupOpen">
<VnTime v-model="formattedTime" />
</QDialog>
</QInput> </QInput>
</div> </div>
</template> </template>

View File

@ -2,21 +2,69 @@
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue'; import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import VnSelectDialog from 'components/common/VnSelectDialog.vue'; import VnSelectDialog from 'components/common/VnSelectDialog.vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
const { t } = useI18n(); const { t } = useI18n();
const value = defineModel({ type: [String, Number, Object] }); const emit = defineEmits(['update:model-value', 'update:options']);
const props = defineProps({
location: {
type: Object,
default: null,
},
});
const locationProperties = [
'postcode',
(obj) =>
obj.city
? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}`
: null,
(obj) => obj.country?.name,
];
const formatLocation = (obj, properties) => {
const parts = properties.map((prop) => {
if (typeof prop === 'string') {
return obj[prop];
} else if (typeof prop === 'function') {
return prop(obj);
}
return null;
});
const filteredParts = parts.filter(
(part) => part !== null && part !== undefined && part !== ''
);
return filteredParts.join(', ');
};
const modelValue = ref(
props.location ? formatLocation(props.location, locationProperties) : null
);
function showLabel(data) { function showLabel(data) {
return `${data.code} - ${data.town}(${data.province}), ${data.country}`; const dataProperties = [
'code',
(obj) => (obj.town ? `${obj.town}(${obj.province})` : null),
'country',
];
return formatLocation(data, dataProperties);
} }
const handleModelValue = (data) => {
emit('update:model-value', data);
};
</script> </script>
<template> <template>
<VnSelectDialog <VnSelectDialog
v-model="value" v-model="modelValue"
option-value="code"
option-filter-value="search" option-filter-value="search"
:option-label="(opt) => showLabel(opt)" :option-label="
(opt) => (typeof modelValue === 'string' ? modelValue : showLabel(opt))
"
url="Postcodes/filter" url="Postcodes/filter"
@update:model-value="handleModelValue"
:use-like="false" :use-like="false"
:label="t('Location')" :label="t('Location')"
:placeholder="t('search_by_postalcode')" :placeholder="t('search_by_postalcode')"
@ -25,9 +73,17 @@ function showLabel(data) {
v-bind="$attrs" v-bind="$attrs"
clearable clearable
:emit-value="false" :emit-value="false"
:tooltip="t('Create new location')"
> >
<template #form> <template #form>
<CreateNewPostcode @on-data-saved="(newValue) => (value = newValue)" /> <CreateNewPostcode
@on-data-saved="
(newValue) => {
modelValue = newValue;
emit('update:model-value', newValue);
}
"
/>
</template> </template>
<template #option="{ itemProps, opt }"> <template #option="{ itemProps, opt }">
<QItem v-bind="itemProps"> <QItem v-bind="itemProps">
@ -50,7 +106,9 @@ function showLabel(data) {
<i18n> <i18n>
en: en:
search_by_postalcode: Search by postalcode, town, province or country search_by_postalcode: Search by postalcode, town, province or country
Create new location: Create new location
es: es:
Location: Ubicación Location: Ubicación
Create new location: Crear nueva ubicación
search_by_postalcode: Buscar por código postal, ciudad o país search_by_postalcode: Buscar por código postal, ciudad o país
</i18n> </i18n>

View File

@ -14,6 +14,7 @@ import VnJsonValue from '../common/VnJsonValue.vue';
import FetchData from '../FetchData.vue'; import FetchData from '../FetchData.vue';
import VnSelect from './VnSelect.vue'; import VnSelect from './VnSelect.vue';
import VnUserLink from '../ui/VnUserLink.vue'; import VnUserLink from '../ui/VnUserLink.vue';
import VnPaginate from '../ui/VnPaginate.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const validationsStore = useValidator(); const validationsStore = useValidator();
@ -66,9 +67,10 @@ const filter = {
}, },
}, },
], ],
where: { and: [{ originFk: route.params.id }] },
}; };
const workers = ref(); const paginate = ref();
const actions = ref(); const actions = ref();
const changeInput = ref(); const changeInput = ref();
const searchInput = ref(); const searchInput = ref();
@ -235,9 +237,7 @@ async function openPointRecord(id, modelLog) {
const locale = validations[modelLog.model]?.locale || {}; const locale = validations[modelLog.model]?.locale || {};
pointRecord.value = parseProps(propNames, locale, data); pointRecord.value = parseProps(propNames, locale, data);
} }
async function setLogTree() { async function setLogTree(data) {
filter.where = { and: [{ originFk: route.params.id }] };
const { data } = await getLogs(filter);
logTree.value = getLogTree(data); logTree.value = getLogTree(data);
} }
@ -266,15 +266,7 @@ async function applyFilter() {
filter.where.and.push(selectedFilters.value); filter.where.and.push(selectedFilters.value);
} }
const { data } = await getLogs(filter); paginate.value.fetch(filter);
logTree.value = getLogTree(data);
}
async function getLogs(filter) {
return axios.get(props.url ?? `${props.model}Logs`, {
params: { filter: JSON.stringify(filter) },
});
} }
function setDate(type) { function setDate(type) {
@ -377,8 +369,6 @@ async function clearFilter() {
await applyFilter(); await applyFilter();
} }
setLogTree();
onUnmounted(() => { onUnmounted(() => {
stateStore.rightDrawer = false; stateStore.rightDrawer = false;
}); });
@ -391,16 +381,6 @@ watch(
); );
</script> </script>
<template> <template>
<FetchData
:url="`${props.model}Logs/${route.params.id}/editors`"
:filter="{
fields: ['id', 'nickname', 'name', 'image'],
order: 'nickname',
limit: 30,
}"
@on-fetch="(data) => (workers = data)"
auto-load
/>
<FetchData <FetchData
:url="`${props.model}Logs/${route.params.id}/models`" :url="`${props.model}Logs/${route.params.id}/models`"
:filter="{ order: ['changedModel'] }" :filter="{ order: ['changedModel'] }"
@ -418,231 +398,284 @@ watch(
" "
auto-load auto-load
/> />
<div <VnPaginate
class="column items-center logs origin-log q-mt-md" ref="paginate"
v-for="(originLog, originLogIndex) in logTree" :data-key="`${model}Log`"
:key="originLogIndex" :url="`${model}Logs`"
:filter="filter"
:skeleton="false"
auto-load
@on-fetch="setLogTree"
search-url="logs"
> >
<QItem class="origin-info items-center q-my-md" v-if="logTree.length > 1"> <template #body>
<h6 class="origin-id text-grey"> <div
{{ useCapitalize(validations[props.model].locale.name) }} class="column items-center logs origin-log q-mt-md"
#{{ originLog.originFk }} v-for="(originLog, originLogIndex) in logTree"
</h6> :key="originLogIndex"
<div class="line bg-grey"></div> >
</QItem> <QItem class="origin-info items-center q-my-md" v-if="logTree.length > 1">
<div <h6 class="origin-id text-grey">
class="user-log q-mb-sm" {{ useCapitalize(validations[props.model].locale.name) }}
v-for="(userLog, userIndex) in originLog.logs" #{{ originLog.originFk }}
:key="userIndex" </h6>
> <div class="line bg-grey"></div>
<div class="timeline"> </QItem>
<div class="user-avatar"> <div
<VnUserLink :worker-id="userLog?.user?.id"> class="user-log q-mb-sm"
<template #link> v-for="(userLog, userIndex) in originLog.logs"
<VnAvatar :key="userIndex"
:class="{ 'cursor-pointer': userLog?.user?.id }"
:worker-id="userLog?.user?.id"
:title="userLog?.user?.nickname"
:show-letter="!userLog?.user"
size="lg"
/>
</template>
</VnUserLink>
</div>
<div class="arrow bg-panel" v-if="byRecord"></div>
<div class="line"></div>
</div>
<QList class="user-changes" v-if="userLog">
<QItem
class="model-log column q-px-none q-py-xs"
v-for="(modelLog, modelLogIndex) in userLog.logs"
:key="modelLogIndex"
> >
<QItemSection> <div class="timeline">
<QItemLabel class="model-info q-mb-xs" v-if="!byRecord"> <div class="user-avatar">
<QChip <VnUserLink :worker-id="userLog?.user?.id">
dense <template #link>
size="md" <VnAvatar
class="model-name q-mr-xs text-white" :class="{ 'cursor-pointer': userLog?.user?.id }"
v-if=" :worker-id="userLog?.user?.id"
!(modelLog.changedModel && modelLog.changedModelId) && :title="userLog?.user?.nickname"
modelLog.model :show-letter="!userLog?.user"
" size="lg"
:style="{ />
backgroundColor: useColor(modelLog.model), </template>
}" </VnUserLink>
:title="`${modelLog.model} #${modelLog.id}`" </div>
> <div class="arrow bg-panel" v-if="byRecord"></div>
{{ t(modelLog.modelI18n) }} <div class="line"></div>
</QChip> </div>
<QList class="user-changes" v-if="userLog">
<span <QItem
class="model-id q-mr-xs" class="model-log column q-px-none q-py-xs"
v-if="modelLog.summaryId" v-for="(modelLog, modelLogIndex) in userLog.logs"
v-text="`#${modelLog.summaryId}`" :key="modelLogIndex"
/>
<span
class="model-value"
:title="modelLog.showValue"
v-text="modelLog.showValue"
/>
<QBtn
flat
round
color="grey"
class="q-mr-xs q-ml-auto"
size="sm"
icon="filter_alt"
:title="t('recordChanges')"
@click.stop="filterByRecord(modelLog)"
/>
</QItemLabel>
</QItemSection>
<QItemSection>
<QCard
class="changes-log q-py-none q-mb-xs"
v-for="(log, logIndex) in modelLog.logs"
:key="logIndex"
> >
<QCardSection class="change-info q-pa-none"> <QItemSection>
<QItem <QItemLabel class="model-info q-mb-xs" v-if="!byRecord">
class="q-px-sm q-py-xs justify-between items-center" <QChip
> dense
<div size="md"
class="date text-grey text-caption q-mr-sm" class="model-name q-mr-xs text-white"
:title=" v-if="
date.formatDate( !(
log.creationDate, modelLog.changedModel &&
'DD/MM/YYYY hh:mm:ss' modelLog.changedModelId
) ?? `date:'dd/MM/yyyy HH:mm:ss'` ) && modelLog.model
" "
:style="{
backgroundColor: useColor(modelLog.model),
}"
:title="`${modelLog.model} #${modelLog.id}`"
> >
{{ toRelativeDate(log.creationDate) }} {{ t(modelLog.modelI18n) }}
</div> </QChip>
<div>
<QBtn
color="grey"
class="pit"
icon="preview"
flat
round
:title="t('pointRecord')"
padding="none"
v-if="log.action != 'insert'"
@click.stop="
openPointRecord(log.id, modelLog)
"
>
<QPopupProxy>
<QCard v-if="pointRecord">
<div
class="header q-px-sm q-py-xs q-ma-none text-white text-bold bg-primary"
>
{{ modelLog.modelI18n }}
<span v-if="modelLog.id"
>#{{ modelLog.id }}</span
>
</div>
<QCardSection
class="change-detail q-pa-sm"
>
<QItem
v-for="(
value, index
) in pointRecord"
:key="index"
class="q-pa-none"
>
<span
class="json-field q-mr-xs text-grey"
:title="value.name"
>
{{ value.nameI18n }}:
</span>
<VnJsonValue
:value="value.val.val"
/>
</QItem>
</QCardSection>
</QCard>
</QPopupProxy>
</QBtn>
<QIcon
class="action q-ml-xs"
:class="actionsClass[log.action]"
:name="actionsIcon[log.action]"
:title="
t(`actions.${actionsText[log.action]}`)
"
/>
</div>
</QItem>
</QCardSection>
<QCardSection
class="change-detail q-px-sm q-py-xs"
:class="{ expanded: log.expand }"
v-if="log.props.length || log.description"
>
<QIcon
class="cursor-pointer q-mr-md"
color="grey"
name="expand_more"
:title="t('globals.details')"
size="sm"
@click="log.expand = !log.expand"
/>
<span v-if="log.props.length" class="attributes">
<span v-if="!log.expand" class="q-pa-none text-grey">
<span
v-for="(prop, propIndex) in log.props"
:key="propIndex"
class="basic-json"
>
<span class="json-field" :title="prop.name">
{{ prop.nameI18n }}:
</span>
<VnJsonValue :value="prop.val.val" />
<span v-if="propIndex < log.props.length - 1"
>,&nbsp;
</span>
</span>
</span>
<span <span
v-if="log.expand" class="model-id q-mr-xs"
class="expanded-json column q-pa-none" v-if="modelLog.summaryId"
> v-text="`#${modelLog.summaryId}`"
<div />
v-for="(prop, prop2Index) in log.props" <span
:key="prop2Index" class="model-value"
class="q-pa-none text-grey" :title="modelLog.showValue"
v-text="modelLog.showValue"
/>
<QBtn
flat
round
color="grey"
class="q-mr-xs q-ml-auto"
size="sm"
icon="filter_alt"
:title="t('recordChanges')"
@click.stop="filterByRecord(modelLog)"
/>
</QItemLabel>
</QItemSection>
<QItemSection>
<QCard
class="changes-log q-py-none q-mb-xs"
v-for="(log, logIndex) in modelLog.logs"
:key="logIndex"
>
<QCardSection class="change-info q-pa-none">
<QItem
class="q-px-sm q-py-xs justify-between items-center"
> >
<span class="json-field" :title="prop.name"> <div
{{ prop.nameI18n }}: class="date text-grey text-caption q-mr-sm"
</span> :title="
<VnJsonValue :value="prop.val.val" /> date.formatDate(
<span v-if="prop.val.id" class="id-value"> log.creationDate,
#{{ prop.val.id }} 'DD/MM/YYYY hh:mm:ss'
</span> ) ?? `date:'dd/MM/yyyy HH:mm:ss'`
<span v-if="log.action == 'update'"> "
>
<VnJsonValue :value="prop.old.val" /> {{ toRelativeDate(log.creationDate) }}
<span v-if="prop.old.id" class="id-value"> </div>
#{{ prop.old.id }} <div>
<QBtn
color="grey"
class="pit"
icon="preview"
flat
round
:title="t('pointRecord')"
padding="none"
v-if="log.action != 'insert'"
@click.stop="
openPointRecord(log.id, modelLog)
"
>
<QPopupProxy>
<QCard v-if="pointRecord">
<div
class="header q-px-sm q-py-xs q-ma-none text-white text-bold bg-primary"
>
{{ modelLog.modelI18n }}
<span v-if="modelLog.id"
>#{{
modelLog.id
}}</span
>
</div>
<QCardSection
class="change-detail q-pa-sm"
>
<QItem
v-for="(
value, index
) in pointRecord"
:key="index"
class="q-pa-none"
>
<span
class="json-field q-mr-xs text-grey"
:title="
value.name
"
>
{{
value.nameI18n
}}:
</span>
<VnJsonValue
:value="
value.val.val
"
/>
</QItem>
</QCardSection>
</QCard>
</QPopupProxy>
</QBtn>
<QIcon
class="action q-ml-xs"
:class="actionsClass[log.action]"
:name="actionsIcon[log.action]"
:title="
t(
`actions.${
actionsText[log.action]
}`
)
"
/>
</div>
</QItem>
</QCardSection>
<QCardSection
class="change-detail q-px-sm q-py-xs"
:class="{ expanded: log.expand }"
v-if="log.props.length || log.description"
>
<QIcon
class="cursor-pointer q-mr-md"
color="grey"
name="expand_more"
:title="t('globals.details')"
size="sm"
@click="log.expand = !log.expand"
/>
<span v-if="log.props.length" class="attributes">
<span
v-if="!log.expand"
class="q-pa-none text-grey"
>
<span
v-for="(prop, propIndex) in log.props"
:key="propIndex"
class="basic-json"
>
<span
class="json-field"
:title="prop.name"
>
{{ prop.nameI18n }}:
</span>
<VnJsonValue :value="prop.val.val" />
<span
v-if="
propIndex <
log.props.length - 1
"
>,&nbsp;
</span>
</span> </span>
</span> </span>
</div> <span
</span> v-if="log.expand"
</span> class="expanded-json column q-pa-none"
<span v-if="!log.props.length" class="description"> >
{{ log.description }} <div
</span> v-for="(
</QCardSection> prop, prop2Index
</QCard> ) in log.props"
</QItemSection> :key="prop2Index"
</QItem> class="q-pa-none text-grey"
</QList> >
</div> <span
</div> class="json-field"
:title="prop.name"
>
{{ prop.nameI18n }}:
</span>
<VnJsonValue :value="prop.val.val" />
<span
v-if="prop.val.id"
class="id-value"
>
#{{ prop.val.id }}
</span>
<span v-if="log.action == 'update'">
<VnJsonValue
:value="prop.old.val"
/>
<span
v-if="prop.old.id"
class="id-value"
>
#{{ prop.old.id }}
</span>
</span>
</div>
</span>
</span>
<span
v-if="!log.props.length"
class="description"
>
{{ log.description }}
</span>
</QCardSection>
</QCard>
</QItemSection>
</QItem>
</QList>
</div>
</div>
</template>
</VnPaginate>
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()"> <Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
<QList dense> <QList dense>
<QSeparator /> <QSeparator />
@ -691,17 +724,16 @@ watch(
</QOptionGroup> </QOptionGroup>
</QItem> </QItem>
<QItem class="q-mt-sm"> <QItem class="q-mt-sm">
<QItemSection v-if="!workers"> <QItemSection v-if="userRadio !== null">
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="workers && userRadio !== null">
<VnSelect <VnSelect
class="full-width" class="full-width"
:label="t('globals.user')" :label="t('globals.user')"
v-model="userSelect" v-model="userSelect"
option-label="name" option-label="name"
option-value="id" option-value="id"
:options="workers" :url="`${model}Logs/${$route.params.id}/editors`"
:fields="['id', 'nickname', 'name', 'image']"
sort-by="nickname"
@update:model-value="selectFilter('userSelect')" @update:model-value="selectFilter('userSelect')"
hide-selected hide-selected
> >

View File

@ -2,6 +2,7 @@
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { useQuasar } from 'quasar';
const stateStore = useStateStore(); const stateStore = useStateStore();
const $props = defineProps({ const $props = defineProps({
@ -10,7 +11,9 @@ const $props = defineProps({
default: true, default: true,
}, },
}); });
onMounted(() => (stateStore.leftDrawer = $props.leftDrawer)); onMounted(
() => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false)
);
</script> </script>
<template> <template>
@ -20,6 +23,8 @@ onMounted(() => (stateStore.leftDrawer = $props.leftDrawer));
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<RouterView></RouterView> <QPage>
<RouterView />
</QPage>
</QPageContainer> </QPageContainer>
</template> </template>

View File

@ -1,7 +1,8 @@
<script setup> <script setup>
import { ref, toRefs, computed, watch, onMounted } from 'vue'; import { ref, toRefs, computed, watch, onMounted, useAttrs } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import { useValidator } from 'src/composables/useValidator';
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']); const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
const $props = defineProps({ const $props = defineProps({
@ -37,6 +38,10 @@ const $props = defineProps({
type: [Array], type: [Array],
default: () => [], default: () => [],
}, },
exprBuilder: {
type: Function,
default: null,
},
isClearable: { isClearable: {
type: Boolean, type: Boolean,
default: true, default: true,
@ -82,10 +87,11 @@ const $props = defineProps({
default: false, default: false,
}, },
}); });
const { validations } = useValidator();
const requiredFieldRule = (val) => validations().required($attrs.required, val);
const $attrs = useAttrs();
const { t } = useI18n(); const { t } = useI18n();
const requiredFieldRule = (val) => val ?? t('globals.fieldRequired'); const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
const { optionLabel, optionValue, optionFilter, optionFilterValue, options, modelValue } = const { optionLabel, optionValue, optionFilter, optionFilterValue, options, modelValue } =
toRefs($props); toRefs($props);
const myOptions = ref([]); const myOptions = ref([]);
@ -135,6 +141,7 @@ function findKeyInOptions() {
function setOptions(data) { function setOptions(data) {
myOptions.value = JSON.parse(JSON.stringify(data)); myOptions.value = JSON.parse(JSON.stringify(data));
myOptionsOriginal.value = JSON.parse(JSON.stringify(data)); myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
emit('update:options', data);
} }
function filter(val, options) { function filter(val, options) {
@ -177,6 +184,7 @@ async function fetchFilter(val) {
}, {}); }, {});
} else defaultWhere = { [key]: getVal(val) }; } else defaultWhere = { [key]: getVal(val) };
const where = { ...(val ? defaultWhere : {}), ...$props.where }; const where = { ...(val ? defaultWhere : {}), ...$props.where };
$props.exprBuilder && Object.assign(where, $props.exprBuilder(key, val));
const fetchOptions = { where, include, limit }; const fetchOptions = { where, include, limit };
if (fields) fetchOptions.fields = fields; if (fields) fetchOptions.fields = fields;
if (sortBy) fetchOptions.order = sortBy; if (sortBy) fetchOptions.order = sortBy;
@ -220,6 +228,8 @@ function nullishToTrue(value) {
} }
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val); const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
defineExpose({ opts: myOptions });
</script> </script>
<template> <template>
@ -248,8 +258,9 @@ const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
ref="vnSelectRef" ref="vnSelectRef"
lazy-rules lazy-rules
:class="{ required: $attrs.required }" :class="{ required: $attrs.required }"
:rules="$attrs.required ? [requiredFieldRule] : null" :rules="mixinRules"
virtual-scroll-slice-size="options.length" virtual-scroll-slice-size="options.length"
hide-bottom-space
> >
<template v-if="isClearable" #append> <template v-if="isClearable" #append>
<QIcon <QIcon

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { computed } from 'vue';
import { useRole } from 'src/composables/useRole'; import { useRole } from 'src/composables/useRole';
import { useAcl } from 'src/composables/useAcl';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
@ -11,6 +12,10 @@ const $props = defineProps({
type: Array, type: Array,
default: () => ['developer'], default: () => ['developer'],
}, },
acls: {
type: Array,
default: () => [],
},
actionIcon: { actionIcon: {
type: String, type: String,
default: 'add', default: 'add',
@ -22,15 +27,12 @@ const $props = defineProps({
}); });
const role = useRole(); const role = useRole();
const showForm = ref(false); const acl = useAcl();
const isAllowedToCreate = computed(() => { const isAllowedToCreate = computed(() => {
if ($props.acls.length) return acl.hasAny($props.acls);
return role.hasAny($props.rolesAllowedToCreate); return role.hasAny($props.rolesAllowedToCreate);
}); });
const toggleForm = () => {
showForm.value = !showForm.value;
};
</script> </script>
<template> <template>
@ -41,7 +43,7 @@ const toggleForm = () => {
> >
<template v-if="isAllowedToCreate" #append> <template v-if="isAllowedToCreate" #append>
<QIcon <QIcon
@click.stop.prevent="toggleForm()" @click.stop.prevent="$refs.dialog.show()"
:name="actionIcon" :name="actionIcon"
:size="actionIcon === 'add' ? 'xs' : 'sm'" :size="actionIcon === 'add' ? 'xs' : 'sm'"
:class="['default-icon', { '--add-icon': actionIcon === 'add' }]" :class="['default-icon', { '--add-icon': actionIcon === 'add' }]"
@ -51,7 +53,7 @@ const toggleForm = () => {
> >
<QTooltip v-if="tooltip">{{ tooltip }}</QTooltip> <QTooltip v-if="tooltip">{{ tooltip }}</QTooltip>
</QIcon> </QIcon>
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale"> <QDialog ref="dialog" transition-show="scale" transition-hide="scale">
<slot name="form" /> <slot name="form" />
</QDialog> </QDialog>
</template> </template>

View File

@ -0,0 +1,52 @@
<script setup>
import { onBeforeMount, ref, useAttrs } from 'vue';
import axios from 'axios';
import VnSelect from 'components/common/VnSelect.vue';
const { schema, table, column, translation, defaultOptions } = defineProps({
schema: {
type: String,
default: 'vn',
},
table: {
type: String,
required: true,
},
column: {
type: String,
required: true,
},
translation: {
type: Function,
default: null,
},
defaultOptions: {
type: Array,
default: () => [],
},
});
const $attrs = useAttrs();
const options = ref([]);
onBeforeMount(async () => {
options.value = [].concat(defaultOptions);
const { data } = await axios.get(`Applications/get-enum-values`, {
params: { schema, table, column },
});
for (const value of data)
options.value.push({
[$attrs['option-value'] ?? 'id']: value,
[$attrs['option-label'] ?? 'name']: translation ? translation(value) : value,
});
});
</script>
<template>
<VnSelect
v-bind="$attrs"
:options="options"
:key="options.length"
:input-debounce="0"
/>
</template>

View File

@ -0,0 +1,16 @@
<script setup>
const model = defineModel({ type: [String, Number], required: true });
</script>
<template>
<QTime v-model="model" now-btn mask="HH:mm" />
</template>
<style lang="scss" scoped>
.q-time {
width: 230px;
min-width: unset;
:deep(.q-time__header) {
min-height: unset;
height: 50px;
}
}
</style>

View File

@ -47,6 +47,7 @@ let store;
let entity; let entity;
const isLoading = ref(false); const isLoading = ref(false);
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName); const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
const menuRef = ref();
defineExpose({ getData }); defineExpose({ getData });
onBeforeMount(async () => { onBeforeMount(async () => {
@ -170,7 +171,7 @@ const toModule = computed(() =>
<QTooltip> <QTooltip>
{{ t('components.cardDescriptor.moreOptions') }} {{ t('components.cardDescriptor.moreOptions') }}
</QTooltip> </QTooltip>
<QMenu ref="menuRef"> <QMenu :ref="menuRef">
<QList> <QList>
<slot name="menu" :entity="entity" :menu-ref="menuRef" /> <slot name="menu" :entity="entity" :menu-ref="menuRef" />
</QList> </QList>

View File

@ -31,7 +31,7 @@ const dialog = ref(null);
<div class="container order-catalog-item overflow-hidden"> <div class="container order-catalog-item overflow-hidden">
<QCard class="card shadow-6"> <QCard class="card shadow-6">
<div class="img-wrapper"> <div class="img-wrapper">
<VnImg :id="item.id" class="image" /> <VnImg :id="item.id" class="image" zoom-resolution="1600x900" />
<div v-if="item.hex && isCatalog" class="item-color-container"> <div v-if="item.hex && isCatalog" class="item-color-container">
<div <div
class="item-color" class="item-color"
@ -127,11 +127,6 @@ const dialog = ref(null);
flex-direction: column; flex-direction: column;
gap: 4px; gap: 4px;
.subName {
color: var(--vn-label-color);
text-transform: uppercase;
}
p { p {
margin-bottom: 0; margin-bottom: 0;
} }

View File

@ -2,10 +2,6 @@
import { computed } from 'vue'; import { computed } from 'vue';
const $props = defineProps({ const $props = defineProps({
maxLength: {
type: Number,
required: true,
},
item: { item: {
type: Object, type: Object,
required: true, required: true,

View File

@ -31,6 +31,7 @@ const props = defineProps({
}); });
defineEmits(['confirm', ...useDialogPluginComponent.emits]); defineEmits(['confirm', ...useDialogPluginComponent.emits]);
defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
const { dialogRef, onDialogOK } = useDialogPluginComponent(); const { dialogRef, onDialogOK } = useDialogPluginComponent();
@ -68,8 +69,10 @@ async function confirm() {
<QSpace /> <QSpace />
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup /> <QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
</QCardSection> </QCardSection>
<QCardSection class="row items-center"> <QCardSection class="q-pb-none">
<span v-if="message !== false" v-html="message" /> <span v-if="message !== false" v-html="message" />
</QCardSection>
<QCardSection class="row items-center q-pt-none">
<slot name="customHTML"></slot> <slot name="customHTML"></slot>
</QCardSection> </QCardSection>
<QCardActions align="right"> <QCardActions align="right">

View File

@ -132,17 +132,6 @@ async function search(evt) {
} }
} }
async function reload() {
isLoading.value = true;
const params = Object.values(userParams.value).filter((param) => param);
store.skip = 0;
store.page = 1;
await arrayData.fetch({ append: false });
if (!$props.showAll && !params.length) store.data = [];
isLoading.value = false;
emit('refresh');
}
async function clearFilters() { async function clearFilters() {
try { try {
isLoading.value = true; isLoading.value = true;
@ -222,7 +211,7 @@ function sanitizer(params) {
icon="search" icon="search"
@click="search()" @click="search()"
></QBtn> ></QBtn>
<QForm @submit="search" id="filterPanelForm"> <QForm @submit="search" id="filterPanelForm" @keyup.enter="search()">
<QList dense> <QList dense>
<QItem class="q-mt-xs"> <QItem class="q-mt-xs">
<QItemSection top> <QItemSection top>
@ -231,32 +220,18 @@ function sanitizer(params) {
</QItemLabel> </QItemLabel>
</QItemSection> </QItemSection>
<QItemSection top side> <QItemSection top side>
<div class="q-gutter-xs"> <QBtn
<QBtn @click="clearFilters"
@click="clearFilters" color="primary"
color="primary" dense
dense flat
flat icon="filter_list_off"
icon="filter_list_off" padding="none"
padding="none" round
round size="sm"
size="sm" >
> <QTooltip>{{ t('Remove filters') }}</QTooltip>
<QTooltip>{{ t('Remove filters') }}</QTooltip> </QBtn>
</QBtn>
<QBtn
@click="reload"
color="primary"
dense
flat
icon="refresh"
padding="none"
round
size="sm"
>
<QTooltip>{{ t('Refresh') }}</QTooltip>
</QBtn>
</div>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">

View File

@ -39,6 +39,8 @@ const getUrl = (zoom = false) => {
const curResolution = zoom const curResolution = zoom
? $props.zoomResolution || $props.resolution ? $props.zoomResolution || $props.resolution
: $props.resolution; : $props.resolution;
if ($props.storage === 'dms')
return `/api/${$props.storage}/${$props.id}/downloadFile?access_token=${token}`;
return isEmployee return isEmployee
? `/api/${$props.storage}/${$props.collection}/${curResolution}/${$props.id}/download?access_token=${token}&${timeStamp.value}` ? `/api/${$props.storage}/${$props.collection}/${curResolution}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
: noImage; : noImage;
@ -52,18 +54,21 @@ defineExpose({
</script> </script>
<template> <template>
<QImg <QImg
:draggable="true"
:class="{ zoomIn: zoom }" :class="{ zoomIn: zoom }"
:src="getUrl()" :src="getUrl()"
v-bind="$attrs" v-bind="$attrs"
@click.stop="show = $props.zoom ? true : false" @click.stop="show = $props.zoom"
spinner-color="primary" spinner-color="primary"
/> />
<QDialog v-if="$props.zoom" v-model="show"> <QDialog v-if="$props.zoom" v-model="show">
<QImg <QImg
:draggable="true"
:src="getUrl(true)" :src="getUrl(true)"
v-bind="$attrs" v-bind="$attrs"
spinner-color="primary" spinner-color="primary"
class="img_zoom" class="img_zoom"
:ratio="0"
/> />
</QDialog> </QDialog>
</template> </template>

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { ref } from 'vue'; import { ref, reactive } from 'vue';
import { onBeforeRouteLeave } from 'vue-router'; import { onBeforeRouteLeave } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
@ -12,36 +12,40 @@ import VnPaginate from 'components/ui/VnPaginate.vue';
import VnUserLink from 'components/ui/VnUserLink.vue'; import VnUserLink from 'components/ui/VnUserLink.vue';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import VnAvatar from 'components/ui/VnAvatar.vue'; import VnAvatar from 'components/ui/VnAvatar.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'components/common/VnSelect.vue';
import FetchData from 'components/FetchData.vue';
import VnInput from 'components/common/VnInput.vue';
const $props = defineProps({ const $props = defineProps({
url: { type: String, default: null }, url: { type: String, default: null },
filter: { type: Object, default: () => {} }, filter: { type: Object, default: () => {} },
body: { type: Object, default: () => {} }, body: { type: Object, default: () => {} },
addNote: { type: Boolean, default: false }, addNote: { type: Boolean, default: false },
selectType: { type: Boolean, default: false },
}); });
const { t } = useI18n(); const { t } = useI18n();
const state = useState(); const state = useState();
const quasar = useQuasar(); const quasar = useQuasar();
const currentUser = ref(state.getUser()); const currentUser = ref(state.getUser());
const newNote = ref(''); const newNote = reactive({ text: null, observationTypeFk: null });
const observationTypes = ref([]);
const vnPaginateRef = ref(); const vnPaginateRef = ref();
function handleKeyUp(event) {
if (event.key === 'Enter') {
event.preventDefault();
if (!event.shiftKey) insert();
}
}
async function insert() { async function insert() {
if (!newNote.text || ($props.selectType && !newNote.observationTypeFk)) return;
const body = $props.body; const body = $props.body;
const newBody = { ...body, ...{ text: newNote.value } }; const newBody = {
...body,
...{ text: newNote.text, observationTypeFk: newNote.observationTypeFk },
};
await axios.post($props.url, newBody); await axios.post($props.url, newBody);
await vnPaginateRef.value.fetch(); await vnPaginateRef.value.fetch();
newNote.value = '';
} }
onBeforeRouteLeave((to, from, next) => { onBeforeRouteLeave((to, from, next) => {
if (newNote.value) if (newNote.text)
quasar.dialog({ quasar.dialog({
component: VnConfirm, component: VnConfirm,
componentProps: { componentProps: {
@ -54,6 +58,13 @@ onBeforeRouteLeave((to, from, next) => {
}); });
</script> </script>
<template> <template>
<FetchData
v-if="selectType"
url="ObservationTypes"
:filter="{ fields: ['id', 'description'] }"
auto-load
@on-fetch="(data) => (observationTypes = data)"
/>
<QCard class="q-pa-xs q-mb-xl full-width" v-if="$props.addNote"> <QCard class="q-pa-xs q-mb-xl full-width" v-if="$props.addNote">
<QCardSection horizontal> <QCardSection horizontal>
<VnAvatar :worker-id="currentUser.id" size="md" /> <VnAvatar :worker-id="currentUser.id" size="md" />
@ -62,29 +73,42 @@ onBeforeRouteLeave((to, from, next) => {
{{ t('globals.now') }} {{ t('globals.now') }}
</div> </div>
</QCardSection> </QCardSection>
<QCardSection class="q-pa-xs q-my-none q-py-none" horizontal> <QCardSection class="q-px-xs q-my-none q-py-none">
<QInput <VnRow class="full-width">
v-model="newNote" <VnSelect
class="full-width" :label="t('Observation type')"
type="textarea" v-if="selectType"
:label="t('Add note here...')" url="ObservationTypes"
filled v-model="newNote.observationTypeFk"
size="lg" option-label="description"
autogrow style="flex: 0.15"
autofocus :required="true"
@keyup="handleKeyUp" @keyup.enter.stop="insert"
clearable />
> <VnInput
<template #append> v-model.trim="newNote.text"
<QBtn type="textarea"
:title="t('Save (Enter)')" :label="t('Add note here...')"
icon="save" filled
color="primary" size="lg"
flat autogrow
@click="insert" @keyup.enter.stop="insert"
/> clearable
</template> :required="true"
</QInput> >
<template #append>
<QBtn
:title="t('Save (Enter)')"
icon="save"
color="primary"
flat
@click="insert"
class="q-mb-xs"
dense
/>
</template>
</VnInput>
</VnRow>
</QCardSection> </QCardSection>
</QCard> </QCard>
<VnPaginate <VnPaginate
@ -98,6 +122,10 @@ onBeforeRouteLeave((to, from, next) => {
class="show" class="show"
v-bind="$attrs" v-bind="$attrs"
search-url="notes" search-url="notes"
@on-fetch="
newNote.text = '';
newNote.observationTypeFk = null;
"
> >
<template #body="{ rows }"> <template #body="{ rows }">
<TransitionGroup name="list" tag="div" class="column items-center full-width"> <TransitionGroup name="list" tag="div" class="column items-center full-width">
@ -111,13 +139,28 @@ onBeforeRouteLeave((to, from, next) => {
:descriptor="false" :descriptor="false"
:worker-id="note.workerFk" :worker-id="note.workerFk"
size="md" size="md"
:title="note.worker?.user.nickname"
/> />
<div class="full-width row justify-between q-pa-xs"> <div class="full-width row justify-between q-pa-xs">
<VnUserLink <div>
:name="`${note.worker.user.nickname}`" <VnUserLink
:worker-id="note.worker.id" :name="`${note.worker.user.nickname}`"
/> :worker-id="note.worker.id"
{{ toDateHourMin(note.created) }} />
<QBadge
class="q-ml-xs"
outline
color="grey"
v-if="selectType && note.observationTypeFk"
>
{{
observationTypes.find(
(ot) => ot.id === note.observationTypeFk
)?.description
}}
</QBadge>
</div>
<span v-text="toDateHourMin(note.created)" />
</div> </div>
</QCardSection> </QCardSection>
<QCardSection class="q-pa-xs q-my-none q-py-none"> <QCardSection class="q-pa-xs q-my-none q-py-none">
@ -131,12 +174,6 @@ onBeforeRouteLeave((to, from, next) => {
<style lang="scss" scoped> <style lang="scss" scoped>
.q-card { .q-card {
width: 90%; width: 90%;
@media (max-width: $breakpoint-sm) {
width: 100%;
}
&__section {
word-wrap: break-word;
}
} }
.q-dialog .q-card { .q-dialog .q-card {
width: 400px; width: 400px;
@ -150,11 +187,28 @@ onBeforeRouteLeave((to, from, next) => {
opacity: 0; opacity: 0;
background-color: $primary; background-color: $primary;
} }
.vn-row > :nth-child(2) {
margin-left: 0;
}
@media (max-width: $breakpoint-xs) {
.vn-row > :deep(*) {
margin-left: 0;
}
.q-card {
width: 100%;
&__section {
padding: 0;
}
}
}
</style> </style>
<i18n> <i18n>
es: es:
Add note here...: Añadir nota aquí... Add note here...: Añadir nota aquí...
New note: Nueva nota New note: Nueva nota
Save (Enter): Guardar (Intro) Save (Enter): Guardar (Intro)
Observation type: Tipo de observación
</i18n> </i18n>

View File

@ -56,7 +56,7 @@ const props = defineProps({
}, },
offset: { offset: {
type: Number, type: Number,
default: 0, default: undefined,
}, },
skeleton: { skeleton: {
type: Boolean, type: Boolean,
@ -122,7 +122,6 @@ watch(
() => [props.url, props.filter], () => [props.url, props.filter],
([url, filter]) => mounted.value && fetch({ url, filter }) ([url, filter]) => mounted.value && fetch({ url, filter })
); );
const addFilter = async (filter, params) => { const addFilter = async (filter, params) => {
await arrayData.addFilter({ filter, params }); await arrayData.addFilter({ filter, params });
}; };
@ -131,9 +130,8 @@ async function fetch(params) {
useArrayData(props.dataKey, params); useArrayData(props.dataKey, params);
arrayData.reset(['filter.skip', 'skip']); arrayData.reset(['filter.skip', 'skip']);
await arrayData.fetch({ append: false }); await arrayData.fetch({ append: false });
if (!store.hasMoreData) { if (!store.hasMoreData) isLoading.value = false;
isLoading.value = false;
}
emit('onFetch', store.data); emit('onFetch', store.data);
return store.data; return store.data;
} }
@ -224,13 +222,20 @@ defineExpose({ fetch, addFilter, paginate });
v-bind="$attrs" v-bind="$attrs"
> >
<slot name="body" :rows="store.data"></slot> <slot name="body" :rows="store.data"></slot>
<div v-if="isLoading" class="info-row q-pa-md text-center"> <div v-if="isLoading" class="spinner info-row q-pa-md text-center">
<QSpinner color="primary" size="md" /> <QSpinner color="primary" size="md" />
</div> </div>
</QInfiniteScroll> </QInfiniteScroll>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.spinner {
z-index: 1;
align-content: end;
position: absolute;
bottom: 0;
left: 0;
}
.info-row { .info-row {
width: 100%; width: 100%;

View File

@ -1,3 +1,6 @@
<script setup>
defineProps({ wrap: { type: Boolean, default: false } });
</script>
<template> <template>
<div class="vn-row q-gutter-md q-mb-md"> <div class="vn-row q-gutter-md q-mb-md">
<slot /> <slot />
@ -15,7 +18,9 @@
} }
@media screen and (max-width: 800px) { @media screen and (max-width: 800px) {
.vn-row { .vn-row {
flex-direction: column; &:not(.wrap) {
flex-direction: column;
}
} }
} }
</style> </style>

View File

@ -108,6 +108,7 @@ async function search() {
...Object.fromEntries(staticParams), ...Object.fromEntries(staticParams),
search: searchText.value, search: searchText.value,
}, },
...{ filter: props.filter },
}; };
if (props.whereFilter) { if (props.whereFilter) {

View File

@ -0,0 +1,33 @@
<script setup>
import { useRoute } from 'vue-router';
import { defineProps } from 'vue';
const props = defineProps({
routeName: {
type: String,
required: true,
},
entityId: {
type: [String, Number],
required: true,
},
url: {
type: String,
default: null,
},
});
const route = useRoute();
const id = props.entityId;
</script>
<template>
<router-link
v-if="route?.name !== routeName"
:to="{ name: routeName, params: { id: id } }"
class="header link"
:href="url"
>
<QIcon name="open_in_new" color="white" size="sm" />
</router-link>
</template>

View File

@ -1,20 +1,18 @@
<script setup> <script setup>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { useI18n } from 'vue-i18n';
const $props = defineProps({ defineProps({
name: { type: String, default: null }, name: { type: String, default: null },
tag: { type: String, default: null },
workerId: { type: Number, default: null }, workerId: { type: Number, default: null },
defaultName: { type: Boolean, default: false }, defaultName: { type: Boolean, default: false },
}); });
const { t } = useI18n();
</script> </script>
<template> <template>
<slot name="link"> <slot name="link">
<span :class="{ link: $props.workerId }"> <span :class="{ link: workerId }">
{{ $props.defaultName ? $props.name ?? t('globals.system') : $props.name }} {{ defaultName ? name ?? $t('globals.system') : name }}
</span> </span>
</slot> </slot>
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" /> <WorkerDescriptorProxy v-if="workerId" :id="workerId" />
</template> </template>

View File

@ -0,0 +1,55 @@
<script setup>
import { defineProps, ref } from 'vue';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const props = defineProps({
usesMana: {
type: Boolean,
required: true,
},
manaCode: {
type: String,
required: true,
},
manaVal: {
type: String,
default: 'mana',
},
manaLabel: {
type: String,
default: 'Promotion mana',
},
manaClaimVal: {
type: String,
default: 'manaClaim',
},
claimLabel: {
type: String,
default: 'Claim mana',
},
});
const manaCode = ref(props.manaCode);
</script>
<template>
<div class="column q-gutter-y-sm q-mt-sm">
<QRadio
v-model="manaCode"
dense
:val="manaVal"
:label="t(manaLabel)"
:dark="true"
class="q-mb-sm"
/>
<QRadio
v-model="manaCode"
dense
:val="manaClaimVal"
:label="t(claimLabel)"
:dark="true"
class="q-mb-sm"
/>
</div>
</template>

View File

@ -0,0 +1,10 @@
import { toCurrency } from 'src/filters';
export function getTotal(rows, key, opts = {}) {
const { currency, cb } = opts;
const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
return currency
? toCurrency(total, currency == 'default' ? undefined : currency)
: total;
}

View File

@ -16,13 +16,18 @@ export function useAcl() {
state.setAcls(acls); state.setAcls(acls);
} }
function hasAny(model, prop, accessType) { function hasAny(acls) {
const acls = state.getAcls().value[model]; for (const acl of acls) {
if (acls) let { model, props, accessType } = acl;
return ['*', prop].some((key) => { const modelAcls = state.getAcls().value[model];
const acl = acls[key]; Array.isArray(props) || (props = [props]);
return acl && (acl['*'] || acl[accessType]); if (modelAcls)
}); return ['*', ...props].some((key) => {
const acl = modelAcls[key];
return acl && (acl['*'] || acl[accessType]);
});
}
return false;
} }
return { return {

View File

@ -26,7 +26,8 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
const params = JSON.parse(query[searchUrl]); const params = JSON.parse(query[searchUrl]);
const filter = params?.filter && JSON.parse(params?.filter ?? '{}'); const filter = params?.filter && JSON.parse(params?.filter ?? '{}');
delete params.filter; delete params.filter;
store.userParams = { ...params, ...store.userParams };
store.userParams = { ...store.userParams, ...params };
store.userFilter = { ...filter, ...store.userFilter }; store.userFilter = { ...filter, ...store.userFilter };
if (filter?.order) store.order = filter.order; if (filter?.order) store.order = filter.order;
} }
@ -113,7 +114,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
for (const row of response.data) store.data.push(row); for (const row of response.data) store.data.push(row);
} else { } else {
store.data = response.data; store.data = response.data;
if (!document.querySelectorAll('[role="dialog"]').length) if (!document.querySelectorAll('[role="dialog"][aria-modal="true"]').length)
updateRouter && updateStateParams(); updateRouter && updateStateParams();
} }

View File

@ -1,22 +1,26 @@
import { useSession } from './useSession'; import { useSession } from './useSession';
import axios from 'axios'; import axios from 'axios';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
export function usePrintService() { export function usePrintService() {
const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n();
const { getTokenMultimedia } = useSession(); const { getTokenMultimedia } = useSession();
function sendEmail(path, params) { function sendEmail(path, params) {
return axios.post(path, params).then(() => return axios.post(path, params).then(() =>
quasar.notify({ quasar.notify({
message: 'Notification sent', message: t('globals.notificationSent'),
type: 'positive', type: 'positive',
icon: 'check', icon: 'check',
}) })
); );
} }
function openReport(path, params) { function openReport(path, params, isNewTab = '_self') {
if (typeof params === 'string') params = JSON.parse(params);
params = Object.assign( params = Object.assign(
{ {
access_token: getTokenMultimedia(), access_token: getTokenMultimedia(),
@ -25,8 +29,7 @@ export function usePrintService() {
); );
const query = new URLSearchParams(params).toString(); const query = new URLSearchParams(params).toString();
window.open(`api/${path}?${query}`, isNewTab);
window.open(`api/${path}?${query}`);
} }
return { return {

View File

@ -37,6 +37,10 @@ a {
.link { .link {
color: $color-link; color: $color-link;
cursor: pointer; cursor: pointer;
&--white {
color: white;
}
} }
.tx-color-link { .tx-color-link {
@ -264,6 +268,7 @@ input::-webkit-inner-spin-button {
max-width: 400px; max-width: 400px;
} }
} }
.edit-photo-btn { .edit-photo-btn {
position: absolute; position: absolute;
right: 12px; right: 12px;
@ -271,3 +276,19 @@ input::-webkit-inner-spin-button {
z-index: 1; z-index: 1;
cursor: pointer; cursor: pointer;
} }
.subName {
color: var(--vn-label-color);
text-transform: uppercase;
}
.q-date {
&__today {
border: 2px solid $info;
color: $info;
}
}
.no-visible {
visibility: hidden;
}

View File

@ -36,7 +36,6 @@ $color-font-secondary: #777;
.bg-success { .bg-success {
background-color: $positive; background-color: $positive;
} }
.bg-notice { .bg-notice {
background-color: $info; background-color: $info;
} }

View File

@ -4,7 +4,7 @@ export default function toHour(date) {
if (!isValidDate(date)) { if (!isValidDate(date)) {
return '--:--'; return '--:--';
} }
return (new Date(date || '')).toLocaleTimeString([], { return new Date(date || '').toLocaleTimeString([], {
hour: '2-digit', hour: '2-digit',
minute: '2-digit', minute: '2-digit',
}); });

View File

@ -2,6 +2,7 @@ globals:
lang: lang:
es: Spanish es: Spanish
en: English en: English
quantity: Quantity
language: Language language: Language
entity: Entity entity: Entity
user: User user: User
@ -40,6 +41,8 @@ globals:
noChanges: No changes to save noChanges: No changes to save
changesToSave: You have changes pending to save changesToSave: You have changes pending to save
confirmRemove: You are about to delete this row. Are you sure? confirmRemove: You are about to delete this row. Are you sure?
rowWillBeRemoved: This row will be removed
sureToContinue: Are you sure you want to continue?
rowAdded: Row added rowAdded: Row added
rowRemoved: Row removed rowRemoved: Row removed
pleaseWait: Please wait... pleaseWait: Please wait...
@ -47,6 +50,7 @@ globals:
summary: summary:
basicData: Basic data basicData: Basic data
daysOnward: Days onward daysOnward: Days onward
daysAgo: Days ago
today: Today today: Today
yesterday: Yesterday yesterday: Yesterday
dateFormat: en-GB dateFormat: en-GB
@ -84,7 +88,7 @@ globals:
description: Description description: Description
id: Id id: Id
order: Order order: Order
original: Original original: Phys. Doc
file: File file: File
selectFile: Select a file selectFile: Select a file
copyClipboard: Copy on clipboard copyClipboard: Copy on clipboard
@ -96,13 +100,20 @@ globals:
to: To to: To
notes: Notes notes: Notes
refresh: Refresh refresh: Refresh
item: Item
ticket: Ticket
campaign: Campaign
weight: Weight
error: Ups! Something went wrong
recalc: Recalculate
pageTitles: pageTitles:
logIn: Login logIn: Login
addressEdit: Update address
summary: Summary summary: Summary
basicData: Basic data basicData: Basic data
log: Logs log: Logs
parkingList: Parkings list parkingList: Parkings list
agencyList: Agencies list agencyList: Agencies
agency: Agency agency: Agency
workCenters: Work centers workCenters: Work centers
modes: Modes modes: Modes
@ -122,9 +133,11 @@ globals:
notifications: Notifications notifications: Notifications
defaulter: Defaulter defaulter: Defaulter
customerCreate: New customer customerCreate: New customer
createOrder: New order
fiscalData: Fiscal data fiscalData: Fiscal data
billingData: Billing data billingData: Billing data
consignees: Consignees consignees: Consignees
address-create: New address
notes: Notes notes: Notes
credits: Credits credits: Credits
greuges: Greuges greuges: Greuges
@ -148,6 +161,7 @@ globals:
dms: File management dms: File management
entryCreate: New entry entryCreate: New entry
latestBuys: Latest buys latestBuys: Latest buys
reserves: Reserves
tickets: Tickets tickets: Tickets
ticketCreate: New Tickets ticketCreate: New Tickets
boxing: Boxing boxing: Boxing
@ -195,7 +209,7 @@ globals:
roadmap: Roadmap roadmap: Roadmap
stops: Stops stops: Stops
routes: Routes routes: Routes
cmrsList: CMRs list cmrsList: CMRs
RouteList: List RouteList: List
routeCreate: New route routeCreate: New route
RouteRoadmap: Roadmaps RouteRoadmap: Roadmaps
@ -260,6 +274,11 @@ globals:
ticketsMonitor: Tickets monitor ticketsMonitor: Tickets monitor
clientsActionsMonitor: Clients and actions clientsActionsMonitor: Clients and actions
serial: Serial serial: Serial
medical: Mutual
RouteExtendedList: Router
wasteRecalc: Waste recaclulate
operator: Operator
supplier: Supplier
created: Created created: Created
worker: Worker worker: Worker
now: Now now: Now
@ -274,12 +293,30 @@ globals:
createInvoiceIn: Create invoice in createInvoiceIn: Create invoice in
myAccount: My account myAccount: My account
noOne: No one noOne: No one
maxTemperature: Max
minTemperature: Min
params:
id: ID
clientFk: Client id
salesPersonFk: Sales person
warehouseFk: Warehouse
provinceFk: Province
from: From
To: To
stateFk: State
departmentFk: Department
email: Email
SSN: SSN
fi: FI
changePass: Change password
deleteConfirmTitle: Delete selected elements
errors: errors:
statusUnauthorized: Access denied statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred statusInternalServerError: An internal server error has ocurred
statusBadGateway: It seems that the server has fall down statusBadGateway: It seems that the server has fall down
statusGatewayTimeout: Could not contact the server statusGatewayTimeout: Could not contact the server
userConfig: Error fetching user config userConfig: Error fetching user config
updateUserConfig: Error updating user config
tokenConfig: Error fetching token config tokenConfig: Error fetching token config
writeRequest: The requested operation could not be completed writeRequest: The requested operation could not be completed
login: login:
@ -310,135 +347,6 @@ resetPassword:
repeatPassword: Repeat password repeatPassword: Repeat password
passwordNotMatch: Passwords don't match passwordNotMatch: Passwords don't match
passwordChanged: Password changed passwordChanged: Password changed
customer:
list:
phone: Phone
email: Email
customerOrders: Display customer orders
moreOptions: More options
card:
customerList: Customer list
customerId: Claim ID
salesPerson: Sales person
credit: Credit
risk: Risk
securedCredit: Secured credit
payMethod: Pay method
debt: Debt
isFrozen: Customer frozen
hasDebt: Customer has debt
isDisabled: Customer inactive
notChecked: Customer no checked
webAccountInactive: Web account inactive
noWebAccess: Web access is disabled
businessType: Business type
passwordRequirements: 'The password must have at least { length } length characters, {nAlpha} alphabetic characters, {nUpper} capital letters, {nDigits} digits and {nPunct} symbols (Ex: $%&.)\n'
businessTypeFk: Business type
summary:
basicData: Basic data
fiscalAddress: Fiscal address
fiscalData: Fiscal data
billingData: Billing data
consignee: Default consignee
businessData: Business data
financialData: Financial data
customerId: Customer ID
name: Name
contact: Contact
phone: Phone
mobile: Mobile
email: Email
salesPerson: Sales person
contactChannel: Contact channel
socialName: Social name
fiscalId: Fiscal ID
postcode: Postcode
province: Province
country: Country
street: Address
isEqualizated: Is equalizated
isActive: Is active
invoiceByAddress: Invoice by address
verifiedData: Verified data
hasToInvoice: Has to invoice
notifyByEmail: Notify by email
vies: VIES
payMethod: Pay method
bankAccount: Bank account
dueDay: Due day
hasLcr: Has LCR
hasCoreVnl: Has core VNL
hasB2BVnl: Has B2B VNL
addressName: Address name
addressCity: City
addressStreet: Street
username: Username
webAccess: Web access
totalGreuge: Total greuge
mana: Mana
priceIncreasingRate: Price increasing rate
averageInvoiced: Average invoiced
claimRate: Claming rate
risk: Risk
riskInfo: Invoices minus payments plus orders not yet invoiced
credit: Credit
creditInfo: Company's maximum risk
securedCredit: Secured credit
securedCreditInfo: Solunion's maximum risk
balance: Balance
balanceInfo: Invoices minus payments
balanceDue: Balance due
balanceDueInfo: Deviated invoices minus payments
recoverySince: Recovery since
businessType: Business Type
city: City
descriptorInfo: Invoices minus payments plus orders not yet
rating: Rating
recommendCredit: Recommended credit
basicData:
socialName: Fiscal name
businessType: Business type
contact: Contact
youCanSaveMultipleEmails: You can save multiple emails
email: Email
phone: Phone
mobile: Mobile
salesPerson: Sales person
contactChannel: Contact channel
previousClient: Previous client
extendedList:
tableVisibleColumns:
id: Identifier
name: Name
socialName: Social name
fi: Tax number
salesPersonFk: Salesperson
credit: Credit
creditInsurance: Credit insurance
phone: Phone
mobile: Mobile
street: Street
countryFk: Country
provinceFk: Province
city: City
postcode: Postcode
email: Email
created: Created
businessTypeFk: Business type
payMethodFk: Billing data
sageTaxTypeFk: Sage tax type
sageTransactionTypeFk: Sage tr. type
isActive: Active
isVies: Vies
isTaxDataChecked: Verified data
isEqualizated: Is equalizated
isFreezed: Freezed
hasToInvoice: Invoice
hasToInvoiceByAddress: Invoice by address
isToBeMailed: Mailing
hasLcr: Received LCR
hasCoreVnl: VNL core received
hasSepaVnl: VNL B2B received
entry: entry:
list: list:
newEntry: New entry newEntry: New entry
@ -602,6 +510,8 @@ ticket:
warehouse: Warehouse warehouse: Warehouse
customerCard: Customer card customerCard: Customer card
alias: Alias alias: Alias
ticketList: Ticket List
newOrder: New Order
boxing: boxing:
expedition: Expedition expedition: Expedition
item: Item item: Item
@ -623,6 +533,7 @@ ticket:
landed: Landed landed: Landed
consigneePhone: Consignee phone consigneePhone: Consignee phone
consigneeMobile: Consignee mobile consigneeMobile: Consignee mobile
consigneeAddress: Consignee address
clientPhone: Client phone clientPhone: Client phone
clientMobile: Client mobile clientMobile: Client mobile
consignee: Consignee consignee: Consignee
@ -652,6 +563,11 @@ ticket:
weight: Weight weight: Weight
goTo: Go to goTo: Go to
summaryAmount: Summary summaryAmount: Summary
purchaseRequest: Purchase request
service: Service
description: Description
attender: Attender
ok: Ok
create: create:
client: Client client: Client
address: Address address: Address
@ -675,7 +591,6 @@ invoiceOut:
client: Client client: Client
company: Company company: Company
customerCard: Customer card customerCard: Customer card
ticketList: Ticket List
summary: summary:
issued: Issued issued: Issued
created: Created created: Created
@ -752,56 +667,6 @@ parking:
searchBar: searchBar:
info: You can search by parking code info: You can search by parking code
label: Search parking... label: Search parking...
invoiceIn:
list:
ref: Reference
supplier: Supplier
supplierRef: Supplier ref.
serialNumber: Serial number
serial: Serial
file: File
issued: Issued
isBooked: Is booked
awb: AWB
amount: Amount
card:
issued: Issued
amount: Amount
client: Client
company: Company
customerCard: Customer card
ticketList: Ticket List
vat: Vat
dueDay: Due day
intrastat: Intrastat
summary:
supplier: Supplier
supplierRef: Supplier ref.
currency: Currency
docNumber: Doc number
issued: Expedition date
operated: Operation date
bookEntried: Entry date
bookedDate: Booked date
sage: Sage withholding
vat: Undeductible VAT
company: Company
booked: Booked
expense: Expense
taxableBase: Taxable base
rate: Rate
sageVat: Sage vat
sageTransaction: Sage transaction
dueDay: Date
bank: Bank
amount: Amount
foreignValue: Foreign value
dueTotal: Due day
noMatch: Do not match
code: Code
net: Net
stems: Stems
country: Country
order: order:
field: field:
salesPersonFk: Sales Person salesPersonFk: Sales Person
@ -878,6 +743,8 @@ worker:
timeControl: Time control timeControl: Time control
locker: Locker locker: Locker
balance: Balance balance: Balance
medical: Medical
operator: Operator
list: list:
name: Name name: Name
email: Email email: Email
@ -889,6 +756,7 @@ worker:
newWorker: New worker newWorker: New worker
card: card:
workerId: Worker ID workerId: Worker ID
user: User
name: Name name: Name
email: Email email: Email
phone: Phone phone: Phone
@ -949,14 +817,23 @@ worker:
bankEntity: Swift / BIC bankEntity: Swift / BIC
formation: formation:
tableVisibleColumns: tableVisibleColumns:
course: Curso course: Course
startDate: Fecha Inicio startDate: Start date
endDate: Fecha Fin endDate: End date
center: Centro Formación center: Training center
invoice: Factura invoice: Invoice
amount: Importe amount: Amount
remark: Bonficado remark: Remark
hasDiploma: Diploma hasDiploma: Has diploma
medical:
tableVisibleColumns:
date: Date
time: Hour
center: Formation Center
invoice: Invoice
amount: Amount
isFit: Fit
remark: Observations
imageNotFound: Image not found imageNotFound: Image not found
balance: balance:
tableVisibleColumns: tableVisibleColumns:
@ -965,7 +842,29 @@ worker:
debit: Debt debit: Debt
credit: Have credit: Have
concept: Concept concept: Concept
operator:
numberOfWagons: Number of wagons
train: Train
itemPackingType: Item packing type
warehouse: Warehouse
sector: Sector
labeler: Printer
linesLimit: Lines limit
volumeLimit: Volume limit
sizeLimit: Size limit
isOnReservationMode: Reservation mode
machine: Machine
wagon: wagon:
pageTitles:
wagons: Wagons
wagonsList: Wagons List
wagonCreate: Create wagon
wagonEdit: Edit wagon
typesList: Types List
typeCreate: Create type
typeEdit: Edit type
wagonCounter: Trolley counter
wagonTray: Tray List
type: type:
name: Name name: Name
submit: Submit submit: Submit
@ -994,34 +893,7 @@ wagon:
minHeightBetweenTrays: 'The minimum height between trays is ' minHeightBetweenTrays: 'The minimum height between trays is '
maxWagonHeight: 'The maximum height of the wagon is ' maxWagonHeight: 'The maximum height of the wagon is '
uncompleteTrays: There are incomplete trays uncompleteTrays: There are incomplete trays
route:
pageTitles:
agency: Agency List
routes: Routes
cmrsList: CMRs list
RouteList: List
routeCreate: New route
basicData: Basic Data
summary: Summary
RouteRoadmap: Roadmaps
RouteRoadmapCreate: Create roadmap
tickets: Tickets
log: Log
autonomous: Autonomous
cmr:
list:
results: results
cmrFk: CMR id
hasCmrDms: Attached in gestdoc
'true': 'Yes'
'false': 'No'
ticketFk: Ticketd id
routeFk: Route id
country: Country
clientFk: Client id
shipped: Preparation date
viewCmr: View CMR
downloadCmrs: Download CMRs
supplier: supplier:
list: list:
payMethod: Pay method payMethod: Pay method
@ -1037,6 +909,7 @@ supplier:
account: Account account: Account
payMethod: Pay Method payMethod: Pay Method
payDay: Pay Day payDay: Pay Day
country: Country
summary: summary:
responsible: Responsible responsible: Responsible
notes: Notes notes: Notes
@ -1135,6 +1008,7 @@ travel:
warehouseOut: Warehouse out warehouseOut: Warehouse out
totalEntries: Total entries totalEntries: Total entries
totalEntriesTooltip: Total entries totalEntriesTooltip: Total entries
daysOnward: Landed days onwards
summary: summary:
confirmed: Confirmed confirmed: Confirmed
entryId: Entry Id entryId: Entry Id
@ -1210,7 +1084,7 @@ item:
producer: Producer producer: Producer
landed: Landed landed: Landed
fixedPrice: fixedPrice:
itemId: Item ID itemFk: Item ID
groupingPrice: Grouping price groupingPrice: Grouping price
packingPrice: Packing price packingPrice: Packing price
hasMinPrice: Has min price hasMinPrice: Has min price
@ -1287,6 +1161,7 @@ components:
active: Is active active: Is active
visible: Is visible visible: Is visible
floramondo: Is floramondo floramondo: Is floramondo
showBadDates: Show future items
userPanel: userPanel:
copyToken: Token copied to clipboard copyToken: Token copied to clipboard
settings: Settings settings: Settings

View File

@ -3,6 +3,7 @@ globals:
es: Español es: Español
en: Inglés en: Inglés
language: Idioma language: Idioma
quantity: Cantidad
entity: Entidad entity: Entidad
user: Usuario user: Usuario
details: Detalles details: Detalles
@ -39,6 +40,8 @@ globals:
noChanges: Sin cambios que guardar noChanges: Sin cambios que guardar
changesToSave: Tienes cambios pendientes de guardar changesToSave: Tienes cambios pendientes de guardar
confirmRemove: Vas a eliminar este registro. ¿Continuar? confirmRemove: Vas a eliminar este registro. ¿Continuar?
rowWillBeRemoved: Esta linea se eliminará
sureToContinue: ¿Seguro que quieres continuar?
rowAdded: Fila añadida rowAdded: Fila añadida
rowRemoved: Fila eliminada rowRemoved: Fila eliminada
pleaseWait: Por favor espera... pleaseWait: Por favor espera...
@ -46,6 +49,7 @@ globals:
summary: summary:
basicData: Datos básicos basicData: Datos básicos
daysOnward: Días adelante daysOnward: Días adelante
daysAgo: Días atras
today: Hoy today: Hoy
yesterday: Ayer yesterday: Ayer
dateFormat: es-ES dateFormat: es-ES
@ -60,7 +64,7 @@ globals:
shipped: F. envío shipped: F. envío
totalEntries: Ent. totales totalEntries: Ent. totales
amount: Importe amount: Importe
packages: Bultos packages: Embalajes
download: Descargar download: Descargar
downloadPdf: Descargar PDF downloadPdf: Descargar PDF
selectRows: 'Seleccionar las { numberRows } filas(s)' selectRows: 'Seleccionar las { numberRows } filas(s)'
@ -86,7 +90,7 @@ globals:
description: Descripción description: Descripción
id: Id id: Id
order: Orden order: Orden
original: Original original: Doc. física
file: Fichero file: Fichero
selectFile: Seleccione un fichero selectFile: Seleccione un fichero
copyClipboard: Copiar en portapapeles copyClipboard: Copiar en portapapeles
@ -98,13 +102,20 @@ globals:
to: Hasta to: Hasta
notes: Notas notes: Notas
refresh: Actualizar refresh: Actualizar
item: Artículo
ticket: Ticket
campaign: Campaña
weight: Peso
error: ¡Ups! Algo salió mal
recalc: Recalcular
pageTitles: pageTitles:
logIn: Inicio de sesión logIn: Inicio de sesión
addressEdit: Modificar consignatario
summary: Resumen summary: Resumen
basicData: Datos básicos basicData: Datos básicos
log: Historial log: Historial
parkingList: Listado de parkings parkingList: Listado de parkings
agencyList: Listado de agencias agencyList: Agencias
agency: Agencia agency: Agencia
workCenters: Centros de trabajo workCenters: Centros de trabajo
modes: Modos modes: Modos
@ -119,6 +130,7 @@ globals:
inheritedRoles: Roles heredados inheritedRoles: Roles heredados
customers: Clientes customers: Clientes
customerCreate: Nuevo cliente customerCreate: Nuevo cliente
createOrder: Nuevo pedido
list: Listado list: Listado
webPayments: Pagos Web webPayments: Pagos Web
extendedList: Listado extendido extendedList: Listado extendido
@ -128,6 +140,7 @@ globals:
fiscalData: Datos fiscales fiscalData: Datos fiscales
billingData: Forma de pago billingData: Forma de pago
consignees: Consignatarios consignees: Consignatarios
'address-create': Nuevo consignatario
notes: Notas notes: Notas
credits: Créditos credits: Créditos
greuges: Greuges greuges: Greuges
@ -151,6 +164,7 @@ globals:
dms: Gestión documental dms: Gestión documental
entryCreate: Nueva entrada entryCreate: Nueva entrada
latestBuys: Últimas compras latestBuys: Últimas compras
reserves: Reservas
tickets: Tickets tickets: Tickets
ticketCreate: Nuevo ticket ticketCreate: Nuevo ticket
boxing: Encajado boxing: Encajado
@ -199,12 +213,13 @@ globals:
roadmap: Troncales roadmap: Troncales
stops: Paradas stops: Paradas
routes: Rutas routes: Rutas
cmrsList: Listado de CMRs cmrsList: CMRs
RouteList: Listado RouteList: Listado
routeCreate: Nueva ruta routeCreate: Nueva ruta
RouteRoadmap: Troncales RouteRoadmap: Troncales
RouteRoadmapCreate: Crear troncal RouteRoadmapCreate: Crear troncal
autonomous: Autónomos autonomous: Autónomos
RouteExtendedList: Enrutador
suppliers: Proveedores suppliers: Proveedores
supplier: Proveedor supplier: Proveedor
supplierCreate: Nuevo proveedor supplierCreate: Nuevo proveedor
@ -255,7 +270,7 @@ globals:
tracking: Estados tracking: Estados
components: Componentes components: Componentes
pictures: Fotos pictures: Fotos
packages: Bultos packages: Embalajes
ldap: LDAP ldap: LDAP
samba: Samba samba: Samba
twoFactor: Doble factor twoFactor: Doble factor
@ -264,6 +279,10 @@ globals:
ticketsMonitor: Monitor de tickets ticketsMonitor: Monitor de tickets
clientsActionsMonitor: Clientes y acciones clientsActionsMonitor: Clientes y acciones
serial: Facturas por serie serial: Facturas por serie
medical: Mutua
wasteRecalc: Recalcular mermas
operator: Operario
supplier: Proveedor
created: Fecha creación created: Fecha creación
worker: Trabajador worker: Trabajador
now: Ahora now: Ahora
@ -278,12 +297,30 @@ globals:
createInvoiceIn: Crear factura recibida createInvoiceIn: Crear factura recibida
myAccount: Mi cuenta myAccount: Mi cuenta
noOne: Nadie noOne: Nadie
maxTemperature: Máx
minTemperature: Mín
params:
id: Id
clientFk: Id cliente
salesPersonFk: Comercial
warehouseFk: Almacén
provinceFk: Provincia
from: Desde
To: Hasta
stateFk: Estado
departmentFk: Departamento
email: Correo
SSN: NSS
fi: NIF
changePass: Cambiar contraseña
deleteConfirmTitle: Eliminar los elementos seleccionados
errors: errors:
statusUnauthorized: Acceso denegado statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor statusInternalServerError: Ha ocurrido un error interno del servidor
statusBadGateway: Parece ser que el servidor ha caído statusBadGateway: Parece ser que el servidor ha caído
statusGatewayTimeout: No se ha podido contactar con el servidor statusGatewayTimeout: No se ha podido contactar con el servidor
userConfig: Error al obtener configuración de usuario userConfig: Error al obtener configuración de usuario
updateUserConfig: Error al actualizar la configuración de usuario
tokenConfig: Error al obtener configuración de token tokenConfig: Error al obtener configuración de token
writeRequest: No se pudo completar la operación solicitada writeRequest: No se pudo completar la operación solicitada
login: login:
@ -312,134 +349,6 @@ resetPassword:
repeatPassword: Repetir contraseña repeatPassword: Repetir contraseña
passwordNotMatch: Las contraseñas no coinciden passwordNotMatch: Las contraseñas no coinciden
passwordChanged: Contraseña cambiada passwordChanged: Contraseña cambiada
customer:
list:
phone: Teléfono
email: Email
customerOrders: Mostrar órdenes del cliente
moreOptions: Más opciones
card:
customerId: ID cliente
salesPerson: Comercial
credit: Crédito
risk: Riesgo
securedCredit: Crédito asegurado
payMethod: Método de pago
debt: Riesgo
isFrozen: Cliente congelado
hasDebt: Cliente con riesgo
isDisabled: Cliente inactivo
notChecked: Cliente no comprobado
webAccountInactive: Sin acceso web
noWebAccess: El acceso web está desactivado
businessType: Tipo de negocio
passwordRequirements: 'La contraseña debe tener al menos { length } caracteres de longitud, {nAlpha} caracteres alfabéticos, {nUpper} letras mayúsculas, {nDigits} dígitos y {nPunct} símbolos (Ej: $%&.)'
businessTypeFk: Tipo de negocio
summary:
basicData: Datos básicos
fiscalAddress: Dirección fiscal
fiscalData: Datos fiscales
billingData: Datos de facturación
consignee: Consignatario pred.
businessData: Datos comerciales
financialData: Datos financieros
customerId: ID cliente
name: Nombre
contact: Contacto
phone: Teléfono
mobile: Móvil
email: Email
salesPerson: Comercial
contactChannel: Canal de contacto
socialName: Razón social
fiscalId: NIF/CIF
postcode: Código postal
province: Provincia
country: País
street: Calle
isEqualizated: Recargo de equivalencia
isActive: Activo
invoiceByAddress: Facturar por consignatario
verifiedData: Datos verificados
hasToInvoice: Facturar
notifyByEmail: Notificar por email
vies: VIES
payMethod: Método de pago
bankAccount: Cuenta bancaria
dueDay: Día de pago
hasLcr: Recibido LCR
hasCoreVnl: Recibido core VNL
hasB2BVnl: Recibido B2B VNL
addressName: Nombre de la dirección
addressCity: Ciudad
addressStreet: Calle
username: Usuario
webAccess: Acceso web
totalGreuge: Greuge total
mana: Maná
priceIncreasingRate: Ratio de incremento de precio
averageInvoiced: Facturación media
claimRate: Ratio de reclamaciones
risk: Riesgo
riskInfo: Facturas menos recibos mas pedidos sin facturar
credit: Crédito
creditInfo: Riesgo máximo asumido por la empresa
securedCredit: Crédito asegurado
securedCreditInfo: Riesgo máximo asumido por Solunion
balance: Balance
balanceInfo: Facturas menos recibos
balanceDue: Saldo vencido
balanceDueInfo: Facturas fuera de plazo menos recibos
recoverySince: Recobro desde
businessType: Tipo de negocio
city: Población
descriptorInfo: Facturas menos recibos mas pedidos sin facturar
rating: Clasificación
recommendCredit: Crédito recomendado
basicData:
socialName: Nombre fiscal
businessType: Tipo de negocio
contact: Contacto
youCanSaveMultipleEmails: Puede guardar varios correos electrónicos encadenándolos mediante comas sin espacios{','} ejemplo{':'} user{'@'}dominio{'.'}com, user2{'@'}dominio{'.'}com siendo el primer correo electrónico el principal
email: Email
phone: Teléfono
mobile: Móvil
salesPerson: Comercial
contactChannel: Canal de contacto
previousClient: Cliente anterior
extendedList:
tableVisibleColumns:
id: Identificador
name: Nombre
socialName: Razón social
fi: NIF / CIF
salesPersonFk: Comercial
credit: Crédito
creditInsurance: Crédito asegurado
phone: Teléfono
mobile: Móvil
street: Dirección fiscal
countryFk: País
provinceFk: Provincia
city: Población
postcode: Código postal
email: Email
created: Fecha creación
businessTypeFk: Tipo de negocio
payMethodFk: Forma de pago
sageTaxTypeFk: Tipo de impuesto Sage
sageTransactionTypeFk: Tipo tr. sage
isActive: Activo
isVies: Vies
isTaxDataChecked: Datos comprobados
isEqualizated: Recargo de equivalencias
isFreezed: Congelado
hasToInvoice: Factura
hasToInvoiceByAddress: Factura por consigna
isToBeMailed: Env. emails
hasLcr: Recibido LCR
hasCoreVnl: Recibido core VNL
hasSepaVnl: Recibido B2B VNL
entry: entry:
list: list:
newEntry: Nueva entrada newEntry: Nueva entrada
@ -592,7 +501,7 @@ ticket:
tracking: Estados tracking: Estados
components: Componentes components: Componentes
pictures: Fotos pictures: Fotos
packages: Bultos packages: Embalajes
list: list:
nickname: Alias nickname: Alias
state: Estado state: Estado
@ -610,6 +519,8 @@ ticket:
warehouse: Almacén warehouse: Almacén
customerCard: Ficha del cliente customerCard: Ficha del cliente
alias: Alias alias: Alias
ticketList: Listado de tickets
newOrder: Nuevo pedido
boxing: boxing:
expedition: Expedición expedition: Expedición
item: Artículo item: Artículo
@ -631,6 +542,7 @@ ticket:
landed: Entregado landed: Entregado
consigneePhone: Tel. consignatario consigneePhone: Tel. consignatario
consigneeMobile: Móv. consignatario consigneeMobile: Móv. consignatario
consigneeAddress: Dir. consignatario
clientPhone: Tel. cliente clientPhone: Tel. cliente
clientMobile: Móv. cliente clientMobile: Móv. cliente
consignee: Consignatario consignee: Consignatario
@ -660,6 +572,10 @@ ticket:
weight: Peso weight: Peso
goTo: Ir a goTo: Ir a
summaryAmount: Resumen summaryAmount: Resumen
purchaseRequest: Petición de compra
service: Servicio
description: Descripción
attender: Consignatario
create: create:
client: Cliente client: Cliente
address: Dirección address: Dirección
@ -798,54 +714,6 @@ parking:
searchBar: searchBar:
info: Puedes buscar por código de parking info: Puedes buscar por código de parking
label: Buscar parking... label: Buscar parking...
invoiceIn:
list:
ref: Referencia
supplier: Proveedor
supplierRef: Ref. proveedor
serialNumber: Num. serie
shortIssued: F. emisión
serial: Serie
file: Fichero
issued: Fecha emisión
isBooked: Conciliada
awb: AWB
amount: Importe
card:
issued: Fecha emisión
amount: Importe
client: Cliente
company: Empresa
customerCard: Ficha del cliente
ticketList: Listado de tickets
vat: Iva
dueDay: Fecha de vencimiento
summary:
supplier: Proveedor
supplierRef: Ref. proveedor
currency: Divisa
docNumber: Número documento
issued: Fecha de expedición
operated: Fecha operación
bookEntried: Fecha asiento
bookedDate: Fecha contable
sage: Retención sage
vat: Iva no deducible
company: Empresa
booked: Contabilizada
expense: Gasto
taxableBase: Base imp.
rate: Tasa
sageTransaction: Sage transación
dueDay: Fecha
bank: Caja
amount: Importe
foreignValue: Divisa
dueTotal: Vencimiento
code: Código
net: Neto
stems: Tallos
country: País
department: department:
pageTitles: pageTitles:
basicData: Basic data basicData: Basic data
@ -881,6 +749,9 @@ worker:
timeControl: Control de horario timeControl: Control de horario
locker: Taquilla locker: Taquilla
balance: Balance balance: Balance
formation: Formación
medical: Mutua
operator: Operario
list: list:
name: Nombre name: Nombre
email: Email email: Email
@ -892,6 +763,7 @@ worker:
newWorker: Nuevo trabajador newWorker: Nuevo trabajador
card: card:
workerId: ID Trabajador workerId: ID Trabajador
user: Usuario
name: Nombre name: Nombre
email: Correo personal email: Correo personal
phone: Teléfono phone: Teléfono
@ -951,6 +823,15 @@ worker:
amount: Importe amount: Importe
remark: Bonficado remark: Bonficado
hasDiploma: Diploma hasDiploma: Diploma
medical:
tableVisibleColumns:
date: Fecha
time: Hora
center: Centro de Formación
invoice: Factura
amount: Importe
isFit: Apto
remark: Observaciones
imageNotFound: No se ha encontrado la imagen imageNotFound: No se ha encontrado la imagen
balance: balance:
tableVisibleColumns: tableVisibleColumns:
@ -959,7 +840,30 @@ worker:
debit: Debe debit: Debe
credit: Haber credit: Haber
concept: Concepto concept: Concepto
operator:
numberOfWagons: Número de vagones
train: tren
itemPackingType: Tipo de embalaje
warehouse: Almacén
sector: Sector
labeler: Impresora
linesLimit: Líneas límite
volumeLimit: Volumen límite
sizeLimit: Tamaño límite
isOnReservationMode: Modo de reserva
machine: Máquina
wagon: wagon:
pageTitles:
wagons: Vagones
wagonsList: Listado vagones
wagonCreate: Crear tipo
wagonEdit: Editar tipo
typesList: Listado tipos
typeCreate: Crear tipo
typeEdit: Editar tipo
wagonCounter: Contador de carros
wagonTray: Listado bandejas
type: type:
name: Nombre name: Nombre
submit: Guardar submit: Guardar
@ -988,21 +892,6 @@ wagon:
minHeightBetweenTrays: 'La distancia mínima entre bandejas es ' minHeightBetweenTrays: 'La distancia mínima entre bandejas es '
maxWagonHeight: 'La altura máxima del vagón es ' maxWagonHeight: 'La altura máxima del vagón es '
uncompleteTrays: Hay bandejas sin completar uncompleteTrays: Hay bandejas sin completar
route:
cmr:
list:
results: resultados
cmrFk: Id CMR
hasCmrDms: Gestdoc
'true':
'false': 'No'
ticketFk: Id ticket
routeFk: Id ruta
country: País
clientFk: Id cliente
shipped: Fecha preparación
viewCmr: Ver CMR
downloadCmrs: Descargar CMRs
supplier: supplier:
list: list:
payMethod: Método de pago payMethod: Método de pago
@ -1018,6 +907,7 @@ supplier:
account: Cuenta account: Cuenta
payMethod: Método de pago payMethod: Método de pago
payDay: Dia de pago payDay: Dia de pago
country: País
summary: summary:
responsible: Responsable responsible: Responsable
notes: Notas notes: Notas
@ -1116,6 +1006,7 @@ travel:
warehouseOut: Alm.entrada warehouseOut: Alm.entrada
totalEntries: totalEntries:
totalEntriesTooltip: Entradas totales totalEntriesTooltip: Entradas totales
daysOnward: Días de llegada en adelante
summary: summary:
confirmed: Confirmado confirmed: Confirmado
entryId: Id entrada entryId: Id entrada
@ -1191,7 +1082,7 @@ item:
producer: Productor producer: Productor
landed: F. entrega landed: F. entrega
fixedPrice: fixedPrice:
itemId: ID Artículo itemFk: ID Artículo
groupingPrice: Precio grouping groupingPrice: Precio grouping
packingPrice: Precio packing packingPrice: Precio packing
hasMinPrice: Tiene precio mínimo hasMinPrice: Tiene precio mínimo
@ -1266,6 +1157,7 @@ components:
active: Activo active: Activo
visible: Visible visible: Visible
floramondo: Floramondo floramondo: Floramondo
showBadDates: Ver items a futuro
userPanel: userPanel:
copyToken: Token copiado al portapapeles copyToken: Token copiado al portapapeles
settings: Configuración settings: Configuración

View File

@ -5,7 +5,7 @@ const quasar = useQuasar();
</script> </script>
<template> <template>
<QLayout view="hHh LpR fFf"> <QLayout view="hHh LpR fFf" v-shortcut>
<Navbar /> <Navbar />
<RouterView></RouterView> <RouterView></RouterView>
<QFooter v-if="quasar.platform.is.mobile"></QFooter> <QFooter v-if="quasar.platform.is.mobile"></QFooter>

View File

@ -27,15 +27,15 @@ const filter = {
order: 'created DESC', order: 'created DESC',
}; };
const urlPath = 'AccessTokens'; const urlPath = 'VnTokens';
const refresh = () => paginateRef.value.fetch(); const refresh = () => paginateRef.value.fetch();
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } }); const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
const killSession = async (id) => { const killSession = async ({ userId, created }) => {
try { try {
await axios.delete(`${urlPath}/${id}`); await axios.post(`${urlPath}/killSession`, { userId, created });
paginateRef.value.fetch(); paginateRef.value.fetch();
notify(t('Session killed'), 'positive'); notify(t('Session killed'), 'positive');
} catch (error) { } catch (error) {
@ -84,7 +84,7 @@ const killSession = async (id) => {
openConfirmationModal( openConfirmationModal(
t('Session will be killed'), t('Session will be killed'),
t('Are you sure you want to continue?'), t('Are you sure you want to continue?'),
() => killSession(row.id) () => killSession(row)
) )
" "
outline outline

View File

@ -5,11 +5,14 @@ import VnTable from 'components/VnTable/VnTable.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import AccountSummary from './Card/AccountSummary.vue'; import AccountSummary from './Card/AccountSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import AccountFilter from './AccountFilter.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const tableRef = ref(); const tableRef = ref();
const filter = {
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
@ -18,27 +21,31 @@ const columns = computed(() => [
isId: true, isId: true,
field: 'id', field: 'id',
cardVisible: true, cardVisible: true,
columnFilter: {
component: 'select',
name: 'search',
attrs: {
url: 'VnUsers/preview',
fields: ['id', 'name'],
},
},
}, },
{ {
align: 'left', align: 'left',
name: 'username', name: 'roleFk',
label: t('role'),
columnFilter: {
component: 'select',
name: 'roleFk',
attrs: {
url: 'VnRoles',
optionValue: 'id',
optionLabel: 'name',
},
},
format: ({ role }, dashIfEmpty) => dashIfEmpty(role?.name),
},
{
align: 'left',
name: 'nickname',
label: t('Nickname'), label: t('Nickname'),
isTitle: true, isTitle: true,
component: 'input', component: 'input',
columnField: { columnField: {
component: null, component: null,
}, },
columnFilter: {
inWhere: true,
},
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -50,9 +57,6 @@ const columns = computed(() => [
columnField: { columnField: {
component: null, component: null,
}, },
columnFilter: {
inWhere: true,
},
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -104,17 +108,25 @@ const exprBuilder = (param, value) => {
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:label="t('account.search')" :label="t('account.search')"
:info="t('account.searchInfo')" :info="t('account.searchInfo')"
:filter="filter"
/> />
<RightMenu>
<template #right-panel>
<AccountFilter data-key="AccountUsers" />
</template>
</RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="AccountUsers" data-key="AccountUsers"
url="VnUsers/preview" url="VnUsers/preview"
:filter="filter"
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
redirect="account" redirect="account"
:use-model="true" :use-model="true"
:right-search="false"
auto-load
/> />
</template> </template>

View File

@ -2,6 +2,7 @@
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
@ -24,7 +25,7 @@ watch(
<template> <template>
<FormModel <FormModel
ref="formModelRef" ref="formModelRef"
:url="`VnUsers/preview`" url="VnUsers/preview"
:url-update="`VnUsers/${route.params.id}/update-user`" :url-update="`VnUsers/${route.params.id}/update-user`"
:filter="accountFilter" :filter="accountFilter"
model="Accounts" model="Accounts"
@ -43,6 +44,15 @@ watch(
option-value="code" option-value="code"
option-label="code" option-label="code"
/> />
<VnSelectEnum
schema="account"
table="user"
column="twoFactor"
v-model="data.twoFactor"
:label="t('account.card.twoFactor')"
option-value="code"
option-label="code"
/>
</div> </div>
</template> </template>
</FormModel> </FormModel>

View File

@ -10,7 +10,7 @@ const { t } = useI18n();
<VnCard <VnCard
data-key="Account" data-key="Account"
:descriptor="AccountDescriptor" :descriptor="AccountDescriptor"
search-data-key="AccountUsers" search-data-key="AccountList"
:searchbar-props="{ :searchbar-props="{
url: 'VnUsers/preview', url: 'VnUsers/preview',
label: t('account.search'), label: t('account.search'),

View File

@ -4,9 +4,12 @@ import { computed, ref, toRefs } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useVnConfirm } from 'composables/useVnConfirm'; import { useVnConfirm } from 'composables/useVnConfirm';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useAcl } from 'src/composables/useAcl';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import VnConfirm from 'src/components/ui/VnConfirm.vue'; import VnConfirm from 'src/components/ui/VnConfirm.vue';
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
const $props = defineProps({ const $props = defineProps({
hasAccount: { hasAccount: {
type: Boolean, type: Boolean,
@ -62,6 +65,19 @@ async function sync() {
} }
</script> </script>
<template> <template>
<VnChangePassword
ref="changePassRef"
:ask-old-pass="true"
:submit-fn="
async (newPassword, oldPassword) => {
await axios.patch(`Accounts/change-password`, {
userId: entityId,
newPassword,
oldPassword,
});
}
"
/>
<VnConfirm <VnConfirm
v-model="showSyncDialog" v-model="showSyncDialog"
:message="t('account.card.actions.sync.message')" :message="t('account.card.actions.sync.message')"
@ -92,6 +108,17 @@ async function sync() {
/> />
</template> </template>
</VnConfirm> </VnConfirm>
<QItem
v-if="
entityId == account.id &&
useAcl().hasAny([{ model: 'Account', props: '*', accessType: 'WRITE' }])
"
v-ripple
clickable
@click="$refs.changePassRef.show()"
>
<QItemSection>{{ t('globals.changePass') }}</QItemSection>
</QItem>
<QItem <QItem
v-if="account.hasAccount" v-if="account.hasAccount"
v-ripple v-ripple
@ -138,6 +165,5 @@ async function sync() {
<QItem v-ripple clickable @click="showSyncDialog = true"> <QItem v-ripple clickable @click="showSyncDialog = true">
<QItemSection>{{ t('account.card.actions.sync.name') }}</QItemSection> <QItemSection>{{ t('account.card.actions.sync.name') }}</QItemSection>
</QItem> </QItem>
<QSeparator /> <QSeparator />
</template> </template>

View File

@ -169,7 +169,13 @@ onMounted(async () => await getAccountData(false));
<AccountMailAliasCreateForm @on-submit-create-alias="createMailAlias" /> <AccountMailAliasCreateForm @on-submit-create-alias="createMailAlias" />
</QDialog> </QDialog>
<QPageSticky position="bottom-right" :offset="[18, 18]"> <QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn fab icon="add" color="primary" @click="openCreateMailAliasForm()"> <QBtn
fab
icon="add"
color="primary"
@click="openCreateMailAliasForm()"
shortcut="+"
>
<QTooltip>{{ t('warehouses.add') }}</QTooltip> <QTooltip>{{ t('warehouses.add') }}</QTooltip>
</QBtn> </QBtn>
</QPageSticky> </QPageSticky>

View File

@ -19,7 +19,15 @@ watch(
</script> </script>
<template> <template>
<FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" /> <FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" />
<FormModel ref="formModelRef" model="AccountPrivileges" url="VnUsers" auto-load> <FormModel
ref="formModelRef"
model="AccountPrivileges"
url="VnUsers/preview"
:filter="{ where: { id: route.params.id } }"
:url-create="`VnUsers/${route.params.id}/privileges`"
:id="route.params.id"
auto-load
>
<template #form="{ data }"> <template #form="{ data }">
<div class="q-gutter-y-sm"> <div class="q-gutter-y-sm">
<QCheckbox <QCheckbox

View File

@ -142,7 +142,13 @@ const redirectToRoleSummary = (id) =>
<SubRoleCreateForm @on-submit-create-subrole="createSubRole" /> <SubRoleCreateForm @on-submit-create-subrole="createSubRole" />
</QDialog> </QDialog>
<QPageSticky position="bottom-right" :offset="[18, 18]"> <QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn fab icon="add" color="primary" @click="openCreateSubRoleForm()"> <QBtn
fab
icon="add"
shortcut="+"
color="primary"
@click="openCreateSubRoleForm()"
>
<QTooltip>{{ t('warehouses.add') }}</QTooltip> <QTooltip>{{ t('warehouses.add') }}</QTooltip>
</QBtn> </QBtn>
</QPageSticky> </QPageSticky>

View File

@ -35,6 +35,7 @@ account:
willDeactivated: User will be deactivated willDeactivated: User will be deactivated
activated: User activated! activated: User activated!
deactivated: User deactivated! deactivated: User deactivated!
twoFactor: Two factor
actions: actions:
setPassword: Set password setPassword: Set password
disableAccount: disableAccount:

View File

@ -32,6 +32,7 @@ account:
activated: ¡Usuario activado! activated: ¡Usuario activado!
deactivated: ¡Usuario desactivado! deactivated: ¡Usuario desactivado!
newUser: Nuevo usuario newUser: Nuevo usuario
twoFactor: Doble factor
privileges: privileges:
delegate: Puede delegar privilegios delegate: Puede delegar privilegios
actions: actions:

View File

@ -3,58 +3,18 @@ import { ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import axios from 'axios';
import VnAvatar from 'src/components/ui/VnAvatar.vue'; import VnAvatar from 'src/components/ui/VnAvatar.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const claimStates = ref([]);
const claimStatesCopy = ref([]);
const optionsList = ref([]);
const workersOptions = ref([]); const workersOptions = ref([]);
function setClaimStates(data) {
claimStates.value = data;
claimStatesCopy.value = data;
}
async function getEnumValues() {
optionsList.value = [{ id: null, description: t('claim.null') }];
const { data } = await axios.get(`Applications/get-enum-values`, {
params: {
schema: 'vn',
table: 'claim',
column: 'pickup',
},
});
for (let value of data)
optionsList.value.push({ id: value, description: t(`claim.${value}`) });
}
getEnumValues();
const statesFilter = {
options: claimStates,
filterFn: (options, value) => {
const search = value.toLowerCase();
if (value === '') return claimStatesCopy.value;
return options.value.filter((row) => {
const description = row.description.toLowerCase();
return description.indexOf(search) > -1;
});
},
};
</script> </script>
<template> <template>
<FetchData <FetchData
@ -70,7 +30,7 @@ const statesFilter = {
auto-load auto-load
:reload="true" :reload="true"
> >
<template #form="{ data, validate, filter }"> <template #form="{ data, validate }">
<VnRow> <VnRow>
<VnInput <VnInput
v-model="data.client.name" v-model="data.client.name"
@ -101,20 +61,14 @@ const statesFilter = {
/> />
</template> </template>
</VnSelect> </VnSelect>
<QSelect <VnSelect
v-model="data.claimStateFk" v-model="data.claimStateFk"
:options="claimStates" url="ClaimStates"
option-value="id"
option-label="description"
emit-value
:label="t('claim.state')" :label="t('claim.state')"
map-options option-label="description"
use-input
@filter="(value, update) => filter(value, update, statesFilter)"
:rules="validate('claim.claimStateFk')" :rules="validate('claim.claimStateFk')"
:input-debounce="0" :input-debounce="0"
> />
</QSelect>
</VnRow> </VnRow>
<VnRow> <VnRow>
<QInput <QInput
@ -123,16 +77,14 @@ const statesFilter = {
:rules="validate('claim.packages')" :rules="validate('claim.packages')"
type="number" type="number"
/> />
<QSelect <VnSelectEnum
v-model="data.pickup" v-model="data.pickup"
:options="optionsList"
option-value="id"
option-label="description"
emit-value
:label="t('claim.pickup')" :label="t('claim.pickup')"
map-options table="claim"
use-input column="pickup"
:input-debounce="0" option-label="description"
:translation="(value) => t(`claim.${value}`)"
:default-options="[{ id: null, description: t('claim.null') }]"
/> />
</VnRow> </VnRow>
</template> </template>

View File

@ -16,7 +16,6 @@ const claimReasons = ref([]);
const claimResults = ref([]); const claimResults = ref([]);
const claimResponsibles = ref([]); const claimResponsibles = ref([]);
const claimRedeliveries = ref([]); const claimRedeliveries = ref([]);
const workers = ref([]);
const selected = ref([]); const selected = ref([]);
const saveButtonRef = ref(); const saveButtonRef = ref();
@ -82,7 +81,9 @@ const columns = computed(() => [
label: t('Worker'), label: t('Worker'),
field: (row) => row.workerFk, field: (row) => row.workerFk,
sortable: true, sortable: true,
options: workers.value, url: 'Workers/search',
where: { active: 1 },
sortBy: 'name ASC',
model: 'workerFk', model: 'workerFk',
optionValue: 'id', optionValue: 'id',
optionLabel: 'nickname', optionLabel: 'nickname',
@ -129,13 +130,6 @@ const columns = computed(() => [
@on-fetch="(data) => (claimRedeliveries = data)" @on-fetch="(data) => (claimRedeliveries = data)"
auto-load auto-load
/> />
<FetchData
url="Workers/search"
:where="{ active: 1 }"
order="name ASC"
@on-fetch="(data) => (workers = data)"
auto-load
/>
<CrudModel <CrudModel
data-key="ClaimDevelopments" data-key="ClaimDevelopments"
url="ClaimDevelopments" url="ClaimDevelopments"
@ -165,6 +159,9 @@ const columns = computed(() => [
> >
<VnSelect <VnSelect
v-model="row[col.model]" v-model="row[col.model]"
:url="col.url"
:where="col.where"
:sort-by="col.sortBy"
:options="col.options" :options="col.options"
:option-value="col.optionValue" :option-value="col.optionValue"
:option-label="col.optionLabel" :option-label="col.optionLabel"

View File

@ -45,7 +45,7 @@ async function onFetchClaim(data) {
const amount = ref(); const amount = ref();
const amountClaimed = ref(); const amountClaimed = ref();
async function onFetch(rows, newRows) { function onFetch(rows, newRows) {
if (newRows) rows = newRows; if (newRows) rows = newRows;
amount.value = 0; amount.value = 0;
amountClaimed.value = 0; amountClaimed.value = 0;
@ -155,7 +155,7 @@ function showImportDialog() {
async function saveWhenHasChanges() { async function saveWhenHasChanges() {
if (claimLinesForm.value.getChanges().updates) { if (claimLinesForm.value.getChanges().updates) {
await claimLinesForm.value.onSubmit(); await claimLinesForm.value.onSubmit();
await claimLinesForm.value.reload(); onFetch(claimLinesForm.value.formData);
} }
} }
</script> </script>
@ -211,7 +211,7 @@ async function saveWhenHasChanges() {
<template #body-cell-claimed="{ row }"> <template #body-cell-claimed="{ row }">
<QTd auto-width align="right" class="text-primary"> <QTd auto-width align="right" class="text-primary">
<QInput <QInput
v-model="row.quantity" v-model.number="row.quantity"
type="number" type="number"
dense dense
@keyup.enter="saveWhenHasChanges()" @keyup.enter="saveWhenHasChanges()"
@ -266,7 +266,9 @@ async function saveWhenHasChanges() {
<template v-if="column.name === 'claimed'"> <template v-if="column.name === 'claimed'">
<QItemLabel class="text-primary"> <QItemLabel class="text-primary">
<QInput <QInput
v-model="props.row.quantity" v-model.number="
props.row.quantity
"
type="number" type="number"
dense dense
autofocus autofocus
@ -315,7 +317,7 @@ async function saveWhenHasChanges() {
</div> </div>
<QPageSticky position="bottom-right" :offset="[25, 25]"> <QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn fab color="primary" icon="add" @click="showImportDialog()" /> <QBtn fab color="primary" shortcut="+" icon="add" @click="showImportDialog()" />
</QPageSticky> </QPageSticky>
</template> </template>

View File

@ -246,7 +246,13 @@ function onDrag() {
</QDialog> </QDialog>
<QPageSticky position="bottom-right" :offset="[25, 25]"> <QPageSticky position="bottom-right" :offset="[25, 25]">
<label for="fileInput"> <label for="fileInput">
<QBtn fab @click="inputFile.nativeEl.click()" icon="add" color="primary"> <QBtn
fab
@click="inputFile.nativeEl.click()"
shortcut="+"
icon="add"
color="primary"
>
<QInput <QInput
ref="inputFile" ref="inputFile"
type="file" type="file"

View File

@ -94,8 +94,8 @@ const detailsColumns = ref([
{ {
name: 'total', name: 'total',
label: 'claim.total', label: 'claim.total',
field: ({ sale }) => field: (row) =>
toCurrency(sale.quantity * sale.price * ((100 - sale.discount) / 100)), toCurrency(row.quantity * row.sale.price * ((100 - row.sale.discount) / 100)),
sortable: true, sortable: true,
}, },
]); ]);

View File

@ -52,6 +52,7 @@ const columns = computed(() => [
name: 'attendedBy', name: 'attendedBy',
orderBy: 'workerFk', orderBy: 'workerFk',
columnFilter: { columnFilter: {
name: 'attenderFk',
component: 'select', component: 'select',
attrs: { attrs: {
url: 'Workers/activeWithInheritedRole', url: 'Workers/activeWithInheritedRole',

View File

@ -5,15 +5,12 @@ import { useRoute, useRouter } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
import FetchData from 'components/FetchData.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const addresses = ref([]); const addresses = ref([]);
const client = ref(null); const client = ref(null);
const provincesLocation = ref([]);
const addressFilter = { const addressFilter = {
fields: [ fields: [
@ -41,7 +38,13 @@ const addressFilter = {
{ {
relation: 'province', relation: 'province',
scope: { scope: {
fields: ['id', 'name'], fields: ['id', 'name', 'countryFk'],
include: [
{
relation: 'country',
scope: { fields: ['id', 'name'] },
},
],
}, },
}, },
], ],
@ -83,13 +86,6 @@ const getClientData = async (id) => {
} }
}; };
const setProvince = (provinceFk) => {
const result = provincesLocation.value.filter(
(province) => province.id === provinceFk
);
return result[0]?.name || '';
};
const isDefaultAddress = (address) => { const isDefaultAddress = (address) => {
return client?.value?.defaultAddressFk === address.id ? 1 : 0; return client?.value?.defaultAddressFk === address.id ? 1 : 0;
}; };
@ -128,12 +124,6 @@ const toCustomerAddressEdit = (addressId) => {
</script> </script>
<template> <template>
<FetchData
@on-fetch="(data) => (provincesLocation = data)"
auto-load
url="Provinces/location"
/>
<div class="full-width flex justify-center"> <div class="full-width flex justify-center">
<QCard class="card-width q-pa-lg" v-if="addresses.length"> <QCard class="card-width q-pa-lg" v-if="addresses.length">
<QCardSection> <QCardSection>
@ -177,7 +167,14 @@ const toCustomerAddressEdit = (addressId) => {
<div>{{ item.street }}</div> <div>{{ item.street }}</div>
<div> <div>
{{ item.postalCode }} - {{ item.city }}, {{ item.postalCode }} - {{ item.city }},
{{ setProvince(item.provinceFk) }} {{ item.province.name }}
</div>
<div>
{{ item.phone }}
<span v-if="item.mobile"
>,
{{ item.mobile }}
</span>
</div> </div>
<div class="flex"> <div class="flex">
<QCheckbox <QCheckbox
@ -218,7 +215,13 @@ const toCustomerAddressEdit = (addressId) => {
</div> </div>
<QPageSticky :offset="[18, 18]"> <QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerAddressCreate()" color="primary" fab icon="add" /> <QBtn
@click.stop="toCustomerAddressCreate()"
color="primary"
fab
icon="add"
shortcut="+"
/>
<QTooltip> <QTooltip>
{{ t('New consignee') }} {{ t('New consignee') }}
</QTooltip> </QTooltip>

View File

@ -2,32 +2,30 @@
import { computed, onBeforeMount, ref } from 'vue'; import { computed, onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useRole } from 'src/composables/useRole'; import { useAcl } from 'src/composables/useAcl';
import axios from 'axios'; import axios from 'axios';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import FetchData from 'components/FetchData.vue';
import { toCurrency, toDate, toDateHourMin } from 'src/filters'; import { toCurrency, toDate, toDateHourMin } from 'src/filters';
import { useState } from 'composables/useState'; import { useState } from 'composables/useState';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { usePrintService } from 'composables/usePrintService'; import { usePrintService } from 'composables/usePrintService';
import { useSession } from 'composables/useSession';
import { useVnConfirm } from 'composables/useVnConfirm'; import { useVnConfirm } from 'composables/useVnConfirm';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnInput from 'components/common/VnInput.vue'; import VnInput from 'components/common/VnInput.vue';
import VnSubToolbar from 'components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'components/ui/VnSubToolbar.vue';
import VnFilter from 'components/VnTable/VnFilter.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue'; import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const { sendEmail } = usePrintService(); const { sendEmail, openReport } = usePrintService();
const { t } = useI18n(); const { t } = useI18n();
const { hasAny } = useRole(); const { hasAny } = useAcl();
const currentBalance = ref({});
const session = useSession();
const tokenMultimedia = session.getTokenMultimedia();
const quasar = useQuasar(); const quasar = useQuasar();
const route = useRoute(); const route = useRoute();
const state = useState(); const state = useState();
@ -35,9 +33,9 @@ const stateStore = useStateStore();
const user = state.getUser(); const user = state.getUser();
const clientRisk = ref([]); const clientRisk = ref([]);
const companies = ref([]);
const tableRef = ref(); const tableRef = ref();
const companyId = ref(); const companyId = ref(user.value.companyFk);
const companyLastId = ref(user.value.companyFk);
const balances = ref([]); const balances = ref([]);
const vnFilterRef = ref({}); const vnFilterRef = ref({});
const filter = computed(() => { const filter = computed(() => {
@ -47,43 +45,16 @@ const filter = computed(() => {
}; };
}); });
const companyFilterColumn = {
align: 'left',
name: 'companyId',
label: t('Company'),
component: 'select',
attrs: {
url: 'Companies',
optionLabel: 'code',
sortBy: 'code',
limit: 0,
},
columnFilter: {
event: {
remove: () => (companyId.value = null),
'update:modelValue': (newCompanyFk) => {
if (!newCompanyFk) return;
vnFilterRef.value.addFilter(newCompanyFk);
companyLastId.value = newCompanyFk;
},
blur: () =>
!companyId.value &&
(companyId.value = companyLastId.value ?? user.value.companyFk),
},
},
visible: false,
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'right',
name: 'payed', name: 'payed',
label: t('Date'), label: t('Date'),
format: ({ payed }) => toDate(payed), format: ({ payed }) => toDate(payed),
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'right',
name: 'created', name: 'created',
label: t('Creation date'), label: t('Creation date'),
format: ({ created }) => toDateHourMin(created), format: ({ created }) => toDateHourMin(created),
@ -91,16 +62,10 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'workerFk',
label: t('Employee'), label: t('Employee'),
columnField: { columnField: {
component: 'userLink', component: 'userLink',
attrs: ({ row }) => { attrs: ({ row }) => ({ workerId: row.workerFk, name: row.userName }),
return {
workerId: row.workerFk,
name: row.userName,
};
},
}, },
cardVisible: true, cardVisible: true,
}, },
@ -125,14 +90,14 @@ const columns = computed(() => [
isId: true, isId: true,
}, },
{ {
align: 'right', align: 'left',
name: 'credit', name: 'credit',
label: t('Havings'), label: t('Havings'),
format: ({ credit }) => credit && toCurrency(credit), format: ({ credit }) => credit && toCurrency(credit),
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'right', align: 'left',
name: 'balance', name: 'balance',
label: t('Balance'), label: t('Balance'),
format: ({ balance }) => toCurrency(balance), format: ({ balance }) => toCurrency(balance),
@ -171,41 +136,20 @@ const columns = computed(() => [
onBeforeMount(() => { onBeforeMount(() => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
companyId.value = user.value.companyFk;
}); });
async function getClientRisk() { async function getCurrentBalance(data) {
const { data } = await axios.get(`clientRisks`, { currentBalance.value[companyId.value] = {
params: { amount: 0,
filter: JSON.stringify({ code: companies.value.find((c) => c.id === companyId.value)?.code,
include: { relation: 'company', scope: { fields: ['code'] } }, };
where: { clientFk: route.params.id, companyFk: user.value.companyFk },
}),
},
});
clientRisk.value = data;
return clientRisk.value;
}
async function getCurrentBalance() { for (const balance of data) {
const currentBalance = (await getClientRisk()).find((balance) => { currentBalance.value[balance.companyFk] = {
return balance.companyFk === companyId.value; code: balance.company.code,
}); amount: balance.amount,
return currentBalance && currentBalance.amount; };
}
async function onFetch(data) {
balances.value = [];
for (const [index, balance] of data.entries()) {
if (index === 0) {
balance.balance = await getCurrentBalance();
continue;
}
const previousBalance = data[index - 1];
balance.balance =
previousBalance?.balance - (previousBalance?.debit - previousBalance?.credit);
} }
balances.value = data;
} }
const showNewPaymentDialog = () => { const showNewPaymentDialog = () => {
@ -220,31 +164,48 @@ const showNewPaymentDialog = () => {
}; };
const showBalancePdf = ({ id }) => { const showBalancePdf = ({ id }) => {
const url = `api/InvoiceOuts/${id}/download?access_token=${tokenMultimedia}`; openReport(`InvoiceOuts/${id}/download`, {}, '_blank');
window.open(url, '_blank');
}; };
</script> </script>
<template> <template>
<FetchData
url="Companies"
auto-load
@on-fetch="(data) => (companies = data)"
></FetchData>
<FetchData
v-if="companies.length > 0"
url="clientRisks"
:filter="{
include: { relation: 'company', scope: { fields: ['code'] } },
where: { clientFk: route.params.id },
}"
auto-load
@on-fetch="getCurrentBalance"
></FetchData>
<VnSubToolbar class="q-mb-md"> <VnSubToolbar class="q-mb-md">
<template #st-data> <template #st-data>
<div class="column justify-center q-px-md q-py-sm"> <div class="column justify-center q-px-md q-py-sm">
<span class="text-bold">{{ t('Total by company') }}</span> <span class="text-bold">{{ t('Total by company') }}</span>
<div class="row justify-center" v-if="clientRisk?.length"> <div class="row justify-center">
{{ clientRisk[0].company.code }}: {{ currentBalance[companyId]?.code }}:
{{ toCurrency(clientRisk[0].amount) }} {{ toCurrency(currentBalance[companyId]?.amount) }}
</div> </div>
</div> </div>
</template> </template>
<template #st-actions> <template #st-actions>
<div> <div>
<VnFilter <VnSelect
:label="t('Company')"
ref="vnFilterRef" ref="vnFilterRef"
v-model="companyId" v-model="companyId"
data-key="CustomerBalance" data-key="CustomerBalance"
:column="companyFilterColumn" :options="companies"
search-url="balance" option-label="code"
/> option-value="id"
></VnSelect>
</div> </div>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
@ -258,7 +219,7 @@ const showBalancePdf = ({ id }) => {
:right-search="false" :right-search="false"
:is-editable="false" :is-editable="false"
:column-search="false" :column-search="false"
@on-fetch="onFetch" :disable-option="{ card: true }"
auto-load auto-load
> >
<template #column-balance="{ rowIndex }"> <template #column-balance="{ rowIndex }">
@ -266,7 +227,7 @@ const showBalancePdf = ({ id }) => {
</template> </template>
<template #column-description="{ row }"> <template #column-description="{ row }">
<div class="link" v-if="row.isInvoice"> <div class="link" v-if="row.isInvoice">
{{ row.description }} {{ t('bill', { ref: row.description }) }}
<InvoiceOutDescriptorProxy :id="row.description" /> <InvoiceOutDescriptorProxy :id="row.description" />
</div> </div>
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description"> <span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
@ -284,7 +245,9 @@ const showBalancePdf = ({ id }) => {
> >
<VnInput <VnInput
v-model="scope.value" v-model="scope.value"
:disable="!hasAny(['administrative'])" :disable="
!hasAny([{ model: 'Receipt', props: '*', accessType: 'WRITE' }])
"
@keypress.enter="scope.set" @keypress.enter="scope.set"
autofocus autofocus
/> />
@ -292,7 +255,13 @@ const showBalancePdf = ({ id }) => {
</template> </template>
</VnTable> </VnTable>
<QPageSticky :offset="[18, 18]" style="z-index: 2"> <QPageSticky :offset="[18, 18]" style="z-index: 2">
<QBtn @click.stop="showNewPaymentDialog()" color="primary" fab icon="add" /> <QBtn
@click.stop="showNewPaymentDialog()"
color="primary"
fab
icon="add"
shortcut="+"
/>
<QTooltip> <QTooltip>
{{ t('New payment') }} {{ t('New payment') }}
</QTooltip> </QTooltip>

View File

@ -16,6 +16,20 @@ const { t } = useI18n();
const businessTypes = ref([]); const businessTypes = ref([]);
const contactChannels = ref([]); const contactChannels = ref([]);
const title = ref(); const title = ref();
const handleSalesModelValue = (val) => ({
or: [
{ id: val },
{ name: val },
{ nickname: { like: '%' + val + '%' } },
{ code: { like: `${val}%` } },
],
});
const exprBuilder = (param, value) => {
return {
and: [{ active: { neq: false } }, handleSalesModelValue(value)],
};
};
</script> </script>
<template> <template>
<FetchData <FetchData
@ -25,6 +39,7 @@ const title = ref();
/> />
<FetchData <FetchData
url="BusinessTypes" url="BusinessTypes"
:filter="{ fields: ['code', 'description'], order: 'description ASC ' }"
@on-fetch="(data) => (businessTypes = data)" @on-fetch="(data) => (businessTypes = data)"
auto-load auto-load
/> />
@ -33,12 +48,12 @@ const title = ref();
<VnRow> <VnRow>
<VnInput <VnInput
:label="t('globals.name')" :label="t('globals.name')"
:rules="validate('client.socialName')" :rules="validate('client.name')"
autofocus autofocus
clearable clearable
v-model="data.name" v-model="data.name"
/> />
<QSelect <VnSelect
:input-debounce="0" :input-debounce="0"
:label="t('customer.basicData.businessType')" :label="t('customer.basicData.businessType')"
:options="businessTypes" :options="businessTypes"
@ -89,20 +104,20 @@ const title = ref();
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
url="Workers/activeWithInheritedRole" url="Workers/search"
:filter="{ where: { role: 'salesPerson' } }"
option-filter="firstName"
v-model="data.salesPersonFk" v-model="data.salesPersonFk"
:label="t('customer.basicData.salesPerson')" :label="t('customer.basicData.salesPerson')"
:params="{
departmentCodes: ['VT', 'shopping'],
}"
:fields="['id', 'nickname']"
sort-by="nickname ASC"
option-label="nickname"
option-value="id"
:rules="validate('client.salesPersonFk')" :rules="validate('client.salesPersonFk')"
:use-like="false" :expr-builder="exprBuilder"
:emit-value="false" emit-value
@update:model-value=" auto-load
(val) => {
title = val?.nickname;
data.salesPersonFk = val?.id;
}
"
> >
<template #prepend> <template #prepend>
<VnAvatar <VnAvatar
@ -111,8 +126,19 @@ const title = ref();
:title="title" :title="title"
/> />
</template> </template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption
>{{ scope.opt?.nickname }},
{{ scope.opt?.code }}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelect> </VnSelect>
<QSelect <VnSelect
v-model="data.contactChannelFk" v-model="data.contactChannelFk"
:options="contactChannels" :options="contactChannels"
option-value="id" option-value="id"
@ -125,7 +151,8 @@ const title = ref();
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
<QSelect <VnSelect
url="Clients"
:input-debounce="0" :input-debounce="0"
:label="t('customer.basicData.previousClient')" :label="t('customer.basicData.previousClient')"
:options="clients" :options="clients"
@ -134,7 +161,9 @@ const title = ref();
map-options map-options
option-label="name" option-label="name"
option-value="id" option-value="id"
sort-by="name ASC"
v-model="data.transferorFk" v-model="data.transferorFk"
:fields="['id', 'name']"
> >
<template #append> <template #append>
<QIcon name="info" class="cursor-pointer"> <QIcon name="info" class="cursor-pointer">
@ -145,7 +174,7 @@ const title = ref();
}}</QTooltip> }}</QTooltip>
</QIcon> </QIcon>
</template> </template>
</QSelect> </VnSelect>
</VnRow> </VnRow>
</template> </template>
</FormModel> </FormModel>

View File

@ -3,7 +3,6 @@ import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
@ -14,8 +13,6 @@ import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const payMethods = ref([]);
const bankEntitiesOptions = ref([]);
const bankEntitiesRef = ref(null); const bankEntitiesRef = ref(null);
const filter = { const filter = {
@ -31,15 +28,6 @@ const getBankEntities = (data, formData) => {
</script> </script>
<template> <template>
<fetch-data @on-fetch="(data) => (payMethods = data)" auto-load url="PayMethods" />
<fetch-data
ref="bankEntitiesRef"
@on-fetch="(data) => (bankEntitiesOptions = data)"
:filter="filter"
auto-load
url="BankEntities"
/>
<FormModel <FormModel
:url-update="`Clients/${route.params.id}`" :url-update="`Clients/${route.params.id}`"
:url="`Clients/${route.params.id}/getCard`" :url="`Clients/${route.params.id}/getCard`"
@ -49,8 +37,9 @@ const getBankEntities = (data, formData) => {
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow> <VnRow>
<VnSelect <VnSelect
auto-load
url="PayMethods"
:label="t('Billing data')" :label="t('Billing data')"
:options="payMethods"
hide-selected hide-selected
option-label="name" option-label="name"
option-value="id" option-value="id"
@ -69,8 +58,11 @@ const getBankEntities = (data, formData) => {
</VnInput> </VnInput>
<VnSelectDialog <VnSelectDialog
:label="t('Swift / BIC')" :label="t('Swift / BIC')"
:options="bankEntitiesOptions" ref="bankEntitiesRef"
:roles-allowed-to-create="['salesAssistant', 'hr']" :filter="filter"
auto-load
url="BankEntities"
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
:rules="validate('Worker.bankEntity')" :rules="validate('Worker.bankEntity')"
hide-selected hide-selected
option-label="name" option-label="name"
@ -85,9 +77,8 @@ const getBankEntities = (data, formData) => {
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt"> <QItemSection v-if="scope.opt">
<QItemLabel <QItemLabel>{{ scope.opt.bic }} </QItemLabel>
>{{ scope.opt.bic }} {{ scope.opt.name }}</QItemLabel <QItemLabel caption> {{ scope.opt.name }}</QItemLabel>
>
</QItemSection> </QItemSection>
</QItem> </QItem>
</template> </template>

View File

@ -1,17 +1,23 @@
<script setup> <script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import CustomerDescriptor from './CustomerDescriptor.vue'; import CustomerDescriptor from './CustomerDescriptor.vue';
import CustomerFilter from '../CustomerFilter.vue'; import CustomerFilter from '../CustomerFilter.vue';
const route = useRoute();
const routeName = computed(() => route.name);
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Client" data-key="Client"
base-url="Clients" base-url="Clients"
:descriptor="CustomerDescriptor" :descriptor="CustomerDescriptor"
:filter-panel="CustomerFilter" :filter-panel="routeName != 'CustomerConsumption' && CustomerFilter"
search-data-key="CustomerList" search-data-key="CustomerList"
:searchbar-props="{ :searchbar-props="{
url: 'Clients/extendedListFilter', url: 'Clients/filter',
label: 'Search customer', label: 'Search customer',
info: 'You can search by customer id or name', info: 'You can search by customer id or name',
}" }"

View File

@ -1,15 +1,241 @@
<script setup> <script setup>
import CustomerConsumptionFilter from './CustomerConsumptionFilter.vue'; import { ref, computed, onBeforeMount } from 'vue';
import { useStateStore } from 'src/stores/useStateStore'; import axios from 'axios';
import { useI18n } from 'vue-i18n';
import { toDate } from 'src/filters/index';
import { useRoute } from 'vue-router';
import VnTable from 'components/VnTable/VnTable.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import { useArrayData } from 'src/composables/useArrayData';
import { usePrintService } from 'src/composables/usePrintService';
import { useVnConfirm } from 'src/composables/useVnConfirm';
const { openConfirmationModal } = useVnConfirm();
const { openReport, sendEmail } = usePrintService();
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
const arrayData = useArrayData('Client');
const { t } = useI18n();
const route = useRoute();
const campaignList = ref();
const showActionBtns = computed(() => handleQueryParams());
function handleQueryParams() {
const query = getQueryParams();
return query.from && query.to;
}
const columns = computed(() => [
{
name: 'search',
align: 'left',
label: t('globals.search'),
visible: false,
},
{
name: 'itemFk',
align: 'left',
label: t('globals.item'),
columnClass: 'shrink',
cardVisible: true,
columnFilter: {
name: 'itemId',
},
},
{
name: 'ticketFk',
align: 'left',
label: t('globals.ticket'),
cardVisible: true,
columnFilter: {
inWhere: true,
},
},
{
name: 'shipped',
align: 'left',
label: t('globals.shipped'),
format: ({ shipped }) => toDate(shipped),
columnFilter: false,
cardVisible: true,
},
{
name: 'description',
align: 'left',
label: t('globals.description'),
columnClass: 'expand',
columnFilter: {
inWhere: true,
},
},
{
name: 'quantity',
label: t('globals.quantity'),
cardVisible: true,
columnFilter: {
inWhere: true,
},
},
{
name: 'grouped',
label: t('Group by items'),
component: 'checkbox',
visible: false,
orderBy: false,
},
]);
onBeforeMount(async () => {
campaignList.value = (await axios('Campaigns/latest')).data;
});
function getQueryParams() {
return JSON.parse(route.query.consumption ?? '{}');
}
function getParams() {
const query = getQueryParams();
return {
from: query.from,
to: query.to,
recipient: arrayData.store.data.email,
recipientId: arrayData.store.data.id,
};
}
const userParams = computed(() => {
const minDate = Date.vnNew();
minDate.setHours(0, 0, 0, 0);
minDate.setMonth(minDate.getMonth() - 2);
const maxDate = Date.vnNew();
maxDate.setHours(23, 59, 59, 59);
return {
campaign: campaignList.value[0]?.id,
from: minDate,
to: maxDate,
};
});
const openReportPdf = () => {
openReport(`Clients/${route.params.id}/campaign-metrics-pdf`, getParams());
};
const openSendEmailDialog = async () => {
openConfirmationModal(
t('The consumption report will be sent'),
t('Please, confirm'),
() => sendCampaignMetricsEmail({ address: arrayData.store.data.email })
);
};
const sendCampaignMetricsEmail = ({ address }) => {
sendEmail(`Clients/${route.params.id}/campaign-metrics-email`, {
recipient: address,
...getParams(),
});
};
</script> </script>
<template> <template>
<Teleport to="#right-panel" v-if="useStateStore().isHeaderMounted()"> <VnTable
<CustomerConsumptionFilter data-key="CustomerConsumption" /> v-if="campaignList"
</Teleport> data-key="CustomerConsumption"
url="Clients/consumption"
:order="['itemTypeFk', 'itemName', 'itemSize', 'description']"
:columns="columns"
search-url="consumption"
:filter="filter"
:user-params="userParams"
:default-remove="false"
:default-reset="false"
:default-save="false"
:has-sub-toolbar="true"
auto-load
>
<template #moreBeforeActions>
<QBtn
color="primary"
flat
icon-right="picture_as_pdf"
@click="openReportPdf()"
:disabled="!showActionBtns"
>
<QTooltip>{{ t('globals.downloadPdf') }}</QTooltip>
</QBtn>
<QBtn
color="primary"
flat
icon-right="email"
@click="openSendEmailDialog()"
:disabled="!showActionBtns"
>
<QTooltip>{{ t('Send to email') }}</QTooltip>
</QBtn>
</template>
<template #column-itemFk="{ row }">
<span class="link">
{{ row.itemFk }}
<ItemDescriptorProxy :id="row.itemFk" />
</span>
</template>
<template #column-ticketFk="{ row }">
<span class="link">
{{ row.ticketFk }}
<TicketDescriptorProxy :id="row.ticketFk" />
</span>
</template>
<template #column-description="{ row }">
<div>{{ row.concept }}</div>
<div v-if="row.subName" class="subName">
{{ row.subName }}
</div>
<FetchedTags :item="row" :max-length="3" />
</template>
<template #moreFilterPanel="{ params }">
<div class="column no-wrap flex-center q-gutter-y-md q-mt-xs q-pr-xl">
<VnSelect
v-model="params.campaign"
:options="campaignList"
:label="t('globals.campaign')"
:filled="true"
class="q-px-sm q-pt-none fit"
dense
option-label="code"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt?.code }}
{{
new Date(scope.opt?.dated).getFullYear()
}}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnInputDate
v-model="params.from"
:label="t('globals.from')"
:filled="true"
class="q-px-xs q-pt-none fit"
dense
/>
<VnInputDate
v-model="params.to"
:label="t('globals.to')"
:filled="true"
class="q-px-xs q-pt-none fit"
dense
/>
</div>
</template>
</VnTable>
</template> </template>
<i18n> <i18n>
es: es:
Enter a new search: Introduce una nueva búsqueda Enter a new search: Introduce una nueva búsqueda
Group by items: Agrupar por artículos
</i18n> </i18n>

View File

@ -5,6 +5,8 @@ import VnInput from 'src/components/common/VnInput.vue';
import { QItem } from 'quasar'; import { QItem } from 'quasar';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import { QItemSection } from 'quasar'; import { QItemSection } from 'quasar';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import { toDate } from 'src/filters';
const { t } = useI18n(); const { t } = useI18n();
defineProps({ dataKey: { type: String, required: true } }); defineProps({ dataKey: { type: String, required: true } });
@ -33,6 +35,8 @@ defineProps({ dataKey: { type: String, required: true } });
<VnSelect <VnSelect
v-model="params.buyerId" v-model="params.buyerId"
url="TicketRequests/getItemTypeWorker" url="TicketRequests/getItemTypeWorker"
:fields="['id', 'nickname']"
sort-by="nickname ASC"
:label="t('params.buyer')" :label="t('params.buyer')"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
@ -43,35 +47,97 @@ defineProps({ dataKey: { type: String, required: true } });
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<!--It's required to include the relation category !! There's 413 records in production-->
<QItemSection> <QItemSection>
<VnSelect <VnSelect
v-model="params.typeId" v-model="params.typeId"
url="ItemTypes" url="ItemTypes"
:label="t('params.type')" :include="['category']"
:fields="['id', 'name', 'categoryFk']"
sort-by="name ASC"
:label="t('params.typeId')"
option-label="name" option-label="name"
option-value="id" option-value="id"
dense dense
outlined outlined
rounded rounded
> >
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>{{
scope.opt?.category?.name
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect> </VnSelect>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnSelect <VnSelect
v-model="params.categoryId"
url="ItemCategories" url="ItemCategories"
:label="t('params.category')" :fields="['id', 'name']"
sort-by="name ASC"
:label="t('params.categoryId')"
option-label="name" option-label="name"
option-value="id" option-value="id"
v-model="params.categoryId"
dense dense
outlined outlined
rounded rounded
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem>
<QItemSection>
<VnSelect
v-model="params.campaignId"
url="Campaigns/latest"
sort-by="dated DESC"
:label="t('params.campaignId')"
option-label="code"
option-value="id"
dense
outlined
rounded
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{
t(`params.${scope.opt?.code}`)
}}</QItemLabel>
<QItemLabel caption>{{
toDate(scope.opt.dated)
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate
:label="t('params.from')"
v-model="params.from"
@update:model-value="searchFn()"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate
:label="t('params.to')"
v-model="params.to"
@update:model-value="searchFn()"
is-outlined
/>
</QItemSection>
</QItem>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>
@ -82,10 +148,30 @@ en:
buyer: Buyer buyer: Buyer
type: Type type: Type
category: Category category: Category
itemId: Item id
buyerId: Buyer
typeId: Type
categoryId: Category
from: From
to: To
campaignId: Campaña
valentinesDay: Valentine's Day
mothersDay: Mother's Day
allSaints: All Saints' Day
es: es:
params: params:
item: Id artículo item: Id artículo
buyer: Comprador buyer: Comprador
type: Tipo type: Tipo
category: Categoría category: Categoría
itemId: Id Artículo
buyerId: Comprador
typeId: Tipo
categoryId: Reino
from: Desde
to: Hasta
campaignId: Campaña
valentinesDay: Día de San Valentín
mothersDay: Día de la Madre
allSaints: Día de Todos los Santos
</i18n> </i18n>

View File

@ -56,17 +56,18 @@ const customerContactsRef = ref(null);
</div> </div>
</VnRow> </VnRow>
<VnRow> <VnRow>
<QIcon <QBtn
@click="customerContactsRef.insert()" @click="customerContactsRef.insert()"
class="cursor-pointer" class="cursor-pointer"
color="primary" color="primary"
name="add" flat
size="sm" icon="add"
shortcut="+"
> >
<QTooltip> <QTooltip>
{{ t('Add contact') }} {{ t('Add contact') }}
</QTooltip> </QTooltip>
</QIcon> </QBtn>
</VnRow> </VnRow>
</QCard> </QCard>
</template> </template>

View File

@ -53,6 +53,8 @@ const openDialog = (item) => {
promise: updateData, promise: updateData,
}, },
}); });
updateData();
showQPageSticky.value = true;
}; };
const openViewCredit = (credit) => { const openViewCredit = (credit) => {
@ -193,6 +195,7 @@ const updateData = () => {
color="primary" color="primary"
fab fab
icon="add" icon="add"
shortcut="+"
/> />
<QTooltip> <QTooltip>
{{ t('New contract') }} {{ t('New contract') }}

View File

@ -1,23 +1,17 @@
<script setup> <script setup>
import { computed, ref, watch } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { QBtn } from 'quasar';
import { toCurrency, toDateHourMin } from 'src/filters'; import { toCurrency, toDateHourMin } from 'src/filters';
import VnTable from 'src/components/VnTable/VnTable.vue';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const clientInformasRef = ref(null); const tableRef = ref();
const rows = ref([]);
const filter = { const filter = {
include: [ include: [
@ -37,10 +31,9 @@ const filter = {
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
field: 'created', format: ({ created }) => toDateHourMin(created),
format: (value) => toDateHourMin(value),
label: t('Since'), label: t('Since'),
name: 'since', name: 'created',
}, },
{ {
align: 'left', align: 'left',
@ -51,66 +44,56 @@ const columns = computed(() => [
{ {
align: 'right', align: 'right',
field: 'rating', field: 'rating',
label: t('Rating'), label: t('customer.summary.rating'),
name: 'rating', name: 'rating',
create: true,
columnCreate: {
component: 'number',
autofocus: true,
},
}, },
{ {
align: 'right', align: 'right',
field: 'recommendedCredit', field: 'recommendedCredit',
format: (value) => toCurrency(value), format: ({ recommendedCredit }) => toCurrency(recommendedCredit),
label: t('Recommended credit'), label: t('customer.summary.recommendCredit'),
name: 'recommendedCredit', name: 'recommendedCredit',
create: true,
columnCreate: {
component: 'number',
autofocus: true,
},
}, },
]); ]);
watch(
() => route.params.id,
(newValue) => {
if (!newValue) return;
filter.where.clientFk = newValue;
clientInformasRef.value?.fetch();
}
);
</script> </script>
<template> <template>
<FetchData <VnTable
:filter="filter" ref="tableRef"
@on-fetch="(data) => (rows = data)" data-key="ClientInformas"
auto-load
ref="clientInformasRef"
url="ClientInformas" url="ClientInformas"
/> :filter="filter"
:order="['created DESC']"
<FormModel :columns="columns"
:form-initial-data="{}" :right-search="false"
:observe-form-changes="false" :is-editable="false"
:url-create="`Clients/${route.params.id}/setRating`" :use-model="true"
:column-search="false"
:disable-option="{ card: true }"
auto-load
:create="{
urlCreate: `Clients/${route.params.id}/setRating`,
title: 'Create rating',
onDataSaved: () => tableRef.reload(),
formInitialData: {},
}"
> >
<template #form="{ data }"> <template #column-employee="{ row }">
<VnRow> <span class="link">{{ row.worker.user.nickname }}</span>
<div class="col"> <WorkerDescriptorProxy :id="row.worker.id" />
<VnInput
:label="t('Rating')"
clearable
type="number"
v-model.number="data.rating"
/>
</div>
<div class="col">
<VnInput
:label="t('Recommended credit')"
clearable
type="number"
v-model.number="data.recommendedCredit"
/>
</div>
</VnRow>
</template> </template>
</FormModel> </VnTable>
<!-- <QTable
<div class="full-width flex justify-center" v-if="rows.length">
<QTable
:columns="columns" :columns="columns"
:pagination="{ rowsPerPage: 0 }" :pagination="{ rowsPerPage: 0 }"
:rows="rows" :rows="rows"
@ -120,22 +103,16 @@ watch(
class="card-width q-px-lg" class="card-width q-px-lg"
> >
<template #body-cell-employee="{ row }"> <template #body-cell-employee="{ row }">
<QTd auto-width @click.stop> <QTd @click.stop>
<QBtn color="blue" flat no-caps>{{ row.worker.user.nickname }}</QBtn> <span class="link">{{ row.worker.user.nickname }}</span>
<WorkerDescriptorProxy :id="row.clientFk" /> <WorkerDescriptorProxy :id="row.clientFk" />
</QTd> </QTd>
</template> </template>
</QTable> </QTable> -->
</div>
<h5 class="flex justify-center color-vn-label" v-else>
{{ t('globals.noResults') }}
</h5>
</template> </template>
<i18n> <i18n>
es: es:
Rating: Clasificación
Recommended credit: Crédito recomendado Recommended credit: Crédito recomendado
Since: Desde Since: Desde
Employee: Empleado Employee: Empleado

View File

@ -3,7 +3,7 @@ import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toCurrency, toDate } from 'src/filters'; import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
@ -11,6 +11,10 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue'; import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue';
import { useState } from 'src/composables/useState';
const state = useState();
const customer = computed(() => state.get('customer'));
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -43,7 +47,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
:subtitle="data.subtitle" :subtitle="data.subtitle"
@on-fetch="setData" @on-fetch="setData"
:summary="$props.summary" :summary="$props.summary"
data-key="customerData" data-key="customer"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<CustomerDescriptorMenu :customer="entity" /> <CustomerDescriptorMenu :customer="entity" />
@ -57,35 +61,46 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
:value="toCurrency(entity.creditInsurance)" :value="toCurrency(entity.creditInsurance)"
/> />
<VnLv :label="t('customer.card.debt')" :value="toCurrency(entity.debt)" /> <VnLv
<VnLv v-if="entity.salesPersonUser" :label="t('customer.card.salesPerson')"> :label="t('customer.card.debt')"
:value="toCurrency(entity.debt)"
:info="t('customer.summary.riskInfo')"
/>
<VnLv :label="t('customer.card.salesPerson')">
<template #value> <template #value>
<VnUserLink <VnUserLink
:name="entity.salesPersonUser?.name" v-if="entity.salesPersonUser"
:name="entity.salesPersonUser.name"
:worker-id="entity.salesPersonFk" :worker-id="entity.salesPersonFk"
/> />
<span v-else>{{ dashIfEmpty(entity.salesPersonUser) }}</span>
</template> </template>
</VnLv> </VnLv>
<VnLv <VnLv
:label="t('customer.card.businessTypeFk')" :label="t('customer.card.businessTypeFk')"
:value="entity.businessTypeFk" :value="entity.businessType.description"
/> />
</template> </template>
<template #icons="{ entity }"> <template #icons>
<QCardActions class="q-gutter-x-md"> <QCardActions v-if="customer" class="q-gutter-x-md">
<QIcon <QIcon
v-if="!entity.isActive" v-if="!customer.isActive"
name="vn:disabled" name="vn:disabled"
size="xs" size="xs"
color="primary" color="primary"
> >
<QTooltip>{{ t('customer.card.isDisabled') }}</QTooltip> <QTooltip>{{ t('customer.card.isDisabled') }}</QTooltip>
</QIcon> </QIcon>
<QIcon v-if="entity.isFreezed" name="vn:frozen" size="xs" color="primary"> <QIcon
v-if="customer.isFreezed"
name="vn:frozen"
size="xs"
color="primary"
>
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip> <QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="!entity.account.active" v-if="!customer.account?.active"
color="primary" color="primary"
name="vn:noweb" name="vn:noweb"
size="xs" size="xs"
@ -93,7 +108,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip> <QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="entity.debt > entity.credit" v-if="customer.debt > customer.credit"
name="vn:risk" name="vn:risk"
size="xs" size="xs"
color="primary" color="primary"
@ -101,7 +116,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip> <QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="!entity.isTaxDataChecked" v-if="!customer.isTaxDataChecked"
name="vn:no036" name="vn:no036"
size="xs" size="xs"
color="primary" color="primary"
@ -109,7 +124,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<QTooltip>{{ t('customer.card.notChecked') }}</QTooltip> <QTooltip>{{ t('customer.card.notChecked') }}</QTooltip>
</QIcon> </QIcon>
<QBtn <QBtn
v-if="entity.unpaid" v-if="customer.unpaid"
flat flat
size="sm" size="sm"
icon="vn:Client_unpaid" icon="vn:Client_unpaid"
@ -121,13 +136,13 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<br /> <br />
{{ {{
t('unpaidDated', { t('unpaidDated', {
dated: toDate(entity.unpaid.dated), dated: toDate(customer.unpaid.dated),
}) })
}} }}
<br /> <br />
{{ {{
t('unpaidAmount', { t('unpaidAmount', {
amount: toCurrency(entity.unpaid.amount), amount: toCurrency(customer.unpaid.amount),
}) })
}} }}
</QTooltip> </QTooltip>
@ -139,7 +154,13 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<QBtn <QBtn
:to="{ :to="{
name: 'TicketList', name: 'TicketList',
query: { table: JSON.stringify({ clientFk: entity.id }) }, query: {
from: undefined,
to: undefined,
table: JSON.stringify({
clientFk: entity.id,
}),
},
}" }"
size="md" size="md"
icon="vn:ticket" icon="vn:ticket"
@ -160,23 +181,8 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
</QBtn> </QBtn>
<QBtn <QBtn
:to="{ :to="{
name: 'OrderCreate', name: 'AccountSummary',
query: { clientId: entity.id }, params: { id: entity.id },
}"
size="md"
icon="vn:basketadd"
color="primary"
>
<QTooltip>{{ t('New order') }}</QTooltip>
</QBtn>
<QBtn
:to="{
name: 'AccountList',
query: {
table: JSON.stringify({
filter: { where: { id: entity.id } },
}),
},
}" }"
size="md" size="md"
icon="face" icon="face"
@ -184,6 +190,18 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
> >
<QTooltip>{{ t('Go to user') }}</QTooltip> <QTooltip>{{ t('Go to user') }}</QTooltip>
</QBtn> </QBtn>
<QBtn
v-if="entity.supplier"
:to="{
name: 'SupplierSummary',
params: { id: entity.supplier.id },
}"
size="md"
icon="vn:supplier"
color="primary"
>
<QTooltip>{{ t('Go to supplier') }}</QTooltip>
</QBtn>
</QCardActions> </QCardActions>
</template> </template>
</CardDescriptor> </CardDescriptor>
@ -197,8 +215,8 @@ es:
Go to module index: Ir al índice del módulo Go to module index: Ir al índice del módulo
Customer ticket list: Listado de tickets del cliente Customer ticket list: Listado de tickets del cliente
Customer invoice out list: Listado de facturas del cliente Customer invoice out list: Listado de facturas del cliente
New order: Nuevo pedido
Go to user: Ir al usuario Go to user: Ir al usuario
Go to supplier: Ir al proveedor
Customer unpaid: Cliente impago Customer unpaid: Cliente impago
Unpaid: Impagado Unpaid: Impagado
unpaidDated: 'Fecha {dated}' unpaidDated: 'Fecha {dated}'

View File

@ -8,6 +8,9 @@ import { useQuasar } from 'quasar';
import useNotify from 'src/composables/useNotify'; import useNotify from 'src/composables/useNotify';
import VnSmsDialog from 'src/components/common/VnSmsDialog.vue'; import VnSmsDialog from 'src/components/common/VnSmsDialog.vue';
import TicketCreateDialog from 'src/pages/Ticket/TicketCreateDialog.vue';
import OrderCreateDialog from 'src/pages/Order/Card/OrderCreateDialog.vue';
import { ref } from 'vue';
const $props = defineProps({ const $props = defineProps({
customer: { customer: {
@ -40,20 +43,32 @@ const sendSms = async (payload) => {
notify(error.message, 'positive'); notify(error.message, 'positive');
} }
}; };
const ticketCreateFormDialog = ref(null);
const openTicketCreateForm = () => {
ticketCreateFormDialog.value.show();
};
const orderCreateFormDialog = ref(null);
const openOrderCreateForm = () => {
orderCreateFormDialog.value.show();
};
</script> </script>
<template> <template>
<QItem v-ripple clickable> <QItem v-ripple clickable @click="openTicketCreateForm()">
<QItemSection> <QItemSection>
<RouterLink {{ t('globals.pageTitles.createTicket') }}
:to="{ <QDialog ref="ticketCreateFormDialog">
name: 'TicketCreate', <TicketCreateDialog />
query: { clientFk: customer.id }, </QDialog>
}" </QItemSection>
class="color-vn-text" </QItem>
> <QItem v-ripple clickable @click="openOrderCreateForm()">
{{ t('Simple ticket') }} <QItemSection>
</RouterLink> {{ t('globals.pageTitles.createOrder') }}
<QDialog ref="orderCreateFormDialog">
<OrderCreateDialog :client-fk="customer.id" />
</QDialog>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem v-ripple clickable> <QItem v-ripple clickable>

View File

@ -236,6 +236,7 @@ const toCustomerFileManagementCreate = () => {
@click.stop="toCustomerFileManagementCreate()" @click.stop="toCustomerFileManagementCreate()"
color="primary" color="primary"
fab fab
shortcut="+"
icon="add" icon="add"
/> />
<QTooltip> <QTooltip>

View File

@ -93,8 +93,9 @@ function handleLocation(data, location) {
<VnRow> <VnRow>
<VnLocation <VnLocation
:rules="validate('Worker.postcode')" :rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']" :roles-allowed-to-create="['deliveryAssistant', 'administrative']"
v-model="data.postcode" :acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
:location="data"
@update:model-value="(location) => handleLocation(data, location)" @update:model-value="(location) => handleLocation(data, location)"
/> />
</VnRow> </VnRow>
@ -134,15 +135,17 @@ function handleLocation(data, location) {
</QTooltip> </QTooltip>
</QIcon> </QIcon>
</div> </div>
<QCheckbox :label="t('Verified data')" v-model="data.isTaxDataChecked" /> <QCheckbox :label="t('Daily invoice')" v-model="data.hasDailyInvoice" />
</VnRow> </VnRow>
<VnRow> <VnRow>
<QCheckbox <QCheckbox
:label="t('Electronic invoice')" :label="t('Electronic invoice')"
v-model="data.hasElectronicInvoice" v-model="data.hasElectronicInvoice"
/><QCheckbox
:label="t('Verified data')"
v-model="data.isTaxDataChecked"
/> />
<QCheckbox :label="t('Daily invoice')" v-model="data.hasDailyInvoice" />
</VnRow> </VnRow>
</template> </template>
</FormModel> </FormModel>

View File

@ -5,10 +5,10 @@ import { useRoute } from 'vue-router';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import { toDateTimeFormat } from 'src/filters/date'; import { toDateTimeFormat } from 'src/filters/date';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import FetchData from 'components/FetchData.vue';
const entityId = computed(() => route.params.id);
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const rows = ref([]);
const totalAmount = ref(); const totalAmount = ref();
const tableRef = ref(); const tableRef = ref();
const filter = computed(() => { const filter = computed(() => {
@ -28,7 +28,7 @@ const filter = computed(() => {
}, },
], ],
where: { where: {
clientFk: route.params.id, clientFk: entityId,
}, },
}; };
}); });
@ -47,7 +47,6 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'userFk',
label: t('Created by'), label: t('Created by'),
component: 'userLink', component: 'userLink',
attrs: ({ row }) => { attrs: ({ row }) => {
@ -73,6 +72,7 @@ const columns = computed(() => [
columnCreate: { columnCreate: {
component: 'select', component: 'select',
url: 'greugeTypes', url: 'greugeTypes',
sortBy: 'name ASC ',
limit: 0, limit: 0,
}, },
}, },
@ -84,14 +84,14 @@ const columns = computed(() => [
create: true, create: true,
}, },
]); ]);
const setRows = (data) => {
rows.value = data;
totalAmount.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0);
};
</script> </script>
<template> <template>
<FetchData
:url="`Greuges/${entityId}/sumAmount`"
auto-load
@on-fetch="({ sumAmount }) => (totalAmount = sumAmount)"
></FetchData>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="Greuges" data-key="Greuges"
@ -104,10 +104,10 @@ const setRows = (data) => {
:is-editable="false" :is-editable="false"
:use-model="true" :use-model="true"
:column-search="false" :column-search="false"
@on-fetch="(data) => setRows(data)" :disable-option="{ card: true }"
:create="{ :create="{
urlCreate: `Greuges`, urlCreate: `Greuges`,
title: t('New credit'), title: t('New greuge'),
onDataSaved: () => tableRef.reload(), onDataSaved: () => tableRef.reload(),
formInitialData: { shipped: new Date(), clientFk: route.params.id }, formInitialData: { shipped: new Date(), clientFk: route.params.id },
}" }"

View File

@ -1,20 +1,19 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { toDateTimeFormat } from 'src/filters/date'; import { toDateTimeFormat } from 'src/filters/date';
import FetchData from 'components/FetchData.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
import { dashIfEmpty } from 'src/filters';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const rows = ref([]);
const filter = { const filter = {
include: [ include: [
{ relation: 'mandateType', scope: { fields: ['id', 'name'] } }, { relation: 'mandateType', scope: { fields: ['id', 'code'] } },
{ relation: 'company', scope: { fields: ['id', 'code'] } }, { relation: 'company', scope: { fields: ['id', 'code'] } },
], ],
where: { clientFk: route.params.id }, where: { clientFk: route.params.id },
@ -22,114 +21,61 @@ const filter = {
limit: 20, limit: 20,
}; };
const tableColumnComponents = {
id: {
component: 'span',
props: () => {},
event: () => {},
},
company: {
component: 'span',
props: () => {},
event: () => {},
},
type: {
component: 'span',
props: () => {},
event: () => {},
},
registerDate: {
component: 'span',
props: () => {},
event: () => {},
},
endDate: {
component: 'span',
props: () => {},
event: () => {},
},
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
field: 'id',
label: t('Id'),
name: 'id', name: 'id',
label: t('globals.id'),
field: 'id',
isId: true,
}, },
{ {
align: 'left', align: 'left',
field: (row) => row.company.code, cardVisible: true,
label: t('Company'), format: ({ company }) => company.code,
label: t('globals.company'),
name: 'company', name: 'company',
}, },
{ {
align: 'left', align: 'left',
field: (row) => row.mandateType.name, cardVisible: true,
label: t('Type'), format: ({ mandateType }) => mandateType.code,
label: t('globals.type'),
name: 'type', name: 'type',
}, },
{ {
align: 'left', align: 'left',
field: 'created', cardVisible: true,
label: t('Register date'), label: t('Register date'),
name: 'registerDate', name: 'created',
format: (value) => toDateTimeFormat(value), format: ({ created }) => toDateTimeFormat(created),
}, },
{ {
align: 'left', align: 'right',
field: 'finished', cardVisible: true,
name: 'finished',
label: t('End date'), label: t('End date'),
name: 'endDate', format: ({ finished }) => dashIfEmpty(toDateTimeFormat(finished)),
format: (value) => (value ? toDateTimeFormat(value) : '-'),
}, },
]); ]);
</script> </script>
<template> <template>
<FetchData
:filter="filter"
@on-fetch="(data) => (rows = data)"
auto-load
url="Mandates"
/>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <VnTable
:filter="filter"
auto-load
url="Mandates"
:columns="columns" :columns="columns"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md" class="full-width q-mt-md"
row-key="id" :right-search="false"
v-if="rows?.length" :row-click="false"
> />
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<component
:is="tableColumnComponents[props.col.name].component"
@click="tableColumnComponents[props.col.name].event(props)"
class="rounded-borders q-pa-sm"
v-bind="tableColumnComponents[props.col.name].props(props)"
>
{{ props.value }}
</component>
</QTr>
</QTd>
</template>
</QTable>
<h5 class="flex justify-center color-vn-label" v-else>
{{ t('globals.noResults') }}
</h5>
</QPage> </QPage>
</template> </template>
<i18n> <i18n>
es: es:
Id: Id
Company: Empresa
Type: Tipo
Register date: Fecha alta Register date: Fecha alta
End date: Fecha baja End date: Fecha baja
</i18n> </i18n>

Some files were not shown because too many files have changed in this diff Show More