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
### Added 🆕

View File

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

View File

@ -2,18 +2,22 @@ import axios from 'axios';
import { useSession } from 'src/composables/useSession';
import { Router } from 'src/router';
import useNotify from 'src/composables/useNotify.js';
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
const session = useSession();
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 token = session.getToken();
if (token.length && !config.headers.Authorization) {
config.headers.Authorization = token;
}
stateQuery.add(config);
return config;
};
@ -22,10 +26,10 @@ const onRequestError = (error) => {
};
const onResponse = (response) => {
const { method } = response.config;
const config = response.config;
stateQuery.remove(config);
const isSaveRequest = method === 'patch';
if (isSaveRequest) {
if (config.method === 'patch') {
notify('globals.dataSaved', 'positive');
}
@ -33,6 +37,8 @@ const onResponse = (response) => {
};
const onResponseError = (error) => {
stateQuery.remove(error.config);
let message = '';
const response = error.response;
@ -79,5 +85,7 @@ const onResponseError = (error) => {
axios.interceptors.request.use(onRequest, onRequestError);
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
.filter((route) => route.meta.keyBinding)
.reduce((map, route) => {
map[route.meta.keyBinding.toLowerCase()] = route.path;
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
return map;
}, {});
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();
router.push(keyBindingMap[key]);
router.push(keyBindingMap[code]);
isNotified = true;
}
};

View File

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

View File

@ -1,8 +1,16 @@
import { boot } from 'quasar/wrappers';
import qFormMixin from './qformMixin';
import mainShortcutMixin from './mainShortcutMixin';
import keyShortcut from './keyShortcut';
import useNotify from 'src/composables/useNotify.js';
const { notify } = useNotify();
export default boot(({ app }) => {
app.mixin(qFormMixin);
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>
import { reactive, ref, onMounted, nextTick } from 'vue';
import { reactive, ref, onMounted, nextTick, computed } from 'vue';
import { useI18n } from 'vue-i18n';
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 VnRow from 'components/ui/VnRow.vue';
import FormModelPopup from './FormModelPopup.vue';
import { useState } from 'src/composables/useState';
defineProps({ showEntityField: { type: Boolean, default: true } });
const emit = defineEmits(['onDataSaved']);
const { t } = useI18n();
const bicInputRef = ref(null);
const state = useState();
const customer = computed(() => state.get('customer'));
const bankEntityFormData = reactive({
name: null,
bic: null,
countryFk: null,
countryFk: customer.value?.countryFk,
id: null,
});
@ -26,8 +31,8 @@ const countriesFilter = {
const countriesOptions = ref([]);
const onDataSaved = (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse);
const onDataSaved = (...args) => {
emit('onDataSaved', ...args);
};
onMounted(async () => {

View File

@ -1,35 +1,42 @@
<script setup>
import { reactive, ref } from 'vue';
import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelectProvince from 'components/VnSelectProvince.vue';
import VnInput from 'components/common/VnInput.vue';
import FormModelPopup from './FormModelPopup.vue';
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 cityFormData = reactive({
const cityFormData = ref({
name: null,
provinceFk: null,
});
const provincesOptions = ref([]);
onMounted(() => {
cityFormData.value.provinceFk = $props.provinceSelected;
});
const onDataSaved = (...args) => {
emit('onDataSaved', ...args);
};
</script>
<template>
<FetchData
@on-fetch="(data) => (provincesOptions = data)"
auto-load
url="Provinces"
/>
<FormModelPopup
:title="t('New city')"
:subtitle="t('Please, ensure you put the correct data!')"
@ -41,11 +48,16 @@ const onDataSaved = (...args) => {
<template #form-inputs="{ data, validate }">
<VnRow>
<VnInput
:label="t('Name')"
:label="t('Names')"
v-model="data.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>
</template>
</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>
import { reactive, ref } from 'vue';
import { reactive, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
@ -22,9 +22,11 @@ const postcodeFormData = reactive({
townFk: null,
});
const townsFetchDataRef = ref(null);
const provincesFetchDataRef = ref(null);
const countriesOptions = ref([]);
const provincesOptions = ref([]);
const townsOptions = ref([]);
const town = ref({});
function onDataSaved(formData) {
@ -61,23 +63,94 @@ function setTown(newTown, data) {
}
async function setProvince(id, data) {
await provincesFetchDataRef.value.fetch();
const newProvince = provincesOptions.value.find((province) => province.id == id);
if (!newProvince) return;
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>
<template>
<FetchData
ref="provincesFetchDataRef"
@on-fetch="(data) => (provincesOptions = data)"
@on-fetch="handleProvinces"
:sort-by="['name ASC']"
:limit="30"
auto-load
url="Provinces/location"
/>
<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
url="Countries"
/>
@ -96,18 +169,20 @@ async function setProvince(id, data) {
:label="t('Postcode')"
v-model="data.code"
:rules="validate('postcode.code')"
clearable
/>
<VnSelectDialog
:label="t('City')"
url="Towns/location"
@update:model-value="(value) => setTown(value, data)"
:tooltip="t('Create city')"
v-model="data.townFk"
:options="townsOptions"
option-label="name"
option-value="id"
:rules="validate('postcode.city')"
:roles-allowed-to-create="['deliveryAssistant']"
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
:emit-value="false"
clearable
:clearable="true"
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
@ -122,6 +197,9 @@ async function setProvince(id, data) {
</template>
<template #form>
<CreateNewCityForm
:country-fk="data.countryFk"
:province-selected="data.provinceFk"
:provinces="provincesOptions"
@on-data-saved="
(_, requestResponse) =>
onCityCreated(requestResponse, data)
@ -132,8 +210,13 @@ async function setProvince(id, data) {
</VnRow>
<VnRow>
<VnSelectProvince
:country-fk="data.countryFk"
:province-selected="data.provinceFk"
@update:model-value="(value) => setProvince(value, data)"
v-model="data.provinceFk"
:clearable="true"
:provinces="provincesOptions"
@on-province-created="onProvinceCreated"
/>
<VnSelect
:label="t('Country')"
@ -152,6 +235,7 @@ async function setProvince(id, data) {
<i18n>
es:
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!
City: Población
Province: Provincia

View File

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

View File

@ -50,7 +50,7 @@ const onDataSaved = (dataSaved) => {
model="thermograph"
:title="t('New thermograph')"
:form-initial-data="thermographFormData"
@on-data-saved="onDataSaved($event)"
@on-data-saved="(_, response) => onDataSaved(response)"
>
<template #form-inputs="{ data, validate }">
<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
? formData.value[formData.value.length - 1].$index + 1
: 0;
formData.value.push(Object.assign({ $index }, $props.dataRequired));
formData.value.push(Object.assign({ $index }, pushData));
hasChanges.value = true;
}
@ -234,6 +234,8 @@ async function remove(data) {
newData = newData.filter((form) => !ids.some((id) => id == form[pk]));
fetch(newData);
});
} else {
reset();
}
emit('update:selected', []);
}

View File

@ -44,7 +44,7 @@ onMounted(async () => {
async function fetch(fetchFilter = {}) {
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.sortBy) filter.order = $props.sortBy;
if ($props.limit) filter.limit = $props.limit;

View File

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

View File

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

View File

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

View File

@ -3,6 +3,7 @@ import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useState } from 'src/composables/useState';
import { useStateStore } from 'stores/useStateStore';
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
import { useQuasar } from 'quasar';
import PinnedModules from './PinnedModules.vue';
import UserPanel from 'components/UserPanel.vue';
@ -12,6 +13,7 @@ import VnAvatar from './ui/VnAvatar.vue';
const { t } = useI18n();
const stateStore = useStateStore();
const quasar = useQuasar();
const stateQuery = useStateQueryStore();
const state = useState();
const user = state.getUser();
const appName = 'Lilium';
@ -24,7 +26,13 @@ const pinnedModulesRef = ref();
<template>
<QHeader color="white" elevated>
<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">
{{ t('globals.collapseMenu') }}
</QTooltip>
@ -44,6 +52,14 @@ const pinnedModulesRef = ref();
</QBtn>
</RouterLink>
<VnBreadcrumbs v-if="$q.screen.gt.sm" />
<QSpinner
color="primary"
class="q-ml-md"
:class="{
'no-visible': !stateQuery.isLoading().value,
}"
size="xs"
/>
<QSpace />
<div id="searchbar" class="searchbar"></div>
<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 { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { useQuasar } from 'quasar';
import { useQuasar, useDialogPluginComponent } from 'quasar';
import VnConfirm from 'components/ui/VnConfirm.vue';
import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
import VnSelect from 'components/common/VnSelect.vue';
import FormPopup from './FormPopup.vue';
import { useDialogPluginComponent } from 'quasar';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
@ -18,19 +17,19 @@ const $props = defineProps({
default: () => {},
},
});
const { dialogRef } = useDialogPluginComponent();
const quasar = useQuasar();
const { t } = useI18n();
const router = useRouter();
const { notify } = useNotify();
const checked = ref(true);
const transferInvoiceParams = reactive({
id: $props.invoiceOutData?.id,
refFk: $props.invoiceOutData?.ref,
});
const rectificativeTypeOptions = ref([]);
const siiTypeInvoiceOutsOptions = ref([]);
const checked = ref(true);
const transferInvoiceParams = reactive({
id: $props.invoiceOutData?.id,
});
const invoiceCorrectionTypesOptions = ref([]);
const selectedClient = (client) => {
@ -44,10 +43,9 @@ const makeInvoice = async () => {
const params = {
id: transferInvoiceParams.id,
cplusRectificationTypeFk: transferInvoiceParams.cplusRectificationTypeFk,
siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk,
invoiceCorrectionTypeFk: transferInvoiceParams.invoiceCorrectionTypeFk,
newClientFk: transferInvoiceParams.newClientFk,
refFk: transferInvoiceParams.refFk,
siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk,
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');
const id = data?.[0];
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 { useRole } from 'src/composables/useRole';
import VnAvatar from './ui/VnAvatar.vue';
import useNotify from 'src/composables/useNotify';
const state = useState();
const session = useSession();
const router = useRouter();
const { t, locale } = useI18n();
const { copyText } = useClipboard();
const { notify } = useNotify();
const userLocale = computed({
get() {
@ -53,6 +55,7 @@ const user = state.getUser();
const warehousesData = ref();
const companiesData = ref();
const accountBankData = ref();
const isEmployee = computed(() => useRole().isEmployee());
onMounted(async () => {
updatePreferences();
@ -70,18 +73,28 @@ function updatePreferences() {
async function saveDarkMode(value) {
const query = `/UserConfigs/${user.value.id}`;
try {
await axios.patch(query, {
darkMode: value,
});
user.value.darkMode = value;
onDataSaved();
} catch (error) {
onDataError();
}
}
async function saveLanguage(value) {
const query = `/VnUsers/${user.value.id}`;
try {
await axios.patch(query, {
lang: value,
});
user.value.lang = value;
onDataSaved();
} catch (error) {
onDataError();
}
}
function logout() {
@ -97,11 +110,23 @@ function localUserData() {
state.setUser(user.value);
}
function saveUserData(param, value) {
axios.post('UserConfigs/setUserConfig', { [param]: value });
async function saveUserData(param, value) {
try {
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>
<template>

View File

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

View File

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

View File

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

View File

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

View File

@ -135,7 +135,7 @@ onMounted(async () => {
});
</script>
<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">
<QCard class="column q-pa-md">
<QIcon name="info" size="sm" class="info-icon">

View File

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

View File

@ -1,6 +1,6 @@
<script setup>
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 { useStateStore } from 'stores/useStateStore';
import useCardSize from 'src/composables/useCardSize';
@ -17,12 +17,16 @@ const props = defineProps({
filterPanel: { type: Object, default: undefined },
searchDataKey: { type: String, default: undefined },
searchbarProps: { type: Object, default: undefined },
redirectOnError: { type: Boolean, default: false },
});
const stateStore = useStateStore();
const route = useRoute();
const router = useRouter();
const url = computed(() => {
if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`;
if (props.baseUrl) {
return `${props.baseUrl}/${route.params.id}`;
}
return props.customUrl;
});
const searchRightDataKey = computed(() => {
@ -35,8 +39,14 @@ const arrayData = useArrayData(props.dataKey, {
});
onBeforeMount(async () => {
try {
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) {
@ -73,7 +83,7 @@ if (props.baseUrl) {
<QPage>
<VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]">
<RouterView :key="route.fullPath" />
<RouterView :key="route.path" />
</div>
</QPage>
</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(() => {
if (typeof $props.prop === 'object') return [$props.prop];
return $props.prop;
});
function mix(toComponent) {
if (mixed) return mixed;
const { component, attrs, event } = toComponent;
const customComponent = $props.components[component];
mixed = {
return {
component: customComponent?.component ?? component,
attrs: {
...toValueAttrs(attrs),
@ -37,7 +35,6 @@ function mix(toComponent) {
},
event: { ...customComponent?.event, ...event },
};
return mixed;
}
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 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 VnDms from 'src/components/common/VnDms.vue';
import VnConfirm from 'components/ui/VnConfirm.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnUserLink from '../ui/VnUserLink.vue';
import { downloadFile } from 'src/composables/downloadFile';
import { useSession } from 'src/composables/useSession';
const route = useRoute();
const quasar = useQuasar();
@ -18,6 +20,7 @@ const { t } = useI18n();
const rows = ref();
const dmsRef = ref();
const formDialog = ref({});
const token = useSession().getTokenMultimedia();
const $props = defineProps({
model: {
@ -89,6 +92,23 @@ const dmsFilter = {
};
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',
field: 'id',
@ -135,19 +155,13 @@ const columns = computed(() => [
field: 'hasFile',
label: t('globals.original'),
name: 'hasFile',
toolTip: t('The documentation is available in paper form'),
component: QCheckbox,
props: (prop) => ({
disable: true,
'model-value': Boolean(prop.value),
}),
},
{
align: 'left',
field: 'file',
label: t('globals.file'),
name: 'file',
component: 'span',
},
{
align: 'left',
field: 'worker',
@ -297,6 +311,14 @@ defineExpose({
row-key="clientFk"
: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">
<QTd :props="props">
<QTr :props="props">
@ -378,7 +400,14 @@ defineExpose({
/>
</QDialog>
<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>
{{ t('Upload file') }}
</QTooltip>
@ -386,10 +415,6 @@ defineExpose({
</QPageSticky>
</template>
<style scoped>
.q-gutter-y-ms {
display: grid;
row-gap: 20px;
}
.labelColor {
color: var(--vn-label-color);
}
@ -397,8 +422,10 @@ defineExpose({
<i18n>
en:
contentTypesInfo: Allowed file types {allowedContentTypes}
The documentation is available in paper form: The documentation is available in paper form
es:
contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes}
Generate identifier for original file: Generar identificador para archivo original
Upload file: Subir fichero
the documentation is available in paper form: Se tiene la documentación en papel
</i18n>

View File

@ -67,9 +67,13 @@ const mixinRules = [
requiredFieldRule,
...($attrs.rules ?? []),
(val) => {
const { min } = vnInputRef.value.$attrs;
const { min, max } = vnInputRef.value.$attrs;
if (!min) return null;
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>
@ -92,7 +96,6 @@ const mixinRules = [
<slot name="prepend" />
</template>
<template #append>
<slot name="append" v-if="$slots.append && !$attrs.disabled" />
<QIcon
name="close"
size="xs"
@ -100,10 +103,12 @@ const mixinRules = [
@click="
() => {
value = null;
vnInputRef.focus();
emit('remove');
}
"
></QIcon>
<slot name="append" v-if="$slots.append && !$attrs.disabled" />
<QIcon v-if="info" name="info">
<QTooltip max-width="350px">
{{ info }}
@ -116,6 +121,13 @@ const mixinRules = [
<i18n>
en:
inputMin: Must be more than {value}
inputMax: Must be less than {value}
es:
inputMin: Debe ser mayor a {value}
inputMax: Debe ser menor a {value}
</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 { date } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useAttrs } from 'vue';
import VnDate from './VnDate.vue';
const model = defineModel({ type: [String, Date] });
const $props = defineProps({
@ -9,30 +11,25 @@ const $props = defineProps({
type: Boolean,
default: false,
},
showEvent: {
type: Boolean,
default: true,
},
});
import { useValidator } from 'src/composables/useValidator';
const { validations } = useValidator();
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 isPopupOpen = ref();
const hover = ref();
const mask = ref();
const $attrs = useAttrs();
onMounted(() => {
// fix quasar bug
mask.value = '##/##/####';
});
const styleAttrs = computed(() => {
return $props.isOutlined
? {
dense: true,
outlined: true,
rounded: true,
}
: {};
});
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
const formattedDate = computed({
get() {
@ -44,16 +41,13 @@ const formattedDate = computed({
let newDate;
if (value) {
// parse input
if (value.includes('/')) {
if (value.length == 6) value = value + new Date().getFullYear();
if (value.length >= 10) {
if (value.includes('/') && value.length >= 10) {
if (value.at(2) == '/') value = value.split('/').reverse().join('/');
value = date.formatDate(
new Date(value).toISOString(),
'YYYY-MM-DDTHH:mm:ss.SSSZ'
);
}
}
const [year, month, day] = value.split('-').map((e) => parseInt(e));
newDate = new Date(year, month - 1, day);
if (model.value) {
@ -75,25 +69,46 @@ const formattedDate = computed({
const popupDate = computed(() =>
model.value ? date.formatDate(new Date(model.value), 'YYYY/MM/DD') : model.value
);
onMounted(() => {
// fix quasar bug
mask.value = '##/##/####';
});
watch(
() => model.value,
(val) => (formattedDate.value = val),
{ immediate: true }
);
const styleAttrs = computed(() => {
return $props.isOutlined
? {
dense: true,
outlined: true,
rounded: true,
}
: {};
});
const manageDate = (date) => {
formattedDate.value = date;
isPopupOpen.value = false;
};
</script>
<template>
<div @mouseover="hover = true" @mouseleave="hover = false">
<QInput
ref="vnInputDateRef"
v-model="formattedDate"
class="vn-input-date"
:mask="mask"
placeholder="dd/mm/aaaa"
v-bind="{ ...$attrs, ...styleAttrs }"
:class="{ required: $attrs.required }"
:rules="$attrs.required ? [requiredFieldRule] : null"
:rules="mixinRules"
:clearable="false"
@click="isPopupOpen = true"
hide-bottom-space
>
<template #append>
<QIcon
@ -106,11 +121,13 @@ watch(
!$attrs.disable
"
@click="
vnInputDateRef.focus();
model = null;
isPopupOpen = false;
"
/>
<QIcon
v-if="showEvent"
name="event"
class="cursor-pointer"
@click="isPopupOpen = !isPopupOpen"
@ -118,6 +135,7 @@ watch(
/>
</template>
<QMenu
v-if="$q.screen.gt.xs"
transition-show="scale"
transition-hide="scale"
v-model="isPopupOpen"
@ -126,18 +144,11 @@ watch(
:no-focus="true"
:no-parent-event="true"
>
<QDate
v-model="popupDate"
:landscape="true"
:today-btn="true"
@update:model-value="
(date) => {
formattedDate = date;
isPopupOpen = false;
}
"
/>
<VnDate v-model="popupDate" @update:model-value="manageDate" />
</QMenu>
<QDialog v-else v-model="isPopupOpen">
<VnDate v-model="popupDate" @update:model-value="manageDate" />
</QDialog>
</QInput>
</div>
</template>

View File

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

View File

@ -2,21 +2,69 @@
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
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) {
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>
<template>
<VnSelectDialog
v-model="value"
option-value="code"
v-model="modelValue"
option-filter-value="search"
:option-label="(opt) => showLabel(opt)"
:option-label="
(opt) => (typeof modelValue === 'string' ? modelValue : showLabel(opt))
"
url="Postcodes/filter"
@update:model-value="handleModelValue"
:use-like="false"
:label="t('Location')"
:placeholder="t('search_by_postalcode')"
@ -25,9 +73,17 @@ function showLabel(data) {
v-bind="$attrs"
clearable
:emit-value="false"
:tooltip="t('Create new location')"
>
<template #form>
<CreateNewPostcode @on-data-saved="(newValue) => (value = newValue)" />
<CreateNewPostcode
@on-data-saved="
(newValue) => {
modelValue = newValue;
emit('update:model-value', newValue);
}
"
/>
</template>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
@ -50,7 +106,9 @@ function showLabel(data) {
<i18n>
en:
search_by_postalcode: Search by postalcode, town, province or country
Create new location: Create new location
es:
Location: Ubicación
Create new location: Crear nueva ubicación
search_by_postalcode: Buscar por código postal, ciudad o país
</i18n>

View File

@ -14,6 +14,7 @@ import VnJsonValue from '../common/VnJsonValue.vue';
import FetchData from '../FetchData.vue';
import VnSelect from './VnSelect.vue';
import VnUserLink from '../ui/VnUserLink.vue';
import VnPaginate from '../ui/VnPaginate.vue';
const stateStore = useStateStore();
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 changeInput = ref();
const searchInput = ref();
@ -235,9 +237,7 @@ async function openPointRecord(id, modelLog) {
const locale = validations[modelLog.model]?.locale || {};
pointRecord.value = parseProps(propNames, locale, data);
}
async function setLogTree() {
filter.where = { and: [{ originFk: route.params.id }] };
const { data } = await getLogs(filter);
async function setLogTree(data) {
logTree.value = getLogTree(data);
}
@ -266,15 +266,7 @@ async function applyFilter() {
filter.where.and.push(selectedFilters.value);
}
const { data } = await getLogs(filter);
logTree.value = getLogTree(data);
}
async function getLogs(filter) {
return axios.get(props.url ?? `${props.model}Logs`, {
params: { filter: JSON.stringify(filter) },
});
paginate.value.fetch(filter);
}
function setDate(type) {
@ -377,8 +369,6 @@ async function clearFilter() {
await applyFilter();
}
setLogTree();
onUnmounted(() => {
stateStore.rightDrawer = false;
});
@ -391,16 +381,6 @@ watch(
);
</script>
<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
:url="`${props.model}Logs/${route.params.id}/models`"
:filter="{ order: ['changedModel'] }"
@ -418,6 +398,17 @@ watch(
"
auto-load
/>
<VnPaginate
ref="paginate"
:data-key="`${model}Log`"
:url="`${model}Logs`"
:filter="filter"
:skeleton="false"
auto-load
@on-fetch="setLogTree"
search-url="logs"
>
<template #body>
<div
class="column items-center logs origin-log q-mt-md"
v-for="(originLog, originLogIndex) in logTree"
@ -465,8 +456,10 @@ watch(
size="md"
class="model-name q-mr-xs text-white"
v-if="
!(modelLog.changedModel && modelLog.changedModelId) &&
modelLog.model
!(
modelLog.changedModel &&
modelLog.changedModelId
) && modelLog.model
"
:style="{
backgroundColor: useColor(modelLog.model),
@ -540,7 +533,9 @@ watch(
>
{{ modelLog.modelI18n }}
<span v-if="modelLog.id"
>#{{ modelLog.id }}</span
>#{{
modelLog.id
}}</span
>
</div>
<QCardSection
@ -555,12 +550,18 @@ watch(
>
<span
class="json-field q-mr-xs text-grey"
:title="value.name"
:title="
value.name
"
>
{{ value.nameI18n }}:
{{
value.nameI18n
}}:
</span>
<VnJsonValue
:value="value.val.val"
:value="
value.val.val
"
/>
</QItem>
</QCardSection>
@ -572,7 +573,11 @@ watch(
:class="actionsClass[log.action]"
:name="actionsIcon[log.action]"
:title="
t(`actions.${actionsText[log.action]}`)
t(
`actions.${
actionsText[log.action]
}`
)
"
/>
</div>
@ -592,17 +597,27 @@ watch(
@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-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">
<span
class="json-field"
:title="prop.name"
>
{{ prop.nameI18n }}:
</span>
<VnJsonValue :value="prop.val.val" />
<span v-if="propIndex < log.props.length - 1"
<span
v-if="
propIndex <
log.props.length - 1
"
>,&nbsp;
</span>
</span>
@ -612,28 +627,44 @@ watch(
class="expanded-json column q-pa-none"
>
<div
v-for="(prop, prop2Index) in log.props"
v-for="(
prop, prop2Index
) in log.props"
:key="prop2Index"
class="q-pa-none text-grey"
>
<span class="json-field" :title="prop.name">
<span
class="json-field"
:title="prop.name"
>
{{ prop.nameI18n }}:
</span>
<VnJsonValue :value="prop.val.val" />
<span v-if="prop.val.id" class="id-value">
<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">
<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">
<span
v-if="!log.props.length"
class="description"
>
{{ log.description }}
</span>
</QCardSection>
@ -643,6 +674,8 @@ watch(
</QList>
</div>
</div>
</template>
</VnPaginate>
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
<QList dense>
<QSeparator />
@ -691,17 +724,16 @@ watch(
</QOptionGroup>
</QItem>
<QItem class="q-mt-sm">
<QItemSection v-if="!workers">
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="workers && userRadio !== null">
<QItemSection v-if="userRadio !== null">
<VnSelect
class="full-width"
:label="t('globals.user')"
v-model="userSelect"
option-label="name"
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')"
hide-selected
>

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@ const dialog = ref(null);
<div class="container order-catalog-item overflow-hidden">
<QCard class="card shadow-6">
<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
class="item-color"
@ -127,11 +127,6 @@ const dialog = ref(null);
flex-direction: column;
gap: 4px;
.subName {
color: var(--vn-label-color);
text-transform: uppercase;
}
p {
margin-bottom: 0;
}

View File

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

View File

@ -31,6 +31,7 @@ const props = defineProps({
});
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
const { dialogRef, onDialogOK } = useDialogPluginComponent();
@ -68,8 +69,10 @@ async function confirm() {
<QSpace />
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
</QCardSection>
<QCardSection class="row items-center">
<QCardSection class="q-pb-none">
<span v-if="message !== false" v-html="message" />
</QCardSection>
<QCardSection class="row items-center q-pt-none">
<slot name="customHTML"></slot>
</QCardSection>
<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() {
try {
isLoading.value = true;
@ -222,7 +211,7 @@ function sanitizer(params) {
icon="search"
@click="search()"
></QBtn>
<QForm @submit="search" id="filterPanelForm">
<QForm @submit="search" id="filterPanelForm" @keyup.enter="search()">
<QList dense>
<QItem class="q-mt-xs">
<QItemSection top>
@ -231,7 +220,6 @@ function sanitizer(params) {
</QItemLabel>
</QItemSection>
<QItemSection top side>
<div class="q-gutter-xs">
<QBtn
@click="clearFilters"
color="primary"
@ -244,19 +232,6 @@ function sanitizer(params) {
>
<QTooltip>{{ t('Remove filters') }}</QTooltip>
</QBtn>
<QBtn
@click="reload"
color="primary"
dense
flat
icon="refresh"
padding="none"
round
size="sm"
>
<QTooltip>{{ t('Refresh') }}</QTooltip>
</QBtn>
</div>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">

View File

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

View File

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

View File

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

View File

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

View File

@ -108,6 +108,7 @@ async function search() {
...Object.fromEntries(staticParams),
search: searchText.value,
},
...{ filter: props.filter },
};
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>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { useI18n } from 'vue-i18n';
const $props = defineProps({
defineProps({
name: { type: String, default: null },
tag: { type: String, default: null },
workerId: { type: Number, default: null },
defaultName: { type: Boolean, default: false },
});
const { t } = useI18n();
</script>
<template>
<slot name="link">
<span :class="{ link: $props.workerId }">
{{ $props.defaultName ? $props.name ?? t('globals.system') : $props.name }}
<span :class="{ link: workerId }">
{{ defaultName ? name ?? $t('globals.system') : name }}
</span>
</slot>
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" />
<WorkerDescriptorProxy v-if="workerId" :id="workerId" />
</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,14 +16,19 @@ export function useAcl() {
state.setAcls(acls);
}
function hasAny(model, prop, accessType) {
const acls = state.getAcls().value[model];
if (acls)
return ['*', prop].some((key) => {
const acl = acls[key];
function hasAny(acls) {
for (const acl of acls) {
let { model, props, accessType } = acl;
const modelAcls = state.getAcls().value[model];
Array.isArray(props) || (props = [props]);
if (modelAcls)
return ['*', ...props].some((key) => {
const acl = modelAcls[key];
return acl && (acl['*'] || acl[accessType]);
});
}
return false;
}
return {
fetch,

View File

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

View File

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

View File

@ -37,6 +37,10 @@ a {
.link {
color: $color-link;
cursor: pointer;
&--white {
color: white;
}
}
.tx-color-link {
@ -264,6 +268,7 @@ input::-webkit-inner-spin-button {
max-width: 400px;
}
}
.edit-photo-btn {
position: absolute;
right: 12px;
@ -271,3 +276,19 @@ input::-webkit-inner-spin-button {
z-index: 1;
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 {
background-color: $positive;
}
.bg-notice {
background-color: $info;
}

View File

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

View File

@ -2,6 +2,7 @@ globals:
lang:
es: Spanish
en: English
quantity: Quantity
language: Language
entity: Entity
user: User
@ -40,6 +41,8 @@ globals:
noChanges: No changes to save
changesToSave: You have changes pending to save
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
rowRemoved: Row removed
pleaseWait: Please wait...
@ -47,6 +50,7 @@ globals:
summary:
basicData: Basic data
daysOnward: Days onward
daysAgo: Days ago
today: Today
yesterday: Yesterday
dateFormat: en-GB
@ -84,7 +88,7 @@ globals:
description: Description
id: Id
order: Order
original: Original
original: Phys. Doc
file: File
selectFile: Select a file
copyClipboard: Copy on clipboard
@ -96,13 +100,20 @@ globals:
to: To
notes: Notes
refresh: Refresh
item: Item
ticket: Ticket
campaign: Campaign
weight: Weight
error: Ups! Something went wrong
recalc: Recalculate
pageTitles:
logIn: Login
addressEdit: Update address
summary: Summary
basicData: Basic data
log: Logs
parkingList: Parkings list
agencyList: Agencies list
agencyList: Agencies
agency: Agency
workCenters: Work centers
modes: Modes
@ -122,9 +133,11 @@ globals:
notifications: Notifications
defaulter: Defaulter
customerCreate: New customer
createOrder: New order
fiscalData: Fiscal data
billingData: Billing data
consignees: Consignees
address-create: New address
notes: Notes
credits: Credits
greuges: Greuges
@ -148,6 +161,7 @@ globals:
dms: File management
entryCreate: New entry
latestBuys: Latest buys
reserves: Reserves
tickets: Tickets
ticketCreate: New Tickets
boxing: Boxing
@ -195,7 +209,7 @@ globals:
roadmap: Roadmap
stops: Stops
routes: Routes
cmrsList: CMRs list
cmrsList: CMRs
RouteList: List
routeCreate: New route
RouteRoadmap: Roadmaps
@ -260,6 +274,11 @@ globals:
ticketsMonitor: Tickets monitor
clientsActionsMonitor: Clients and actions
serial: Serial
medical: Mutual
RouteExtendedList: Router
wasteRecalc: Waste recaclulate
operator: Operator
supplier: Supplier
created: Created
worker: Worker
now: Now
@ -274,12 +293,30 @@ globals:
createInvoiceIn: Create invoice in
myAccount: My account
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:
statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred
statusBadGateway: It seems that the server has fall down
statusGatewayTimeout: Could not contact the server
userConfig: Error fetching user config
updateUserConfig: Error updating user config
tokenConfig: Error fetching token config
writeRequest: The requested operation could not be completed
login:
@ -310,135 +347,6 @@ resetPassword:
repeatPassword: Repeat password
passwordNotMatch: Passwords don't match
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:
list:
newEntry: New entry
@ -602,6 +510,8 @@ ticket:
warehouse: Warehouse
customerCard: Customer card
alias: Alias
ticketList: Ticket List
newOrder: New Order
boxing:
expedition: Expedition
item: Item
@ -623,6 +533,7 @@ ticket:
landed: Landed
consigneePhone: Consignee phone
consigneeMobile: Consignee mobile
consigneeAddress: Consignee address
clientPhone: Client phone
clientMobile: Client mobile
consignee: Consignee
@ -652,6 +563,11 @@ ticket:
weight: Weight
goTo: Go to
summaryAmount: Summary
purchaseRequest: Purchase request
service: Service
description: Description
attender: Attender
ok: Ok
create:
client: Client
address: Address
@ -675,7 +591,6 @@ invoiceOut:
client: Client
company: Company
customerCard: Customer card
ticketList: Ticket List
summary:
issued: Issued
created: Created
@ -752,56 +667,6 @@ parking:
searchBar:
info: You can search by parking code
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:
field:
salesPersonFk: Sales Person
@ -878,6 +743,8 @@ worker:
timeControl: Time control
locker: Locker
balance: Balance
medical: Medical
operator: Operator
list:
name: Name
email: Email
@ -889,6 +756,7 @@ worker:
newWorker: New worker
card:
workerId: Worker ID
user: User
name: Name
email: Email
phone: Phone
@ -949,14 +817,23 @@ worker:
bankEntity: Swift / BIC
formation:
tableVisibleColumns:
course: Curso
startDate: Fecha Inicio
endDate: Fecha Fin
center: Centro Formación
invoice: Factura
amount: Importe
remark: Bonficado
hasDiploma: Diploma
course: Course
startDate: Start date
endDate: End date
center: Training center
invoice: Invoice
amount: Amount
remark: Remark
hasDiploma: Has diploma
medical:
tableVisibleColumns:
date: Date
time: Hour
center: Formation Center
invoice: Invoice
amount: Amount
isFit: Fit
remark: Observations
imageNotFound: Image not found
balance:
tableVisibleColumns:
@ -965,7 +842,29 @@ worker:
debit: Debt
credit: Have
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:
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:
name: Name
submit: Submit
@ -994,34 +893,7 @@ wagon:
minHeightBetweenTrays: 'The minimum height between trays is '
maxWagonHeight: 'The maximum height of the wagon is '
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:
list:
payMethod: Pay method
@ -1037,6 +909,7 @@ supplier:
account: Account
payMethod: Pay Method
payDay: Pay Day
country: Country
summary:
responsible: Responsible
notes: Notes
@ -1135,6 +1008,7 @@ travel:
warehouseOut: Warehouse out
totalEntries: Total entries
totalEntriesTooltip: Total entries
daysOnward: Landed days onwards
summary:
confirmed: Confirmed
entryId: Entry Id
@ -1210,7 +1084,7 @@ item:
producer: Producer
landed: Landed
fixedPrice:
itemId: Item ID
itemFk: Item ID
groupingPrice: Grouping price
packingPrice: Packing price
hasMinPrice: Has min price
@ -1287,6 +1161,7 @@ components:
active: Is active
visible: Is visible
floramondo: Is floramondo
showBadDates: Show future items
userPanel:
copyToken: Token copied to clipboard
settings: Settings

View File

@ -3,6 +3,7 @@ globals:
es: Español
en: Inglés
language: Idioma
quantity: Cantidad
entity: Entidad
user: Usuario
details: Detalles
@ -39,6 +40,8 @@ globals:
noChanges: Sin cambios que guardar
changesToSave: Tienes cambios pendientes de guardar
confirmRemove: Vas a eliminar este registro. ¿Continuar?
rowWillBeRemoved: Esta linea se eliminará
sureToContinue: ¿Seguro que quieres continuar?
rowAdded: Fila añadida
rowRemoved: Fila eliminada
pleaseWait: Por favor espera...
@ -46,6 +49,7 @@ globals:
summary:
basicData: Datos básicos
daysOnward: Días adelante
daysAgo: Días atras
today: Hoy
yesterday: Ayer
dateFormat: es-ES
@ -60,7 +64,7 @@ globals:
shipped: F. envío
totalEntries: Ent. totales
amount: Importe
packages: Bultos
packages: Embalajes
download: Descargar
downloadPdf: Descargar PDF
selectRows: 'Seleccionar las { numberRows } filas(s)'
@ -86,7 +90,7 @@ globals:
description: Descripción
id: Id
order: Orden
original: Original
original: Doc. física
file: Fichero
selectFile: Seleccione un fichero
copyClipboard: Copiar en portapapeles
@ -98,13 +102,20 @@ globals:
to: Hasta
notes: Notas
refresh: Actualizar
item: Artículo
ticket: Ticket
campaign: Campaña
weight: Peso
error: ¡Ups! Algo salió mal
recalc: Recalcular
pageTitles:
logIn: Inicio de sesión
addressEdit: Modificar consignatario
summary: Resumen
basicData: Datos básicos
log: Historial
parkingList: Listado de parkings
agencyList: Listado de agencias
agencyList: Agencias
agency: Agencia
workCenters: Centros de trabajo
modes: Modos
@ -119,6 +130,7 @@ globals:
inheritedRoles: Roles heredados
customers: Clientes
customerCreate: Nuevo cliente
createOrder: Nuevo pedido
list: Listado
webPayments: Pagos Web
extendedList: Listado extendido
@ -128,6 +140,7 @@ globals:
fiscalData: Datos fiscales
billingData: Forma de pago
consignees: Consignatarios
'address-create': Nuevo consignatario
notes: Notas
credits: Créditos
greuges: Greuges
@ -151,6 +164,7 @@ globals:
dms: Gestión documental
entryCreate: Nueva entrada
latestBuys: Últimas compras
reserves: Reservas
tickets: Tickets
ticketCreate: Nuevo ticket
boxing: Encajado
@ -199,12 +213,13 @@ globals:
roadmap: Troncales
stops: Paradas
routes: Rutas
cmrsList: Listado de CMRs
cmrsList: CMRs
RouteList: Listado
routeCreate: Nueva ruta
RouteRoadmap: Troncales
RouteRoadmapCreate: Crear troncal
autonomous: Autónomos
RouteExtendedList: Enrutador
suppliers: Proveedores
supplier: Proveedor
supplierCreate: Nuevo proveedor
@ -255,7 +270,7 @@ globals:
tracking: Estados
components: Componentes
pictures: Fotos
packages: Bultos
packages: Embalajes
ldap: LDAP
samba: Samba
twoFactor: Doble factor
@ -264,6 +279,10 @@ globals:
ticketsMonitor: Monitor de tickets
clientsActionsMonitor: Clientes y acciones
serial: Facturas por serie
medical: Mutua
wasteRecalc: Recalcular mermas
operator: Operario
supplier: Proveedor
created: Fecha creación
worker: Trabajador
now: Ahora
@ -278,12 +297,30 @@ globals:
createInvoiceIn: Crear factura recibida
myAccount: Mi cuenta
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:
statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor
statusBadGateway: Parece ser que el servidor ha caído
statusGatewayTimeout: No se ha podido contactar con el servidor
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
writeRequest: No se pudo completar la operación solicitada
login:
@ -312,134 +349,6 @@ resetPassword:
repeatPassword: Repetir contraseña
passwordNotMatch: Las contraseñas no coinciden
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:
list:
newEntry: Nueva entrada
@ -592,7 +501,7 @@ ticket:
tracking: Estados
components: Componentes
pictures: Fotos
packages: Bultos
packages: Embalajes
list:
nickname: Alias
state: Estado
@ -610,6 +519,8 @@ ticket:
warehouse: Almacén
customerCard: Ficha del cliente
alias: Alias
ticketList: Listado de tickets
newOrder: Nuevo pedido
boxing:
expedition: Expedición
item: Artículo
@ -631,6 +542,7 @@ ticket:
landed: Entregado
consigneePhone: Tel. consignatario
consigneeMobile: Móv. consignatario
consigneeAddress: Dir. consignatario
clientPhone: Tel. cliente
clientMobile: Móv. cliente
consignee: Consignatario
@ -660,6 +572,10 @@ ticket:
weight: Peso
goTo: Ir a
summaryAmount: Resumen
purchaseRequest: Petición de compra
service: Servicio
description: Descripción
attender: Consignatario
create:
client: Cliente
address: Dirección
@ -798,54 +714,6 @@ parking:
searchBar:
info: Puedes buscar por código de 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:
pageTitles:
basicData: Basic data
@ -881,6 +749,9 @@ worker:
timeControl: Control de horario
locker: Taquilla
balance: Balance
formation: Formación
medical: Mutua
operator: Operario
list:
name: Nombre
email: Email
@ -892,6 +763,7 @@ worker:
newWorker: Nuevo trabajador
card:
workerId: ID Trabajador
user: Usuario
name: Nombre
email: Correo personal
phone: Teléfono
@ -951,6 +823,15 @@ worker:
amount: Importe
remark: Bonficado
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
balance:
tableVisibleColumns:
@ -959,7 +840,30 @@ worker:
debit: Debe
credit: Haber
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:
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:
name: Nombre
submit: Guardar
@ -988,21 +892,6 @@ wagon:
minHeightBetweenTrays: 'La distancia mínima entre bandejas es '
maxWagonHeight: 'La altura máxima del vagón es '
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:
list:
payMethod: Método de pago
@ -1018,6 +907,7 @@ supplier:
account: Cuenta
payMethod: Método de pago
payDay: Dia de pago
country: País
summary:
responsible: Responsable
notes: Notas
@ -1116,6 +1006,7 @@ travel:
warehouseOut: Alm.entrada
totalEntries:
totalEntriesTooltip: Entradas totales
daysOnward: Días de llegada en adelante
summary:
confirmed: Confirmado
entryId: Id entrada
@ -1191,7 +1082,7 @@ item:
producer: Productor
landed: F. entrega
fixedPrice:
itemId: ID Artículo
itemFk: ID Artículo
groupingPrice: Precio grouping
packingPrice: Precio packing
hasMinPrice: Tiene precio mínimo
@ -1266,6 +1157,7 @@ components:
active: Activo
visible: Visible
floramondo: Floramondo
showBadDates: Ver items a futuro
userPanel:
copyToken: Token copiado al portapapeles
settings: Configuración

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
import FormModel from 'components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { ref, watch } from 'vue';
@ -24,7 +25,7 @@ watch(
<template>
<FormModel
ref="formModelRef"
:url="`VnUsers/preview`"
url="VnUsers/preview"
:url-update="`VnUsers/${route.params.id}/update-user`"
:filter="accountFilter"
model="Accounts"
@ -43,6 +44,15 @@ watch(
option-value="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>
</template>
</FormModel>

View File

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

View File

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

View File

@ -169,7 +169,13 @@ onMounted(async () => await getAccountData(false));
<AccountMailAliasCreateForm @on-submit-create-alias="createMailAlias" />
</QDialog>
<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>
</QBtn>
</QPageSticky>

View File

@ -19,7 +19,15 @@ watch(
</script>
<template>
<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 }">
<div class="q-gutter-y-sm">
<QCheckbox

View File

@ -142,7 +142,13 @@ const redirectToRoleSummary = (id) =>
<SubRoleCreateForm @on-submit-create-subrole="createSubRole" />
</QDialog>
<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>
</QBtn>
</QPageSticky>

View File

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

View File

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

View File

@ -3,58 +3,18 @@ import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
import 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 VnInputDate from 'components/common/VnInputDate.vue';
import axios from 'axios';
import VnAvatar from 'src/components/ui/VnAvatar.vue';
const route = useRoute();
const { t } = useI18n();
const claimStates = ref([]);
const claimStatesCopy = ref([]);
const optionsList = 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>
<template>
<FetchData
@ -70,7 +30,7 @@ const statesFilter = {
auto-load
:reload="true"
>
<template #form="{ data, validate, filter }">
<template #form="{ data, validate }">
<VnRow>
<VnInput
v-model="data.client.name"
@ -101,20 +61,14 @@ const statesFilter = {
/>
</template>
</VnSelect>
<QSelect
<VnSelect
v-model="data.claimStateFk"
:options="claimStates"
option-value="id"
option-label="description"
emit-value
url="ClaimStates"
:label="t('claim.state')"
map-options
use-input
@filter="(value, update) => filter(value, update, statesFilter)"
option-label="description"
:rules="validate('claim.claimStateFk')"
:input-debounce="0"
>
</QSelect>
/>
</VnRow>
<VnRow>
<QInput
@ -123,16 +77,14 @@ const statesFilter = {
:rules="validate('claim.packages')"
type="number"
/>
<QSelect
<VnSelectEnum
v-model="data.pickup"
:options="optionsList"
option-value="id"
option-label="description"
emit-value
:label="t('claim.pickup')"
map-options
use-input
:input-debounce="0"
table="claim"
column="pickup"
option-label="description"
:translation="(value) => t(`claim.${value}`)"
:default-options="[{ id: null, description: t('claim.null') }]"
/>
</VnRow>
</template>

View File

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

View File

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

View File

@ -246,7 +246,13 @@ function onDrag() {
</QDialog>
<QPageSticky position="bottom-right" :offset="[25, 25]">
<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
ref="inputFile"
type="file"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,15 +1,241 @@
<script setup>
import CustomerConsumptionFilter from './CustomerConsumptionFilter.vue';
import { useStateStore } from 'src/stores/useStateStore';
import { ref, computed, onBeforeMount } from 'vue';
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>
<template>
<Teleport to="#right-panel" v-if="useStateStore().isHeaderMounted()">
<CustomerConsumptionFilter data-key="CustomerConsumption" />
</Teleport>
<VnTable
v-if="campaignList"
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>
<i18n>
es:
Enter a new search: Introduce una nueva búsqueda
Group by items: Agrupar por artículos
</i18n>

View File

@ -5,6 +5,8 @@ import VnInput from 'src/components/common/VnInput.vue';
import { QItem } from 'quasar';
import VnSelect from 'src/components/common/VnSelect.vue';
import { QItemSection } from 'quasar';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import { toDate } from 'src/filters';
const { t } = useI18n();
defineProps({ dataKey: { type: String, required: true } });
@ -33,6 +35,8 @@ defineProps({ dataKey: { type: String, required: true } });
<VnSelect
v-model="params.buyerId"
url="TicketRequests/getItemTypeWorker"
:fields="['id', 'nickname']"
sort-by="nickname ASC"
:label="t('params.buyer')"
option-value="id"
option-label="nickname"
@ -43,35 +47,97 @@ defineProps({ dataKey: { type: String, required: true } });
</QItemSection>
</QItem>
<QItem>
<!--It's required to include the relation category !! There's 413 records in production-->
<QItemSection>
<VnSelect
v-model="params.typeId"
url="ItemTypes"
:label="t('params.type')"
:include="['category']"
:fields="['id', 'name', 'categoryFk']"
sort-by="name ASC"
:label="t('params.typeId')"
option-label="name"
option-value="id"
dense
outlined
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>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
v-model="params.categoryId"
url="ItemCategories"
:label="t('params.category')"
:fields="['id', 'name']"
sort-by="name ASC"
:label="t('params.categoryId')"
option-label="name"
option-value="id"
v-model="params.categoryId"
dense
outlined
rounded
/>
</QItemSection>
</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>
</VnFilterPanel>
</template>
@ -82,10 +148,30 @@ en:
buyer: Buyer
type: Type
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:
params:
item: Id artículo
buyer: Comprador
type: Tipo
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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,20 +1,19 @@
<script setup>
import { computed, ref } from 'vue';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
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 route = useRoute();
const rows = ref([]);
const filter = {
include: [
{ relation: 'mandateType', scope: { fields: ['id', 'name'] } },
{ relation: 'mandateType', scope: { fields: ['id', 'code'] } },
{ relation: 'company', scope: { fields: ['id', 'code'] } },
],
where: { clientFk: route.params.id },
@ -22,114 +21,61 @@ const filter = {
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(() => [
{
align: 'left',
field: 'id',
label: t('Id'),
name: 'id',
label: t('globals.id'),
field: 'id',
isId: true,
},
{
align: 'left',
field: (row) => row.company.code,
label: t('Company'),
cardVisible: true,
format: ({ company }) => company.code,
label: t('globals.company'),
name: 'company',
},
{
align: 'left',
field: (row) => row.mandateType.name,
label: t('Type'),
cardVisible: true,
format: ({ mandateType }) => mandateType.code,
label: t('globals.type'),
name: 'type',
},
{
align: 'left',
field: 'created',
cardVisible: true,
label: t('Register date'),
name: 'registerDate',
format: (value) => toDateTimeFormat(value),
name: 'created',
format: ({ created }) => toDateTimeFormat(created),
},
{
align: 'left',
field: 'finished',
align: 'right',
cardVisible: true,
name: 'finished',
label: t('End date'),
name: 'endDate',
format: (value) => (value ? toDateTimeFormat(value) : '-'),
format: ({ finished }) => dashIfEmpty(toDateTimeFormat(finished)),
},
]);
</script>
<template>
<FetchData
<QPage class="column items-center q-pa-md">
<VnTable
:filter="filter"
@on-fetch="(data) => (rows = data)"
auto-load
url="Mandates"
/>
<QPage class="column items-center q-pa-md">
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
v-if="rows?.length"
>
<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>
:right-search="false"
:row-click="false"
/>
</QPage>
</template>
<i18n>
es:
Id: Id
Company: Empresa
Type: Tipo
Register date: Fecha alta
End date: Fecha baja
</i18n>

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