Merge pull request '8355-testToMaster' (!1177) from 8355-testToMaster into master
Reviewed-on: #1177 Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
This commit is contained in:
commit
cc6ee7ce30
164
CHANGELOG.md
164
CHANGELOG.md
|
@ -1,3 +1,167 @@
|
||||||
|
# Version 24.52 - 2024-01-07
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- chore: refs #8197 remove console log by:alexm
|
||||||
|
- chore: refs #8197 replace name by:alexm
|
||||||
|
- chore: refs #8197 unnecessary file by:alexm
|
||||||
|
- feat: #8110 apply mixin in quasar components by:Javier Segarra
|
||||||
|
- feat(Account & AccountRole): refs #8197 add VnCardMain by:alexm
|
||||||
|
- feat: addDptoLink by:Jtubau
|
||||||
|
- feat: added restore ticket function in ticket descriptor menu by:Jon
|
||||||
|
- feat: add support service wip by:jorgep
|
||||||
|
- feat: focus menu searchbar by:jorgep
|
||||||
|
- feat: make additional data object by:jorgep
|
||||||
|
- feat: message to grant access by:jorgep
|
||||||
|
- feat: refs #6583 add default param by:jorgep
|
||||||
|
- feat: refs #6583 add destination opt filter by:jorgep
|
||||||
|
- feat: refs #6583 add icon by:jorgep
|
||||||
|
- feat: refs #6583 add locale by:jorgep
|
||||||
|
- feat: refs #7072 added test to computed fn total by:Jtubau
|
||||||
|
- feat: refs #7235 update invoice out global form to fetch config based on serial type by:jgallego
|
||||||
|
- feat: refs #7301 add exclude inventory supplier from list by:pablone
|
||||||
|
- feat: refs #7301 enhance VnDateBadge styling and improve ItemLastEntries component by:pablone
|
||||||
|
- feat: refs #7882 Added distribution point by:guillermo
|
||||||
|
- feat: refs #7882 Added longitude & latitude by:guillermo
|
||||||
|
- feat: refs #7936 add autocomplete on tab fn by:jorgep
|
||||||
|
- feat: refs #7936 add company filter by:jorgep
|
||||||
|
- feat: refs #7936 add currency check before fetching by:jorgep
|
||||||
|
- feat: refs #7936 add dueDated field by:jorgep
|
||||||
|
- feat: refs #7936 add number validation to VnInputNumber & new daysAgo filter in InvoiceInFilter by:jorgep
|
||||||
|
- feat: refs #7936 add optionCaption by:jorgep
|
||||||
|
- feat: refs #7936 add row click navigation to InvoiceInSerial by:jorgep
|
||||||
|
- feat: refs #7936 add unit tests by:jorgep
|
||||||
|
- feat: refs #7936 add useAccountShortToStandard composable by:jorgep
|
||||||
|
- feat: refs #7936 calculate exchange & update taxable base by:jorgep
|
||||||
|
- feat: refs #7936 enhance downloadFile function to support opening in a new tab by:jorgep
|
||||||
|
- feat: refs #7936 enhance getTotal fn & add unit tests by:jorgep
|
||||||
|
- feat: refs #7936 enhance vn-select by:jorgep
|
||||||
|
- feat: refs #7936 improve optionLabel logic in InvoiceInVat component for better handling of numeric values by:jorgep
|
||||||
|
- feat: refs #7936 limit decimal places by:jorgep
|
||||||
|
- feat: refs #7936 make fields required by:jorgep
|
||||||
|
- feat: refs #7936 show country code & isVies fields by:jorgep
|
||||||
|
- feat: refs #7936 show id & value by:jorgep
|
||||||
|
- feat: refs #7936 simplify optionLabel wip by:jorgep
|
||||||
|
- feat: refs #7936 update 'isVies' label to use global translation key by:jorgep
|
||||||
|
- feat: refs #7936 update option labels in InvoiceIn components for better clarity by:jorgep
|
||||||
|
- feat: refs #7936 use default invoice data by:jorgep
|
||||||
|
- feat: refs #8001 change request by:robert
|
||||||
|
- feat: refs #8001 ticketExpeditionGrafana by:robert
|
||||||
|
- feat: refs #8194 created VnSelectWorker component and use it in Lilium by:Jon
|
||||||
|
- feat: refs #8197 better leftMenu and VnCardMain improvements by:alexm
|
||||||
|
- feat: refs #8197 default leftMenu by:alexm
|
||||||
|
- feat: refs #8197 default sectionName by:alexm
|
||||||
|
- feat: refs #8197 keepData in VnSection by:alexm
|
||||||
|
- feat: refs #8197 vnTableFilter by:alexm
|
||||||
|
- feat: refs #8197 working rightMenu by:alexm
|
||||||
|
- feat: remove re-fetch when add element by:Javier Segarra
|
||||||
|
- feat: remove search after category by:Javier Segarra
|
||||||
|
- feat: requested changes in item module by:Jon
|
||||||
|
- feat: update quantity by:Javier Segarra
|
||||||
|
- feat(VnPaginate): refs #8197 hold data when change to Card by:alexm
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- perf: #6896 REMOVE COMMENTS by:Javier Segarra
|
||||||
|
- perf: qFormMixin by:Javier Segarra
|
||||||
|
- perf: qFormMixin improvement by:Javier Segarra
|
||||||
|
- perf: refs #8194 select worker component by:Jon
|
||||||
|
- perf: refs #8197 perf by:alexm
|
||||||
|
- perf: remove comments by:Javier Segarra
|
||||||
|
- perf: remove unused variables (origin/warmfix_noUsedVars) by:Javier Segarra
|
||||||
|
- refactor: added again search emit by:Jon
|
||||||
|
- refactor: add useCau composable by:jorgep
|
||||||
|
- refactor: deleted log by:Jon
|
||||||
|
- refactor: deleted onUnmounted code by:Jon
|
||||||
|
- refactor: deleted useless hidden tag by:Jon
|
||||||
|
- refactor: deleted warnings and corrected itemTag by:Jon
|
||||||
|
- refactor: drop logic by:jorgep
|
||||||
|
- refactor: ignore params when searching by id on searchbar (origin/VnSearchbar-SearchRemoveParams) by:Jon
|
||||||
|
- refactor: log error by:Jon
|
||||||
|
- refactor: refs #7936 locale by:jorgep
|
||||||
|
- refactor: refs #7936 simplify getTotal fn by:jorgep
|
||||||
|
- refactor: refs #7936 update label capitalization and replace invoice type options by:jorgep
|
||||||
|
- refactor: refs #8194 deleted unnecessary label by:Jon
|
||||||
|
- refactor: refs #8194 modified select worker template by:Jon
|
||||||
|
- refactor: refs #8194 modified select worker to allow no one filter from monitor ticket by:Jon
|
||||||
|
- refactor: refs #8194 moved translation to the correct place by:Jon
|
||||||
|
- refactor: refs #8194 requested changes by:Jon
|
||||||
|
- refactor: refs #8194 structure changes in component and related files by:Jon
|
||||||
|
- refactor: refs #8197 adapt AccountAcls to VnCardMain by:alexm
|
||||||
|
- refactor: refs #8197 adapt AccountAlias by:alexm
|
||||||
|
- refactor: refs #8197 adapt Ticket to VnCardMain by:alexm
|
||||||
|
- refactor: refs #8197 backward compatible (8197-VnCardMain_backwardCompatibility) by:alexm
|
||||||
|
- refactor: refs #8197 rename VnSectionMain to VnModule and VnCardMain to VnSection by:alexm
|
||||||
|
- refactor: refs #8288 changed invoice out spanish translation by:provira
|
||||||
|
- refactor: use locale keys by:jorgep
|
||||||
|
- refactor: use teleport to avoid qdrawer overlapping by:Jon
|
||||||
|
- refactor: use VnSelectWorker by:Jon
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- fix: account by:carlossa
|
||||||
|
- fix: account create by:carlossa
|
||||||
|
- fix: accountList create by:carlossa
|
||||||
|
- fix(AccountList): use $refs by:alexm
|
||||||
|
- fix: add data-key by:alexm
|
||||||
|
- fix: addLocales by:Jtubau
|
||||||
|
- fix: dated field by:Jon
|
||||||
|
- fix: e2e by:jorgep
|
||||||
|
- fix: fix department filter by:carlossa
|
||||||
|
- fix: fixed translations by:Javier Segarra
|
||||||
|
- fix: fixed translations by:provira
|
||||||
|
- fix: get total from api by:Javier Segarra
|
||||||
|
- fix: handle non-object options by:jorgep
|
||||||
|
- fix: monitorPayMethodFilter by:carlossa
|
||||||
|
- fix: orderBy priority by:Javier Segarra
|
||||||
|
- fix: prevent null by:jorgep
|
||||||
|
- fix: redirection vnTable VnTableFilter by:alexm
|
||||||
|
- fix: refs #6389 fix filter trad by:carlossa
|
||||||
|
- fix: refs #6389 fix front, filters, itp by:carlossa
|
||||||
|
- fix: refs #6389 front add packing filter by:carlossa
|
||||||
|
- fix: refs #6389 front by:carlossa
|
||||||
|
- fix: refs #6389 front filters by:carlossa
|
||||||
|
- fix: refs #6389 ipt by:carlossa
|
||||||
|
- fix: refs #6389 packing by:carlossa
|
||||||
|
- fix: refs #6583 update checkbox for filtering by destination in TicketAdvanceFilter by:jorgep
|
||||||
|
- fix: refs #7031 add test e2e by:carlossa
|
||||||
|
- fix: refs #7031 fix zoneTest by:carlossa
|
||||||
|
- fix: refs #7301 unnecessary console logs from ItemLastEntries.vue by:pablone
|
||||||
|
- fix: refs #7936 changes by:jorgep
|
||||||
|
- fix: refs #7936 decimal places & locale by:jorgep
|
||||||
|
- fix: refs #7936 descriptor & dueday by:jorgep
|
||||||
|
- fix: refs #7936 exclude disabled els on tab by:jorgep
|
||||||
|
- fix: refs #7936 format tax calculation to two decimal places by:jorgep
|
||||||
|
- fix: refs #7936 improve error handling by:jorgep
|
||||||
|
- fix: refs #7936 redirection by:jorgep
|
||||||
|
- fix: refs #7936 rollback by:jorgep
|
||||||
|
- fix: refs #7936 serial by:jorgep
|
||||||
|
- fix: refs #7936 tabulation wip by:jorgep
|
||||||
|
- fix: refs #7936 test by:jorgep
|
||||||
|
- fix: refs #8114 clean by:carlossa
|
||||||
|
- fix: refs #8114 fix agencyList by:carlossa
|
||||||
|
- fix: refs #8114 fix lifeCycle hooks by:carlossa
|
||||||
|
- fix: refs #8114 fix pr by:carlossa
|
||||||
|
- fix: refs #8114 fix removeAddress by:carlossa
|
||||||
|
- fix: refs #8114 orderList by:carlossa
|
||||||
|
- fix: refs #8114 remove logs by:carlossa
|
||||||
|
- fix: refs #8197 mapKey (origin/8197-perf_vnTableInside, 8197-perf_vnTableInside) by:alexm
|
||||||
|
- fix: refs #8197 redirection (8197-perf_redirection) by:alexm
|
||||||
|
- fix: refs #8197 staticParams and redirect by:alexm
|
||||||
|
- fix: refs #8197 vnPaginate onFetch emit by:alexm
|
||||||
|
- fix: refs #8197 vnPaginate when change :id by:alexm
|
||||||
|
- fix: refs #8197 vnTableFilter in vnTable by:alexm
|
||||||
|
- fix: refs #8315 ticketBoxing test by:alexm
|
||||||
|
- fix: remove url by:carlossa
|
||||||
|
- fix: rollback by:jorgep
|
||||||
|
- fix: test by:jorgep
|
||||||
|
- fix(VnDmsList): refs #8197 add mapKey by:alexm
|
||||||
|
- revert: refs #8197 arrayData changes by:alexm
|
||||||
|
- test: refs #8197 fix e2e by:alexm
|
||||||
|
- test: refs #8315 fix claimDevelopment fixtures by:alexm
|
||||||
|
- test: refs #8315 fix clientList by:alexm
|
||||||
|
- test: refs #8315 fix VnSelect in e2e by:alexm
|
||||||
|
|
||||||
# Version 24.50 - 2024-12-10
|
# Version 24.50 - 2024-12-10
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.50.0",
|
"version": "24.52.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
@ -64,4 +64,4 @@
|
||||||
"vite": "^5.1.4",
|
"vite": "^5.1.4",
|
||||||
"vitest": "^0.31.1"
|
"vitest": "^0.31.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import routes from 'src/router/modules';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
let isNotified = false;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
created: function () {
|
||||||
|
const router = useRouter();
|
||||||
|
const keyBindingMap = routes
|
||||||
|
.filter((route) => route.meta.keyBinding)
|
||||||
|
.reduce((map, route) => {
|
||||||
|
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
||||||
|
return map;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
const handleKeyDown = (event) => {
|
||||||
|
const { ctrlKey, altKey, code } = event;
|
||||||
|
|
||||||
|
if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
|
||||||
|
event.preventDefault();
|
||||||
|
router.push(keyBindingMap[code]);
|
||||||
|
isNotified = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleKeyUp = (event) => {
|
||||||
|
const { ctrlKey, altKey } = event;
|
||||||
|
if (!ctrlKey || !altKey) {
|
||||||
|
isNotified = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('keydown', handleKeyDown);
|
||||||
|
window.addEventListener('keyup', handleKeyUp);
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,30 +1,51 @@
|
||||||
import { getCurrentInstance } from 'vue';
|
function focusFirstInput(input) {
|
||||||
|
input.focus();
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
const vm = getCurrentInstance();
|
const that = this;
|
||||||
if (vm.type.name === 'QForm') {
|
|
||||||
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
|
const form = document.querySelector('.q-form#formModel');
|
||||||
// TODO: AUTOFOCUS IS NOT FOCUSING
|
if (!form) return;
|
||||||
const that = this;
|
try {
|
||||||
this.$el.addEventListener('keyup', function (evt) {
|
const inputsFormCard = form.querySelectorAll(
|
||||||
if (evt.key === 'Enter' && !that.$attrs['prevent-submit']) {
|
`input:not([disabled]):not([type="checkbox"])`
|
||||||
const input = evt.target;
|
);
|
||||||
if (input.type == 'textarea' && evt.shiftKey) {
|
if (inputsFormCard.length) {
|
||||||
evt.preventDefault();
|
focusFirstInput(inputsFormCard[0]);
|
||||||
let { selectionStart, selectionEnd } = input;
|
|
||||||
input.value =
|
|
||||||
input.value.substring(0, selectionStart) +
|
|
||||||
'\n' +
|
|
||||||
input.value.substring(selectionEnd);
|
|
||||||
selectionStart = selectionEnd = selectionStart + 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
evt.preventDefault();
|
|
||||||
that.onSubmit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
const textareas = document.querySelectorAll(
|
||||||
|
'textarea:not([disabled]), [contenteditable]:not([disabled])'
|
||||||
|
);
|
||||||
|
if (textareas.length) {
|
||||||
|
focusFirstInput(textareas[textareas.length - 1]);
|
||||||
|
}
|
||||||
|
const inputs = document.querySelectorAll(
|
||||||
|
'form#formModel input:not([disabled]):not([type="checkbox"])'
|
||||||
|
);
|
||||||
|
const input = inputs[0];
|
||||||
|
if (!input) return;
|
||||||
|
|
||||||
|
focusFirstInput(input);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
form.addEventListener('keyup', function (evt) {
|
||||||
|
if (evt.key === 'Enter') {
|
||||||
|
const input = evt.target;
|
||||||
|
if (input.type == 'textarea' && evt.shiftKey) {
|
||||||
|
evt.preventDefault();
|
||||||
|
let { selectionStart, selectionEnd } = input;
|
||||||
|
input.value =
|
||||||
|
input.value.substring(0, selectionStart) +
|
||||||
|
'\n' +
|
||||||
|
input.value.substring(selectionEnd);
|
||||||
|
selectionStart = selectionEnd = selectionStart + 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
evt.preventDefault();
|
||||||
|
that.onSubmit();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
|
import axios from 'axios';
|
||||||
import { boot } from 'quasar/wrappers';
|
import { boot } from 'quasar/wrappers';
|
||||||
import qFormMixin from './qformMixin';
|
import qFormMixin from './qformMixin';
|
||||||
import keyShortcut from './keyShortcut';
|
import keyShortcut from './keyShortcut';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import { QForm } from 'quasar';
|
||||||
import { CanceledError } from 'axios';
|
import { QLayout } from 'quasar';
|
||||||
|
import mainShortcutMixin from './mainShortcutMixin';
|
||||||
const { notify } = useNotify();
|
import { useCau } from 'src/composables/useCau';
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app }) => {
|
||||||
app.mixin(qFormMixin);
|
QForm.mixins = [qFormMixin];
|
||||||
|
QLayout.mixins = [mainShortcutMixin];
|
||||||
|
|
||||||
app.directive('shortcut', keyShortcut);
|
app.directive('shortcut', keyShortcut);
|
||||||
app.config.errorHandler = (error) => {
|
app.config.errorHandler = async (error) => {
|
||||||
let message;
|
let message;
|
||||||
const response = error.response;
|
const response = error.response;
|
||||||
const responseData = response?.data;
|
const responseData = response?.data;
|
||||||
|
@ -40,12 +43,12 @@ export default boot(({ app }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error(error);
|
console.error(error);
|
||||||
if (error instanceof CanceledError) {
|
if (error instanceof axios.CanceledError) {
|
||||||
const env = process.env.NODE_ENV;
|
const env = process.env.NODE_ENV;
|
||||||
if (env && env !== 'development') return;
|
if (env && env !== 'development') return;
|
||||||
message = 'Duplicate request';
|
message = 'Duplicate request';
|
||||||
}
|
}
|
||||||
|
|
||||||
notify(message ?? 'globals.error', 'negative', 'error');
|
await useCau(response, message);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -55,13 +55,6 @@ async function setCountry(countryFk, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Province
|
// Province
|
||||||
|
|
||||||
async function handleProvinces(data) {
|
|
||||||
provincesOptions.value = data;
|
|
||||||
if (postcodeFormData.countryFk) {
|
|
||||||
await fetchTowns();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function setProvince(id, data) {
|
async function setProvince(id, data) {
|
||||||
if (data.provinceFk === id) return;
|
if (data.provinceFk === id) return;
|
||||||
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
||||||
|
|
|
@ -92,13 +92,13 @@ function findMatches(search, item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addChildren(module, route, parent) {
|
function addChildren(module, route, parent) {
|
||||||
if (route.menus) {
|
const menus = route?.meta?.menu ?? route?.menus?.[props.source]; //backwards compatible
|
||||||
const mainMenus = route.menus[props.source];
|
if (!menus) return;
|
||||||
const matches = findMatches(mainMenus, route);
|
|
||||||
|
|
||||||
for (const child of matches) {
|
const matches = findMatches(menus, route);
|
||||||
navigation.addMenuItem(module, child, parent);
|
|
||||||
}
|
for (const child of matches) {
|
||||||
|
navigation.addMenuItem(module, child, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,16 +122,26 @@ function getRoutes() {
|
||||||
if (props.source === 'card') {
|
if (props.source === 'card') {
|
||||||
const currentRoute = route.matched[1];
|
const currentRoute = route.matched[1];
|
||||||
const currentModule = toLowerCamel(currentRoute.name);
|
const currentModule = toLowerCamel(currentRoute.name);
|
||||||
const moduleDef = routes.find(
|
let moduleDef = routes.find(
|
||||||
(route) => toLowerCamel(route.name) === currentModule
|
(route) => toLowerCamel(route.name) === currentModule
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!moduleDef) return;
|
if (!moduleDef) return;
|
||||||
|
if (!moduleDef?.menus) moduleDef = betaGetRoutes();
|
||||||
addChildren(currentModule, moduleDef, items.value);
|
addChildren(currentModule, moduleDef, items.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function betaGetRoutes() {
|
||||||
|
let menuRoute;
|
||||||
|
let index = route.matched.length - 1;
|
||||||
|
while (!menuRoute && index > 0) {
|
||||||
|
if (route.matched[index]?.meta?.menu) menuRoute = route.matched[index];
|
||||||
|
index--;
|
||||||
|
}
|
||||||
|
return menuRoute;
|
||||||
|
}
|
||||||
|
|
||||||
async function togglePinned(item, event) {
|
async function togglePinned(item, event) {
|
||||||
if (event.defaultPrevented) return;
|
if (event.defaultPrevented) return;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -177,6 +187,7 @@ function normalize(text) {
|
||||||
class="full-width"
|
class="full-width"
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
|
autofocus
|
||||||
/>
|
/>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
|
|
|
@ -59,6 +59,7 @@ const pinnedModulesRef = ref();
|
||||||
'no-visible': !stateQuery.isLoading().value,
|
'no-visible': !stateQuery.isLoading().value,
|
||||||
}"
|
}"
|
||||||
size="xs"
|
size="xs"
|
||||||
|
data-cy="loading-spinner"
|
||||||
/>
|
/>
|
||||||
<QSpace />
|
<QSpace />
|
||||||
<div id="searchbar" class="searchbar"></div>
|
<div id="searchbar" class="searchbar"></div>
|
||||||
|
|
|
@ -32,7 +32,10 @@ const $props = defineProps({
|
||||||
defineExpose({ addFilter, props: $props });
|
defineExpose({ addFilter, props: $props });
|
||||||
|
|
||||||
const model = defineModel(undefined, { required: true });
|
const model = defineModel(undefined, { required: true });
|
||||||
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
const arrayData = useArrayData(
|
||||||
|
$props.dataKey,
|
||||||
|
$props.searchUrl ? { searchUrl: $props.searchUrl } : null
|
||||||
|
);
|
||||||
const columnFilter = computed(() => $props.column?.columnFilter);
|
const columnFilter = computed(() => $props.column?.columnFilter);
|
||||||
|
|
||||||
const updateEvent = { 'update:modelValue': addFilter };
|
const updateEvent = { 'update:modelValue': addFilter };
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onBeforeMount, onMounted, computed, watch } from 'vue';
|
import { ref, onBeforeMount, onMounted, computed, watch, useAttrs } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import { useFilterParams } from 'src/composables/useFilterParams';
|
||||||
|
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
|
|
||||||
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
|
||||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
||||||
import VnFilter from 'components/VnTable/VnFilter.vue';
|
import VnFilter from 'components/VnTable/VnFilter.vue';
|
||||||
import VnTableChip from 'components/VnTable/VnChip.vue';
|
import VnTableChip from 'components/VnTable/VnChip.vue';
|
||||||
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
||||||
|
import VnTableFilter from './VnTableFilter.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
columns: {
|
columns: {
|
||||||
|
@ -33,6 +34,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
rightSearchIcon: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
rowClick: {
|
rowClick: {
|
||||||
type: [Function, Boolean],
|
type: [Function, Boolean],
|
||||||
default: null,
|
default: null,
|
||||||
|
@ -101,10 +106,6 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '90vh',
|
default: '90vh',
|
||||||
},
|
},
|
||||||
chipLocale: {
|
|
||||||
type: String,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
footer: {
|
footer: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
@ -119,22 +120,21 @@ const stateStore = useStateStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
const $attrs = useAttrs();
|
||||||
|
|
||||||
const CARD_MODE = 'card';
|
const CARD_MODE = 'card';
|
||||||
const TABLE_MODE = 'table';
|
const TABLE_MODE = 'table';
|
||||||
const mode = ref(CARD_MODE);
|
const mode = ref(CARD_MODE);
|
||||||
const selected = ref([]);
|
const selected = ref([]);
|
||||||
const hasParams = ref(false);
|
const hasParams = ref(false);
|
||||||
const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}');
|
|
||||||
const params = ref({ ...routeQuery, ...routeQuery.filter?.where });
|
|
||||||
const orders = ref(parseOrder(routeQuery.filter?.order));
|
|
||||||
const CrudModelRef = ref({});
|
const CrudModelRef = ref({});
|
||||||
const showForm = ref(false);
|
const showForm = ref(false);
|
||||||
const splittedColumns = ref({ columns: [] });
|
const splittedColumns = ref({ columns: [] });
|
||||||
const columnsVisibilitySkipped = ref();
|
const columnsVisibilitySkipped = ref();
|
||||||
const createForm = ref();
|
const createForm = ref();
|
||||||
const tableFilterRef = ref([]);
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
const params = ref(useFilterParams($attrs['data-key']).params);
|
||||||
|
const orders = ref(useFilterParams($attrs['data-key']).orders);
|
||||||
|
|
||||||
const tableModes = [
|
const tableModes = [
|
||||||
{
|
{
|
||||||
|
@ -183,41 +183,8 @@ watch(
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.query[$props.searchUrl],
|
|
||||||
(val) => setUserParams(val),
|
|
||||||
{ immediate: true, deep: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
||||||
|
const showRightIcon = computed(() => $props.rightSearch || $props.rightSearchIcon);
|
||||||
function setUserParams(watchedParams, watchedOrder) {
|
|
||||||
if (!watchedParams) return;
|
|
||||||
|
|
||||||
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
|
|
||||||
const filter =
|
|
||||||
typeof watchedParams?.filter == 'string'
|
|
||||||
? JSON.parse(watchedParams?.filter ?? '{}')
|
|
||||||
: watchedParams?.filter;
|
|
||||||
const where = filter?.where;
|
|
||||||
const order = watchedOrder ?? filter?.order;
|
|
||||||
|
|
||||||
watchedParams = { ...watchedParams, ...where };
|
|
||||||
delete watchedParams.filter;
|
|
||||||
delete params.value?.filter;
|
|
||||||
params.value = { ...params.value, ...sanitizer(watchedParams) };
|
|
||||||
orders.value = parseOrder(order);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sanitizer(params) {
|
|
||||||
for (const [key, value] of Object.entries(params)) {
|
|
||||||
if (value && typeof value == 'object') {
|
|
||||||
const param = Object.values(value)[0];
|
|
||||||
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
function splitColumns(columns) {
|
function splitColumns(columns) {
|
||||||
splittedColumns.value = {
|
splittedColumns.value = {
|
||||||
|
@ -298,17 +265,6 @@ function getColAlign(col) {
|
||||||
return 'text-' + (col.align ?? 'left');
|
return 'text-' + (col.align ?? 'left');
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseOrder(urlOrders) {
|
|
||||||
const orderObject = {};
|
|
||||||
if (!urlOrders) return orderObject;
|
|
||||||
if (typeof urlOrders == 'string') urlOrders = [urlOrders];
|
|
||||||
for (const [index, orders] of urlOrders.entries()) {
|
|
||||||
const [name, direction] = orders.split(' ');
|
|
||||||
orderObject[name] = { direction, index: index + 1 };
|
|
||||||
}
|
|
||||||
return orderObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||||
defineExpose({
|
defineExpose({
|
||||||
create: createForm,
|
create: createForm,
|
||||||
|
@ -357,61 +313,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
show-if-above
|
show-if-above
|
||||||
>
|
>
|
||||||
<QScrollArea class="fit">
|
<QScrollArea class="fit">
|
||||||
<VnFilterPanel
|
<VnTableFilter :data-key="$attrs['data-key']" :columns="columns" :redirect="redirect" />
|
||||||
:data-key="$attrs['data-key']"
|
|
||||||
:search-button="true"
|
|
||||||
v-model="params"
|
|
||||||
: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
|
|
||||||
class="row no-wrap flex-center"
|
|
||||||
v-for="col of splittedColumns.columns.filter(
|
|
||||||
(c) => c.columnFilter ?? true
|
|
||||||
)"
|
|
||||||
:key="col.id"
|
|
||||||
>
|
|
||||||
<VnFilter
|
|
||||||
ref="tableFilterRef"
|
|
||||||
:column="col"
|
|
||||||
:data-key="$attrs['data-key']"
|
|
||||||
v-model="params[columnName(col)]"
|
|
||||||
:search-url="searchUrl"
|
|
||||||
/>
|
|
||||||
<VnTableOrder
|
|
||||||
v-if="
|
|
||||||
col?.columnFilter !== false &&
|
|
||||||
col?.name !== 'tableActions'
|
|
||||||
"
|
|
||||||
v-model="orders[col.orderBy ?? col.name]"
|
|
||||||
:name="col.orderBy ?? col.name"
|
|
||||||
:data-key="$attrs['data-key']"
|
|
||||||
:search-url="searchUrl"
|
|
||||||
:vertical="false"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<slot
|
|
||||||
name="moreFilterPanel"
|
|
||||||
:params="params"
|
|
||||||
: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>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<CrudModel
|
<CrudModel
|
||||||
|
@ -467,7 +369,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
:options="tableModes.filter((mode) => !mode.disable)"
|
:options="tableModes.filter((mode) => !mode.disable)"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="$props.rightSearch"
|
v-if="showRightIcon"
|
||||||
icon="filter_alt"
|
icon="filter_alt"
|
||||||
class="bg-vn-section-color q-ml-sm"
|
class="bg-vn-section-color q-ml-sm"
|
||||||
dense
|
dense
|
||||||
|
@ -589,6 +491,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
$props.rowClick && $props.rowClick(row);
|
$props.rowClick && $props.rowClick(row);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
style="height: 100%"
|
||||||
>
|
>
|
||||||
<QCardSection
|
<QCardSection
|
||||||
vertical
|
vertical
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
||||||
|
import VnFilter from 'components/VnTable/VnFilter.vue';
|
||||||
|
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
columns: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
chipLocale: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
searchUrl: {
|
||||||
|
type: [String, Boolean],
|
||||||
|
default: 'table',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const tableFilterRef = ref([]);
|
||||||
|
|
||||||
|
function columnName(col) {
|
||||||
|
const column = { ...col, ...col.columnFilter };
|
||||||
|
let name = column.name;
|
||||||
|
if (column.alias) name = column.alias + '.' + name;
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnFilterPanel v-bind="$attrs" :search-button="true" :disable-submit-event="true">
|
||||||
|
<template #body="{ params, orders }">
|
||||||
|
<div
|
||||||
|
class="row no-wrap flex-center"
|
||||||
|
v-for="col of columns.filter((c) => c.columnFilter ?? true)"
|
||||||
|
:key="col.id"
|
||||||
|
>
|
||||||
|
<VnFilter
|
||||||
|
ref="tableFilterRef"
|
||||||
|
:column="col"
|
||||||
|
:data-key="$attrs['data-key']"
|
||||||
|
v-model="params[columnName(col)]"
|
||||||
|
:search-url="searchUrl"
|
||||||
|
/>
|
||||||
|
<VnTableOrder
|
||||||
|
v-if="col?.columnFilter !== false && col?.name !== 'tableActions'"
|
||||||
|
v-model="orders[col.orderBy ?? col.name]"
|
||||||
|
:name="col.orderBy ?? col.name"
|
||||||
|
:data-key="$attrs['data-key']"
|
||||||
|
:search-url="searchUrl"
|
||||||
|
:vertical="true"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<slot
|
||||||
|
name="moreFilterPanel"
|
||||||
|
:params="params"
|
||||||
|
:orders="orders"
|
||||||
|
:columns="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>
|
||||||
|
</template>
|
|
@ -15,7 +15,7 @@ let root = ref(null);
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
matched.value = currentRoute.value.matched.filter(
|
matched.value = currentRoute.value.matched.filter(
|
||||||
(matched) => Object.keys(matched.meta).length
|
(matched) => !!matched?.meta?.title || !!matched?.meta?.icon
|
||||||
);
|
);
|
||||||
breadcrumbs.value.length = 0;
|
breadcrumbs.value.length = 0;
|
||||||
if (!matched.value[0]) return;
|
if (!matched.value[0]) return;
|
||||||
|
|
|
@ -14,6 +14,7 @@ defineProps({
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
focus-on-mount
|
focus-on-mount
|
||||||
@update:model-value="promise"
|
@update:model-value="promise"
|
||||||
|
data-cy="vnBtnSelect_select"
|
||||||
/>
|
/>
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
<script setup>
|
||||||
|
import { onBeforeMount, computed } from 'vue';
|
||||||
|
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import useCardSize from 'src/composables/useCardSize';
|
||||||
|
import LeftMenu from 'components/LeftMenu.vue';
|
||||||
|
import VnSubToolbar from '../ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
dataKey: { type: String, required: true },
|
||||||
|
baseUrl: { type: String, default: undefined },
|
||||||
|
customUrl: { type: String, default: undefined },
|
||||||
|
filter: { type: Object, default: () => {} },
|
||||||
|
descriptor: { type: Object, required: true },
|
||||||
|
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}`;
|
||||||
|
}
|
||||||
|
return props.customUrl;
|
||||||
|
});
|
||||||
|
|
||||||
|
const arrayData = useArrayData(props.dataKey, {
|
||||||
|
url: url.value,
|
||||||
|
filter: props.filter,
|
||||||
|
});
|
||||||
|
|
||||||
|
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) {
|
||||||
|
onBeforeRouteUpdate(async (to, from) => {
|
||||||
|
if (to.params.id !== from.params.id) {
|
||||||
|
arrayData.store.url = `${props.baseUrl}/${to.params.id}`;
|
||||||
|
await arrayData.fetch({ append: false, updateRouter: false });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<Teleport to="#left-panel" v-if="stateStore.isHeaderMounted()">
|
||||||
|
<component :is="descriptor" />
|
||||||
|
<QSeparator />
|
||||||
|
<LeftMenu source="card" />
|
||||||
|
</Teleport>
|
||||||
|
<VnSubToolbar />
|
||||||
|
<div :class="[useCardSize(), $attrs.class]">
|
||||||
|
<RouterView :key="route.path" />
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -0,0 +1,39 @@
|
||||||
|
<script setup>
|
||||||
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
|
|
||||||
|
defineProps({ date: { type: [Date, String], required: true } });
|
||||||
|
|
||||||
|
function getBadgeAttrs(date) {
|
||||||
|
let today = Date.vnNew();
|
||||||
|
today.setHours(0, 0, 0, 0);
|
||||||
|
let timeTicket = new Date(date);
|
||||||
|
timeTicket.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
|
let timeDiff = today - timeTicket;
|
||||||
|
|
||||||
|
if (timeDiff == 0) return { color: 'warning', class: 'black-text-color' };
|
||||||
|
if (timeDiff < 0) return { color: 'success', class: 'black-text-color' };
|
||||||
|
return { color: 'transparent', class: 'normal-text-color' };
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatShippedDate(date) {
|
||||||
|
if (!date) return '-';
|
||||||
|
const dateSplit = date.split('T');
|
||||||
|
const [year, month, day] = dateSplit[0].split('-');
|
||||||
|
const newDate = new Date(year, month - 1, day);
|
||||||
|
return toDateFormat(newDate);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<QBadge v-bind="getBadgeAttrs(date)" class="q-pa-sm" style="font-size: 14px">
|
||||||
|
{{ formatShippedDate(date) }}
|
||||||
|
</QBadge>
|
||||||
|
</template>
|
||||||
|
<style lang="scss">
|
||||||
|
.black-text-color {
|
||||||
|
color: var(--vn-black-text-color);
|
||||||
|
}
|
||||||
|
.normal-text-color {
|
||||||
|
color: var(--vn-text-color);
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -297,7 +297,7 @@ defineExpose({
|
||||||
ref="dmsRef"
|
ref="dmsRef"
|
||||||
:data-key="$props.model"
|
:data-key="$props.model"
|
||||||
:url="$props.model"
|
:url="$props.model"
|
||||||
:filter="dmsFilter"
|
:user-filter="dmsFilter"
|
||||||
:order="['dmsFk DESC']"
|
:order="['dmsFk DESC']"
|
||||||
:auto-load="true"
|
:auto-load="true"
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
|
|
|
@ -1,13 +1,28 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useAttrs } from 'vue';
|
defineProps({
|
||||||
|
step: { type: Number, default: 0.01 },
|
||||||
|
decimalPlaces: { type: Number, default: 2 },
|
||||||
|
positive: { type: Boolean, default: true },
|
||||||
|
});
|
||||||
|
|
||||||
const model = defineModel({ type: [Number, String] });
|
const model = defineModel({ type: [Number, String] });
|
||||||
const $attrs = useAttrs();
|
|
||||||
const step = ref($attrs.step || 0.01);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnInput v-bind="$attrs" v-model.number="model" type="number" :step="step" />
|
<VnInput
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-model.number="model"
|
||||||
|
type="number"
|
||||||
|
:step="step"
|
||||||
|
@input="
|
||||||
|
(evt) => {
|
||||||
|
const val = evt.target.value;
|
||||||
|
if (positive && val < 0) return (model = 0);
|
||||||
|
const [, decimal] = val.split('.');
|
||||||
|
if (val && decimal?.length > decimalPlaces)
|
||||||
|
model = parseFloat(val).toFixed(decimalPlaces);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -238,6 +238,7 @@ async function openPointRecord(id, modelLog) {
|
||||||
pointRecord.value = parseProps(propNames, locale, data);
|
pointRecord.value = parseProps(propNames, locale, data);
|
||||||
}
|
}
|
||||||
async function setLogTree(data) {
|
async function setLogTree(data) {
|
||||||
|
if (!data) return;
|
||||||
logTree.value = getLogTree(data);
|
logTree.value = getLogTree(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import LeftMenu from 'components/LeftMenu.vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { onMounted } from 'vue';
|
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
import LeftMenu from '../LeftMenu.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -14,12 +14,29 @@ const $props = defineProps({
|
||||||
onMounted(
|
onMounted(
|
||||||
() => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false)
|
() => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const teleportRef = ref({});
|
||||||
|
const hasContent = ref();
|
||||||
|
let observer;
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (!teleportRef.value) return;
|
||||||
|
const checkContent = () => {
|
||||||
|
hasContent.value = teleportRef.value?.innerHTML?.trim() !== '';
|
||||||
|
};
|
||||||
|
|
||||||
|
observer = new MutationObserver(checkContent);
|
||||||
|
observer.observe(teleportRef.value, { childList: true, subtree: true });
|
||||||
|
|
||||||
|
checkContent();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||||
<QScrollArea class="fit text-grey-8">
|
<QScrollArea class="fit text-grey-8">
|
||||||
<LeftMenu />
|
<div id="left-panel" ref="teleportRef"></div>
|
||||||
|
<LeftMenu v-if="!hasContent" />
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<QPageContainer>
|
<QPageContainer>
|
|
@ -0,0 +1,94 @@
|
||||||
|
<script setup>
|
||||||
|
import RightMenu from './RightMenu.vue';
|
||||||
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
|
import VnTableFilter from '../VnTable/VnTableFilter.vue';
|
||||||
|
import { onBeforeMount, computed } from 'vue';
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
section: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
dataKey: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
searchBar: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
prefix: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
rightFilter: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
columns: {
|
||||||
|
type: Array,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
arrayDataProps: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
redirect: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
keepData: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
let arrayData;
|
||||||
|
const sectionValue = computed(() => $props.section ?? $props.dataKey);
|
||||||
|
const isMainSection = computed(() => {
|
||||||
|
const isSame = sectionValue.value == route.name;
|
||||||
|
if (!isSame && arrayData) {
|
||||||
|
arrayData.reset(['userParams', 'userFilter']);
|
||||||
|
}
|
||||||
|
return isSame;
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
if ($props.dataKey)
|
||||||
|
arrayData = useArrayData($props.dataKey, {
|
||||||
|
searchUrl: 'table',
|
||||||
|
keepData: $props.keepData,
|
||||||
|
...$props.arrayDataProps,
|
||||||
|
navigate: $props.redirect,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<slot name="searchbar">
|
||||||
|
<VnSearchbar
|
||||||
|
v-if="searchBar"
|
||||||
|
v-bind="arrayDataProps"
|
||||||
|
:data-key="dataKey"
|
||||||
|
:label="$t(`${prefix}.search`)"
|
||||||
|
:info="$t(`${prefix}.searchInfo`)"
|
||||||
|
/>
|
||||||
|
</slot>
|
||||||
|
|
||||||
|
<RightMenu>
|
||||||
|
<template #right-panel v-if="$slots['rightMenu'] || rightFilter">
|
||||||
|
<slot name="rightMenu">
|
||||||
|
<VnTableFilter
|
||||||
|
v-if="rightFilter && columns"
|
||||||
|
:data-key="dataKey"
|
||||||
|
:array-data="arrayData"
|
||||||
|
:columns="columns"
|
||||||
|
/>
|
||||||
|
</slot>
|
||||||
|
</template>
|
||||||
|
</RightMenu>
|
||||||
|
<slot name="body" v-if="isMainSection" />
|
||||||
|
<RouterView v-else />
|
||||||
|
</template>
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
import dataByOrder from 'src/utils/dataByOrder';
|
import dataByOrder from 'src/utils/dataByOrder';
|
||||||
|
import { QItemLabel } from 'quasar';
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
||||||
const $attrs = useAttrs();
|
const $attrs = useAttrs();
|
||||||
|
@ -33,6 +34,10 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: 'id',
|
default: 'id',
|
||||||
},
|
},
|
||||||
|
optionCaption: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
optionFilter: {
|
optionFilter: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
|
@ -101,6 +106,10 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
isOutlined: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
||||||
|
@ -115,6 +124,15 @@ const noOneOpt = ref({
|
||||||
[optionValue.value]: false,
|
[optionValue.value]: false,
|
||||||
[optionLabel.value]: noOneText,
|
[optionLabel.value]: noOneText,
|
||||||
});
|
});
|
||||||
|
const styleAttrs = computed(() => {
|
||||||
|
return $props.isOutlined
|
||||||
|
? {
|
||||||
|
dense: true,
|
||||||
|
outlined: true,
|
||||||
|
rounded: true,
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
});
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const useURL = computed(() => $props.url);
|
const useURL = computed(() => $props.url);
|
||||||
const value = computed({
|
const value = computed({
|
||||||
|
@ -210,7 +228,7 @@ async function fetchFilter(val) {
|
||||||
const fetchOptions = { where, include, limit };
|
const fetchOptions = { where, include, limit };
|
||||||
if (fields) fetchOptions.fields = fields;
|
if (fields) fetchOptions.fields = fields;
|
||||||
if (sortBy) fetchOptions.order = sortBy;
|
if (sortBy) fetchOptions.order = sortBy;
|
||||||
arrayData.reset(['skip', 'filter.skip', 'page']);
|
arrayData.resetPagination();
|
||||||
|
|
||||||
const { data } = await arrayData.applyFilter({ filter: fetchOptions });
|
const { data } = await arrayData.applyFilter({ filter: fetchOptions });
|
||||||
setOptions(data);
|
setOptions(data);
|
||||||
|
@ -292,7 +310,7 @@ function handleKeyDown(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const focusableElements = document.querySelectorAll(
|
const focusableElements = document.querySelectorAll(
|
||||||
'a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
'a:not([disabled]), button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])'
|
||||||
);
|
);
|
||||||
const currentIndex = Array.prototype.indexOf.call(
|
const currentIndex = Array.prototype.indexOf.call(
|
||||||
focusableElements,
|
focusableElements,
|
||||||
|
@ -311,9 +329,8 @@ function handleKeyDown(event) {
|
||||||
:options="myOptions"
|
:options="myOptions"
|
||||||
:option-label="optionLabel"
|
:option-label="optionLabel"
|
||||||
:option-value="optionValue"
|
:option-value="optionValue"
|
||||||
v-bind="$attrs"
|
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||||
@filter="filterHandler"
|
@filter="filterHandler"
|
||||||
@keydown="handleKeyDown"
|
|
||||||
:emit-value="nullishToTrue($attrs['emit-value'])"
|
:emit-value="nullishToTrue($attrs['emit-value'])"
|
||||||
:map-options="nullishToTrue($attrs['map-options'])"
|
:map-options="nullishToTrue($attrs['map-options'])"
|
||||||
:use-input="nullishToTrue($attrs['use-input'])"
|
:use-input="nullishToTrue($attrs['use-input'])"
|
||||||
|
@ -328,13 +345,15 @@ function handleKeyDown(event) {
|
||||||
:input-debounce="useURL ? '300' : '0'"
|
:input-debounce="useURL ? '300' : '0'"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@virtual-scroll="onScroll"
|
@virtual-scroll="onScroll"
|
||||||
|
@keydown="handleKeyDown"
|
||||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||||
|
:data-url="url"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-show="isClearable && value"
|
v-show="isClearable && value"
|
||||||
name="close"
|
name="close"
|
||||||
@click.stop="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
value = null;
|
value = null;
|
||||||
emit('remove');
|
emit('remove');
|
||||||
|
@ -362,6 +381,22 @@ function handleKeyDown(event) {
|
||||||
</div>
|
</div>
|
||||||
<slot v-else :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
<slot v-else :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||||
</template>
|
</template>
|
||||||
|
<template #option="{ opt, itemProps }">
|
||||||
|
<QItem v-bind="itemProps">
|
||||||
|
<QItemSection v-if="typeof opt !== 'object'"> {{ opt }}</QItemSection>
|
||||||
|
<QItemSection v-else-if="opt[optionValue] == opt[optionLabel]">
|
||||||
|
<QItemLabel>{{ opt[optionLabel] }}</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection v-else>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ opt[optionLabel] }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel caption v-if="optionCaption !== false">
|
||||||
|
{{ `#${opt[optionCaption] || opt[optionValue]}` }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
</QSelect>
|
</QSelect>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
<script setup>
|
||||||
|
import { computed, useAttrs } from 'vue';
|
||||||
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
const $props = defineProps({
|
||||||
|
hasAvatar: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
hasInfo: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
modelValue: {
|
||||||
|
type: [String, Number, Object],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const $attrs = useAttrs();
|
||||||
|
|
||||||
|
const value = computed({
|
||||||
|
get() {
|
||||||
|
return $props.modelValue;
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
emit('update:modelValue', val);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const url = computed(() => {
|
||||||
|
let url = 'Workers/search';
|
||||||
|
const { departmentCodes } = $attrs.params ?? {};
|
||||||
|
if (!departmentCodes) return url;
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
departmentCodes: JSON.stringify(departmentCodes),
|
||||||
|
});
|
||||||
|
|
||||||
|
return url.concat(`?${params.toString()}`);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VnSelect
|
||||||
|
:label="$t('globals.worker')"
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-model="value"
|
||||||
|
:url="url"
|
||||||
|
option-value="id"
|
||||||
|
option-label="nickname"
|
||||||
|
:fields="['id', 'name', 'nickname', 'code']"
|
||||||
|
sort-by="nickname ASC"
|
||||||
|
>
|
||||||
|
<template #prepend v-if="$props.hasAvatar">
|
||||||
|
<VnAvatar :worker-id="value" color="primary" :title="title" />
|
||||||
|
</template>
|
||||||
|
<template #append v-if="$props.hasInfo">
|
||||||
|
<QIcon name="info" class="cursor-pointer">
|
||||||
|
<QTooltip>{{ $t($props.hasInfo) }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</template>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ scope.opt.name }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel v-if="!scope.opt.id">
|
||||||
|
{{ scope.opt.nickname }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel caption v-else>
|
||||||
|
{{ scope.opt.nickname }}, {{ scope.opt.code }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Responsible for approving invoices: Responsable de aprobar las facturas
|
||||||
|
</i18n>
|
|
@ -222,8 +222,8 @@ const toModule = computed(() =>
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.body {
|
:deep(.body) {
|
||||||
background-color: var(--vn-section-color);
|
background-color: var(--vn-section-color);
|
||||||
.text-h5 {
|
.text-h5 {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
@ -262,9 +262,7 @@ const toModule = computed(() =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.title {
|
.title {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, toRef } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
|
@ -13,7 +13,7 @@ const DEFAULT_PRICE_KG = 0;
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
defineProps({
|
const props = defineProps({
|
||||||
item: {
|
item: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -25,57 +25,63 @@ defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const dialog = ref(null);
|
const dialog = ref(null);
|
||||||
|
const card = toRef(props, 'item');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="container order-catalog-item overflow-hidden">
|
<div class="container order-catalog-item overflow-hidden">
|
||||||
<QCard class="card shadow-6">
|
<QCard class="card shadow-6">
|
||||||
<div class="img-wrapper">
|
<div class="img-wrapper">
|
||||||
<VnImg :id="item.id" class="image" zoom-resolution="1600x900" />
|
<VnImg :id="card.id" class="image" zoom-resolution="1600x900" />
|
||||||
<div v-if="item.hex && isCatalog" class="item-color-container">
|
<div v-if="card.hex && isCatalog" class="item-color-container">
|
||||||
<div
|
<div
|
||||||
class="item-color"
|
class="item-color"
|
||||||
:style="{ backgroundColor: `#${item.hex}` }"
|
:style="{ backgroundColor: `#${card.hex}` }"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<span class="link">
|
<span class="link">
|
||||||
{{ item.name }}
|
{{ card.name }}
|
||||||
<ItemDescriptorProxy :id="item.id" />
|
<ItemDescriptorProxy :id="card.id" />
|
||||||
</span>
|
</span>
|
||||||
<p class="subName">{{ item.subName }}</p>
|
<p class="subName">{{ card.subName }}</p>
|
||||||
<template v-for="index in 4" :key="`tag-${index}`">
|
<template v-for="index in 4" :key="`tag-${index}`">
|
||||||
<VnLv
|
<VnLv
|
||||||
v-if="item?.[`tag${index + 4}`]"
|
v-if="card?.[`tag${index + 4}`]"
|
||||||
:label="item?.[`tag${index + 4}`] + ':'"
|
:label="card?.[`tag${index + 4}`] + ':'"
|
||||||
:value="item?.[`value${index + 4}`]"
|
:value="card?.[`value${index + 4}`]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<div v-if="item.minQuantity" class="min-quantity">
|
<div v-if="card.minQuantity" class="min-quantity">
|
||||||
<QIcon name="production_quantity_limits" size="xs" />
|
<QIcon name="production_quantity_limits" size="xs" />
|
||||||
{{ item.minQuantity }}
|
{{ card.minQuantity }}
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="price">
|
<div class="price">
|
||||||
<p v-if="isCatalog">
|
<p v-if="isCatalog">
|
||||||
{{ item.available }} {{ t('to') }}
|
{{ card.available }} {{ t('to') }}
|
||||||
{{ toCurrency(item.price) }}
|
{{ toCurrency(card.price) }}
|
||||||
</p>
|
</p>
|
||||||
<slot name="price" />
|
<slot name="price" />
|
||||||
<QIcon v-if="isCatalog" name="add_circle" class="icon">
|
<QIcon v-if="isCatalog" name="add_circle" class="icon">
|
||||||
<QTooltip>{{ t('globals.add') }}</QTooltip>
|
<QTooltip>{{ t('globals.add') }}</QTooltip>
|
||||||
<QPopupProxy ref="dialog">
|
<QPopupProxy ref="dialog">
|
||||||
<OrderCatalogItemDialog
|
<OrderCatalogItemDialog
|
||||||
:item="item"
|
:item="card"
|
||||||
@added="() => dialog.hide()"
|
@added="
|
||||||
|
(quantityAdded) => {
|
||||||
|
card.available += quantityAdded;
|
||||||
|
dialog.hide();
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="item.priceKg" class="price-kg">
|
<p v-if="card.priceKg" class="price-kg">
|
||||||
{{ t('price-kg') }}
|
{{ t('price-kg') }}
|
||||||
{{ toCurrency(item.priceKg) || DEFAULT_PRICE_KG }}
|
{{ toCurrency(card.priceKg) || DEFAULT_PRICE_KG }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -98,6 +98,7 @@ function cancel() {
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('globals.confirm')"
|
:label="t('globals.confirm')"
|
||||||
|
:title="t('globals.confirm')"
|
||||||
color="primary"
|
color="primary"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@click="confirm()"
|
@click="confirm()"
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, computed, watch } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import toDate from 'filters/toDate';
|
import toDate from 'filters/toDate';
|
||||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||||
|
import { useFilterParams } from 'src/composables/useFilterParams';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t, te } = useI18n();
|
||||||
|
const route = useRoute();
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -55,63 +57,35 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
arrayData: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
||||||
'update:modelValue',
|
'update:modelValue',
|
||||||
'refresh',
|
'refresh',
|
||||||
'clear',
|
'clear',
|
||||||
|
'search',
|
||||||
'init',
|
'init',
|
||||||
'remove',
|
'remove',
|
||||||
'setUserParams',
|
'setUserParams',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const arrayData = useArrayData($props.dataKey, {
|
const arrayData =
|
||||||
exprBuilder: $props.exprBuilder,
|
$props.arrayData ??
|
||||||
searchUrl: $props.searchUrl,
|
useArrayData($props.dataKey, {
|
||||||
navigate: $props.redirect ? {} : null,
|
exprBuilder: $props.exprBuilder,
|
||||||
});
|
searchUrl: $props.searchUrl,
|
||||||
const route = useRoute();
|
navigate: $props.redirect ? {} : null,
|
||||||
|
});
|
||||||
|
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const userParams = ref({});
|
const userParams = ref(useFilterParams($props.dataKey).params);
|
||||||
|
const userOrders = ref(useFilterParams($props.dataKey).orders);
|
||||||
|
|
||||||
defineExpose({ search, sanitizer, params: userParams });
|
defineExpose({ search, params: userParams, remove });
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
if (!userParams.value) userParams.value = $props.modelValue ?? {};
|
|
||||||
emit('init', { params: userParams.value });
|
|
||||||
});
|
|
||||||
|
|
||||||
function setUserParams(watchedParams) {
|
|
||||||
if (!watchedParams || Object.keys(watchedParams).length == 0) return;
|
|
||||||
|
|
||||||
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
|
|
||||||
if (typeof watchedParams?.filter == 'string')
|
|
||||||
watchedParams.filter = JSON.parse(watchedParams.filter);
|
|
||||||
|
|
||||||
watchedParams = { ...watchedParams, ...watchedParams.filter?.where };
|
|
||||||
const order = watchedParams.filter?.order;
|
|
||||||
|
|
||||||
delete watchedParams.filter;
|
|
||||||
userParams.value = sanitizer(watchedParams);
|
|
||||||
emit('setUserParams', userParams.value, order);
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.query[$props.searchUrl],
|
|
||||||
(val, oldValue) => (val || oldValue) && setUserParams(val)
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => arrayData.store.userParams,
|
|
||||||
(val, oldValue) => (val || oldValue) && setUserParams(val),
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => $props.modelValue,
|
|
||||||
(val) => (userParams.value = val ?? {})
|
|
||||||
);
|
|
||||||
|
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
async function search(evt) {
|
async function search(evt) {
|
||||||
|
@ -122,10 +96,9 @@ async function search(evt) {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const filter = { ...userParams.value, ...$props.modelValue };
|
const filter = { ...userParams.value, ...$props.modelValue };
|
||||||
store.userParamsChanged = true;
|
store.userParamsChanged = true;
|
||||||
const { params: newParams } = await arrayData.addFilter({
|
await arrayData.addFilter({
|
||||||
params: filter,
|
params: filter,
|
||||||
});
|
});
|
||||||
userParams.value = newParams;
|
|
||||||
|
|
||||||
if (!$props.showAll && !Object.values(filter).length) store.data = [];
|
if (!$props.showAll && !Object.values(filter).length) store.data = [];
|
||||||
emit('search');
|
emit('search');
|
||||||
|
@ -138,7 +111,7 @@ async function clearFilters() {
|
||||||
try {
|
try {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
store.userParamsChanged = true;
|
store.userParamsChanged = true;
|
||||||
arrayData.reset(['skip', 'filter.skip', 'page']);
|
arrayData.resetPagination();
|
||||||
// Filtrar los params no removibles
|
// Filtrar los params no removibles
|
||||||
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
||||||
$props.unremovableParams.includes(param)
|
$props.unremovableParams.includes(param)
|
||||||
|
@ -148,9 +121,8 @@ async function clearFilters() {
|
||||||
for (const key of removableFilters) {
|
for (const key of removableFilters) {
|
||||||
newParams[key] = userParams.value[key];
|
newParams[key] = userParams.value[key];
|
||||||
}
|
}
|
||||||
userParams.value = {};
|
|
||||||
userParams.value = { ...newParams }; // Actualizar los params con los removibles
|
await arrayData.applyFilter({ params: { ...newParams } });
|
||||||
await arrayData.applyFilter({ params: userParams.value });
|
|
||||||
|
|
||||||
if (!$props.showAll) {
|
if (!$props.showAll) {
|
||||||
store.data = [];
|
store.data = [];
|
||||||
|
@ -213,20 +185,13 @@ function formatValue(value) {
|
||||||
return `"${value}"`;
|
return `"${value}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sanitizer(params) {
|
const getLocale = (label) => {
|
||||||
for (const [key, value] of Object.entries(params)) {
|
const param = label.split('.').at(-1);
|
||||||
if (key === 'and' && Array.isArray(value)) {
|
const globalLocale = `globals.params.${param}`;
|
||||||
value.forEach((item) => {
|
if (te(globalLocale)) return t(globalLocale);
|
||||||
Object.assign(params, item);
|
else if (te(t(`params.${param}`)));
|
||||||
});
|
else return t(`${route.meta.moduleName}.params.${param}`);
|
||||||
delete params[key];
|
};
|
||||||
} else if (value && typeof value === 'object') {
|
|
||||||
const param = Object.values(value)[0];
|
|
||||||
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -237,7 +202,11 @@ function sanitizer(params) {
|
||||||
style="position: fixed; z-index: 1; right: 0; bottom: 0"
|
style="position: fixed; z-index: 1; right: 0; bottom: 0"
|
||||||
icon="search"
|
icon="search"
|
||||||
@click="search()"
|
@click="search()"
|
||||||
></QBtn>
|
>
|
||||||
|
<QTooltip bottom anchor="bottom right">
|
||||||
|
{{ t('globals.search') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
<QForm @submit="search" id="filterPanelForm" @keyup.enter="search()">
|
<QForm @submit="search" id="filterPanelForm" @keyup.enter="search()">
|
||||||
<QList dense>
|
<QList dense>
|
||||||
<QItem class="q-mt-xs">
|
<QItem class="q-mt-xs">
|
||||||
|
@ -276,7 +245,12 @@ function sanitizer(params) {
|
||||||
@remove="remove(chip.label)"
|
@remove="remove(chip.label)"
|
||||||
data-cy="vnFilterPanelChip"
|
data-cy="vnFilterPanelChip"
|
||||||
>
|
>
|
||||||
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
<slot
|
||||||
|
name="tags"
|
||||||
|
:tag="chip"
|
||||||
|
:format-fn="formatValue"
|
||||||
|
:get-locale="getLocale"
|
||||||
|
>
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ chip.label }}:</strong>
|
<strong>{{ chip.label }}:</strong>
|
||||||
<span>"{{ formatValue(chip.value) }}"</span>
|
<span>"{{ formatValue(chip.value) }}"</span>
|
||||||
|
@ -289,6 +263,7 @@ function sanitizer(params) {
|
||||||
:params="userParams"
|
:params="userParams"
|
||||||
:tags="customTags"
|
:tags="customTags"
|
||||||
:format-fn="formatValue"
|
:format-fn="formatValue"
|
||||||
|
:get-locale="getLocale"
|
||||||
:search-fn="search"
|
:search-fn="search"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -296,7 +271,13 @@ function sanitizer(params) {
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
</QList>
|
</QList>
|
||||||
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
||||||
<slot name="body" :params="sanitizer(userParams)" :search-fn="search"></slot>
|
<slot
|
||||||
|
name="body"
|
||||||
|
:get-locale="getLocale"
|
||||||
|
:params="userParams"
|
||||||
|
:orders="userOrders"
|
||||||
|
:search-fn="search"
|
||||||
|
></slot>
|
||||||
</QList>
|
</QList>
|
||||||
</QForm>
|
</QForm>
|
||||||
<QInnerLoading
|
<QInnerLoading
|
||||||
|
|
|
@ -106,10 +106,14 @@ const store = arrayData.store;
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (props.autoLoad && !store.data?.length) await fetch();
|
if (props.autoLoad && !store.data?.length) await fetch();
|
||||||
|
else emit('onFetch', store.data);
|
||||||
mounted.value = true;
|
mounted.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => arrayData.reset());
|
onBeforeUnmount(() => {
|
||||||
|
if (!store.keepData) arrayData.reset(['data']);
|
||||||
|
arrayData.resetPagination();
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.data,
|
() => props.data,
|
||||||
|
@ -137,8 +141,8 @@ const addFilter = async (filter, params) => {
|
||||||
|
|
||||||
async function fetch(params) {
|
async function fetch(params) {
|
||||||
useArrayData(props.dataKey, params);
|
useArrayData(props.dataKey, params);
|
||||||
arrayData.reset(['filter.skip', 'skip', 'page']);
|
arrayData.resetPagination();
|
||||||
await arrayData.fetch({ append: false, updateRouter: mounted.value });
|
await arrayData.fetch({ append: false });
|
||||||
return emitStoreData();
|
return emitStoreData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,13 +204,20 @@ async function onLoad(index, done) {
|
||||||
done(isDone);
|
done(isDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ fetch, update, addFilter, paginate });
|
defineExpose({
|
||||||
|
fetch,
|
||||||
|
update,
|
||||||
|
addFilter,
|
||||||
|
paginate,
|
||||||
|
userParams: arrayData.store.userParams,
|
||||||
|
currentFilter: arrayData.store.currentFilter,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="full-width">
|
<div class="full-width">
|
||||||
<div
|
<div
|
||||||
v-if="!props.autoLoad && !store.data && !isLoading"
|
v-if="!store.data && !store.data?.length && !isLoading"
|
||||||
class="info-row q-pa-md text-center"
|
class="info-row q-pa-md text-center"
|
||||||
>
|
>
|
||||||
<h5>
|
<h5>
|
||||||
|
|
|
@ -100,8 +100,10 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
async function search() {
|
async function search() {
|
||||||
const staticParams = Object.entries(store.userParams);
|
const staticParams = Object.keys(store.userParams ?? {}).length
|
||||||
arrayData.reset(['skip', 'page']);
|
? store.userParams
|
||||||
|
: store.defaultParams;
|
||||||
|
arrayData.resetPagination();
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
params: {
|
params: {
|
||||||
|
@ -112,7 +114,7 @@ async function search() {
|
||||||
|
|
||||||
if (!props.searchRemoveParams || !searchText.value) {
|
if (!props.searchRemoveParams || !searchText.value) {
|
||||||
filter.params = {
|
filter.params = {
|
||||||
...Object.fromEntries(staticParams),
|
...staticParams,
|
||||||
search: searchText.value,
|
search: searchText.value,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -124,6 +126,7 @@ async function search() {
|
||||||
delete filter.params.search;
|
delete filter.params.search;
|
||||||
}
|
}
|
||||||
await arrayData.applyFilter(filter);
|
await arrayData.applyFilter(filter);
|
||||||
|
searchText.value = undefined;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
export async function getExchange(amount, currencyFk, dated, decimalPlaces = 2) {
|
||||||
|
try {
|
||||||
|
const { data } = await axios.get('ReferenceRates/findOne', {
|
||||||
|
params: {
|
||||||
|
filter: {
|
||||||
|
fields: ['value'],
|
||||||
|
where: { currencyFk, dated },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return (amount / data.value).toFixed(decimalPlaces);
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
import { toCurrency } from 'src/filters';
|
import { toCurrency } from 'src/filters';
|
||||||
|
|
||||||
export function getTotal(rows, key, opts = {}) {
|
export function getTotal(rows, key, opts = {}) {
|
||||||
const { currency, cb } = opts;
|
const { currency, cb, decimalPlaces } = opts;
|
||||||
const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
|
const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
|
||||||
|
|
||||||
return currency
|
return currency
|
||||||
? toCurrency(total, currency == 'default' ? undefined : currency)
|
? toCurrency(total, currency == 'default' ? undefined : currency)
|
||||||
: total;
|
: parseFloat(total).toFixed(decimalPlaces ?? 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
export function useAccountShortToStandard(val) {
|
||||||
|
if (!val || !/^\d+(\.\d*)$/.test(val)) return;
|
||||||
|
return val?.replace('.', '0'.repeat(11 - val.length));
|
||||||
|
}
|
|
@ -25,11 +25,14 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
const searchUrl = store.searchUrl;
|
const searchUrl = store.searchUrl;
|
||||||
if (query[searchUrl]) {
|
if (query[searchUrl]) {
|
||||||
const params = JSON.parse(query[searchUrl]);
|
const params = JSON.parse(query[searchUrl]);
|
||||||
const filter = params?.filter && JSON.parse(params?.filter ?? '{}');
|
const filter =
|
||||||
|
params?.filter && typeof params?.filter == 'object'
|
||||||
|
? params?.filter
|
||||||
|
: JSON.parse(params?.filter ?? '{}');
|
||||||
delete params.filter;
|
delete params.filter;
|
||||||
|
|
||||||
store.userParams = { ...store.userParams, ...params };
|
store.userParams = { ...store.userParams, ...params };
|
||||||
store.userFilter = { ...filter, ...store.userFilter };
|
store.filter = { ...filter, ...store.userFilter };
|
||||||
if (filter?.order) store.order = filter.order;
|
if (filter?.order) store.order = filter.order;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -50,6 +53,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
'searchUrl',
|
'searchUrl',
|
||||||
'navigate',
|
'navigate',
|
||||||
'mapKey',
|
'mapKey',
|
||||||
|
'keepData',
|
||||||
];
|
];
|
||||||
if (typeof userOptions === 'object') {
|
if (typeof userOptions === 'object') {
|
||||||
for (const option in userOptions) {
|
for (const option in userOptions) {
|
||||||
|
@ -61,6 +65,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
store[option] = userOptions.keepOpts?.includes(option)
|
store[option] = userOptions.keepOpts?.includes(option)
|
||||||
? Object.assign(defaultOpts, store[option])
|
? Object.assign(defaultOpts, store[option])
|
||||||
: defaultOpts;
|
: defaultOpts;
|
||||||
|
if (option === 'userParams') store.defaultParams = store[option];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +80,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
const filter = {
|
const filter = {
|
||||||
limit: store.limit,
|
limit: store.limit,
|
||||||
};
|
};
|
||||||
|
|
||||||
let userParams = { ...store.userParams };
|
let userParams = { ...store.userParams };
|
||||||
|
|
||||||
Object.assign(filter, store.userFilter);
|
Object.assign(filter, store.userFilter);
|
||||||
|
@ -143,6 +147,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
if (arrayDataStore.get(key)) arrayDataStore.reset(key, opts);
|
if (arrayDataStore.get(key)) arrayDataStore.reset(key, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetPagination() {
|
||||||
|
if (arrayDataStore.get(key)) arrayDataStore.resetPagination(key);
|
||||||
|
}
|
||||||
|
|
||||||
function cancelRequest() {
|
function cancelRequest() {
|
||||||
if (canceller) {
|
if (canceller) {
|
||||||
canceller.abort();
|
canceller.abort();
|
||||||
|
@ -166,7 +174,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
userParams = sanitizerParams(userParams, store?.exprBuilder);
|
userParams = sanitizerParams(userParams, store?.exprBuilder);
|
||||||
|
|
||||||
store.userParams = userParams;
|
store.userParams = userParams;
|
||||||
reset(['skip', 'filter.skip', 'page']);
|
resetPagination();
|
||||||
|
|
||||||
await fetch({});
|
await fetch({});
|
||||||
return { filter, params };
|
return { filter, params };
|
||||||
|
@ -193,7 +201,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
store.order = order;
|
store.order = order;
|
||||||
reset(['skip', 'filter.skip', 'page']);
|
resetPagination();
|
||||||
fetch({});
|
fetch({});
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
|
@ -276,7 +284,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
const pushUrl = { path: to };
|
const pushUrl = { path: to };
|
||||||
if (to.endsWith('/list') || to.endsWith('/'))
|
if (to.endsWith('/list') || to.endsWith('/'))
|
||||||
pushUrl.query = newUrl.query;
|
pushUrl.query = newUrl.query;
|
||||||
else destroy();
|
|
||||||
return router.push(pushUrl);
|
return router.push(pushUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,7 +303,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
for (const row of data) {
|
for (const row of data) {
|
||||||
const key = row[store.mapKey];
|
const key = row[store.mapKey];
|
||||||
const val = { ...row, key };
|
const val = { ...row, key };
|
||||||
if (store.map.has(key)) {
|
if (key && store.map.has(key)) {
|
||||||
const { position } = store.map.get(key);
|
const { position } = store.map.get(key);
|
||||||
val.position = position;
|
val.position = position;
|
||||||
store.map.set(key, val);
|
store.map.set(key, val);
|
||||||
|
@ -328,5 +335,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
isLoading,
|
isLoading,
|
||||||
deleteOption,
|
deleteOption,
|
||||||
reset,
|
reset,
|
||||||
|
resetPagination,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import { useVnConfirm } from 'src/composables/useVnConfirm';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { i18n } from 'src/boot/i18n';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
|
export async function useCau(res, message) {
|
||||||
|
const { notify } = useNotify();
|
||||||
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
const { config, headers, request, status, statusText, data } = res || {};
|
||||||
|
const { params, url, method, signal, headers: confHeaders } = config || {};
|
||||||
|
const { message: resMessage, code, name } = data?.error || {};
|
||||||
|
|
||||||
|
const additionalData = {
|
||||||
|
path: location.hash,
|
||||||
|
message: resMessage,
|
||||||
|
code,
|
||||||
|
request: request?.responseURL,
|
||||||
|
status,
|
||||||
|
name,
|
||||||
|
statusText: statusText,
|
||||||
|
config: {
|
||||||
|
url,
|
||||||
|
method,
|
||||||
|
params,
|
||||||
|
headers: confHeaders,
|
||||||
|
aborted: signal?.aborted,
|
||||||
|
version: headers?.['salix-version'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const opts = {
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
icon: 'support_agent',
|
||||||
|
color: 'primary',
|
||||||
|
dense: true,
|
||||||
|
flat: false,
|
||||||
|
round: true,
|
||||||
|
handler: async () => {
|
||||||
|
const locale = i18n.global.t;
|
||||||
|
const reason = ref(
|
||||||
|
code == 'ACCESS_DENIED' ? locale('cau.askPrivileges') : ''
|
||||||
|
);
|
||||||
|
openConfirmationModal(
|
||||||
|
locale('cau.title'),
|
||||||
|
locale('cau.subtitle'),
|
||||||
|
async () => {
|
||||||
|
await axios.post('OsTickets/send-to-support', {
|
||||||
|
reason: reason.value,
|
||||||
|
additionalData,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
component: VnInput,
|
||||||
|
props: {
|
||||||
|
modelValue: reason,
|
||||||
|
'onUpdate:modelValue': (val) => (reason.value = val),
|
||||||
|
label: locale('cau.inputLabel'),
|
||||||
|
class: 'full-width',
|
||||||
|
required: true,
|
||||||
|
autofocus: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
notify(message ?? 'globals.error', 'negative', 'error', opts);
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { onBeforeMount, ref, watch } from 'vue';
|
||||||
|
|
||||||
|
export function useFilterParams(key) {
|
||||||
|
if (!key) throw new Error('ArrayData: A key is required to use this composable');
|
||||||
|
const params = ref({});
|
||||||
|
const orders = ref({});
|
||||||
|
const arrayData = ref({});
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
arrayData.value = useArrayData(key);
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => arrayData.value.store?.currentFilter,
|
||||||
|
(val, oldValue) => (val || oldValue) && setUserParams(val),
|
||||||
|
{ immediate: true, deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
function parseOrder(urlOrders) {
|
||||||
|
const orderObject = {};
|
||||||
|
if (urlOrders) {
|
||||||
|
if (typeof urlOrders == 'string') urlOrders = [urlOrders];
|
||||||
|
for (const [index, orders] of urlOrders.entries()) {
|
||||||
|
const [name, direction] = orders.split(' ');
|
||||||
|
orderObject[name] = { direction, index: index + 1 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orders.value = orderObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setUserParams(watchedParams) {
|
||||||
|
if (!watchedParams || Object.keys(watchedParams).length == 0) return;
|
||||||
|
|
||||||
|
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
|
||||||
|
if (typeof watchedParams?.filter == 'string')
|
||||||
|
watchedParams.filter = JSON.parse(watchedParams.filter);
|
||||||
|
|
||||||
|
watchedParams = { ...watchedParams, ...watchedParams.filter?.where };
|
||||||
|
parseOrder(watchedParams.filter?.order);
|
||||||
|
|
||||||
|
delete watchedParams.filter;
|
||||||
|
params.value = sanitizer(watchedParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sanitizer(params) {
|
||||||
|
for (const [key, value] of Object.entries(params)) {
|
||||||
|
if (key === 'and' && Array.isArray(value)) {
|
||||||
|
value.forEach((item) => {
|
||||||
|
Object.assign(params, item);
|
||||||
|
});
|
||||||
|
delete params[key];
|
||||||
|
} else if (value && typeof value === 'object') {
|
||||||
|
const param = Object.values(value)[0];
|
||||||
|
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
params,
|
||||||
|
orders,
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ import { Notify } from 'quasar';
|
||||||
import { i18n } from 'src/boot/i18n';
|
import { i18n } from 'src/boot/i18n';
|
||||||
|
|
||||||
export default function useNotify() {
|
export default function useNotify() {
|
||||||
const notify = (message, type, icon) => {
|
const notify = (message, type, icon, opts = {}) => {
|
||||||
const defaultIcons = {
|
const defaultIcons = {
|
||||||
warning: 'warning',
|
warning: 'warning',
|
||||||
negative: 'error',
|
negative: 'error',
|
||||||
|
@ -13,6 +13,7 @@ export default function useNotify() {
|
||||||
message: i18n.global.t(message),
|
message: i18n.global.t(message),
|
||||||
type: type,
|
type: type,
|
||||||
icon: icon ? icon : defaultIcons[type],
|
icon: icon ? icon : defaultIcons[type],
|
||||||
|
...opts,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,29 @@
|
||||||
|
import { h } from 'vue';
|
||||||
|
import { Dialog } from 'quasar';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
|
|
||||||
export function useVnConfirm() {
|
export function useVnConfirm() {
|
||||||
const quasar = useQuasar();
|
const openConfirmationModal = (
|
||||||
|
title,
|
||||||
const openConfirmationModal = (title, message, promise, successFn) => {
|
message,
|
||||||
quasar
|
promise,
|
||||||
.dialog({
|
successFn,
|
||||||
component: VnConfirm,
|
customHTML = {}
|
||||||
componentProps: {
|
) => {
|
||||||
|
const { component, props } = customHTML;
|
||||||
|
Dialog.create({
|
||||||
|
component: h(
|
||||||
|
VnConfirm,
|
||||||
|
{
|
||||||
title: title,
|
title: title,
|
||||||
message: message,
|
message: message,
|
||||||
promise: promise,
|
promise: promise,
|
||||||
},
|
},
|
||||||
})
|
{ customHTML: () => h(component, props) }
|
||||||
.onOk(async () => {
|
),
|
||||||
if (successFn) successFn();
|
}).onOk(async () => {
|
||||||
});
|
if (successFn) successFn();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return { openConfirmationModal };
|
return { openConfirmationModal };
|
||||||
|
|
|
@ -3,19 +3,21 @@
|
||||||
@import '@quasar/quasar-ui-qcalendar/src/QCalendarMonth.sass';
|
@import '@quasar/quasar-ui-qcalendar/src/QCalendarMonth.sass';
|
||||||
|
|
||||||
body.body--light {
|
body.body--light {
|
||||||
--font-color: black;
|
|
||||||
--vn-header-color: #cecece;
|
--vn-header-color: #cecece;
|
||||||
--vn-page-color: #ffffff;
|
--vn-page-color: #ffffff;
|
||||||
--vn-section-color: #e0e0e0;
|
--vn-section-color: #e0e0e0;
|
||||||
--vn-section-hover-color: #b9b9b9;
|
--vn-section-hover-color: #b9b9b9;
|
||||||
--vn-text-color: var(--font-color);
|
--vn-text-color: black;
|
||||||
--vn-label-color: #5f5f5f;
|
--vn-label-color: #5f5f5f;
|
||||||
--vn-accent-color: #e7e3e3;
|
--vn-accent-color: #e7e3e3;
|
||||||
|
--vn-empty-tag: #acacac;
|
||||||
|
--vn-black-text-color: black;
|
||||||
|
--vn-text-color-contrast: white;
|
||||||
|
|
||||||
background-color: var(--vn-page-color);
|
background-color: var(--vn-page-color);
|
||||||
|
|
||||||
.q-header .q-toolbar {
|
.q-header .q-toolbar {
|
||||||
color: var(--font-color);
|
color: var(--vn-text-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body.body--dark {
|
body.body--dark {
|
||||||
|
@ -26,6 +28,9 @@ body.body--dark {
|
||||||
--vn-text-color: white;
|
--vn-text-color: white;
|
||||||
--vn-label-color: #a8a8a8;
|
--vn-label-color: #a8a8a8;
|
||||||
--vn-accent-color: #424242;
|
--vn-accent-color: #424242;
|
||||||
|
--vn-empty-tag: #2d2d2d;
|
||||||
|
--vn-black-text-color: black;
|
||||||
|
--vn-text-color-contrast: black;
|
||||||
|
|
||||||
background-color: var(--vn-page-color);
|
background-color: var(--vn-page-color);
|
||||||
}
|
}
|
||||||
|
@ -84,6 +89,10 @@ select:-webkit-autofill {
|
||||||
background-color: var(--vn-section-hover-color);
|
background-color: var(--vn-section-hover-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-vn-page {
|
||||||
|
background-color: var(--vn-page-color);
|
||||||
|
}
|
||||||
|
|
||||||
.color-vn-label {
|
.color-vn-label {
|
||||||
color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
}
|
}
|
||||||
|
@ -187,7 +196,7 @@ select:-webkit-autofill {
|
||||||
|
|
||||||
.q-tooltip {
|
.q-tooltip {
|
||||||
background-color: var(--vn-page-color);
|
background-color: var(--vn-page-color);
|
||||||
color: var(--font-color);
|
color: var(--vn-text-color);
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,7 @@ globals:
|
||||||
small: Small
|
small: Small
|
||||||
medium: Medium
|
medium: Medium
|
||||||
big: Big
|
big: Big
|
||||||
|
email: Email
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Login
|
logIn: Login
|
||||||
addressEdit: Update address
|
addressEdit: Update address
|
||||||
|
@ -329,13 +330,26 @@ globals:
|
||||||
email: Email
|
email: Email
|
||||||
SSN: SSN
|
SSN: SSN
|
||||||
fi: FI
|
fi: FI
|
||||||
|
packing: ITP
|
||||||
myTeam: My team
|
myTeam: My team
|
||||||
departmentFk: Department
|
departmentFk: Department
|
||||||
|
from: From
|
||||||
|
to: To
|
||||||
|
supplierFk: Supplier
|
||||||
|
supplierRef: Supplier ref
|
||||||
|
serial: Serial
|
||||||
|
amount: Importe
|
||||||
|
awbCode: AWB
|
||||||
|
correctedFk: Rectified
|
||||||
|
correctingFk: Rectificative
|
||||||
|
daysOnward: Days onward
|
||||||
countryFk: Country
|
countryFk: Country
|
||||||
|
companyFk: Company
|
||||||
changePass: Change password
|
changePass: Change password
|
||||||
deleteConfirmTitle: Delete selected elements
|
deleteConfirmTitle: Delete selected elements
|
||||||
changeState: Change state
|
changeState: Change state
|
||||||
raid: 'Raid {daysInForward} days'
|
raid: 'Raid {daysInForward} days'
|
||||||
|
isVies: Vies
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Access denied
|
statusUnauthorized: Access denied
|
||||||
statusInternalServerError: An internal server error has ocurred
|
statusInternalServerError: An internal server error has ocurred
|
||||||
|
@ -369,6 +383,11 @@ resetPassword:
|
||||||
repeatPassword: Repeat password
|
repeatPassword: Repeat password
|
||||||
passwordNotMatch: Passwords don't match
|
passwordNotMatch: Passwords don't match
|
||||||
passwordChanged: Password changed
|
passwordChanged: Password changed
|
||||||
|
cau:
|
||||||
|
title: Send cau
|
||||||
|
subtitle: By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.
|
||||||
|
inputLabel: Explain why this error should not appear
|
||||||
|
askPrivileges: Ask for privileges
|
||||||
entry:
|
entry:
|
||||||
list:
|
list:
|
||||||
newEntry: New entry
|
newEntry: New entry
|
||||||
|
@ -398,8 +417,8 @@ entry:
|
||||||
buys: Buys
|
buys: Buys
|
||||||
stickers: Stickers
|
stickers: Stickers
|
||||||
package: Package
|
package: Package
|
||||||
packing: Packing
|
packing: Pack.
|
||||||
grouping: Grouping
|
grouping: Group.
|
||||||
buyingValue: Buying value
|
buyingValue: Buying value
|
||||||
import: Import
|
import: Import
|
||||||
pvp: PVP
|
pvp: PVP
|
||||||
|
@ -592,7 +611,7 @@ worker:
|
||||||
fi: DNI/NIE/NIF
|
fi: DNI/NIE/NIF
|
||||||
birth: Birth
|
birth: Birth
|
||||||
isFreelance: Freelance
|
isFreelance: Freelance
|
||||||
isSsDiscounted: Bonificación SS
|
isSsDiscounted: SS Bonification
|
||||||
hasMachineryAuthorized: Machinery authorized
|
hasMachineryAuthorized: Machinery authorized
|
||||||
isDisable: Disable
|
isDisable: Disable
|
||||||
notificationsManager:
|
notificationsManager:
|
||||||
|
@ -724,7 +743,6 @@ supplier:
|
||||||
sageTransactionTypeFk: Sage transaction type
|
sageTransactionTypeFk: Sage transaction type
|
||||||
supplierActivityFk: Supplier activity
|
supplierActivityFk: Supplier activity
|
||||||
isTrucker: Trucker
|
isTrucker: Trucker
|
||||||
isVies: Vies
|
|
||||||
billingData:
|
billingData:
|
||||||
payMethodFk: Billing data
|
payMethodFk: Billing data
|
||||||
payDemFk: Payment deadline
|
payDemFk: Payment deadline
|
||||||
|
@ -839,6 +857,7 @@ components:
|
||||||
value: Value
|
value: Value
|
||||||
# ItemFixedPriceFilter
|
# ItemFixedPriceFilter
|
||||||
buyerFk: Buyer
|
buyerFk: Buyer
|
||||||
|
warehouseFk: Warehouse
|
||||||
started: From
|
started: From
|
||||||
ended: To
|
ended: To
|
||||||
mine: For me
|
mine: For me
|
||||||
|
|
|
@ -131,6 +131,7 @@ globals:
|
||||||
small: Pequeño/a
|
small: Pequeño/a
|
||||||
medium: Mediano/a
|
medium: Mediano/a
|
||||||
big: Grande
|
big: Grande
|
||||||
|
email: Correo
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Inicio de sesión
|
logIn: Inicio de sesión
|
||||||
addressEdit: Modificar consignatario
|
addressEdit: Modificar consignatario
|
||||||
|
@ -335,11 +336,22 @@ globals:
|
||||||
SSN: NSS
|
SSN: NSS
|
||||||
fi: NIF
|
fi: NIF
|
||||||
myTeam: Mi equipo
|
myTeam: Mi equipo
|
||||||
|
from: Desde
|
||||||
|
to: Hasta
|
||||||
|
supplierFk: Proveedor
|
||||||
|
supplierRef: Ref. proveedor
|
||||||
|
serial: Serie
|
||||||
|
amount: Importe
|
||||||
|
awbCode: AWB
|
||||||
|
daysOnward: Días adelante
|
||||||
|
packing: ITP
|
||||||
countryFk: País
|
countryFk: País
|
||||||
|
companyFk: Empresa
|
||||||
changePass: Cambiar contraseña
|
changePass: Cambiar contraseña
|
||||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||||
changeState: Cambiar estado
|
changeState: Cambiar estado
|
||||||
raid: 'Redada {daysInForward} días'
|
raid: 'Redada {daysInForward} días'
|
||||||
|
isVies: Vies
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Acceso denegado
|
statusUnauthorized: Acceso denegado
|
||||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||||
|
@ -371,6 +383,11 @@ resetPassword:
|
||||||
repeatPassword: Repetir contraseña
|
repeatPassword: Repetir contraseña
|
||||||
passwordNotMatch: Las contraseñas no coinciden
|
passwordNotMatch: Las contraseñas no coinciden
|
||||||
passwordChanged: Contraseña cambiada
|
passwordChanged: Contraseña cambiada
|
||||||
|
cau:
|
||||||
|
title: Enviar cau
|
||||||
|
subtitle: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc
|
||||||
|
inputLabel: Explique el motivo por el que no deberia aparecer este fallo
|
||||||
|
askPrivileges: Solicitar permisos
|
||||||
entry:
|
entry:
|
||||||
list:
|
list:
|
||||||
newEntry: Nueva entrada
|
newEntry: Nueva entrada
|
||||||
|
@ -401,8 +418,8 @@ entry:
|
||||||
buys: Compras
|
buys: Compras
|
||||||
stickers: Etiquetas
|
stickers: Etiquetas
|
||||||
package: Embalaje
|
package: Embalaje
|
||||||
packing: Packing
|
packing: Pack.
|
||||||
grouping: Grouping
|
grouping: Group.
|
||||||
buyingValue: Coste
|
buyingValue: Coste
|
||||||
import: Importe
|
import: Importe
|
||||||
pvp: PVP
|
pvp: PVP
|
||||||
|
@ -492,7 +509,7 @@ invoiceOut:
|
||||||
ticketList: Listado de tickets
|
ticketList: Listado de tickets
|
||||||
summary:
|
summary:
|
||||||
issued: Fecha
|
issued: Fecha
|
||||||
dued: Vencimiento
|
dued: Fecha límite
|
||||||
booked: Contabilizada
|
booked: Contabilizada
|
||||||
taxBreakdown: Desglose impositivo
|
taxBreakdown: Desglose impositivo
|
||||||
taxableBase: Base imp.
|
taxableBase: Base imp.
|
||||||
|
@ -591,6 +608,15 @@ worker:
|
||||||
role: Rol
|
role: Rol
|
||||||
sipExtension: Extensión
|
sipExtension: Extensión
|
||||||
locker: Taquilla
|
locker: Taquilla
|
||||||
|
fiDueDate: F. caducidad DNI
|
||||||
|
sex: Sexo
|
||||||
|
seniority: Antigüedad
|
||||||
|
fi: DNI/NIE/NIF
|
||||||
|
birth: F. nacimiento
|
||||||
|
isFreelance: Autónomo
|
||||||
|
isSsDiscounted: Bonificación SS
|
||||||
|
hasMachineryAuthorized: Autorizado para maquinaria
|
||||||
|
isDisable: Deshabilitado
|
||||||
notificationsManager:
|
notificationsManager:
|
||||||
activeNotifications: Notificaciones activas
|
activeNotifications: Notificaciones activas
|
||||||
availableNotifications: Notificaciones disponibles
|
availableNotifications: Notificaciones disponibles
|
||||||
|
@ -719,7 +745,6 @@ supplier:
|
||||||
sageTransactionTypeFk: Tipo de transacción sage
|
sageTransactionTypeFk: Tipo de transacción sage
|
||||||
supplierActivityFk: Actividad proveedor
|
supplierActivityFk: Actividad proveedor
|
||||||
isTrucker: Transportista
|
isTrucker: Transportista
|
||||||
isVies: Vies
|
|
||||||
billingData:
|
billingData:
|
||||||
payMethodFk: Forma de pago
|
payMethodFk: Forma de pago
|
||||||
payDemFk: Plazo de pago
|
payDemFk: Plazo de pago
|
||||||
|
@ -833,6 +858,7 @@ components:
|
||||||
value: Valor
|
value: Valor
|
||||||
# ItemFixedPriceFilter
|
# ItemFixedPriceFilter
|
||||||
buyerFk: Comprador
|
buyerFk: Comprador
|
||||||
|
warehouseFk: Almacen
|
||||||
started: Desde
|
started: Desde
|
||||||
ended: Hasta
|
ended: Hasta
|
||||||
mine: Para mi
|
mine: Para mi
|
||||||
|
|
|
@ -1,50 +1,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
import Navbar from 'src/components/NavBar.vue';
|
import Navbar from 'src/components/NavBar.vue';
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import routes from 'src/router/modules';
|
|
||||||
import { onMounted } from 'vue';
|
|
||||||
|
|
||||||
const quasar = useQuasar();
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
let isNotified = false;
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const keyBindingMap = routes
|
|
||||||
.filter((route) => route.meta.keyBinding)
|
|
||||||
.reduce((map, route) => {
|
|
||||||
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
|
||||||
return map;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
const handleKeyDown = (event) => {
|
|
||||||
const { ctrlKey, altKey, code } = event;
|
|
||||||
|
|
||||||
if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
|
|
||||||
event.preventDefault();
|
|
||||||
router.push(keyBindingMap[code]);
|
|
||||||
isNotified = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleKeyUp = (event) => {
|
|
||||||
const { ctrlKey, altKey } = event;
|
|
||||||
|
|
||||||
if (!ctrlKey || !altKey) {
|
|
||||||
isNotified = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener('keydown', handleKeyDown);
|
|
||||||
window.addEventListener('keyup', handleKeyUp);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QLayout view="hHh LpR fFf" v-shortcut>
|
<QLayout view="hHh LpR fFf" v-shortcut>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<RouterView></RouterView>
|
<RouterView></RouterView>
|
||||||
<QFooter v-if="quasar.platform.is.mobile"></QFooter>
|
<QFooter v-if="$q.platform.is.mobile"></QFooter>
|
||||||
</QLayout>
|
</QLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -21,13 +20,13 @@ defineProps({
|
||||||
|
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const roles = ref();
|
const roles = ref();
|
||||||
const validationsStore = useValidator();
|
const validationsStore = useValidator();
|
||||||
const { models } = validationsStore;
|
const { models } = validationsStore;
|
||||||
|
const dataKey = 'AccountAcls';
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
|
@ -134,38 +133,40 @@ const deleteAcl = async ({ id }) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
|
||||||
data-key="AccountAcls"
|
|
||||||
url="ACLs"
|
|
||||||
:expr-builder="exprBuilder"
|
|
||||||
:label="t('acls.search')"
|
|
||||||
:info="t('acls.searchInfo')"
|
|
||||||
/>
|
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
|
||||||
</QDrawer>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
url="VnRoles?fields=['name']"
|
url="VnRoles?fields=['name']"
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="(data) => (roles = data)"
|
@on-fetch="(data) => (roles = data)"
|
||||||
/>
|
/>
|
||||||
<VnTable
|
<VnSection
|
||||||
ref="tableRef"
|
:data-key="dataKey"
|
||||||
data-key="AccountAcls"
|
|
||||||
:url="`ACLs`"
|
|
||||||
:create="{
|
|
||||||
urlCreate: 'ACLs',
|
|
||||||
title: 'Create ACL',
|
|
||||||
onDataSaved: () => tableRef.reload(),
|
|
||||||
formInitialData: {},
|
|
||||||
}"
|
|
||||||
order="id DESC"
|
|
||||||
:disable-option="{ card: true }"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
default-mode="table"
|
prefix="acls"
|
||||||
:right-search="true"
|
:array-data-props="{
|
||||||
:is-editable="true"
|
url: 'ACLs',
|
||||||
:use-model="true"
|
order: 'id DESC',
|
||||||
/>
|
exprBuilder,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #body>
|
||||||
|
<VnTable
|
||||||
|
ref="tableRef"
|
||||||
|
:data-key="dataKey"
|
||||||
|
:create="{
|
||||||
|
urlCreate: 'ACLs',
|
||||||
|
title: 'Create ACL',
|
||||||
|
onDataSaved: () => tableRef.reload(),
|
||||||
|
formInitialData: {},
|
||||||
|
}"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
|
:columns="columns"
|
||||||
|
default-mode="table"
|
||||||
|
:right-search="false"
|
||||||
|
:is-editable="true"
|
||||||
|
:use-model="true"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</VnSection>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -2,21 +2,12 @@
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const dataKey = 'AccountAliasList';
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
|
||||||
switch (param) {
|
|
||||||
case 'search':
|
|
||||||
return /^\d+$/.test(value)
|
|
||||||
? { id: value }
|
|
||||||
: { alias: { like: `%${value}%` } };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -40,40 +31,45 @@ const columns = computed(() => [
|
||||||
create: true,
|
create: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const exprBuilder = (param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return /^\d+$/.test(value)
|
||||||
|
? { id: value }
|
||||||
|
: { alias: { like: `%${value}%` } };
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-if="stateStore.isHeaderMounted()">
|
<VnSection
|
||||||
<Teleport to="#searchbar">
|
:data-key="dataKey"
|
||||||
<VnSearchbar
|
|
||||||
data-key="AccountAliasList"
|
|
||||||
url="MailAliases"
|
|
||||||
:expr-builder="exprBuilder"
|
|
||||||
:label="t('mailAlias.search')"
|
|
||||||
:info="t('mailAlias.searchInfo')"
|
|
||||||
/>
|
|
||||||
</Teleport>
|
|
||||||
</template>
|
|
||||||
<VnTable
|
|
||||||
ref="tableRef"
|
|
||||||
data-key="AccountAliasList"
|
|
||||||
url="MailAliases"
|
|
||||||
:create="{
|
|
||||||
urlCreate: 'MailAliases',
|
|
||||||
title: 'Create MailAlias',
|
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
|
||||||
formInitialData: {},
|
|
||||||
}"
|
|
||||||
order="id DESC"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:disable-option="{ card: true }"
|
prefix="mailAlias"
|
||||||
default-mode="table"
|
:array-data-props="{ url: 'MailAliases', order: 'id DESC', exprBuilder }"
|
||||||
redirect="account/alias"
|
>
|
||||||
:is-editable="true"
|
<template #body>
|
||||||
:use-model="true"
|
<VnTable
|
||||||
/>
|
:data-key="dataKey"
|
||||||
|
ref="tableRef"
|
||||||
|
:create="{
|
||||||
|
urlCreate: 'MailAliases',
|
||||||
|
title: 'Create MailAlias',
|
||||||
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
|
formInitialData: {},
|
||||||
|
}"
|
||||||
|
:columns="columns"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
|
default-mode="table"
|
||||||
|
redirect="account/alias"
|
||||||
|
:is-editable="true"
|
||||||
|
:use-model="true"
|
||||||
|
:right-search="false"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</VnSection>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Id: Id
|
Id: Id
|
||||||
|
|
|
@ -31,7 +31,6 @@ const rolesOptions = ref([]);
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
:hidden-tags="['search']"
|
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
search-url="table"
|
search-url="table"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { ref, computed } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
|
||||||
import AccountSummary from './Card/AccountSummary.vue';
|
import AccountSummary from './Card/AccountSummary.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import AccountFilter from './AccountFilter.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const tableRef = ref();
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||||
};
|
};
|
||||||
|
const dataKey = 'AccountList';
|
||||||
|
const roles = ref([]);
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -22,20 +24,41 @@ const columns = computed(() => [
|
||||||
field: 'id',
|
field: 'id',
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'name',
|
||||||
|
label: t('Name'),
|
||||||
|
component: 'input',
|
||||||
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'roleFk',
|
name: 'roleFk',
|
||||||
label: t('role'),
|
label: t('Role'),
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'VnRoles',
|
||||||
|
optionValue: 'id',
|
||||||
|
optionLabel: 'name',
|
||||||
|
},
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'select',
|
component: 'select',
|
||||||
name: 'roleFk',
|
name: 'roleFk',
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'VnRoles',
|
options: roles,
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: 'name',
|
optionLabel: 'name',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
format: ({ role }, dashIfEmpty) => dashIfEmpty(role?.name),
|
format: ({ role }, dashIfEmpty) => dashIfEmpty(role?.name),
|
||||||
|
create: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -51,20 +74,32 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'name',
|
name: 'email',
|
||||||
label: t('Name'),
|
label: t('Email'),
|
||||||
component: 'input',
|
component: 'input',
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
cardVisible: true,
|
|
||||||
create: true,
|
create: true,
|
||||||
|
visible: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'email',
|
name: 'password',
|
||||||
label: t('email'),
|
label: t('Password'),
|
||||||
component: 'input',
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
|
attrs: {},
|
||||||
|
required: true,
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'active',
|
||||||
|
label: t('Active'),
|
||||||
|
component: 'checkbox',
|
||||||
create: true,
|
create: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
},
|
},
|
||||||
|
@ -82,7 +117,8 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const exprBuilder = (param, value) => {
|
|
||||||
|
function exprBuilder(param, value) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
return /^\d+$/.test(value)
|
return /^\d+$/.test(value)
|
||||||
|
@ -99,35 +135,51 @@ const exprBuilder = (param, value) => {
|
||||||
case 'roleFk':
|
case 'roleFk':
|
||||||
return { [param]: value };
|
return { [param]: value };
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<FetchData url="VnRoles" @on-fetch="(data) => (roles = data)" auto-load />
|
||||||
data-key="AccountList"
|
<VnSection
|
||||||
:expr-builder="exprBuilder"
|
:data-key="dataKey"
|
||||||
:label="t('account.search')"
|
|
||||||
:info="t('account.searchInfo')"
|
|
||||||
:filter="filter"
|
|
||||||
/>
|
|
||||||
<RightMenu>
|
|
||||||
<template #right-panel>
|
|
||||||
<AccountFilter data-key="AccountList" />
|
|
||||||
</template>
|
|
||||||
</RightMenu>
|
|
||||||
<VnTable
|
|
||||||
ref="tableRef"
|
|
||||||
data-key="AccountList"
|
|
||||||
url="VnUsers/preview"
|
|
||||||
:filter="filter"
|
|
||||||
order="id DESC"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
default-mode="table"
|
prefix="account"
|
||||||
redirect="account"
|
:array-data-props="{
|
||||||
:use-model="true"
|
url: 'VnUsers/preview',
|
||||||
:right-search="false"
|
userFilter: filter,
|
||||||
auto-load
|
order: 'id DESC',
|
||||||
/>
|
exprBuilder,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #body>
|
||||||
|
<VnTable
|
||||||
|
ref="tableRef"
|
||||||
|
:data-key="dataKey"
|
||||||
|
:columns="columns"
|
||||||
|
:create="{
|
||||||
|
urlCreate: 'VnUsers',
|
||||||
|
title: t('Create user'),
|
||||||
|
onDataSaved: ({ id }) => $refs.tableRef.redirect(id),
|
||||||
|
formInitialData: {},
|
||||||
|
}"
|
||||||
|
default-mode="table"
|
||||||
|
redirect="account"
|
||||||
|
:use-model="true"
|
||||||
|
:right-search="false"
|
||||||
|
>
|
||||||
|
<template #more-create-dialog="{ data }">
|
||||||
|
<QCardSection>
|
||||||
|
<VnInput
|
||||||
|
:label="t('Password')"
|
||||||
|
v-model="data.password"
|
||||||
|
type="password"
|
||||||
|
:required="true"
|
||||||
|
autocomplete="new-password"
|
||||||
|
/>
|
||||||
|
</QCardSection>
|
||||||
|
</template>
|
||||||
|
</VnTable>
|
||||||
|
</template>
|
||||||
|
</VnSection>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
@ -135,4 +187,7 @@ const exprBuilder = (param, value) => {
|
||||||
Id: Id
|
Id: Id
|
||||||
Nickname: Nickname
|
Nickname: Nickname
|
||||||
Name: Nombre
|
Name: Nombre
|
||||||
|
Password: Contraseña
|
||||||
|
Active: Activo
|
||||||
|
Role: Rol
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -37,11 +37,7 @@ onBeforeMount(() => {
|
||||||
@on-fetch="(data) => (rolesOptions = data)"
|
@on-fetch="(data) => (rolesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<VnFilterPanel
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||||
:data-key="props.dataKey"
|
|
||||||
:search-button="true"
|
|
||||||
:hidden-tags="['search']"
|
|
||||||
>
|
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`acls.aclFilter.${tag.label}`) }}: </strong>
|
<strong>{{ t(`acls.aclFilter.${tag.label}`) }}: </strong>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||||
import AliasDescriptor from './AliasDescriptor.vue';
|
import AliasDescriptor from './AliasDescriptor.vue';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCardBeta
|
||||||
data-key="Alias"
|
data-key="Alias"
|
||||||
base-url="MailAliases"
|
base-url="MailAliases"
|
||||||
:descriptor="AliasDescriptor"
|
:descriptor="AliasDescriptor"
|
||||||
|
|
|
@ -1,20 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
|
||||||
import AccountDescriptor from './AccountDescriptor.vue';
|
import AccountDescriptor from './AccountDescriptor.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCardBeta data-key="AccountId" :descriptor="AccountDescriptor" />
|
||||||
data-key="Account"
|
|
||||||
:descriptor="AccountDescriptor"
|
|
||||||
search-data-key="AccountList"
|
|
||||||
:searchbar-props="{
|
|
||||||
url: 'VnUsers/preview',
|
|
||||||
label: t('account.search'),
|
|
||||||
info: t('account.searchInfo'),
|
|
||||||
}"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -41,7 +41,7 @@ const hasAccount = ref(false);
|
||||||
/>
|
/>
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
ref="descriptor"
|
ref="descriptor"
|
||||||
:url="`VnUsers/preview`"
|
url="VnUsers/preview"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
module="Account"
|
module="Account"
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
|
|
|
@ -30,7 +30,7 @@ const filter = {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
data-key="AccountSummary"
|
data-key="AccountId"
|
||||||
ref="AccountSummary"
|
ref="AccountSummary"
|
||||||
url="VnUsers/preview"
|
url="VnUsers/preview"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
|
|
|
@ -3,11 +3,13 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import RoleSummary from './Card/RoleSummary.vue';
|
import RoleSummary from './Card/RoleSummary.vue';
|
||||||
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { viewSummary } = useSummaryDialog();
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -15,8 +17,10 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
const url = 'VnRoles';
|
||||||
|
const dataKey = 'AccountRoleList';
|
||||||
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const { viewSummary } = useSummaryDialog();
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -81,30 +85,32 @@ const exprBuilder = (param, value) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSection
|
||||||
data-key="AccountRolesList"
|
:data-key="dataKey"
|
||||||
:expr-builder="exprBuilder"
|
|
||||||
:label="t('role.searchRoles')"
|
|
||||||
:info="t('role.searchInfo')"
|
|
||||||
/>
|
|
||||||
<VnTable
|
|
||||||
ref="tableRef"
|
|
||||||
data-key="AccountRolesList"
|
|
||||||
:url="`VnRoles`"
|
|
||||||
:create="{
|
|
||||||
urlCreate: 'VnRoles',
|
|
||||||
title: t('Create rol'),
|
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
|
||||||
formInitialData: {
|
|
||||||
editorFk: entityId,
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
order="id ASC"
|
|
||||||
:disable-option="{ card: true }"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
default-mode="table"
|
prefix="role"
|
||||||
redirect="account/role"
|
:array-data-props="{ url, exprBuilder, order: 'id ASC' }"
|
||||||
/>
|
>
|
||||||
|
<template #body>
|
||||||
|
<VnTable
|
||||||
|
ref="tableRef"
|
||||||
|
:data-key="dataKey"
|
||||||
|
:create="{
|
||||||
|
urlCreate: 'VnRoles',
|
||||||
|
title: t('Create rol'),
|
||||||
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
|
formInitialData: {
|
||||||
|
editorFk: entityId,
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
|
:columns="columns"
|
||||||
|
default-mode="table"
|
||||||
|
redirect="account/role"
|
||||||
|
:right-search="false"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</VnSection>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -13,12 +13,7 @@ const props = defineProps({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnFilterPanel
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true" :redirect="false">
|
||||||
:data-key="props.dataKey"
|
|
||||||
:search-button="true"
|
|
||||||
:hidden-tags="['search']"
|
|
||||||
:redirect="false"
|
|
||||||
>
|
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`role.${tag.label}`) }}: </strong>
|
<strong>{{ t(`role.${tag.label}`) }}: </strong>
|
||||||
|
|
|
@ -1,20 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
|
||||||
import RoleDescriptor from './RoleDescriptor.vue';
|
import RoleDescriptor from './RoleDescriptor.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCardBeta data-key="Role" :descriptor="RoleDescriptor" />
|
||||||
data-key="Role"
|
|
||||||
:descriptor="RoleDescriptor"
|
|
||||||
search-data-key="AccountRolesList"
|
|
||||||
:searchbar-props="{
|
|
||||||
url: 'VnRoles',
|
|
||||||
label: t('role.searchRoles'),
|
|
||||||
info: t('role.searchInfo'),
|
|
||||||
searchUrl: 'table',
|
|
||||||
}"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -43,14 +43,14 @@ const removeRole = async () => {
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
module="Role"
|
module="Role"
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
data-key="accountData"
|
data-key="Role"
|
||||||
:title="data.title"
|
:title="data.title"
|
||||||
:subtitle="data.subtitle"
|
:subtitle="data.subtitle"
|
||||||
:summary="$props.summary"
|
:summary="$props.summary"
|
||||||
>
|
>
|
||||||
<template #menu>
|
<template #menu>
|
||||||
<QItem v-ripple clickable @click="removeRole()">
|
<QItem v-ripple clickable @click="removeRole()">
|
||||||
<QItemSection>{{ t('Delete') }}</QItemSection>
|
<QItemSection>{{ t('globals.delete') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
|
|
|
@ -27,10 +27,10 @@ const filter = {
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
ref="summary"
|
ref="summary"
|
||||||
:url="`VnRoles`"
|
:url="`VnRoles/${entityId}`"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
@on-fetch="(data) => (role = data)"
|
@on-fetch="(data) => (role = data)"
|
||||||
data-key="RoleSummary"
|
data-key="Role"
|
||||||
>
|
>
|
||||||
<template #header> {{ role.id }} - {{ role.name }} </template>
|
<template #header> {{ role.id }} - {{ role.name }} </template>
|
||||||
<template #body>
|
<template #body>
|
||||||
|
|
|
@ -66,7 +66,7 @@ account:
|
||||||
mailInputInfo: All emails will be forwarded to the specified address.
|
mailInputInfo: All emails will be forwarded to the specified address.
|
||||||
role:
|
role:
|
||||||
newRole: New role
|
newRole: New role
|
||||||
searchRoles: Search role
|
search: Search role
|
||||||
searchInfo: Search role by id or name
|
searchInfo: Search role by id or name
|
||||||
description: Description
|
description: Description
|
||||||
id: Id
|
id: Id
|
||||||
|
|
|
@ -6,6 +6,7 @@ import CrudModel from 'components/CrudModel.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import { tMobile } from 'composables/tMobile';
|
import { tMobile } from 'composables/tMobile';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
|
@ -157,19 +158,14 @@ const columns = computed(() => [
|
||||||
auto-width
|
auto-width
|
||||||
@keyup.ctrl.enter.stop="claimDevelopmentForm.saveChanges()"
|
@keyup.ctrl.enter.stop="claimDevelopmentForm.saveChanges()"
|
||||||
>
|
>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
|
v-if="col.name == 'worker'"
|
||||||
v-model="row[col.model]"
|
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"
|
|
||||||
:autofocus="col.tabIndex == 1"
|
:autofocus="col.tabIndex == 1"
|
||||||
input-debounce="0"
|
input-debounce="0"
|
||||||
hide-selected
|
hide-selected
|
||||||
>
|
>
|
||||||
<template #option="scope" v-if="col.name == 'worker'">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||||
|
@ -180,7 +176,20 @@ const columns = computed(() => [
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelectWorker>
|
||||||
|
<VnSelect
|
||||||
|
v-else
|
||||||
|
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"
|
||||||
|
:autofocus="col.tabIndex == 1"
|
||||||
|
input-debounce="0"
|
||||||
|
hide-selected
|
||||||
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #item="props">
|
<template #item="props">
|
||||||
|
|
|
@ -120,13 +120,13 @@ const developmentColumns = ref([
|
||||||
{
|
{
|
||||||
name: 'claimReason',
|
name: 'claimReason',
|
||||||
label: 'claim.reason',
|
label: 'claim.reason',
|
||||||
field: (row) => row.claimReason.description,
|
field: (row) => row.claimReason?.description,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'claimResult',
|
name: 'claimResult',
|
||||||
label: 'claim.result',
|
label: 'claim.result',
|
||||||
field: (row) => row.claimResult.description,
|
field: (row) => row.claimResult?.description,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,7 +131,7 @@ const STATE_COLOR = {
|
||||||
<VnTable
|
<VnTable
|
||||||
data-key="ClaimList"
|
data-key="ClaimList"
|
||||||
url="Claims/filter"
|
url="Claims/filter"
|
||||||
:order="['priority ASC', 'created ASC']"
|
:order="['t.priority ASC', 'created ASC']"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
redirect="claim"
|
redirect="claim"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
import { getDifferences, getUpdatedValues } from 'src/filters';
|
import { getDifferences, getUpdatedValues } from 'src/filters';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -16,7 +16,6 @@ const { t } = useI18n();
|
||||||
|
|
||||||
const businessTypes = ref([]);
|
const businessTypes = ref([]);
|
||||||
const contactChannels = ref([]);
|
const contactChannels = ref([]);
|
||||||
const title = ref();
|
|
||||||
const handleSalesModelValue = (val) => ({
|
const handleSalesModelValue = (val) => ({
|
||||||
or: [
|
or: [
|
||||||
{ id: val },
|
{ id: val },
|
||||||
|
@ -117,41 +116,17 @@ function onBeforeSave(formData, originalData) {
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
url="Workers/search"
|
|
||||||
v-model="data.salesPersonFk"
|
|
||||||
:label="t('customer.summary.salesPerson')"
|
:label="t('customer.summary.salesPerson')"
|
||||||
|
v-model="data.salesPersonFk"
|
||||||
:params="{
|
:params="{
|
||||||
departmentCodes: ['VT', 'shopping'],
|
departmentCodes: ['VT', 'shopping'],
|
||||||
}"
|
}"
|
||||||
:fields="['id', 'nickname']"
|
:has-avatar="true"
|
||||||
sort-by="nickname ASC"
|
|
||||||
option-label="nickname"
|
|
||||||
option-value="id"
|
|
||||||
:rules="validate('client.salesPersonFk')"
|
:rules="validate('client.salesPersonFk')"
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
emit-value
|
emit-value
|
||||||
auto-load
|
/>
|
||||||
>
|
|
||||||
<template #prepend>
|
|
||||||
<VnAvatar
|
|
||||||
:worker-id="data.salesPersonFk"
|
|
||||||
color="primary"
|
|
||||||
: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>
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
v-model="data.contactChannelFk"
|
v-model="data.contactChannelFk"
|
||||||
:options="contactChannels"
|
:options="contactChannels"
|
||||||
|
|
|
@ -110,7 +110,7 @@ function handleLocation(data, location) {
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox :label="t('Has to invoice')" v-model="data.hasToInvoice" />
|
<QCheckbox :label="t('Has to invoice')" v-model="data.hasToInvoice" />
|
||||||
<div>
|
<div>
|
||||||
<QCheckbox :label="t('Vies')" v-model="data.isVies" />
|
<QCheckbox :label="t('globals.isVies')" v-model="data.isVies" />
|
||||||
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('whenActivatingIt') }}
|
{{ t('whenActivatingIt') }}
|
||||||
|
@ -169,7 +169,6 @@ es:
|
||||||
Active: Activo
|
Active: Activo
|
||||||
Frozen: Congelado
|
Frozen: Congelado
|
||||||
Has to invoice: Factura
|
Has to invoice: Factura
|
||||||
Vies: Vies
|
|
||||||
Notify by email: Notificar vía e-mail
|
Notify by email: Notificar vía e-mail
|
||||||
Invoice by address: Facturar por consignatario
|
Invoice by address: Facturar por consignatario
|
||||||
Is equalizated: Recargo de equivalencia
|
Is equalizated: Recargo de equivalencia
|
||||||
|
|
|
@ -63,9 +63,10 @@ const columns = computed(() => [
|
||||||
<template>
|
<template>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<VnTable
|
<VnTable
|
||||||
|
data-key="Mandates"
|
||||||
|
url="Mandates"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
auto-load
|
auto-load
|
||||||
url="Mandates"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
class="full-width q-mt-md"
|
class="full-width q-mt-md"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
|
|
@ -173,7 +173,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:label="t('customer.summary.notifyByEmail')"
|
:label="t('customer.summary.notifyByEmail')"
|
||||||
:value="entity.isToBeMailed"
|
:value="entity.isToBeMailed"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('customer.summary.vies')" :value="entity.isVies" />
|
<VnLv :label="t('globals.isVies')" :value="entity.isVies" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
defineProps({
|
defineProps({
|
||||||
|
@ -65,19 +66,14 @@ const exprBuilder = (param, value) => {
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem class="q-mb-sm">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
url="Workers/search"
|
:label="t('Salesperson')"
|
||||||
|
v-model="params.salesPersonFk"
|
||||||
:params="{
|
:params="{
|
||||||
departmentCodes: ['VT'],
|
departmentCodes: ['VT'],
|
||||||
}"
|
}"
|
||||||
auto-load
|
|
||||||
:label="t('Salesperson')"
|
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
v-model="params.salesPersonFk"
|
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
sort-by="nickname ASC"
|
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
use-input
|
use-input
|
||||||
|
@ -86,18 +82,7 @@ const exprBuilder = (param, value) => {
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
>
|
/>
|
||||||
<template #option="{ itemProps, opt }">
|
|
||||||
<QItem v-bind="itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption>
|
|
||||||
{{ opt.nickname }},{{ opt.code }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template></VnSelect
|
|
||||||
>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem class="q-mb-sm">
|
||||||
|
@ -185,6 +170,8 @@ en:
|
||||||
phone: Phone
|
phone: Phone
|
||||||
email: Email
|
email: Email
|
||||||
zoneFk: Zone
|
zoneFk: Zone
|
||||||
|
socialName : Social name
|
||||||
|
name: Name
|
||||||
postcode: Postcode
|
postcode: Postcode
|
||||||
es:
|
es:
|
||||||
params:
|
params:
|
||||||
|
@ -196,6 +183,8 @@ es:
|
||||||
phone: Teléfono
|
phone: Teléfono
|
||||||
email: Email
|
email: Email
|
||||||
zoneFk: Zona
|
zoneFk: Zona
|
||||||
|
socialName : Razón social
|
||||||
|
name: Nombre
|
||||||
postcode: CP
|
postcode: CP
|
||||||
FI: NIF
|
FI: NIF
|
||||||
Salesperson: Comercial
|
Salesperson: Comercial
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import { ref, computed, markRaw } from 'vue';
|
import { ref, computed, markRaw } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
|
@ -12,7 +11,7 @@ import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
import CustomerFilter from './CustomerFilter.vue';
|
import CustomerFilter from './CustomerFilter.vue';
|
||||||
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -264,7 +263,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('customer.extendedList.tableVisibleColumns.isVies'),
|
label: t('globals.isVies'),
|
||||||
name: 'isVies',
|
name: 'isVies',
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
inWhere: true,
|
inWhere: true,
|
||||||
|
@ -419,43 +418,19 @@ function handleLocation(data, location) {
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
redirect="customer"
|
redirect="customer"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
auto-load
|
|
||||||
>
|
>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
url="Workers/search"
|
|
||||||
v-model="data.salesPersonFk"
|
|
||||||
:label="t('customer.summary.salesPerson')"
|
:label="t('customer.summary.salesPerson')"
|
||||||
|
v-model="data.salesPersonFk"
|
||||||
:params="{
|
:params="{
|
||||||
departmentCodes: ['VT', 'shopping'],
|
departmentCodes: ['VT', 'shopping'],
|
||||||
}"
|
}"
|
||||||
:fields="['id', 'nickname', 'code']"
|
:has-avatar="true"
|
||||||
sort-by="nickname ASC"
|
:id-value="data.salesPersonFk"
|
||||||
option-label="nickname"
|
|
||||||
option-value="id"
|
|
||||||
emit-value
|
emit-value
|
||||||
auto-load
|
auto-load
|
||||||
>
|
/>
|
||||||
<template #prepend>
|
|
||||||
<VnAvatar
|
|
||||||
:worker-id="data.salesPersonFk"
|
|
||||||
color="primary"
|
|
||||||
: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>
|
|
||||||
|
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.location"
|
v-model="data.location"
|
||||||
|
|
|
@ -240,6 +240,7 @@ es:
|
||||||
defaulterSinced: Desde
|
defaulterSinced: Desde
|
||||||
Client: Cliente
|
Client: Cliente
|
||||||
Salesperson: Comercial
|
Salesperson: Comercial
|
||||||
|
Departments: Departamentos
|
||||||
Country: País
|
Country: País
|
||||||
P. Method: F. Pago
|
P. Method: F. Pago
|
||||||
Balance D.: Saldo V.
|
Balance D.: Saldo V.
|
||||||
|
|
|
@ -12,6 +12,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||||
import CustomerNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
import CustomerNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
||||||
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -144,7 +145,6 @@ function handleLocation(data, location) {
|
||||||
:url="`Addresses/${route.params.addressId}`"
|
:url="`Addresses/${route.params.addressId}`"
|
||||||
@on-data-saved="onDataSaved()"
|
@on-data-saved="onDataSaved()"
|
||||||
auto-load
|
auto-load
|
||||||
model="customer"
|
|
||||||
>
|
>
|
||||||
<template #moreActions>
|
<template #moreActions>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -220,31 +220,35 @@ function handleLocation(data, location) {
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<VnSelect
|
||||||
<VnSelect
|
:label="t('Incoterms')"
|
||||||
:label="t('Incoterms')"
|
:options="incoterms"
|
||||||
:options="incoterms"
|
hide-selected
|
||||||
hide-selected
|
option-label="name"
|
||||||
option-label="name"
|
option-value="code"
|
||||||
option-value="code"
|
v-model="data.incotermsFk"
|
||||||
v-model="data.incotermsFk"
|
/>
|
||||||
/>
|
<VnSelectDialog
|
||||||
</div>
|
:label="t('Customs agent')"
|
||||||
<div class="col">
|
:options="customsAgents"
|
||||||
<VnSelectDialog
|
hide-selected
|
||||||
:label="t('Customs agent')"
|
option-label="fiscalName"
|
||||||
:options="customsAgents"
|
option-value="id"
|
||||||
hide-selected
|
v-model="data.customsAgentFk"
|
||||||
option-label="fiscalName"
|
:tooltip="t('New customs agent')"
|
||||||
option-value="id"
|
>
|
||||||
v-model="data.customsAgentFk"
|
<template #form>
|
||||||
:tooltip="t('New customs agent')"
|
<CustomerNewCustomsAgent />
|
||||||
>
|
</template>
|
||||||
<template #form>
|
</VnSelectDialog>
|
||||||
<CustomerNewCustomsAgent />
|
</VnRow>
|
||||||
</template>
|
<VnRow>
|
||||||
</VnSelectDialog>
|
<VnInputNumber
|
||||||
</div>
|
:label="t('Longitude')"
|
||||||
|
clearable
|
||||||
|
v-model="data.longitude"
|
||||||
|
/>
|
||||||
|
<VnInputNumber :label="t('Latitude')" clearable v-model="data.latitude" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<h4 class="q-mb-xs">{{ t('Notes') }}</h4>
|
<h4 class="q-mb-xs">{{ t('Notes') }}</h4>
|
||||||
<VnRow
|
<VnRow
|
||||||
|
@ -322,4 +326,6 @@ es:
|
||||||
Description: Descripción
|
Description: Descripción
|
||||||
Add note: Añadir nota
|
Add note: Añadir nota
|
||||||
Remove note: Eliminar nota
|
Remove note: Eliminar nota
|
||||||
|
Longitude: Longitud
|
||||||
|
Latitude: Latitud
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -88,7 +88,6 @@ customer:
|
||||||
businessTypeFk: Business type
|
businessTypeFk: Business type
|
||||||
sageTaxTypeFk: Sage tax type
|
sageTaxTypeFk: Sage tax type
|
||||||
sageTransactionTypeFk: Sage tr. type
|
sageTransactionTypeFk: Sage tr. type
|
||||||
isVies: Vies
|
|
||||||
isTaxDataChecked: Verified data
|
isTaxDataChecked: Verified data
|
||||||
isFreezed: Freezed
|
isFreezed: Freezed
|
||||||
hasToInvoice: Invoice
|
hasToInvoice: Invoice
|
||||||
|
|
|
@ -90,7 +90,6 @@ customer:
|
||||||
businessTypeFk: Tipo de negocio
|
businessTypeFk: Tipo de negocio
|
||||||
sageTaxTypeFk: Tipo de impuesto Sage
|
sageTaxTypeFk: Tipo de impuesto Sage
|
||||||
sageTransactionTypeFk: Tipo tr. sage
|
sageTransactionTypeFk: Tipo tr. sage
|
||||||
isVies: Vies
|
|
||||||
isTaxDataChecked: Datos comprobados
|
isTaxDataChecked: Datos comprobados
|
||||||
isFreezed: Congelado
|
isFreezed: Congelado
|
||||||
hasToInvoice: Factura
|
hasToInvoice: Factura
|
||||||
|
|
|
@ -6,6 +6,7 @@ import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -48,14 +49,9 @@ const { t } = useI18n();
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
:label="t('department.bossDepartment')"
|
:label="t('department.bossDepartment')"
|
||||||
v-model="data.workerFk"
|
v-model="data.workerFk"
|
||||||
url="Workers/search"
|
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
hide-selected
|
|
||||||
map-options
|
|
||||||
:rules="validate('department.workerFk')"
|
:rules="validate('department.workerFk')"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
|
|
@ -83,7 +83,7 @@ const { openConfirmationModal } = useVnConfirm();
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('department.chat')" :value="entity.chatName" />
|
<VnLv :label="t('department.chat')" :value="entity.chatName" />
|
||||||
<VnLv :label="t('department.email')" :value="entity.notificationEmail" copy />
|
<VnLv :label="t('globals.email')" :value="entity.notificationEmail" copy />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('department.selfConsumptionCustomer')"
|
:label="t('department.selfConsumptionCustomer')"
|
||||||
:value="entity.client?.name"
|
:value="entity.client?.name"
|
||||||
|
|
|
@ -58,7 +58,7 @@ onMounted(async () => {
|
||||||
dash
|
dash
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('department.email')"
|
:label="t('globals.email')"
|
||||||
:value="department.notificationEmail"
|
:value="department.notificationEmail"
|
||||||
dash
|
dash
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -74,8 +74,8 @@ const showEntryReport = () => {
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('globals.agency')" :value="entity.travel?.agency?.name" />
|
<VnLv :label="t('globals.agency')" :value="entity.travel?.agency?.name" />
|
||||||
<VnLv :label="t('shipped')" :value="toDate(entity.travel?.shipped)" />
|
<VnLv :label="t('globals.shipped')" :value="toDate(entity.travel?.shipped)" />
|
||||||
<VnLv :label="t('landed')" :value="toDate(entity.travel?.landed)" />
|
<VnLv :label="t('globals.landed')" :value="toDate(entity.travel?.landed)" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('globals.warehouseOut')"
|
:label="t('globals.warehouseOut')"
|
||||||
:value="entity.travel?.warehouseOut?.name"
|
:value="entity.travel?.warehouseOut?.name"
|
||||||
|
|
|
@ -212,7 +212,7 @@ const fetchEntryBuys = async () => {
|
||||||
:label="t('entry.summary.travelAgency')"
|
:label="t('entry.summary.travelAgency')"
|
||||||
:value="entry.travel.agency?.name"
|
:value="entry.travel.agency?.name"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('shipped')" :value="toDate(entry.travel.shipped)" />
|
<VnLv :label="t('globals.shipped')" :value="toDate(entry.travel.shipped)" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('globals.warehouseOut')"
|
:label="t('globals.warehouseOut')"
|
||||||
:value="entry.travel.warehouseOut?.name"
|
:value="entry.travel.warehouseOut?.name"
|
||||||
|
@ -222,7 +222,7 @@ const fetchEntryBuys = async () => {
|
||||||
v-model="entry.travel.isDelivered"
|
v-model="entry.travel.isDelivered"
|
||||||
:disable="true"
|
:disable="true"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('landed')" :value="toDate(entry.travel.landed)" />
|
<VnLv :label="t('globals.landed')" :value="toDate(entry.travel.landed)" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('globals.warehouseIn')"
|
:label="t('globals.warehouseIn')"
|
||||||
:value="entry.travel.warehouseIn?.name"
|
:value="entry.travel.warehouseIn?.name"
|
||||||
|
|
|
@ -58,7 +58,7 @@ const tagValues = ref([]);
|
||||||
<QItem class="q-my-md">
|
<QItem class="q-my-md">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('components.itemsFilterPanel.supplierFk')"
|
:label="t('globals.params.supplierFk')"
|
||||||
v-model="params.supplierFk"
|
v-model="params.supplierFk"
|
||||||
:options="suppliersOptions"
|
:options="suppliersOptions"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -85,7 +85,7 @@ const tagValues = ref([]);
|
||||||
<QItem class="q-my-md">
|
<QItem class="q-my-md">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('components.itemsFilterPanel.from')"
|
:label="t('components.itemsFilterPanel.started')"
|
||||||
v-model="params.from"
|
v-model="params.from"
|
||||||
is-outlined
|
is-outlined
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
@ -95,7 +95,7 @@ const tagValues = ref([]);
|
||||||
<QItem class="q-my-md">
|
<QItem class="q-my-md">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('components.itemsFilterPanel.to')"
|
:label="t('components.itemsFilterPanel.ended')"
|
||||||
v-model="params.to"
|
v-model="params.to"
|
||||||
is-outlined
|
is-outlined
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
@ -113,7 +113,7 @@ const tagValues = ref([]);
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('components.itemsFilterPanel.visible')"
|
:label="t('globals.visible')"
|
||||||
v-model="params.visible"
|
v-model="params.visible"
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
|
|
@ -65,6 +65,6 @@ onMounted(async () => {
|
||||||
es:
|
es:
|
||||||
Date: Fecha
|
Date: Fecha
|
||||||
params:
|
params:
|
||||||
dated: Date
|
dated: Fecha
|
||||||
workerFk: Trabajador
|
workerFk: Trabajador
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -116,6 +116,7 @@ function deleteFile(dmsFk) {
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
:required="true"
|
||||||
:label="t('supplierFk')"
|
:label="t('supplierFk')"
|
||||||
v-model="data.supplierFk"
|
v-model="data.supplierFk"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -244,14 +245,19 @@ function deleteFile(dmsFk) {
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
:required="true"
|
||||||
|
:is-clearable="false"
|
||||||
:label="t('Currency')"
|
:label="t('Currency')"
|
||||||
v-model="data.currencyFk"
|
v-model="data.currencyFk"
|
||||||
:options="currencies"
|
:options="currencies"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
|
sort-by="id"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
:required="true"
|
||||||
|
:is-clearable="false"
|
||||||
v-if="companiesRef"
|
v-if="companiesRef"
|
||||||
:label="t('Company')"
|
:label="t('Company')"
|
||||||
v-model="data.companyFk"
|
v-model="data.companyFk"
|
||||||
|
@ -262,7 +268,7 @@ function deleteFile(dmsFk) {
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('invoiceIn.summary.sage')"
|
:label="t('InvoiceIn.summary.sage')"
|
||||||
v-model="data.withholdingSageFk"
|
v-model="data.withholdingSageFk"
|
||||||
:options="sageWithholdings"
|
:options="sageWithholdings"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, capitalize } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useCapitalize } from 'src/composables/useCapitalize';
|
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
|
||||||
const { push, currentRoute } = useRouter();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const invoiceId = +currentRoute.value.params.id;
|
|
||||||
const arrayData = useArrayData();
|
const arrayData = useArrayData();
|
||||||
const invoiceIn = computed(() => arrayData.store.data);
|
const invoiceIn = computed(() => arrayData.store.data);
|
||||||
const invoiceInCorrectionRef = ref();
|
const invoiceInCorrectionRef = ref();
|
||||||
const filter = {
|
const filter = {
|
||||||
include: { relation: 'invoiceIn' },
|
include: { relation: 'invoiceIn' },
|
||||||
where: { correctingFk: invoiceId },
|
where: { correctingFk: route.params.id },
|
||||||
};
|
};
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -31,7 +29,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'type',
|
name: 'type',
|
||||||
label: useCapitalize(t('globals.type')),
|
label: capitalize(t('globals.type')),
|
||||||
field: (row) => row.cplusRectificationTypeFk,
|
field: (row) => row.cplusRectificationTypeFk,
|
||||||
options: cplusRectificationTypes.value,
|
options: cplusRectificationTypes.value,
|
||||||
model: 'cplusRectificationTypeFk',
|
model: 'cplusRectificationTypeFk',
|
||||||
|
@ -43,10 +41,10 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'class',
|
name: 'class',
|
||||||
label: useCapitalize(t('globals.class')),
|
label: capitalize(t('globals.class')),
|
||||||
field: (row) => row.siiTypeInvoiceOutFk,
|
field: (row) => row.siiTypeInvoiceInFk,
|
||||||
options: siiTypeInvoiceOuts.value,
|
options: siiTypeInvoiceIns.value,
|
||||||
model: 'siiTypeInvoiceOutFk',
|
model: 'siiTypeInvoiceInFk',
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: 'code',
|
optionLabel: 'code',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -55,7 +53,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'reason',
|
name: 'reason',
|
||||||
label: useCapitalize(t('globals.reason')),
|
label: capitalize(t('globals.reason')),
|
||||||
field: (row) => row.invoiceCorrectionTypeFk,
|
field: (row) => row.invoiceCorrectionTypeFk,
|
||||||
options: invoiceCorrectionTypes.value,
|
options: invoiceCorrectionTypes.value,
|
||||||
model: 'invoiceCorrectionTypeFk',
|
model: 'invoiceCorrectionTypeFk',
|
||||||
|
@ -67,13 +65,10 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const cplusRectificationTypes = ref([]);
|
const cplusRectificationTypes = ref([]);
|
||||||
const siiTypeInvoiceOuts = ref([]);
|
const siiTypeInvoiceIns = ref([]);
|
||||||
const invoiceCorrectionTypes = ref([]);
|
const invoiceCorrectionTypes = ref([]);
|
||||||
const rowsSelected = ref([]);
|
|
||||||
|
|
||||||
const requiredFieldRule = (val) => val || t('globals.requiredField');
|
const requiredFieldRule = (val) => val || t('globals.requiredField');
|
||||||
|
|
||||||
const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -82,9 +77,9 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="SiiTypeInvoiceOuts"
|
url="SiiTypeInvoiceIns"
|
||||||
:where="{ code: { like: 'R%' } }"
|
:where="{ code: { like: 'R%' } }"
|
||||||
@on-fetch="(data) => (siiTypeInvoiceOuts = data)"
|
@on-fetch="(data) => (siiTypeInvoiceIns = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -99,17 +94,14 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
url="InvoiceInCorrections"
|
url="InvoiceInCorrections"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
auto-load
|
auto-load
|
||||||
v-model:selected="rowsSelected"
|
|
||||||
primary-key="correctingFk"
|
primary-key="correctingFk"
|
||||||
@save-changes="onSave"
|
:default-remove="false"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QTable
|
<QTable
|
||||||
v-model:selected="rowsSelected"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
row-key="$index"
|
row-key="$index"
|
||||||
selection="single"
|
|
||||||
:grid="$q.screen.lt.sm"
|
:grid="$q.screen.lt.sm"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
>
|
>
|
||||||
|
@ -121,8 +113,17 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:readonly="row.invoiceIn.isBooked"
|
:disable="row.invoiceIn.isBooked"
|
||||||
/>
|
:filter-options="['description']"
|
||||||
|
>
|
||||||
|
<template #option="{ opt, itemProps }">
|
||||||
|
<QItem v-bind="itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ opt.description }}</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-class="{ row, col }">
|
<template #body-cell-class="{ row, col }">
|
||||||
|
@ -134,8 +135,20 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:rules="[requiredFieldRule]"
|
:rules="[requiredFieldRule]"
|
||||||
:readonly="row.invoiceIn.isBooked"
|
:filter-options="['code', 'description']"
|
||||||
/>
|
:disable="row.invoiceIn.isBooked"
|
||||||
|
>
|
||||||
|
<template #option="{ opt, itemProps }">
|
||||||
|
<QItem v-bind="itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel
|
||||||
|
>{{ opt.code }} -
|
||||||
|
{{ opt.description }}</QItemLabel
|
||||||
|
>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-reason="{ row, col }">
|
<template #body-cell-reason="{ row, col }">
|
||||||
|
@ -147,7 +160,7 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:rules="[requiredFieldRule]"
|
:rules="[requiredFieldRule]"
|
||||||
:readonly="row.invoiceIn.isBooked"
|
:disable="row.invoiceIn.isBooked"
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -155,7 +168,6 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
</template>
|
</template>
|
||||||
</CrudModel>
|
</CrudModel>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped></style>
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Original invoice: Factura origen
|
Original invoice: Factura origen
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, computed, onBeforeMount } from 'vue';
|
import { ref, reactive, computed, onBeforeMount, capitalize } from 'vue';
|
||||||
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
|
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
@ -15,7 +15,6 @@ import FetchData from 'src/components/FetchData.vue';
|
||||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import { useCapitalize } from 'src/composables/useCapitalize';
|
|
||||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||||
import InvoiceInToBook from '../InvoiceInToBook.vue';
|
import InvoiceInToBook from '../InvoiceInToBook.vue';
|
||||||
|
|
||||||
|
@ -37,7 +36,7 @@ const totalAmount = ref();
|
||||||
const currentAction = ref();
|
const currentAction = ref();
|
||||||
const config = ref();
|
const config = ref();
|
||||||
const cplusRectificationTypes = ref([]);
|
const cplusRectificationTypes = ref([]);
|
||||||
const siiTypeInvoiceOuts = ref([]);
|
const siiTypeInvoiceIns = ref([]);
|
||||||
const invoiceCorrectionTypes = ref([]);
|
const invoiceCorrectionTypes = ref([]);
|
||||||
const actions = {
|
const actions = {
|
||||||
unbook: {
|
unbook: {
|
||||||
|
@ -91,7 +90,7 @@ const routes = reactive({
|
||||||
return {
|
return {
|
||||||
name: 'InvoiceInList',
|
name: 'InvoiceInList',
|
||||||
query: {
|
query: {
|
||||||
params: JSON.stringify({ supplierFk: id }),
|
table: JSON.stringify({ supplierFk: id }),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -100,7 +99,7 @@ const routes = reactive({
|
||||||
return {
|
return {
|
||||||
name: 'InvoiceInList',
|
name: 'InvoiceInList',
|
||||||
query: {
|
query: {
|
||||||
params: JSON.stringify({ correctedFk: entityId.value }),
|
table: JSON.stringify({ correctedFk: entityId.value }),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -119,21 +118,21 @@ const routes = reactive({
|
||||||
const correctionFormData = reactive({
|
const correctionFormData = reactive({
|
||||||
invoiceReason: 2,
|
invoiceReason: 2,
|
||||||
invoiceType: 2,
|
invoiceType: 2,
|
||||||
invoiceClass: 6,
|
invoiceClass: 8,
|
||||||
});
|
});
|
||||||
const isNotFilled = computed(() => Object.values(correctionFormData).includes(null));
|
const isNotFilled = computed(() => Object.values(correctionFormData).includes(null));
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
await setInvoiceCorrection(entityId.value);
|
await setInvoiceCorrection(entityId.value);
|
||||||
const { data } = await axios.get(`InvoiceIns/${entityId.value}/getTotals`);
|
const { data } = await axios.get(`InvoiceIns/${entityId.value}/getTotals`);
|
||||||
totalAmount.value = data.totalDueDay;
|
totalAmount.value = data.totalTaxableBase;
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeRouteUpdate(async (to, from) => {
|
onBeforeRouteUpdate(async (to, from) => {
|
||||||
if (to.params.id !== from.params.id) {
|
if (to.params.id !== from.params.id) {
|
||||||
await setInvoiceCorrection(to.params.id);
|
await setInvoiceCorrection(to.params.id);
|
||||||
const { data } = await axios.get(`InvoiceIns/${to.params.id}/getTotals`);
|
const { data } = await axios.get(`InvoiceIns/${to.params.id}/getTotals`);
|
||||||
totalAmount.value = data.totalDueDay;
|
totalAmount.value = data.totalTaxableBase;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -207,7 +206,8 @@ const isAgricultural = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
function showPdfInvoice() {
|
function showPdfInvoice() {
|
||||||
if (isAgricultural()) openReport(`InvoiceIns/${entityId.value}/invoice-in-pdf`);
|
if (isAgricultural())
|
||||||
|
openReport(`InvoiceIns/${entityId.value}/invoice-in-pdf`, null, '_blank');
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendPdfInvoiceConfirmation() {
|
function sendPdfInvoiceConfirmation() {
|
||||||
|
@ -262,9 +262,9 @@ const createInvoiceInCorrection = async () => {
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="SiiTypeInvoiceOuts"
|
url="siiTypeInvoiceIns"
|
||||||
:where="{ code: { like: 'R%' } }"
|
:where="{ code: { like: 'R%' } }"
|
||||||
@on-fetch="(data) => (siiTypeInvoiceOuts = data)"
|
@on-fetch="(data) => (siiTypeInvoiceIns = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -355,10 +355,13 @@ const createInvoiceInCorrection = async () => {
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('invoiceIn.list.issued')" :value="toDate(entity.issued)" />
|
<VnLv :label="t('InvoiceIn.list.issued')" :value="toDate(entity.issued)" />
|
||||||
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" />
|
<VnLv
|
||||||
<VnLv :label="t('invoiceIn.list.amount')" :value="toCurrency(totalAmount)" />
|
:label="t('InvoiceIn.summary.bookedDate')"
|
||||||
<VnLv :label="t('invoiceIn.list.supplier')">
|
:value="toDate(entity.booked)"
|
||||||
|
/>
|
||||||
|
<VnLv :label="t('InvoiceIn.list.amount')" :value="toCurrency(totalAmount)" />
|
||||||
|
<VnLv :label="t('InvoiceIn.list.supplier')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<span class="link">
|
<span class="link">
|
||||||
{{ entity?.supplier?.nickname }}
|
{{ entity?.supplier?.nickname }}
|
||||||
|
@ -375,7 +378,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
color="primary"
|
color="primary"
|
||||||
:to="routes.getSupplier(entity.supplierFk)"
|
:to="routes.getSupplier(entity.supplierFk)"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('invoiceIn.list.supplier') }}</QTooltip>
|
<QTooltip>{{ t('InvoiceIn.list.supplier') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<QBtn
|
<QBtn
|
||||||
size="md"
|
size="md"
|
||||||
|
@ -391,7 +394,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
color="primary"
|
color="primary"
|
||||||
:to="routes.getTickets(entity.supplierFk)"
|
:to="routes.getTickets(entity.supplierFk)"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip>
|
<QTooltip>{{ t('InvoiceIn.descriptor.ticketList') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="
|
v-if="
|
||||||
|
@ -435,9 +438,9 @@ const createInvoiceInCorrection = async () => {
|
||||||
readonly
|
readonly
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="`${useCapitalize(t('globals.class'))}`"
|
:label="`${capitalize(t('globals.class'))}`"
|
||||||
v-model="correctionFormData.invoiceClass"
|
v-model="correctionFormData.invoiceClass"
|
||||||
:options="siiTypeInvoiceOuts"
|
:options="siiTypeInvoiceIns"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
:required="true"
|
:required="true"
|
||||||
|
@ -445,15 +448,27 @@ const createInvoiceInCorrection = async () => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="`${useCapitalize(t('globals.type'))}`"
|
:label="`${capitalize(t('globals.type'))}`"
|
||||||
v-model="correctionFormData.invoiceType"
|
v-model="correctionFormData.invoiceType"
|
||||||
:options="cplusRectificationTypes"
|
:options="cplusRectificationTypes"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="description"
|
option-label="description"
|
||||||
:required="true"
|
:required="true"
|
||||||
/>
|
>
|
||||||
|
<template #option="{ opt }">
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel
|
||||||
|
>{{ opt.code }} -
|
||||||
|
{{ opt.description }}</QItemLabel
|
||||||
|
>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<div></div>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="`${useCapitalize(t('globals.reason'))}`"
|
:label="`${capitalize(t('globals.reason'))}`"
|
||||||
v-model="correctionFormData.invoiceReason"
|
v-model="correctionFormData.invoiceReason"
|
||||||
:options="invoiceCorrectionTypes"
|
:options="invoiceCorrectionTypes"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
|
@ -25,6 +25,7 @@ const banks = ref([]);
|
||||||
const invoiceInFormRef = ref();
|
const invoiceInFormRef = ref();
|
||||||
const invoiceId = +route.params.id;
|
const invoiceId = +route.params.id;
|
||||||
const filter = { where: { invoiceInFk: invoiceId } };
|
const filter = { where: { invoiceInFk: invoiceId } };
|
||||||
|
const areRows = ref(false);
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -143,8 +144,6 @@ async function insert() {
|
||||||
}"
|
}"
|
||||||
:disable="!isNotEuro(currency)"
|
:disable="!isNotEuro(currency)"
|
||||||
v-model="row.foreignValue"
|
v-model="row.foreignValue"
|
||||||
clearable
|
|
||||||
clear-icon="close"
|
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -230,7 +229,14 @@ async function insert() {
|
||||||
</template>
|
</template>
|
||||||
</CrudModel>
|
</CrudModel>
|
||||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||||
<QBtn color="primary" icon="add" shortcut="+" size="lg" round @click="insert" />
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
|
size="lg"
|
||||||
|
round
|
||||||
|
@click="!areRows ? insert() : invoiceInFormRef.insert()"
|
||||||
|
/>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -26,7 +26,7 @@ const columns = computed(() => [
|
||||||
options: intrastats.value,
|
options: intrastats.value,
|
||||||
model: 'intrastatFk',
|
model: 'intrastatFk',
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: 'description',
|
optionLabel: (row) => `${row.id}: ${row.description}`,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
tabIndex: 1,
|
tabIndex: 1,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -68,12 +68,6 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const formatOpt = (row, { model, options }, prop) => {
|
|
||||||
const obj = row[model];
|
|
||||||
const option = options.find(({ id }) => id == obj);
|
|
||||||
return option ? `${obj}:${option[prop]}` : '';
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -118,12 +112,10 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
option-value="id"
|
:option-value="col.optionValue"
|
||||||
option-label="description"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'description']"
|
:filter-options="['id', 'description']"
|
||||||
:hide-selected="false"
|
data-cy="intrastat-code"
|
||||||
:fill-input="false"
|
|
||||||
:display-value="formatOpt(row, col, 'description')"
|
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -138,8 +130,8 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
option-value="id"
|
:option-value="col.optionValue"
|
||||||
option-label="code"
|
:option-label="col.optionLabel"
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -154,7 +146,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
{{ getTotal(rows, 'net') }}
|
{{ getTotal(rows, 'net') }}
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd>
|
<QTd>
|
||||||
{{ getTotal(rows, 'stems') }}
|
{{ getTotal(rows, 'stems', { decimalPlaces: 0 }) }}
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd />
|
<QTd />
|
||||||
</QTr>
|
</QTr>
|
||||||
|
@ -169,12 +161,14 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
<QList>
|
<QList>
|
||||||
<QItem>
|
<QItem>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('code')"
|
:label="t('Code')"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
v-model="props.row['intrastatFk']"
|
v-model="props.row['intrastatFk']"
|
||||||
:options="intrastats"
|
:options="intrastats"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="description"
|
:option-label="
|
||||||
|
(row) => `${row.id}:${row.description}`
|
||||||
|
"
|
||||||
:filter-options="['id', 'description']"
|
:filter-options="['id', 'description']"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
|
@ -248,11 +242,6 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang="scss" scoped>
|
|
||||||
:deep(.q-table tr .q-td:nth-child(2) input) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
amount: Amount
|
amount: Amount
|
||||||
|
@ -261,7 +250,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
country: Country
|
country: Country
|
||||||
es:
|
es:
|
||||||
Code: Código
|
Code: Código
|
||||||
amount: Cantidad
|
amount: Valor mercancía
|
||||||
net: Neto
|
net: Neto
|
||||||
stems: Tallos
|
stems: Tallos
|
||||||
country: País
|
country: País
|
||||||
|
|
|
@ -26,14 +26,14 @@ const intrastatTotals = ref({ amount: 0, net: 0, stems: 0 });
|
||||||
const vatColumns = ref([
|
const vatColumns = ref([
|
||||||
{
|
{
|
||||||
name: 'expense',
|
name: 'expense',
|
||||||
label: 'invoiceIn.summary.expense',
|
label: 'InvoiceIn.summary.expense',
|
||||||
field: (row) => row.expenseFk,
|
field: (row) => row.expenseFk,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'landed',
|
name: 'landed',
|
||||||
label: 'invoiceIn.summary.taxableBase',
|
label: 'InvoiceIn.summary.taxableBase',
|
||||||
field: (row) => row.taxableBase,
|
field: (row) => row.taxableBase,
|
||||||
format: (value) => toCurrency(value),
|
format: (value) => toCurrency(value),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -41,7 +41,7 @@ const vatColumns = ref([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'vat',
|
name: 'vat',
|
||||||
label: 'invoiceIn.summary.sageVat',
|
label: 'InvoiceIn.summary.sageVat',
|
||||||
field: (row) => {
|
field: (row) => {
|
||||||
if (row.taxTypeSage) return `#${row.taxTypeSage.id} : ${row.taxTypeSage.vat}`;
|
if (row.taxTypeSage) return `#${row.taxTypeSage.id} : ${row.taxTypeSage.vat}`;
|
||||||
},
|
},
|
||||||
|
@ -51,7 +51,7 @@ const vatColumns = ref([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'transaction',
|
name: 'transaction',
|
||||||
label: 'invoiceIn.summary.sageTransaction',
|
label: 'InvoiceIn.summary.sageTransaction',
|
||||||
field: (row) => {
|
field: (row) => {
|
||||||
if (row.transactionTypeSage)
|
if (row.transactionTypeSage)
|
||||||
return `#${row.transactionTypeSage.id} : ${row.transactionTypeSage?.transaction}`;
|
return `#${row.transactionTypeSage.id} : ${row.transactionTypeSage?.transaction}`;
|
||||||
|
@ -62,7 +62,7 @@ const vatColumns = ref([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'rate',
|
name: 'rate',
|
||||||
label: 'invoiceIn.summary.rate',
|
label: 'InvoiceIn.summary.rate',
|
||||||
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
|
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
|
||||||
format: (value) => toCurrency(value),
|
format: (value) => toCurrency(value),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -70,7 +70,7 @@ const vatColumns = ref([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'currency',
|
name: 'currency',
|
||||||
label: 'invoiceIn.summary.currency',
|
label: 'InvoiceIn.summary.currency',
|
||||||
field: (row) => row.foreignValue,
|
field: (row) => row.foreignValue,
|
||||||
format: (val) => val && toCurrency(val, currency.value),
|
format: (val) => val && toCurrency(val, currency.value),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -81,21 +81,21 @@ const vatColumns = ref([
|
||||||
const dueDayColumns = ref([
|
const dueDayColumns = ref([
|
||||||
{
|
{
|
||||||
name: 'date',
|
name: 'date',
|
||||||
label: 'invoiceIn.summary.dueDay',
|
label: 'InvoiceIn.summary.dueDay',
|
||||||
field: (row) => toDate(row.dueDated),
|
field: (row) => toDate(row.dueDated),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'bank',
|
name: 'bank',
|
||||||
label: 'invoiceIn.summary.bank',
|
label: 'InvoiceIn.summary.bank',
|
||||||
field: (row) => row.bank.bank,
|
field: (row) => row.bank.bank,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
label: 'invoiceIn.list.amount',
|
label: 'InvoiceIn.list.amount',
|
||||||
field: (row) => row.amount,
|
field: (row) => row.amount,
|
||||||
format: (value) => toCurrency(value),
|
format: (value) => toCurrency(value),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -103,7 +103,7 @@ const dueDayColumns = ref([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'landed',
|
name: 'landed',
|
||||||
label: 'invoiceIn.summary.foreignValue',
|
label: 'InvoiceIn.summary.foreignValue',
|
||||||
field: (row) => row.foreignValue,
|
field: (row) => row.foreignValue,
|
||||||
format: (val) => val && toCurrency(val, currency.value),
|
format: (val) => val && toCurrency(val, currency.value),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -114,7 +114,7 @@ const dueDayColumns = ref([
|
||||||
const intrastatColumns = ref([
|
const intrastatColumns = ref([
|
||||||
{
|
{
|
||||||
name: 'code',
|
name: 'code',
|
||||||
label: 'invoiceIn.summary.code',
|
label: 'InvoiceIn.summary.code',
|
||||||
field: (row) => {
|
field: (row) => {
|
||||||
return `${row.intrastat.id}: ${row.intrastat?.description}`;
|
return `${row.intrastat.id}: ${row.intrastat?.description}`;
|
||||||
},
|
},
|
||||||
|
@ -123,21 +123,21 @@ const intrastatColumns = ref([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
label: 'invoiceIn.list.amount',
|
label: 'InvoiceIn.list.amount',
|
||||||
field: (row) => toCurrency(row.amount),
|
field: (row) => toCurrency(row.amount),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'net',
|
name: 'net',
|
||||||
label: 'invoiceIn.summary.net',
|
label: 'InvoiceIn.summary.net',
|
||||||
field: (row) => row.net,
|
field: (row) => row.net,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'stems',
|
name: 'stems',
|
||||||
label: 'invoiceIn.summary.stems',
|
label: 'InvoiceIn.summary.stems',
|
||||||
field: (row) => row.stems,
|
field: (row) => row.stems,
|
||||||
format: (value) => value,
|
format: (value) => value,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -145,7 +145,7 @@ const intrastatColumns = ref([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'landed',
|
name: 'landed',
|
||||||
label: 'invoiceIn.summary.country',
|
label: 'InvoiceIn.summary.country',
|
||||||
field: (row) => row.country?.code,
|
field: (row) => row.country?.code,
|
||||||
format: (value) => value,
|
format: (value) => value,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -210,7 +210,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
/>
|
/>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.list.supplier')"
|
:label="t('InvoiceIn.list.supplier')"
|
||||||
:value="entity.supplier?.name"
|
:value="entity.supplier?.name"
|
||||||
>
|
>
|
||||||
<template #value>
|
<template #value>
|
||||||
|
@ -221,14 +221,18 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.list.supplierRef')"
|
:label="t('InvoiceIn.list.supplierRef')"
|
||||||
:value="entity.supplierRef"
|
:value="entity.supplierRef"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.summary.currency')"
|
:label="t('InvoiceIn.summary.currency')"
|
||||||
:value="entity.currency?.code"
|
:value="entity.currency?.code"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('invoiceIn.serial')" :value="`${entity.serial}`" />
|
<VnLv :label="t('InvoiceIn.serial')" :value="`${entity.serial}`" />
|
||||||
|
<VnLv
|
||||||
|
:label="t('globals.country')"
|
||||||
|
:value="entity.supplier?.country?.code"
|
||||||
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
|
@ -239,21 +243,22 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<VnLv
|
<VnLv
|
||||||
:ellipsis-value="false"
|
:ellipsis-value="false"
|
||||||
:label="t('invoiceIn.summary.issued')"
|
:label="t('InvoiceIn.summary.issued')"
|
||||||
:value="toDate(entity.issued)"
|
:value="toDate(entity.issued)"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.summary.operated')"
|
:label="t('InvoiceIn.summary.operated')"
|
||||||
:value="toDate(entity.operated)"
|
:value="toDate(entity.operated)"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.summary.bookEntried')"
|
:label="t('InvoiceIn.summary.bookEntried')"
|
||||||
:value="toDate(entity.bookEntried)"
|
:value="toDate(entity.bookEntried)"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.summary.bookedDate')"
|
:label="t('InvoiceIn.summary.bookedDate')"
|
||||||
:value="toDate(entity.booked)"
|
:value="toDate(entity.booked)"
|
||||||
/>
|
/>
|
||||||
|
<VnLv :label="t('globals.isVies')" :value="entity.supplier?.isVies" />
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
|
@ -263,18 +268,18 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
/>
|
/>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.summary.sage')"
|
:label="t('InvoiceIn.summary.sage')"
|
||||||
:value="entity.sageWithholding?.withholding"
|
:value="entity.sageWithholding?.withholding"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.summary.vat')"
|
:label="t('InvoiceIn.summary.vat')"
|
||||||
:value="entity.expenseDeductible?.name"
|
:value="entity.expenseDeductible?.name"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.card.company')"
|
:label="t('InvoiceIn.card.company')"
|
||||||
:value="entity.company?.code"
|
:value="entity.company?.code"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('invoiceIn.isBooked')" :value="invoiceIn?.isBooked" />
|
<VnLv :label="t('InvoiceIn.isBooked')" :value="invoiceIn?.isBooked" />
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
|
@ -285,11 +290,11 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.summary.taxableBase')"
|
:label="t('InvoiceIn.summary.taxableBase')"
|
||||||
:value="toCurrency(entity.totals.totalTaxableBase)"
|
:value="toCurrency(entity.totals.totalTaxableBase)"
|
||||||
/>
|
/>
|
||||||
<VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" />
|
<VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" />
|
||||||
<VnLv :label="t('invoiceIn.summary.dueTotal')">
|
<VnLv :label="t('InvoiceIn.summary.dueTotal')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<QChip
|
<QChip
|
||||||
dense
|
dense
|
||||||
|
@ -297,8 +302,8 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
:color="amountsNotMatch ? 'negative' : 'transparent'"
|
:color="amountsNotMatch ? 'negative' : 'transparent'"
|
||||||
:title="
|
:title="
|
||||||
amountsNotMatch
|
amountsNotMatch
|
||||||
? t('invoiceIn.summary.noMatch')
|
? t('InvoiceIn.summary.noMatch')
|
||||||
: t('invoiceIn.summary.dueTotal')
|
: t('InvoiceIn.summary.dueTotal')
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ toCurrency(entity.totals.totalDueDay) }}
|
{{ toCurrency(entity.totals.totalDueDay) }}
|
||||||
|
@ -309,7 +314,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</QCard>
|
</QCard>
|
||||||
<!--Vat-->
|
<!--Vat-->
|
||||||
<QCard v-if="entity.invoiceInTax.length" class="vat">
|
<QCard v-if="entity.invoiceInTax.length" class="vat">
|
||||||
<VnTitle :url="getLink('vat')" :text="t('invoiceIn.card.vat')" />
|
<VnTitle :url="getLink('vat')" :text="t('InvoiceIn.card.vat')" />
|
||||||
<QTable
|
<QTable
|
||||||
:columns="vatColumns"
|
:columns="vatColumns"
|
||||||
:rows="entity.invoiceInTax"
|
:rows="entity.invoiceInTax"
|
||||||
|
@ -357,7 +362,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</QCard>
|
</QCard>
|
||||||
<!--Due Day-->
|
<!--Due Day-->
|
||||||
<QCard v-if="entity.invoiceInDueDay.length" class="due-day">
|
<QCard v-if="entity.invoiceInDueDay.length" class="due-day">
|
||||||
<VnTitle :url="getLink('due-day')" :text="t('invoiceIn.card.dueDay')" />
|
<VnTitle :url="getLink('due-day')" :text="t('InvoiceIn.card.dueDay')" />
|
||||||
<QTable :columns="dueDayColumns" :rows="entity.invoiceInDueDay" flat>
|
<QTable :columns="dueDayColumns" :rows="entity.invoiceInDueDay" flat>
|
||||||
<template #header="dueDayProps">
|
<template #header="dueDayProps">
|
||||||
<QTr :props="dueDayProps" class="bg">
|
<QTr :props="dueDayProps" class="bg">
|
||||||
|
@ -395,7 +400,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
<QCard v-if="entity.invoiceInIntrastat.length">
|
<QCard v-if="entity.invoiceInIntrastat.length">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="getLink('intrastat')"
|
:url="getLink('intrastat')"
|
||||||
:text="t('invoiceIn.card.intrastat')"
|
:text="t('InvoiceIn.card.intrastat')"
|
||||||
/>
|
/>
|
||||||
<QTable
|
<QTable
|
||||||
:columns="intrastatColumns"
|
:columns="intrastatColumns"
|
||||||
|
|
|
@ -11,12 +11,14 @@ import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||||
import CreateNewExpenseForm from 'src/components/CreateNewExpenseForm.vue';
|
import CreateNewExpenseForm from 'src/components/CreateNewExpenseForm.vue';
|
||||||
|
import { getExchange } from 'src/composables/getExchange';
|
||||||
|
import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const arrayData = useArrayData();
|
const arrayData = useArrayData();
|
||||||
|
const route = useRoute();
|
||||||
const invoiceIn = computed(() => arrayData.store.data);
|
const invoiceIn = computed(() => arrayData.store.data);
|
||||||
const invoiceId = +useRoute().params.id;
|
|
||||||
const currency = computed(() => invoiceIn.value?.currency?.code);
|
const currency = computed(() => invoiceIn.value?.currency?.code);
|
||||||
const expenses = ref([]);
|
const expenses = ref([]);
|
||||||
const sageTaxTypes = ref([]);
|
const sageTaxTypes = ref([]);
|
||||||
|
@ -39,9 +41,8 @@ const columns = computed(() => [
|
||||||
options: expenses.value,
|
options: expenses.value,
|
||||||
model: 'expenseFk',
|
model: 'expenseFk',
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: 'id',
|
optionLabel: (row) => `${row.id}: ${row.name}`,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
tabIndex: 1,
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -50,7 +51,6 @@ const columns = computed(() => [
|
||||||
field: (row) => row.taxableBase,
|
field: (row) => row.taxableBase,
|
||||||
model: 'taxableBase',
|
model: 'taxableBase',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
tabIndex: 2,
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -60,9 +60,8 @@ const columns = computed(() => [
|
||||||
options: sageTaxTypes.value,
|
options: sageTaxTypes.value,
|
||||||
model: 'taxTypeSageFk',
|
model: 'taxTypeSageFk',
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: 'id',
|
optionLabel: (row) => `${row.id}: ${row.vat}`,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
tabindex: 3,
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -72,16 +71,14 @@ const columns = computed(() => [
|
||||||
options: sageTransactionTypes.value,
|
options: sageTransactionTypes.value,
|
||||||
model: 'transactionTypeSageFk',
|
model: 'transactionTypeSageFk',
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: 'id',
|
optionLabel: (row) => `${row.id}: ${row.transaction}`,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
tabIndex: 4,
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'rate',
|
name: 'rate',
|
||||||
label: t('Rate'),
|
label: t('Rate'),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
tabIndex: 5,
|
|
||||||
field: (row) => taxRate(row, row.taxTypeSageFk),
|
field: (row) => taxRate(row, row.taxTypeSageFk),
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
|
@ -89,7 +86,6 @@ const columns = computed(() => [
|
||||||
name: 'foreignvalue',
|
name: 'foreignvalue',
|
||||||
label: t('Foreign value'),
|
label: t('Foreign value'),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
tabIndex: 6,
|
|
||||||
field: (row) => row.foreignValue,
|
field: (row) => row.foreignValue,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
|
@ -106,7 +102,7 @@ const filter = {
|
||||||
'transactionTypeSageFk',
|
'transactionTypeSageFk',
|
||||||
],
|
],
|
||||||
where: {
|
where: {
|
||||||
invoiceInFk: invoiceId,
|
invoiceInFk: route.params.id,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,14 +116,20 @@ function taxRate(invoiceInTax) {
|
||||||
const taxTypeSage = taxRateSelection?.rate ?? 0;
|
const taxTypeSage = taxRateSelection?.rate ?? 0;
|
||||||
const taxableBase = invoiceInTax?.taxableBase ?? 0;
|
const taxableBase = invoiceInTax?.taxableBase ?? 0;
|
||||||
|
|
||||||
return (taxTypeSage / 100) * taxableBase;
|
return ((taxTypeSage / 100) * taxableBase).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatOpt = (row, { model, options }, prop) => {
|
function autocompleteExpense(evt, row, col) {
|
||||||
const obj = row[model];
|
const val = evt.target.value;
|
||||||
const option = options.find(({ id }) => id == obj);
|
if (!val) return;
|
||||||
return option ? `${obj}:${option[prop]}` : '';
|
|
||||||
};
|
const param = isNaN(val) ? row[col.model] : val;
|
||||||
|
const lookup = expenses.value.find(
|
||||||
|
({ id }) => id == useAccountShortToStandard(param)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (lookup) row[col.model] = lookup;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -148,10 +150,10 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
data-key="InvoiceInTaxes"
|
data-key="InvoiceInTaxes"
|
||||||
url="InvoiceInTaxes"
|
url="InvoiceInTaxes"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
:data-required="{ invoiceInFk: invoiceId }"
|
:data-required="{ invoiceInFk: $route.params.id }"
|
||||||
auto-load
|
auto-load
|
||||||
v-model:selected="rowsSelected"
|
v-model:selected="rowsSelected"
|
||||||
:go-to="`/invoice-in/${invoiceId}/due-day`"
|
:go-to="`/invoice-in/${$route.params.id}/due-day`"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QTable
|
<QTable
|
||||||
|
@ -171,6 +173,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'name']"
|
:filter-options="['id', 'name']"
|
||||||
:tooltip="t('Create a new expense')"
|
:tooltip="t('Create a new expense')"
|
||||||
|
@keydown.tab="autocompleteExpense($event, row, col)"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -187,13 +190,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-taxablebase="{ row }">
|
<template #body-cell-taxablebase="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
{{ currency }}
|
|
||||||
<VnInputNumber
|
<VnInputNumber
|
||||||
:class="{
|
|
||||||
'no-pointer-events': isNotEuro(currency),
|
|
||||||
}"
|
|
||||||
:disable="isNotEuro(currency)"
|
|
||||||
label=""
|
|
||||||
clear-icon="close"
|
clear-icon="close"
|
||||||
v-model="row.taxableBase"
|
v-model="row.taxableBase"
|
||||||
clearable
|
clearable
|
||||||
|
@ -208,9 +205,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'vat']"
|
:filter-options="['id', 'vat']"
|
||||||
:hide-selected="false"
|
data-cy="vat-sageiva"
|
||||||
:fill-input="false"
|
|
||||||
:display-value="formatOpt(row, col, 'vat')"
|
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -233,11 +228,6 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'transaction']"
|
:filter-options="['id', 'transaction']"
|
||||||
:autofocus="col.tabIndex == 1"
|
|
||||||
input-debounce="0"
|
|
||||||
:hide-selected="false"
|
|
||||||
:fill-input="false"
|
|
||||||
:display-value="formatOpt(row, col, 'transaction')"
|
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -262,6 +252,16 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
}"
|
}"
|
||||||
:disable="!isNotEuro(currency)"
|
:disable="!isNotEuro(currency)"
|
||||||
v-model="row.foreignValue"
|
v-model="row.foreignValue"
|
||||||
|
@update:model-value="
|
||||||
|
async (val) => {
|
||||||
|
if (!isNotEuro(currency)) return;
|
||||||
|
row.taxableBase = await getExchange(
|
||||||
|
val,
|
||||||
|
row.currencyFk,
|
||||||
|
invoiceIn.issued
|
||||||
|
);
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -305,7 +305,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
v-model="props.row['expenseFk']"
|
v-model="props.row['expenseFk']"
|
||||||
:options="expenses"
|
:options="expenses"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
:option-label="(row) => `${row.id}:${row.name}`"
|
||||||
:filter-options="['id', 'name']"
|
:filter-options="['id', 'name']"
|
||||||
:tooltip="t('Create a new expense')"
|
:tooltip="t('Create a new expense')"
|
||||||
>
|
>
|
||||||
|
@ -339,7 +339,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
v-model="props.row['taxTypeSageFk']"
|
v-model="props.row['taxTypeSageFk']"
|
||||||
:options="sageTaxTypes"
|
:options="sageTaxTypes"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="vat"
|
:option-label="(row) => `${row.id}:${row.vat}`"
|
||||||
:filter-options="['id', 'vat']"
|
:filter-options="['id', 'vat']"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
|
@ -362,7 +362,9 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
v-model="props.row['transactionTypeSageFk']"
|
v-model="props.row['transactionTypeSageFk']"
|
||||||
:options="sageTransactionTypes"
|
:options="sageTransactionTypes"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="transaction"
|
:option-label="
|
||||||
|
(row) => `${row.id}:${row.transaction}`
|
||||||
|
"
|
||||||
:filter-options="['id', 'transaction']"
|
:filter-options="['id', 'transaction']"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
|
@ -418,11 +420,6 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
.bg {
|
.bg {
|
||||||
background-color: var(--vn-light-gray);
|
background-color: var(--vn-light-gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.q-table tr td:nth-child(n + 4):nth-child(-n + 5) input) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: $breakpoint-xs) {
|
@media (max-width: $breakpoint-xs) {
|
||||||
.q-dialog {
|
.q-dialog {
|
||||||
.q-card {
|
.q-card {
|
||||||
|
|
|
@ -83,7 +83,7 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('invoiceIn.list.supplierRef')"
|
:label="t('InvoiceIn.list.supplierRef')"
|
||||||
v-model="data.supplierRef"
|
v-model="data.supplierRef"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
@ -97,10 +97,10 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
|
||||||
map-options
|
map-options
|
||||||
hide-selected
|
hide-selected
|
||||||
:required="true"
|
:required="true"
|
||||||
:rules="validate('invoiceIn.companyFk')"
|
:rules="validate('InvoiceIn.companyFk')"
|
||||||
/>
|
/>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('invoiceIn.summary.issued')"
|
:label="t('InvoiceIn.summary.issued')"
|
||||||
v-model="data.issued"
|
v-model="data.issued"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
|
@ -1,41 +1,66 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import { dateRange } from 'src/filters';
|
||||||
|
import { date } from 'quasar';
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
defineProps({ dataKey: { type: String, required: true } });
|
defineProps({ dataKey: { type: String, required: true } });
|
||||||
const activities = ref([]);
|
const dateFormat = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
|
||||||
|
|
||||||
|
function handleDaysAgo(params, daysAgo) {
|
||||||
|
const [from, to] = dateRange(Date.vnNew());
|
||||||
|
if (!daysAgo && daysAgo !== 0) {
|
||||||
|
Object.assign(params, { from: undefined, to: undefined });
|
||||||
|
} else {
|
||||||
|
from.setDate(from.getDate() - daysAgo);
|
||||||
|
Object.assign(params, {
|
||||||
|
from: date.formatDate(from, dateFormat),
|
||||||
|
to: date.formatDate(to, dateFormat),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<VnFilterPanel :data-key="dataKey" :search-button="true" :hidden-tags="['daysAgo']">
|
||||||
url="SupplierActivities"
|
<template #tags="{ tag, formatFn, getLocale }">
|
||||||
auto-load
|
|
||||||
@on-fetch="(data) => (activities = data)"
|
|
||||||
/>
|
|
||||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
|
||||||
<template #tags="{ tag, formatFn }">
|
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ getLocale(tag.label) }}: </strong>
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ params, searchFn }">
|
<template #body="{ params, searchFn, getLocale }">
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate :label="t('From')" v-model="params.from" is-outlined />
|
<VnInputDate
|
||||||
|
:label="$t('globals.from')"
|
||||||
|
v-model="params.from"
|
||||||
|
is-outlined
|
||||||
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
|
<VnInputDate
|
||||||
|
:label="$t('globals.to')"
|
||||||
|
v-model="params.to"
|
||||||
|
is-outlined
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInputNumber
|
||||||
|
:label="$t('globals.daysAgo')"
|
||||||
|
v-model="params.daysAgo"
|
||||||
|
is-outlined
|
||||||
|
:step="0"
|
||||||
|
@update:model-value="(val) => handleDaysAgo(params, val)"
|
||||||
|
@remove="(val) => handleDaysAgo(params, val)"
|
||||||
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
|
@ -44,20 +69,18 @@ const activities = ref([]);
|
||||||
v-model="params.supplierFk"
|
v-model="params.supplierFk"
|
||||||
url="Suppliers"
|
url="Suppliers"
|
||||||
:fields="['id', 'nickname']"
|
:fields="['id', 'nickname']"
|
||||||
:label="t('params.supplierFk')"
|
:label="getLocale('supplierFk')"
|
||||||
option-value="id"
|
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
:filter-options="['id', 'name']"
|
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('params.supplierRef')"
|
:label="getLocale('supplierRef')"
|
||||||
v-model="params.supplierRef"
|
v-model="params.supplierRef"
|
||||||
is-outlined
|
is-outlined
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
@ -67,7 +90,7 @@ const activities = ref([]);
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('params.fi')"
|
:label="getLocale('fi')"
|
||||||
v-model="params.fi"
|
v-model="params.fi"
|
||||||
is-outlined
|
is-outlined
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
@ -77,7 +100,7 @@ const activities = ref([]);
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('params.serial')"
|
:label="getLocale('serial')"
|
||||||
v-model="params.serial"
|
v-model="params.serial"
|
||||||
is-outlined
|
is-outlined
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
@ -87,7 +110,7 @@ const activities = ref([]);
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('params.account')"
|
:label="getLocale('account')"
|
||||||
v-model="params.account"
|
v-model="params.account"
|
||||||
is-outlined
|
is-outlined
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
@ -97,7 +120,7 @@ const activities = ref([]);
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('params.awb')"
|
:label="getLocale('globals.params.awbCode')"
|
||||||
v-model="params.awbCode"
|
v-model="params.awbCode"
|
||||||
is-outlined
|
is-outlined
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
@ -107,24 +130,34 @@ const activities = ref([]);
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputNumber
|
<VnInputNumber
|
||||||
:label="t('Amount')"
|
:label="$t('globals.amount')"
|
||||||
v-model="params.amount"
|
v-model="params.amount"
|
||||||
is-outlined
|
is-outlined
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnSelect
|
||||||
|
v-model="params.companyFk"
|
||||||
|
:label="$t('globals.company')"
|
||||||
|
url="Companies"
|
||||||
|
option-label="code"
|
||||||
|
:fields="['id', 'code']"
|
||||||
|
is-outlined
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('invoiceIn.isBooked')"
|
:label="$t('InvoiceIn.isBooked')"
|
||||||
v-model="params.isBooked"
|
v-model="params.isBooked"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
|
||||||
<QItemSection>
|
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('params.correctingFk')"
|
:label="getLocale('params.correctingFk')"
|
||||||
v-model="params.correctingFk"
|
v-model="params.correctingFk"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
|
@ -134,54 +167,3 @@ const activities = ref([]);
|
||||||
</template>
|
</template>
|
||||||
</VnFilterPanel>
|
</VnFilterPanel>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
|
||||||
en:
|
|
||||||
params:
|
|
||||||
search: Id or supplier name
|
|
||||||
supplierRef: Supplier ref.
|
|
||||||
supplierFk: Supplier
|
|
||||||
fi: Supplier fiscal id
|
|
||||||
clientFk: Customer
|
|
||||||
amount: Amount
|
|
||||||
created: Created
|
|
||||||
awb: AWB
|
|
||||||
dued: Dued
|
|
||||||
serialNumber: Serial Number
|
|
||||||
serial: Serial
|
|
||||||
account: Ledger account
|
|
||||||
isBooked: is booked
|
|
||||||
correctedFk: Rectified
|
|
||||||
issued: Issued
|
|
||||||
to: To
|
|
||||||
from: From
|
|
||||||
awbCode: AWB
|
|
||||||
correctingFk: Rectificative
|
|
||||||
supplierActivityFk: Supplier activity
|
|
||||||
es:
|
|
||||||
params:
|
|
||||||
search: Id o nombre proveedor
|
|
||||||
supplierRef: Ref. proveedor
|
|
||||||
supplierFk: Proveedor
|
|
||||||
clientFk: Cliente
|
|
||||||
fi: CIF proveedor
|
|
||||||
serialNumber: Num. serie
|
|
||||||
serial: Serie
|
|
||||||
awb: AWB
|
|
||||||
amount: Importe
|
|
||||||
issued: Emitida
|
|
||||||
isBooked: Contabilizada
|
|
||||||
account: Cuenta contable
|
|
||||||
created: Creada
|
|
||||||
dued: Vencida
|
|
||||||
correctedFk: Rectificada
|
|
||||||
correctingFk: Rectificativa
|
|
||||||
supplierActivityFk: Actividad proveedor
|
|
||||||
from: Desde
|
|
||||||
to: Hasta
|
|
||||||
From: Desde
|
|
||||||
To: Hasta
|
|
||||||
Amount: Importe
|
|
||||||
Issued: Fecha factura
|
|
||||||
Id or supplier: Id o proveedor
|
|
||||||
</i18n>
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import { useState } from 'src/composables/useState';
|
||||||
import { downloadFile } from 'src/composables/downloadFile';
|
import { downloadFile } from 'src/composables/downloadFile';
|
||||||
import { toDate, toCurrency } from 'src/filters/index';
|
import { toDate, toCurrency } from 'src/filters/index';
|
||||||
import InvoiceInFilter from './InvoiceInFilter.vue';
|
import InvoiceInFilter from './InvoiceInFilter.vue';
|
||||||
|
@ -14,8 +15,10 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
const user = useState().getUser();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -23,7 +26,14 @@ onMounted(async () => (stateStore.rightDrawer = true));
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
const companies = ref([]);
|
||||||
const cols = computed(() => [
|
const cols = computed(() => [
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'isBooked',
|
||||||
|
label: t('InvoiceIn.isBooked'),
|
||||||
|
columnFilter: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'id',
|
name: 'id',
|
||||||
|
@ -32,7 +42,7 @@ const cols = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'supplierFk',
|
name: 'supplierFk',
|
||||||
label: t('invoiceIn.list.supplier'),
|
label: t('InvoiceIn.list.supplier'),
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -45,16 +55,16 @@ const cols = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'supplierRef',
|
name: 'supplierRef',
|
||||||
label: t('invoiceIn.list.supplierRef'),
|
label: t('InvoiceIn.list.supplierRef'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'serial',
|
name: 'serial',
|
||||||
label: t('invoiceIn.serial'),
|
label: t('InvoiceIn.serial'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('invoiceIn.list.issued'),
|
label: t('InvoiceIn.list.issued'),
|
||||||
name: 'issued',
|
name: 'issued',
|
||||||
component: null,
|
component: null,
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
|
@ -64,21 +74,38 @@ const cols = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'isBooked',
|
label: t('InvoiceIn.list.dueDated'),
|
||||||
label: t('invoiceIn.isBooked'),
|
name: 'dueDated',
|
||||||
columnFilter: false,
|
component: null,
|
||||||
|
columnFilter: {
|
||||||
|
component: 'date',
|
||||||
|
},
|
||||||
|
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.dueDated)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'awbCode',
|
name: 'awbCode',
|
||||||
label: t('invoiceIn.list.awb'),
|
label: t('InvoiceIn.list.awb'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
label: t('invoiceIn.list.amount'),
|
label: t('InvoiceIn.list.amount'),
|
||||||
format: ({ amount }) => toCurrency(amount),
|
format: ({ amount }) => toCurrency(amount),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'companyFk',
|
||||||
|
label: t('globals.company'),
|
||||||
|
columnFilter: {
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'Companies',
|
||||||
|
fields: ['id', 'code'],
|
||||||
|
optionLabel: 'code',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
format: (row) => row.code,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
name: 'tableActions',
|
name: 'tableActions',
|
||||||
|
@ -87,6 +114,7 @@ const cols = computed(() => [
|
||||||
title: t('components.smartCard.openSummary'),
|
title: t('components.smartCard.openSummary'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
type: 'submit',
|
type: 'submit',
|
||||||
|
isPrimary: true,
|
||||||
action: (row) => viewSummary(row.id, InvoiceInSummary),
|
action: (row) => viewSummary(row.id, InvoiceInSummary),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -101,6 +129,7 @@ const cols = computed(() => [
|
||||||
]);
|
]);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData url="Companies" @on-fetch="(data) => (companies = data)" auto-load />
|
||||||
<InvoiceInSearchbar />
|
<InvoiceInSearchbar />
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
|
@ -116,7 +145,7 @@ const cols = computed(() => [
|
||||||
urlCreate: 'InvoiceIns',
|
urlCreate: 'InvoiceIns',
|
||||||
title: t('globals.createInvoiceIn'),
|
title: t('globals.createInvoiceIn'),
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: {},
|
formInitialData: { companyFk: user.companyFk, issued: Date.vnNew() },
|
||||||
}"
|
}"
|
||||||
redirect="invoice-in"
|
redirect="invoice-in"
|
||||||
:columns="cols"
|
:columns="cols"
|
||||||
|
@ -151,7 +180,7 @@ const cols = computed(() => [
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('invoiceIn.list.supplierRef')"
|
:label="t('InvoiceIn.list.supplierRef')"
|
||||||
v-model="data.supplierRef"
|
v-model="data.supplierRef"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
@ -163,7 +192,7 @@ const cols = computed(() => [
|
||||||
option-label="code"
|
option-label="code"
|
||||||
:required="true"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
<VnInputDate :label="t('invoiceIn.summary.issued')" v-model="data.issued" />
|
<VnInputDate :label="t('InvoiceIn.summary.issued')" v-model="data.issued" />
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -58,6 +58,14 @@ onBeforeMount(async () => {
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:user-params="{ daysAgo }"
|
:user-params="{ daysAgo }"
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
|
:row-click="
|
||||||
|
(row) => {
|
||||||
|
$router.push({
|
||||||
|
name: 'InvoiceInList',
|
||||||
|
query: { table: JSON.stringify({ serial: row.serial }) },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -8,7 +8,11 @@ defineProps({ dataKey: { type: String, required: true } });
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
<VnFilterPanel
|
||||||
|
:data-key="dataKey"
|
||||||
|
:search-button="true"
|
||||||
|
:unremovable-params="['daysAgo']"
|
||||||
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
invoiceIn:
|
InvoiceIn:
|
||||||
serial: Serial
|
serial: Serial
|
||||||
isBooked: Is booked
|
isBooked: Is booked
|
||||||
list:
|
list:
|
||||||
|
@ -7,8 +7,11 @@ invoiceIn:
|
||||||
supplierRef: Supplier ref.
|
supplierRef: Supplier ref.
|
||||||
file: File
|
file: File
|
||||||
issued: Issued
|
issued: Issued
|
||||||
|
dueDated: Due dated
|
||||||
awb: AWB
|
awb: AWB
|
||||||
amount: Amount
|
amount: Amount
|
||||||
|
descriptor:
|
||||||
|
ticketList: Ticket list
|
||||||
card:
|
card:
|
||||||
client: Client
|
client: Client
|
||||||
company: Company
|
company: Company
|
||||||
|
@ -39,3 +42,9 @@ invoiceIn:
|
||||||
net: Net
|
net: Net
|
||||||
stems: Stems
|
stems: Stems
|
||||||
country: Country
|
country: Country
|
||||||
|
params:
|
||||||
|
search: Id or supplier name
|
||||||
|
account: Ledger account
|
||||||
|
correctingFk: Rectificative
|
||||||
|
correctedFk: Corrected
|
||||||
|
isBooked: Is booked
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
invoiceIn:
|
InvoiceIn:
|
||||||
serial: Serie
|
serial: Serie
|
||||||
isBooked: Contabilizada
|
isBooked: Contabilizada
|
||||||
list:
|
list:
|
||||||
ref: Referencia
|
ref: Referencia
|
||||||
supplier: Proveedor
|
supplier: Proveedor
|
||||||
supplierRef: Ref. proveedor
|
supplierRef: Ref. proveedor
|
||||||
shortIssued: F. emisión
|
issued: F. emisión
|
||||||
|
dueDated: F. vencimiento
|
||||||
file: Fichero
|
file: Fichero
|
||||||
issued: Fecha emisión
|
|
||||||
awb: AWB
|
awb: AWB
|
||||||
amount: Importe
|
amount: Importe
|
||||||
|
descriptor:
|
||||||
|
ticketList: Listado de tickets
|
||||||
card:
|
card:
|
||||||
client: Cliente
|
client: Cliente
|
||||||
company: Empresa
|
company: Empresa
|
||||||
|
@ -38,3 +40,8 @@ invoiceIn:
|
||||||
net: Neto
|
net: Neto
|
||||||
stems: Tallos
|
stems: Tallos
|
||||||
country: País
|
country: País
|
||||||
|
params:
|
||||||
|
search: Id o nombre proveedor
|
||||||
|
account: Cuenta contable
|
||||||
|
correctingFk: Rectificativa
|
||||||
|
correctedFk: Rectificada
|
||||||
|
|
|
@ -115,6 +115,9 @@ onMounted(async () => {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('invoiceOutSerialType')"
|
:label="t('invoiceOutSerialType')"
|
||||||
v-model="formData.serialType"
|
v-model="formData.serialType"
|
||||||
|
@update:model-value="
|
||||||
|
invoiceOutGlobalStore.fetchInvoiceOutConfig(formData)
|
||||||
|
"
|
||||||
:options="serialTypesOptions"
|
:options="serialTypesOptions"
|
||||||
option-value="type"
|
option-value="type"
|
||||||
option-label="type"
|
option-label="type"
|
||||||
|
|
|
@ -351,7 +351,7 @@ watchEffect(selectedRows);
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="InvoiceOutSerials"
|
url="InvoiceOutSerials"
|
||||||
v-model="data.serial"
|
v-model="data.serial"
|
||||||
:label="t('invoiceIn.serial')"
|
:label="t('InvoiceIn.serial')"
|
||||||
:options="invoiceOutSerialsOptions"
|
:options="invoiceOutSerialsOptions"
|
||||||
option-label="description"
|
option-label="description"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
|
|
|
@ -2,12 +2,15 @@
|
||||||
import { ref, nextTick } from 'vue';
|
import { ref, nextTick } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const itemBarcodeRef = ref(null);
|
const itemBarcodeRef = ref(null);
|
||||||
|
|
||||||
|
@ -23,6 +26,24 @@ const focusLastInput = () => {
|
||||||
if (lastInput) lastInput.focus();
|
if (lastInput) lastInput.focus();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const removeRow = (row) => {
|
||||||
|
itemBarcodeRef.value.remove([row]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const submit = async (rows) => {
|
||||||
|
const params = rows[rows.length - 1];
|
||||||
|
let { data } = await axios.get('ItemBarcodes');
|
||||||
|
const code = params.code;
|
||||||
|
|
||||||
|
if (data.some((codes) => codes.code === code)) {
|
||||||
|
notify(t('Codes can not be repeated'), 'negative');
|
||||||
|
itemBarcodeRef.value.reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await axios.patch(`ItemBarcodes`, params);
|
||||||
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="full-width flex justify-center">
|
<div class="full-width flex justify-center">
|
||||||
|
@ -39,6 +60,7 @@ const focusLastInput = () => {
|
||||||
ref="itemBarcodeRef"
|
ref="itemBarcodeRef"
|
||||||
url="ItemBarcodes"
|
url="ItemBarcodes"
|
||||||
auto-load
|
auto-load
|
||||||
|
:save-fn="submit"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QCard class="q-px-lg q-py-md">
|
<QCard class="q-px-lg q-py-md">
|
||||||
|
@ -54,7 +76,7 @@ const focusLastInput = () => {
|
||||||
focusable-input
|
focusable-input
|
||||||
/>
|
/>
|
||||||
<QIcon
|
<QIcon
|
||||||
@click="itemBarcodeRef.remove([row])"
|
@click="removeRow(row)"
|
||||||
class="cursor-pointer q-ml-md"
|
class="cursor-pointer q-ml-md"
|
||||||
color="primary"
|
color="primary"
|
||||||
name="delete"
|
name="delete"
|
||||||
|
@ -89,4 +111,5 @@ es:
|
||||||
Code: Código
|
Code: Código
|
||||||
Remove barcode: Quitar código de barras
|
Remove barcode: Quitar código de barras
|
||||||
Add barcode: Añadir código de barras
|
Add barcode: Añadir código de barras
|
||||||
|
Codes can not be repeated: Los códigos no puden ser repetidos
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -70,6 +70,7 @@ const onIntrastatCreated = (response, formData) => {
|
||||||
option-label="name"
|
option-label="name"
|
||||||
hide-selected
|
hide-selected
|
||||||
map-options
|
map-options
|
||||||
|
required
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: [Number, String],
|
||||||
required: false,
|
required: false,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
@ -29,7 +29,7 @@ const $props = defineProps({
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
saleFk: {
|
saleFk: {
|
||||||
type: Number,
|
type: [Number, String],
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
warehouseFk: {
|
warehouseFk: {
|
||||||
|
@ -61,7 +61,7 @@ onMounted(async () => {
|
||||||
const data = ref(useCardDescription());
|
const data = ref(useCardDescription());
|
||||||
const setData = async (entity) => {
|
const setData = async (entity) => {
|
||||||
if (!entity) return;
|
if (!entity) return;
|
||||||
data.value = useCardDescription(entity.name, entity.id);
|
data.value = useCardDescription(entity?.name, entity?.id);
|
||||||
await updateStock();
|
await updateStock();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ const $props = defineProps({
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
entityId: {
|
entityId: {
|
||||||
type: String,
|
type: [String, Number],
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
showEditButton: {
|
showEditButton: {
|
||||||
|
@ -67,7 +67,7 @@ const handlePhotoUpdated = (evt = false) => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="relative-position">
|
<div class="relative-position">
|
||||||
<VnImg ref="image" :id="$props.entityId" zoom-resolution="1600x900">
|
<VnImg ref="image" :id="parseInt($props.entityId)" zoom-resolution="1600x900">
|
||||||
<template #error>
|
<template #error>
|
||||||
<div class="absolute-full picture text-center q-pa-md flex flex-center">
|
<div class="absolute-full picture text-center q-pa-md flex flex-center">
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, computed, onUnmounted, ref, watch } from 'vue';
|
import { onMounted, computed, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { dateRange } from 'src/filters';
|
import { dateRange } from 'src/filters';
|
||||||
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
import VnDateBadge from 'src/components/common/VnDateBadge.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import { toDateTimeFormat } from 'src/filters/date.js';
|
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
import { toCurrency } from 'filters/index';
|
import { toCurrency } from 'filters/index';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const stateStore = useStateStore();
|
const from = ref();
|
||||||
|
const to = ref();
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -36,25 +36,23 @@ const exprBuilder = (param, value) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const from = ref();
|
const where = {
|
||||||
const to = ref();
|
itemFk: route.params.id,
|
||||||
|
};
|
||||||
|
|
||||||
const arrayData = useArrayData('ItemLastEntries', {
|
const arrayData = useArrayData('ItemLastEntries', {
|
||||||
url: 'Items/lastEntriesFilter',
|
url: 'Items/lastEntriesFilter',
|
||||||
order: ['landed DESC', 'buyFk DESC'],
|
order: ['landed DESC', 'buyFk DESC'],
|
||||||
exprBuilder: exprBuilder,
|
exprBuilder: exprBuilder,
|
||||||
userFilter: {
|
userFilter: {
|
||||||
where: {
|
where: where,
|
||||||
itemFk: route.params.id,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const itemLastEntries = ref([]);
|
const itemLastEntries = ref([]);
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
label: t('lastEntries.ig'),
|
label: 'Nv',
|
||||||
name: 'ig',
|
name: 'ig',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
|
@ -62,45 +60,52 @@ const columns = computed(() => [
|
||||||
label: t('itemDiary.warehouse'),
|
label: t('itemDiary.warehouse'),
|
||||||
name: 'warehouse',
|
name: 'warehouse',
|
||||||
field: 'warehouse',
|
field: 'warehouse',
|
||||||
align: 'left',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('lastEntries.landed'),
|
label: t('lastEntries.landed'),
|
||||||
name: 'id',
|
name: 'date',
|
||||||
field: 'landed',
|
field: 'landed',
|
||||||
align: 'left',
|
align: 'center',
|
||||||
format: (val) => toDateTimeFormat(val),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('lastEntries.entry'),
|
label: t('lastEntries.entry'),
|
||||||
name: 'entry',
|
name: 'entry',
|
||||||
field: 'stateName',
|
field: 'stateName',
|
||||||
align: 'left',
|
align: 'center',
|
||||||
format: (val) => dashIfEmpty(val),
|
format: (val) => dashIfEmpty(val),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('lastEntries.pvp'),
|
label: t('lastEntries.pvp'),
|
||||||
name: 'pvp',
|
name: 'pvp',
|
||||||
field: 'reference',
|
field: 'reference',
|
||||||
align: 'left',
|
align: 'center',
|
||||||
format: (_, row) => toCurrency(row.price2) + ' / ' + toCurrency(row.price3),
|
format: (_, row) => toCurrency(row.price2) + ' / ' + toCurrency(row.price3),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: t('lastEntries.printedStickers'),
|
||||||
|
name: 'printedStickers',
|
||||||
|
field: 'printedStickers',
|
||||||
|
align: 'center',
|
||||||
|
format: (val) => dashIfEmpty(val),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: t('lastEntries.label'),
|
label: t('lastEntries.label'),
|
||||||
name: 'label',
|
name: 'stickers',
|
||||||
field: 'stickers',
|
field: 'stickers',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
format: (val) => dashIfEmpty(val),
|
format: (val) => dashIfEmpty(val),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.packing'),
|
label: 'Packing',
|
||||||
name: 'packing',
|
name: 'packing',
|
||||||
|
field: 'packing',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('lastEntries.grouping'),
|
label: t('lastEntries.grouping'),
|
||||||
name: 'grouping',
|
name: 'grouping',
|
||||||
|
field: 'grouping',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -111,18 +116,19 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('lastEntries.quantity'),
|
label: t('lastEntries.quantity'),
|
||||||
name: 'stems',
|
name: 'quantity',
|
||||||
field: 'quantity',
|
field: 'quantity',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('lastEntries.cost'),
|
label: t('lastEntries.cost'),
|
||||||
name: 'cost',
|
name: 'cost',
|
||||||
align: 'left',
|
field: 'cost',
|
||||||
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('lastEntries.kg'),
|
label: 'Kg',
|
||||||
name: 'stems',
|
name: 'weight',
|
||||||
field: 'weight',
|
field: 'weight',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
|
@ -134,9 +140,9 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('lastEntries.supplier'),
|
label: t('lastEntries.supplier'),
|
||||||
name: 'stems',
|
name: 'supplier',
|
||||||
field: 'supplier',
|
field: 'supplier',
|
||||||
align: 'left',
|
align: 'center',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -160,7 +166,10 @@ const updateFilter = async () => {
|
||||||
else if (from.value && !to.value) filter = { gte: from.value };
|
else if (from.value && !to.value) filter = { gte: from.value };
|
||||||
else if (from.value && to.value) filter = { between: [from.value, to.value] };
|
else if (from.value && to.value) filter = { between: [from.value, to.value] };
|
||||||
|
|
||||||
arrayData.store.userFilter.where.landed = filter;
|
const userFilter = arrayData.store.userFilter.where;
|
||||||
|
|
||||||
|
userFilter.landed = filter;
|
||||||
|
|
||||||
await fetchItemLastEntries();
|
await fetchItemLastEntries();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,9 +190,10 @@ onMounted(async () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
function getBadgeClass(groupingMode, expectedGrouping) {
|
||||||
|
return groupingMode === expectedGrouping ? 'accent-badge' : 'simple-badge';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSubToolbar>
|
<VnSubToolbar>
|
||||||
<template #st-data>
|
<template #st-data>
|
||||||
|
@ -192,27 +202,43 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
dense
|
dense
|
||||||
v-model="from"
|
v-model="from"
|
||||||
class="q-mr-lg"
|
class="q-mr-lg"
|
||||||
|
data-cy="from"
|
||||||
|
/>
|
||||||
|
<VnInputDate
|
||||||
|
:label="t('lastEntries.to')"
|
||||||
|
v-model="to"
|
||||||
|
dense
|
||||||
|
class="q-mr-lg"
|
||||||
|
data-cy="to"
|
||||||
/>
|
/>
|
||||||
<VnInputDate :label="t('lastEntries.to')" dense v-model="to" />
|
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<QPage class="column items-center q-pa-xd">
|
<QPage class="column items-center q-pa-xd">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="itemLastEntries"
|
:rows="itemLastEntries"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
class="full-width q-mt-md"
|
class="table full-width q-mt-md"
|
||||||
:no-data-label="t('globals.noResults')"
|
:no-data-label="t('globals.noResults')"
|
||||||
>
|
>
|
||||||
<template #body-cell-ig="{ row }">
|
<template #body-cell-ig="{ row }">
|
||||||
<QTd @click.stop>
|
<QTd class="text-center">
|
||||||
<QCheckbox
|
<QIcon
|
||||||
v-model="row.isIgnored"
|
:name="row.isIgnored ? 'check_box' : 'check_box_outline_blank'"
|
||||||
:disable="true"
|
style="color: var(--vn-label-color)"
|
||||||
:false-value="0"
|
size="sm"
|
||||||
:true-value="1"
|
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
<template #body-cell-warehouse="{ row }">
|
||||||
|
<QTd>
|
||||||
|
<span>{{ row.warehouse }}</span>
|
||||||
|
</QTd>
|
||||||
|
</template>
|
||||||
|
<template #body-cell-date="{ row }">
|
||||||
|
<QTd class="text-center">
|
||||||
|
<VnDateBadge :date="row.landed" />
|
||||||
|
</QTd>
|
||||||
|
</template>
|
||||||
<template #body-cell-entry="{ row }">
|
<template #body-cell-entry="{ row }">
|
||||||
<QTd @click.stop>
|
<QTd @click.stop>
|
||||||
<div class="full-width flex justify-center">
|
<div class="full-width flex justify-center">
|
||||||
|
@ -221,32 +247,37 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
</div>
|
</div>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
<template #body-cell-pvp="{ value }">
|
||||||
|
<QTd @click.stop class="text-center">
|
||||||
|
<span> {{ value }}</span>
|
||||||
|
<QTooltip> {{ t('lastEntries.grouping') }}/Packing </QTooltip></QTd
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<template #body-cell-printedStickers="{ row }">
|
||||||
|
<QTd @click.stop class="text-center">
|
||||||
|
<span style="color: var(--vn-label-color)">
|
||||||
|
{{ row.printedStickers }}</span
|
||||||
|
>
|
||||||
|
</QTd>
|
||||||
|
</template>
|
||||||
<template #body-cell-packing="{ row }">
|
<template #body-cell-packing="{ row }">
|
||||||
<QTd @click.stop>
|
<QTd @click.stop>
|
||||||
<QBadge
|
<QBadge
|
||||||
class="center-content"
|
class="center-content"
|
||||||
|
:class="getBadgeClass(row.groupingMode, 'packing')"
|
||||||
rounded
|
rounded
|
||||||
:color="row.groupingMode == 'packing' ? 'grey-13' : 'black'"
|
|
||||||
>
|
>
|
||||||
{{ dashIfEmpty(row.packing) }}
|
{{ dashIfEmpty(row.packing) }}
|
||||||
<QTooltip>{{ t('lastEntries.packing') }}</QTooltip>
|
<QTooltip>Packing</QTooltip>
|
||||||
</QBadge>
|
</QBadge>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-pvp="{ value }">
|
|
||||||
<QTd @click.stop
|
|
||||||
><span> {{ value }}</span>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('lastEntries.grouping') }}/{{ t('lastEntries.packing') }}
|
|
||||||
</QTooltip></QTd
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
<template #body-cell-grouping="{ row }">
|
<template #body-cell-grouping="{ row }">
|
||||||
<QTd @click.stop>
|
<QTd @click.stop>
|
||||||
<QBadge
|
<QBadge
|
||||||
class="center-content"
|
class="center-content"
|
||||||
|
:class="getBadgeClass(row.groupingMode, 'grouping')"
|
||||||
rounded
|
rounded
|
||||||
:color="row.groupingMode == 'grouping' ? 'grey-13' : 'black'"
|
|
||||||
>
|
>
|
||||||
{{ dashIfEmpty(row.grouping) }}
|
{{ dashIfEmpty(row.grouping) }}
|
||||||
<QTooltip>{{ t('lastEntries.grouping') }}</QTooltip>
|
<QTooltip>{{ t('lastEntries.grouping') }}</QTooltip>
|
||||||
|
@ -254,7 +285,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-cost="{ row }">
|
<template #body-cell-cost="{ row }">
|
||||||
<QTd @click.stop>
|
<QTd @click.stop class="text-center">
|
||||||
<span>
|
<span>
|
||||||
{{ toCurrency(row.cost, 'EUR', 3) }}
|
{{ toCurrency(row.cost, 'EUR', 3) }}
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
|
@ -272,10 +303,28 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
</span>
|
</span>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
<template #body-cell-supplier="{ row }">
|
||||||
|
<QTd @click.stop>
|
||||||
|
<div class="full-width flex justify-left">
|
||||||
|
<QBadge
|
||||||
|
:class="
|
||||||
|
row.isInventorySupplier ? 'bg-vn-page' : 'transparent'
|
||||||
|
"
|
||||||
|
dense
|
||||||
|
>
|
||||||
|
<SupplierDescriptorProxy :id="row.supplierFk" />
|
||||||
|
<span class="link">{{ row.supplier }}</span>
|
||||||
|
</QBadge>
|
||||||
|
</div>
|
||||||
|
</QTd>
|
||||||
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Hide inventory supplier: Ocultar proveedor inventario
|
||||||
|
</i18n>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.q-badge--rounded {
|
.q-badge--rounded {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
@ -287,4 +336,19 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
padding: 0 11px;
|
padding: 0 11px;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
}
|
}
|
||||||
|
.th :first-child {
|
||||||
|
.td {
|
||||||
|
text-align: center;
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.accent-badge {
|
||||||
|
background-color: var(--vn-label-color);
|
||||||
|
color: var(--vn-text-color-contrast);
|
||||||
|
}
|
||||||
|
.simple-badge {
|
||||||
|
background-color: transparent;
|
||||||
|
color: var(--vn-text-color);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, computed, reactive } from 'vue';
|
import { onMounted, ref, computed, reactive, watchEffect } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
|
|
||||||
import { toDateFormat } from 'src/filters/date.js';
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
|
||||||
|
@ -21,8 +17,9 @@ const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
const tableRef = ref();
|
||||||
const rowsSelected = ref([]);
|
const selectedRows = ref([]);
|
||||||
|
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -36,6 +33,11 @@ const exprBuilder = (param, value) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const params = reactive({ itemFk: route.params.id });
|
const params = reactive({ itemFk: route.params.id });
|
||||||
|
const filter = reactive({
|
||||||
|
where: {
|
||||||
|
itemFk: route.params.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const arrayData = useArrayData('ItemShelvings', {
|
const arrayData = useArrayData('ItemShelvings', {
|
||||||
url: 'ItemShelvingPlacementSupplyStocks',
|
url: 'ItemShelvingPlacementSupplyStocks',
|
||||||
|
@ -44,123 +46,69 @@ const arrayData = useArrayData('ItemShelvings', {
|
||||||
});
|
});
|
||||||
const rows = computed(() => arrayData.store.data || []);
|
const rows = computed(() => arrayData.store.data || []);
|
||||||
|
|
||||||
const applyColumnFilter = async (col) => {
|
|
||||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
|
||||||
params[paramKey] = col.columnFilter.filterValue;
|
|
||||||
await arrayData.addFilter({ filter: null, params });
|
|
||||||
};
|
|
||||||
|
|
||||||
const getInputEvents = (col) => {
|
|
||||||
return col.columnFilter.type === 'select'
|
|
||||||
? { 'update:modelValue': () => applyColumnFilter(col) }
|
|
||||||
: {
|
|
||||||
'keyup.enter': () => applyColumnFilter(col),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
label: t('shelvings.created'),
|
label: t('shelvings.created'),
|
||||||
name: 'created',
|
name: 'created',
|
||||||
field: 'created',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
columnFilter: false,
|
||||||
columnFilter: null,
|
format: (row) => toDateFormat(row.created),
|
||||||
format: (val) => toDateFormat(val),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: t('shelvings.item'),
|
label: t('shelvings.item'),
|
||||||
name: 'item',
|
name: 'itemFk',
|
||||||
field: 'itemFk',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
columnFilter: false,
|
||||||
columnFilter: null,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.concept'),
|
label: t('shelvings.concept'),
|
||||||
name: 'concept',
|
name: 'longName',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
columnFilter: false,
|
||||||
columnFilter: null,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.parking'),
|
label: t('shelvings.parking'),
|
||||||
name: 'parking',
|
name: 'parking',
|
||||||
field: 'parking',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
component: 'select',
|
||||||
format: (val) => dashIfEmpty(val),
|
attrs: {
|
||||||
columnFilter: {
|
url: 'parkings',
|
||||||
component: VnSelect,
|
fields: ['code'],
|
||||||
type: 'select',
|
'sort-by': 'code ASC',
|
||||||
filterValue: null,
|
'option-value': 'code',
|
||||||
event: getInputEvents,
|
'option-label': 'code',
|
||||||
attrs: {
|
dense: true,
|
||||||
url: 'parkings',
|
|
||||||
fields: ['code'],
|
|
||||||
'sort-by': 'code ASC',
|
|
||||||
'option-value': 'code',
|
|
||||||
'option-label': 'code',
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
columnField: { component: null },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.shelving'),
|
label: t('shelvings.shelving'),
|
||||||
name: 'shelving',
|
name: 'shelving',
|
||||||
field: 'shelving',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
component: 'select',
|
||||||
format: (val) => dashIfEmpty(val),
|
attrs: {
|
||||||
columnFilter: {
|
url: 'shelvings',
|
||||||
component: VnSelect,
|
fields: ['code'],
|
||||||
type: 'select',
|
'sort-by': 'code ASC',
|
||||||
filterValue: null,
|
'option-value': 'code',
|
||||||
event: getInputEvents,
|
'option-label': 'code',
|
||||||
attrs: {
|
dense: true,
|
||||||
url: 'shelvings',
|
|
||||||
fields: ['code'],
|
|
||||||
'sort-by': 'code ASC',
|
|
||||||
'option-value': 'code',
|
|
||||||
'option-label': 'code',
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
columnField: { component: null },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.label'),
|
label: t('shelvings.label'),
|
||||||
name: 'label',
|
name: 'label',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
columnFilter: { inWhere: true },
|
||||||
format: (_, row) => (row.stock / row.packing).toFixed(2),
|
format: (row) => (row.stock / row.packing).toFixed(2),
|
||||||
columnFilter: {
|
|
||||||
component: VnInput,
|
|
||||||
type: 'text',
|
|
||||||
filterParamKey: 'label',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.packing'),
|
label: t('shelvings.packing'),
|
||||||
field: 'packing',
|
|
||||||
name: 'packing',
|
name: 'packing',
|
||||||
|
attrs: { inWhere: true },
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
|
||||||
columnFilter: {
|
|
||||||
component: VnInput,
|
|
||||||
type: 'text',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
format: (val) => dashIfEmpty(val),
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -169,15 +117,16 @@ const totalLabels = computed(() =>
|
||||||
);
|
);
|
||||||
|
|
||||||
const removeLines = async () => {
|
const removeLines = async () => {
|
||||||
const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk);
|
const itemShelvingIds = selectedRows.value.map((row) => row.itemShelvingFk);
|
||||||
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
|
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
|
||||||
rowsSelected.value = [];
|
selectedRows.value = [];
|
||||||
notify('shelvings.shelvingsRemoved', 'positive');
|
notify('shelvings.shelvingsRemoved', 'positive');
|
||||||
await arrayData.fetch({ append: false });
|
await tableRef.value.reload();
|
||||||
};
|
};
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
});
|
});
|
||||||
|
watchEffect(selectedRows);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -203,7 +152,7 @@ onMounted(async () => {
|
||||||
<QBtn
|
<QBtn
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="delete"
|
icon="delete"
|
||||||
:disabled="!rowsSelected.length"
|
:disabled="!hasSelectedCards"
|
||||||
@click="
|
@click="
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('shelvings.removeConfirmTitle'),
|
t('shelvings.removeConfirmTitle'),
|
||||||
|
@ -219,41 +168,27 @@ onMounted(async () => {
|
||||||
</Teleport>
|
</Teleport>
|
||||||
</template>
|
</template>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QTable
|
<VnTable
|
||||||
:rows="rows"
|
ref="tableRef"
|
||||||
|
data-key="ItemShelving"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
row-key="id"
|
:url="`ItemShelvingPlacementSupplyStocks`"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:filter="filter"
|
||||||
class="full-width q-mt-md"
|
:expr-builder="exprBuilder"
|
||||||
selection="multiple"
|
:right-search="false"
|
||||||
v-model:selected="rowsSelected"
|
v-model:selected="selectedRows"
|
||||||
:no-data-label="t('globals.noResults')"
|
:table="{
|
||||||
|
'row-key': 'itemShelvingFk',
|
||||||
|
selection: 'multiple',
|
||||||
|
}"
|
||||||
|
auto-load
|
||||||
>
|
>
|
||||||
<template #top-row="{ cols }">
|
<template #column-longName="{ row }">
|
||||||
<QTr>
|
<span class="link" @click.stop>
|
||||||
<QTd />
|
{{ row.longName }}
|
||||||
<QTd
|
|
||||||
v-for="(col, index) in cols"
|
|
||||||
:key="index"
|
|
||||||
style="max-width: 100px"
|
|
||||||
>
|
|
||||||
<component
|
|
||||||
:is="col.columnFilter.component"
|
|
||||||
v-if="col.columnFilter"
|
|
||||||
v-model="col.columnFilter.filterValue"
|
|
||||||
v-bind="col.columnFilter.attrs"
|
|
||||||
v-on="col.columnFilter.event(col)"
|
|
||||||
dense
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</QTr>
|
|
||||||
</template>
|
|
||||||
<template #body-cell-concept="{ row }">
|
|
||||||
<QTd @click.stop>
|
|
||||||
<span class="link">{{ row.longName }}</span>
|
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
</QTd>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</VnTable>
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -46,7 +46,7 @@ const getUrl = (id, param) => `#/Item/${id}/${param}`;
|
||||||
<template #body="{ entity: { item, tags, visible, available, botanical } }">
|
<template #body="{ entity: { item, tags, visible, available, botanical } }">
|
||||||
<QCard class="vn-one photo">
|
<QCard class="vn-one photo">
|
||||||
<ItemDescriptorImage
|
<ItemDescriptorImage
|
||||||
:entity-id="entityId"
|
:entity-id="Number(entityId)"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:available="available"
|
:available="available"
|
||||||
:show-edit-button="false"
|
:show-edit-button="false"
|
||||||
|
@ -89,7 +89,7 @@ const getUrl = (id, param) => `#/Item/${id}/${param}`;
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="getUrl(entityId, 'basic-data')"
|
:url="getUrl(entityId, 'basic-data')"
|
||||||
:text="t('item.summary.otherData')"
|
:text="t('item.summary.basicData')"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('item.summary.intrastatCode')"
|
:label="t('item.summary.intrastatCode')"
|
||||||
|
|
|
@ -8,7 +8,6 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -60,6 +59,10 @@ const insertTag = (rows) => {
|
||||||
itemTagsRef.value.formData[itemTagsRef.value.formData.length - 1].priority =
|
itemTagsRef.value.formData[itemTagsRef.value.formData.length - 1].priority =
|
||||||
getHighestPriority(rows);
|
getHighestPriority(rows);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const submitTags = async (data) => {
|
||||||
|
itemTagsRef.value.onSubmit(data);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -77,7 +80,6 @@ const insertTag = (rows) => {
|
||||||
data-key="ItemTags"
|
data-key="ItemTags"
|
||||||
model="ItemTags"
|
model="ItemTags"
|
||||||
url="ItemTags"
|
url="ItemTags"
|
||||||
update-url="Tags/onSubmit"
|
|
||||||
:data-required="{
|
:data-required="{
|
||||||
$index: undefined,
|
$index: undefined,
|
||||||
itemFk: route.params.id,
|
itemFk: route.params.id,
|
||||||
|
@ -126,7 +128,7 @@ const insertTag = (rows) => {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
v-if="row.tag?.isFree === false"
|
v-if="row.tag?.isFree === false"
|
||||||
:key="row.tagFk"
|
:key="row.tagFk"
|
||||||
:label="t('Value')"
|
:label="t('itemTags.value')"
|
||||||
v-model="row.value"
|
v-model="row.value"
|
||||||
:url="`Tags/${row.tagFk}/filterValue`"
|
:url="`Tags/${row.tagFk}/filterValue`"
|
||||||
option-label="value"
|
option-label="value"
|
||||||
|
@ -147,6 +149,7 @@ const insertTag = (rows) => {
|
||||||
v-model="row.value"
|
v-model="row.value"
|
||||||
:label="t('itemTags.value')"
|
:label="t('itemTags.value')"
|
||||||
:is-clearable="false"
|
:is-clearable="false"
|
||||||
|
@keyup.enter.stop="submitTags(row)"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('itemBasicData.relevancy')"
|
:label="t('itemBasicData.relevancy')"
|
||||||
|
@ -154,6 +157,7 @@ const insertTag = (rows) => {
|
||||||
v-model="row.priority"
|
v-model="row.priority"
|
||||||
:required="true"
|
:required="true"
|
||||||
:rules="validate('itemTag.priority')"
|
:rules="validate('itemTag.priority')"
|
||||||
|
@keyup.enter.stop="submitTags(row)"
|
||||||
/>
|
/>
|
||||||
<div class="row justify-center" style="flex: 0">
|
<div class="row justify-center" style="flex: 0">
|
||||||
<QIcon
|
<QIcon
|
||||||
|
@ -189,3 +193,8 @@ const insertTag = (rows) => {
|
||||||
</QPage>
|
</QPage>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Tags can not be repeated: Las etiquetas no pueden repetirse
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -28,7 +28,7 @@ const taxesFilter = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const ItemTaxRef = ref(null);
|
const ItemTaxRef = ref();
|
||||||
const taxesOptions = ref([]);
|
const taxesOptions = ref([]);
|
||||||
|
|
||||||
const submitTaxes = async (data) => {
|
const submitTaxes = async (data) => {
|
||||||
|
@ -36,7 +36,10 @@ const submitTaxes = async (data) => {
|
||||||
id: tax.id,
|
id: tax.id,
|
||||||
taxClassFk: tax.taxClassFk,
|
taxClassFk: tax.taxClassFk,
|
||||||
}));
|
}));
|
||||||
|
if (payload.some((item) => item.taxClassFk === null)) {
|
||||||
|
notify(t('Tax class cannot be blank'), 'negative');
|
||||||
|
return;
|
||||||
|
}
|
||||||
await axios.post(`Items/updateTaxes`, payload);
|
await axios.post(`Items/updateTaxes`, payload);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
};
|
};
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue