Merge branch 'dev' of https: refs #7957//gitea.verdnatura.es/verdnatura/salix-front into 7957-monitorChanges
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
30bdf42f3f
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": "25.02.0",
|
"version": "25.04.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -69,6 +62,7 @@ async function setProvince(id, data) {
|
||||||
postcodeFormData.provinceFk = id;
|
postcodeFormData.provinceFk = id;
|
||||||
await fetchTowns();
|
await fetchTowns();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onProvinceCreated(data) {
|
async function onProvinceCreated(data) {
|
||||||
postcodeFormData.provinceFk = data.id;
|
postcodeFormData.provinceFk = data.id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ function resetData(data) {
|
||||||
originalData.value = JSON.parse(JSON.stringify(data));
|
originalData.value = JSON.parse(JSON.stringify(data));
|
||||||
formData.value = JSON.parse(JSON.stringify(data));
|
formData.value = JSON.parse(JSON.stringify(data));
|
||||||
|
|
||||||
if (watchChanges.value) watchChanges.value(); //destoy watcher
|
if (watchChanges.value) watchChanges.value(); //destroy watcher
|
||||||
watchChanges.value = watch(formData, () => (hasChanges.value = true), { deep: true });
|
watchChanges.value = watch(formData, () => (hasChanges.value = true), { deep: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,10 +270,8 @@ function getChanges() {
|
||||||
|
|
||||||
function isEmpty(obj) {
|
function isEmpty(obj) {
|
||||||
if (obj == null) return true;
|
if (obj == null) return true;
|
||||||
if (obj === undefined) return true;
|
if (Array.isArray(obj)) return !obj.length;
|
||||||
if (Object.keys(obj).length === 0) return true;
|
return !Object.keys(obj).length;
|
||||||
|
|
||||||
if (obj.length > 0) return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reload(params) {
|
async function reload(params) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { onMounted, onUnmounted, computed, ref, watch, nextTick } from 'vue';
|
import { onMounted, onUnmounted, computed, ref, watch, nextTick } from 'vue';
|
||||||
import { onBeforeRouteLeave, useRouter } from 'vue-router';
|
import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
|
@ -12,7 +12,6 @@ import SkeletonForm from 'components/ui/SkeletonForm.vue';
|
||||||
import VnConfirm from './ui/VnConfirm.vue';
|
import VnConfirm from './ui/VnConfirm.vue';
|
||||||
import { tMobile } from 'src/composables/tMobile';
|
import { tMobile } from 'src/composables/tMobile';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -57,6 +57,7 @@ onMounted(() => stateStore.setMounted());
|
||||||
'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,
|
||||||
|
@ -54,8 +59,8 @@ const $props = defineProps({
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
bottom: {
|
bottom: {
|
||||||
type: Object,
|
type: Boolean,
|
||||||
default: null,
|
default: false,
|
||||||
},
|
},
|
||||||
cardClass: {
|
cardClass: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -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 = [
|
||||||
{
|
{
|
||||||
|
@ -184,41 +184,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 = {
|
||||||
|
@ -299,17 +266,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,
|
||||||
|
@ -358,61 +314,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
|
||||||
|
@ -468,7 +370,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
|
||||||
|
@ -576,29 +478,6 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #bottom v-if="bottom">
|
|
||||||
<slot name="bottom-table">
|
|
||||||
<QBtn
|
|
||||||
@click="
|
|
||||||
() =>
|
|
||||||
createAsDialog
|
|
||||||
? (showForm = !showForm)
|
|
||||||
: handleOnDataSaved(create)
|
|
||||||
"
|
|
||||||
class="cursor-pointer fill-icon"
|
|
||||||
color="primary"
|
|
||||||
icon="add_circle"
|
|
||||||
size="md"
|
|
||||||
round
|
|
||||||
flat
|
|
||||||
shortcut="+"
|
|
||||||
:disabled="!disabledAttr"
|
|
||||||
/>
|
|
||||||
<QTooltip>
|
|
||||||
{{ createForm.title }}
|
|
||||||
</QTooltip>
|
|
||||||
</slot>
|
|
||||||
</template>
|
|
||||||
<template #item="{ row, colsMap }">
|
<template #item="{ row, colsMap }">
|
||||||
<component
|
<component
|
||||||
:is="$props.redirect ? 'router-link' : 'span'"
|
:is="$props.redirect ? 'router-link' : 'span'"
|
||||||
|
@ -723,6 +602,27 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
<div class="full-width bottomButton" v-if="bottom">
|
||||||
|
<QBtn
|
||||||
|
@click="
|
||||||
|
() =>
|
||||||
|
createAsDialog
|
||||||
|
? (showForm = !showForm)
|
||||||
|
: handleOnDataSaved(create)
|
||||||
|
"
|
||||||
|
class="cursor-pointer fill-icon"
|
||||||
|
color="primary"
|
||||||
|
icon="add_circle"
|
||||||
|
size="md"
|
||||||
|
round
|
||||||
|
flat
|
||||||
|
shortcut="+"
|
||||||
|
:disabled="!disabledAttr"
|
||||||
|
/>
|
||||||
|
<QTooltip>
|
||||||
|
{{ createForm.title }}
|
||||||
|
</QTooltip>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</CrudModel>
|
</CrudModel>
|
||||||
<QPageSticky v-if="$props.create" :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky v-if="$props.create" :offset="[20, 20]" style="z-index: 2">
|
||||||
|
|
|
@ -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>
|
|
@ -1,4 +1,4 @@
|
||||||
import { describe, expect, it, beforeAll, beforeEach } from 'vitest';
|
import { describe, expect, it, beforeAll, beforeEach, vi } from 'vitest';
|
||||||
import { createWrapper } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
|
@ -13,6 +13,15 @@ describe('VnTable', () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
vm = wrapper.vm;
|
vm = wrapper.vm;
|
||||||
|
|
||||||
|
vi.mock('src/composables/useFilterParams', () => {
|
||||||
|
return {
|
||||||
|
useFilterParams: vi.fn(() => ({
|
||||||
|
params: {},
|
||||||
|
orders: {},
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => (vm.selected = []));
|
beforeEach(() => (vm.selected = []));
|
|
@ -0,0 +1,248 @@
|
||||||
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
|
import CrudModel from 'components/CrudModel.vue';
|
||||||
|
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
describe('CrudModel', () => {
|
||||||
|
let wrapper;
|
||||||
|
let vm;
|
||||||
|
let data;
|
||||||
|
beforeAll(() => {
|
||||||
|
wrapper = createWrapper(CrudModel, {
|
||||||
|
global: {
|
||||||
|
stubs: [
|
||||||
|
'vnPaginate',
|
||||||
|
'useState',
|
||||||
|
'arrayData',
|
||||||
|
'useStateStore',
|
||||||
|
'vue-i18n',
|
||||||
|
],
|
||||||
|
mocks: {
|
||||||
|
validate: vi.fn(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
propsData: {
|
||||||
|
dataRequired: {
|
||||||
|
fk: 1,
|
||||||
|
},
|
||||||
|
dataKey: 'crudModelKey',
|
||||||
|
model: 'crudModel',
|
||||||
|
url: 'crudModelUrl',
|
||||||
|
saveFn: '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
wrapper=wrapper.wrapper;
|
||||||
|
vm=wrapper.vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
vm.fetch([]);
|
||||||
|
vm.watchChanges = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('insert()', () => {
|
||||||
|
it('should new element in list with index 0 if formData not has data', () => {
|
||||||
|
vm.insert();
|
||||||
|
|
||||||
|
expect(vm.formData.length).toEqual(1);
|
||||||
|
expect(vm.formData[0].fk).toEqual(1);
|
||||||
|
expect(vm.formData[0].$index).toEqual(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getChanges()', () => {
|
||||||
|
it('should return correct updates and creates', async () => {
|
||||||
|
vm.fetch([
|
||||||
|
{ id: 1, name: 'New name one' },
|
||||||
|
{ id: 2, name: 'New name two' },
|
||||||
|
{ id: 3, name: 'Bruce Wayne' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
vm.originalData = [
|
||||||
|
{ id: 1, name: 'Tony Starks' },
|
||||||
|
{ id: 2, name: 'Jessica Jones' },
|
||||||
|
{ id: 3, name: 'Bruce Wayne' },
|
||||||
|
];
|
||||||
|
|
||||||
|
vm.insert();
|
||||||
|
const result = vm.getChanges();
|
||||||
|
|
||||||
|
const expected = {
|
||||||
|
creates: [
|
||||||
|
{
|
||||||
|
$index: 3,
|
||||||
|
fk: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
updates: [
|
||||||
|
{
|
||||||
|
data: {
|
||||||
|
name: 'New name one',
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: {
|
||||||
|
name: 'New name two',
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(result).toEqual(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getDifferences()', () => {
|
||||||
|
it('should return the differences between two objects', async () => {
|
||||||
|
const obj1 = {
|
||||||
|
a: 1,
|
||||||
|
b: 2,
|
||||||
|
c: 3,
|
||||||
|
};
|
||||||
|
const obj2 = {
|
||||||
|
a: null,
|
||||||
|
b: 4,
|
||||||
|
d: 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = vm.getDifferences(obj1, obj2);
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
a: null,
|
||||||
|
b: 4,
|
||||||
|
d: 5,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('isEmpty()', () => {
|
||||||
|
let dummyObj;
|
||||||
|
let dummyArray;
|
||||||
|
let result;
|
||||||
|
it('should return true if object si null', async () => {
|
||||||
|
dummyObj = null;
|
||||||
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true if object si undefined', async () => {
|
||||||
|
dummyObj = undefined;
|
||||||
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true if object is empty', async () => {
|
||||||
|
dummyObj ={};
|
||||||
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false if object is not empty', async () => {
|
||||||
|
dummyObj = {a:1, b:2, c:3};
|
||||||
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true if array is empty', async () => {
|
||||||
|
dummyArray = [];
|
||||||
|
result = vm.isEmpty(dummyArray);
|
||||||
|
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false if array is not empty', async () => {
|
||||||
|
dummyArray = [1,2,3];
|
||||||
|
result = vm.isEmpty(dummyArray);
|
||||||
|
|
||||||
|
expect(result).toBe(false);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('resetData()', () => {
|
||||||
|
it('should add $index to elements in data[] and sets originalData and formData with data', async () => {
|
||||||
|
data = [{
|
||||||
|
name: 'Tony',
|
||||||
|
lastName: 'Stark',
|
||||||
|
age: 42,
|
||||||
|
}];
|
||||||
|
|
||||||
|
vm.resetData(data);
|
||||||
|
|
||||||
|
expect(vm.originalData).toEqual(data);
|
||||||
|
expect(vm.originalData[0].$index).toEqual(0);
|
||||||
|
expect(vm.formData).toEqual(data);
|
||||||
|
expect(vm.formData[0].$index).toEqual(0);
|
||||||
|
expect(vm.watchChanges).not.toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should dont do nothing if data is null', async () => {
|
||||||
|
vm.resetData(null);
|
||||||
|
|
||||||
|
expect(vm.watchChanges).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set originalData and formatData with data and generate watchChanges', async () => {
|
||||||
|
data = {
|
||||||
|
name: 'Tony',
|
||||||
|
lastName: 'Stark',
|
||||||
|
age: 42,
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.resetData(data);
|
||||||
|
|
||||||
|
expect(vm.originalData).toEqual(data);
|
||||||
|
expect(vm.formData).toEqual(data);
|
||||||
|
expect(vm.watchChanges).not.toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('saveChanges()', () => {
|
||||||
|
data = [{
|
||||||
|
name: 'Tony',
|
||||||
|
lastName: 'Stark',
|
||||||
|
age: 42,
|
||||||
|
}];
|
||||||
|
|
||||||
|
it('should call saveFn if exists', async () => {
|
||||||
|
await wrapper.setProps({ saveFn: vi.fn() });
|
||||||
|
|
||||||
|
vm.saveChanges(data);
|
||||||
|
|
||||||
|
expect(vm.saveFn).toHaveBeenCalledOnce();
|
||||||
|
expect(vm.isLoading).toBe(false);
|
||||||
|
expect(vm.hasChanges).toBe(false);
|
||||||
|
|
||||||
|
await wrapper.setProps({ saveFn: '' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should use default url if there's not saveFn", async () => {
|
||||||
|
const postMock =vi.spyOn(axios, 'post');
|
||||||
|
|
||||||
|
vm.formData = [{
|
||||||
|
name: 'Bruce',
|
||||||
|
lastName: 'Wayne',
|
||||||
|
age: 45,
|
||||||
|
}]
|
||||||
|
|
||||||
|
await vm.saveChanges(data);
|
||||||
|
|
||||||
|
expect(postMock).toHaveBeenCalledWith(vm.url + '/crud', data);
|
||||||
|
expect(vm.isLoading).toBe(false);
|
||||||
|
expect(vm.hasChanges).toBe(false);
|
||||||
|
expect(vm.originalData).toEqual(JSON.parse(JSON.stringify(vm.formData)));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,56 @@
|
||||||
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
|
import EditForm from 'components/EditTableCellValueForm.vue';
|
||||||
|
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
const fieldA = 'fieldA';
|
||||||
|
const fieldB = 'fieldB';
|
||||||
|
|
||||||
|
describe('EditForm', () => {
|
||||||
|
let vm;
|
||||||
|
const mockRows = [
|
||||||
|
{ id: 1, itemFk: 101 },
|
||||||
|
{ id: 2, itemFk: 102 },
|
||||||
|
];
|
||||||
|
const mockFieldsOptions = [
|
||||||
|
{ label: 'Field A', field: fieldA, component: 'input', attrs: {} },
|
||||||
|
{ label: 'Field B', field: fieldB, component: 'date', attrs: {} },
|
||||||
|
];
|
||||||
|
const editUrl = '/api/edit';
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
vi.spyOn(axios, 'post').mockResolvedValue({ status: 200 });
|
||||||
|
vm = createWrapper(EditForm, {
|
||||||
|
props: {
|
||||||
|
rows: mockRows,
|
||||||
|
fieldsOptions: mockFieldsOptions,
|
||||||
|
editUrl,
|
||||||
|
},
|
||||||
|
}).vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('onSubmit()', () => {
|
||||||
|
it('should call axios.post with the correct parameters in the payload', async () => {
|
||||||
|
const selectedField = { field: fieldA, component: 'input', attrs: {} };
|
||||||
|
const newValue = 'Test Value';
|
||||||
|
|
||||||
|
vm.selectedField = selectedField;
|
||||||
|
vm.newValue = newValue;
|
||||||
|
|
||||||
|
await vm.onSubmit();
|
||||||
|
|
||||||
|
const payload = axios.post.mock.calls[0][1];
|
||||||
|
|
||||||
|
expect(axios.post).toHaveBeenCalledWith(editUrl, expect.any(Object));
|
||||||
|
expect(payload.field).toEqual(fieldA);
|
||||||
|
expect(payload.newValue).toEqual(newValue);
|
||||||
|
|
||||||
|
expect(payload.lines).toEqual(expect.arrayContaining(mockRows));
|
||||||
|
|
||||||
|
expect(vm.isLoading).toEqual(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,149 @@
|
||||||
|
import { describe, expect, it, beforeAll, vi, afterAll } from 'vitest';
|
||||||
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
|
import FormModel from 'src/components/FormModel.vue';
|
||||||
|
|
||||||
|
describe('FormModel', () => {
|
||||||
|
const model = 'mockModel';
|
||||||
|
const url = 'mockUrl';
|
||||||
|
const formInitialData = { mockKey: 'mockVal' };
|
||||||
|
|
||||||
|
describe('modelValue', () => {
|
||||||
|
it('should use the provided model', () => {
|
||||||
|
const { vm } = mount({ propsData: { model } });
|
||||||
|
expect(vm.modelValue).toBe(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should use the route meta title when model is not provided', () => {
|
||||||
|
const { vm } = mount({});
|
||||||
|
expect(vm.modelValue).toBe('formModel_mockTitle');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('onMounted()', () => {
|
||||||
|
let mockGet;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
mockGet = vi.spyOn(axios, 'get').mockResolvedValue({ data: {} });
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
mockGet.mockRestore();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not fetch when has formInitialData', () => {
|
||||||
|
mount({ propsData: { url, model, autoLoad: true, formInitialData } });
|
||||||
|
expect(mockGet).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fetch when there is url and auto-load', () => {
|
||||||
|
mount({ propsData: { url, model, autoLoad: true } });
|
||||||
|
expect(mockGet).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not observe changes', () => {
|
||||||
|
const { vm } = mount({
|
||||||
|
propsData: { url, model, observeFormChanges: false, formInitialData },
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(vm.hasChanges).toBe(true);
|
||||||
|
vm.reset();
|
||||||
|
expect(vm.hasChanges).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should observe changes', async () => {
|
||||||
|
const { vm } = mount({
|
||||||
|
propsData: { url, model, formInitialData },
|
||||||
|
});
|
||||||
|
vm.state.set(model, formInitialData);
|
||||||
|
expect(vm.hasChanges).toBe(false);
|
||||||
|
|
||||||
|
vm.formData.mockKey = 'newVal';
|
||||||
|
await vm.$nextTick();
|
||||||
|
expect(vm.hasChanges).toBe(true);
|
||||||
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('trimData()', () => {
|
||||||
|
let vm;
|
||||||
|
beforeAll(() => {
|
||||||
|
vm = mount({}).vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should trim whitespace from string values', () => {
|
||||||
|
const data = { key1: ' value1 ', key2: ' value2 ' };
|
||||||
|
const trimmedData = vm.trimData(data);
|
||||||
|
expect(trimmedData).toEqual({ key1: 'value1', key2: 'value2' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not modify non-string values', () => {
|
||||||
|
const data = { key1: 123, key2: true, key3: null, key4: undefined };
|
||||||
|
const trimmedData = vm.trimData(data);
|
||||||
|
expect(trimmedData).toEqual(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('save()', async () => {
|
||||||
|
it('should not call if there are not changes', async () => {
|
||||||
|
const { vm } = mount({ propsData: { url, model } });
|
||||||
|
|
||||||
|
await vm.save();
|
||||||
|
expect(vm.hasChanges).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call axios.patch with the right data', async () => {
|
||||||
|
const spy = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
||||||
|
const { vm } = mount({ propsData: { url, model, formInitialData } });
|
||||||
|
vm.formData.mockKey = 'newVal';
|
||||||
|
await vm.$nextTick();
|
||||||
|
await vm.save();
|
||||||
|
expect(spy).toHaveBeenCalled();
|
||||||
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call axios.post with the right data', async () => {
|
||||||
|
const spy = vi.spyOn(axios, 'post').mockResolvedValue({ data: {} });
|
||||||
|
const { vm } = mount({
|
||||||
|
propsData: { url, model, formInitialData, urlCreate: 'mockUrlCreate' },
|
||||||
|
});
|
||||||
|
vm.formData.mockKey = 'newVal';
|
||||||
|
await vm.$nextTick();
|
||||||
|
await vm.save();
|
||||||
|
expect(spy).toHaveBeenCalled();
|
||||||
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should use the saveFn', async () => {
|
||||||
|
const { vm } = mount({
|
||||||
|
propsData: { url, model, formInitialData, saveFn: () => {} },
|
||||||
|
});
|
||||||
|
const spyPatch = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
||||||
|
const spySaveFn = vi.spyOn(vm.$props, 'saveFn');
|
||||||
|
|
||||||
|
vm.formData.mockKey = 'newVal';
|
||||||
|
await vm.$nextTick();
|
||||||
|
await vm.save();
|
||||||
|
expect(spyPatch).not.toHaveBeenCalled();
|
||||||
|
expect(spySaveFn).toHaveBeenCalled();
|
||||||
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reload the data after save', async () => {
|
||||||
|
const { vm } = mount({
|
||||||
|
propsData: { url, model, formInitialData, reload: true },
|
||||||
|
});
|
||||||
|
vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
||||||
|
|
||||||
|
vm.formData.mockKey = 'newVal';
|
||||||
|
await vm.$nextTick();
|
||||||
|
await vm.save();
|
||||||
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function mount({ propsData = {} }) {
|
||||||
|
return createWrapper(FormModel, {
|
||||||
|
propsData,
|
||||||
|
});
|
||||||
|
}
|
|
@ -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>
|
|
@ -11,9 +11,9 @@ function getBadgeAttrs(date) {
|
||||||
|
|
||||||
let timeDiff = today - timeTicket;
|
let timeDiff = today - timeTicket;
|
||||||
|
|
||||||
if (timeDiff == 0) return { color: 'warning', 'text-color': 'black' };
|
if (timeDiff == 0) return { color: 'warning', class: 'black-text-color' };
|
||||||
if (timeDiff < 0) return { color: 'success', 'text-color': 'black' };
|
if (timeDiff < 0) return { color: 'success', class: 'black-text-color' };
|
||||||
return { color: 'transparent', 'text-color': 'white' };
|
return { color: 'transparent', class: 'normal-text-color' };
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatShippedDate(date) {
|
function formatShippedDate(date) {
|
||||||
|
@ -29,3 +29,11 @@ function formatShippedDate(date) {
|
||||||
{{ formatShippedDate(date) }}
|
{{ formatShippedDate(date) }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
</template>
|
</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,14 +1,12 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, watch, computed, ref, useAttrs } from 'vue';
|
import { onMounted, watch, computed, ref, useAttrs } from 'vue';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import VnDate from './VnDate.vue';
|
import VnDate from './VnDate.vue';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
|
|
||||||
const $attrs = useAttrs();
|
const $attrs = useAttrs();
|
||||||
const { isRequired, requiredFieldRule } = useRequired($attrs);
|
const { isRequired, requiredFieldRule } = useRequired($attrs);
|
||||||
const model = defineModel({ type: [String, Date] });
|
const model = defineModel({ type: [String, Date] });
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
isOutlined: {
|
isOutlined: {
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, useAttrs } from 'vue';
|
import { computed, ref, useAttrs } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import VnTime from './VnTime.vue';
|
import VnTime from './VnTime.vue';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
|
|
||||||
const $attrs = useAttrs();
|
const $attrs = useAttrs();
|
||||||
const { isRequired, requiredFieldRule } = useRequired($attrs);
|
const { isRequired, requiredFieldRule } = useRequired($attrs);
|
||||||
const { t } = useI18n();
|
|
||||||
const model = defineModel({ type: String });
|
const model = defineModel({ type: String });
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
timeOnly: {
|
timeOnly: {
|
||||||
|
|
|
@ -26,7 +26,7 @@ const locationProperties = [
|
||||||
(obj) => obj.country?.name,
|
(obj) => obj.country?.name,
|
||||||
];
|
];
|
||||||
|
|
||||||
const formatLocation = (obj, properties) => {
|
const formatLocation = (obj, properties = locationProperties) => {
|
||||||
const parts = properties.map((prop) => {
|
const parts = properties.map((prop) => {
|
||||||
if (typeof prop === 'string') {
|
if (typeof prop === 'string') {
|
||||||
return obj[prop];
|
return obj[prop];
|
||||||
|
|
|
@ -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>
|
|
@ -166,7 +166,11 @@ onMounted(() => {
|
||||||
const arrayDataKey =
|
const arrayDataKey =
|
||||||
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
||||||
|
|
||||||
const arrayData = useArrayData(arrayDataKey, { url: $props.url, searchUrl: false });
|
const arrayData = useArrayData(arrayDataKey, {
|
||||||
|
url: $props.url,
|
||||||
|
searchUrl: false,
|
||||||
|
mapKey: $attrs['map-key'],
|
||||||
|
});
|
||||||
|
|
||||||
function findKeyInOptions() {
|
function findKeyInOptions() {
|
||||||
if (!$props.options) return;
|
if (!$props.options) return;
|
||||||
|
@ -224,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);
|
||||||
|
@ -379,7 +383,8 @@ function handleKeyDown(event) {
|
||||||
</template>
|
</template>
|
||||||
<template #option="{ opt, itemProps }">
|
<template #option="{ opt, itemProps }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
<QItemSection v-if="opt[optionValue] == opt[optionLabel]">
|
<QItemSection v-if="typeof opt !== 'object'"> {{ opt }}</QItemSection>
|
||||||
|
<QItemSection v-else-if="opt[optionValue] == opt[optionLabel]">
|
||||||
<QItemLabel>{{ opt[optionLabel] }}</QItemLabel>
|
<QItemLabel>{{ opt[optionLabel] }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection v-else>
|
<QItemSection v-else>
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
|
import VnDmsList from 'src/components/common/VnDmsList.vue';
|
||||||
|
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
describe('VnDmsList', () => {
|
||||||
|
let vm;
|
||||||
|
const dms = {
|
||||||
|
userFk: 1,
|
||||||
|
name: 'DMS 1'
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
|
||||||
|
vm = createWrapper(VnDmsList, {
|
||||||
|
props: {
|
||||||
|
model: 'WorkerDms/1110/filter',
|
||||||
|
defaultDmsCode: 'hhrrData',
|
||||||
|
filter: 'wd.workerFk',
|
||||||
|
updateModel: 'Workers',
|
||||||
|
deleteModel: 'WorkerDms',
|
||||||
|
downloadModel: 'WorkerDms'
|
||||||
|
}
|
||||||
|
}).vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('setData()', () => {
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
userFk: 1,
|
||||||
|
name: 'Jessica',
|
||||||
|
lastName: 'Jones',
|
||||||
|
file: '4.jpg',
|
||||||
|
created: '2021-07-28 21:00:00'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
userFk: 2,
|
||||||
|
name: 'Bruce',
|
||||||
|
lastName: 'Banner',
|
||||||
|
created: '2022-07-28 21:00:00',
|
||||||
|
dms: {
|
||||||
|
userFk: 2,
|
||||||
|
name: 'Bruce',
|
||||||
|
lastName: 'BannerDMS',
|
||||||
|
created: '2022-07-28 21:00:00',
|
||||||
|
file: '4.jpg',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
userFk: 3,
|
||||||
|
name: 'Natasha',
|
||||||
|
lastName: 'Romanoff',
|
||||||
|
file: '4.jpg',
|
||||||
|
created: '2021-10-28 21:00:00'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
it('Should replace objects that contain the "dms" property with the value of the same and sort by creation date', () => {
|
||||||
|
vm.setData(data);
|
||||||
|
expect([vm.rows][0][0].lastName).toEqual('BannerDMS');
|
||||||
|
expect([vm.rows][0][1].lastName).toEqual('Romanoff');
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('parseDms()', () => {
|
||||||
|
const resultDms = { ...dms, userId:1};
|
||||||
|
|
||||||
|
it('Should add properties that end with "Fk" by changing the suffix to "Id"', () => {
|
||||||
|
const parsedDms = vm.parseDms(dms);
|
||||||
|
expect(parsedDms).toEqual(resultDms);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('showFormDialog()', () => {
|
||||||
|
const resultDms = { ...dms, userId:1};
|
||||||
|
|
||||||
|
it('should call fn parseDms() and set show true if dms is defined', () => {
|
||||||
|
vm.showFormDialog(dms);
|
||||||
|
expect(vm.formDialog.show).toEqual(true);
|
||||||
|
expect(vm.formDialog.dms).toEqual(resultDms);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,91 @@
|
||||||
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import VnLocation from 'components/common/VnLocation.vue';
|
||||||
|
import { vi, afterEach, expect, it, beforeEach, describe } from 'vitest';
|
||||||
|
|
||||||
|
function buildComponent(data) {
|
||||||
|
return createWrapper(VnLocation, {
|
||||||
|
global: {
|
||||||
|
props: {
|
||||||
|
location: data
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}).vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('formatLocation', () => {
|
||||||
|
let locationBase;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
locationBase = {
|
||||||
|
postcode: '46680',
|
||||||
|
city: 'Algemesi',
|
||||||
|
province: { name: 'Valencia' },
|
||||||
|
country: { name: 'Spain' }
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the postcode, city, province and country', () => {
|
||||||
|
const location = { ...locationBase };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.formatLocation(location)).toEqual('46680, Algemesi(Valencia), Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the postcode and country', () => {
|
||||||
|
const location = { ...locationBase, city: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.formatLocation(location)).toEqual('46680, Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the city, province and country', () => {
|
||||||
|
const location = { ...locationBase, postcode: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.formatLocation(location)).toEqual('Algemesi(Valencia), Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the country', () => {
|
||||||
|
const location = { ...locationBase, postcode: undefined, city: undefined, province: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.formatLocation(location)).toEqual('Spain');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('showLabel', () => {
|
||||||
|
let locationBase;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
locationBase = {
|
||||||
|
code: '46680',
|
||||||
|
town: 'Algemesi',
|
||||||
|
province: 'Valencia',
|
||||||
|
country: 'Spain'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the label with postcode, city, province and country', () => {
|
||||||
|
const location = { ...locationBase };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.showLabel(location)).toEqual('46680, Algemesi(Valencia), Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the label with postcode and country', () => {
|
||||||
|
const location = { ...locationBase, town: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.showLabel(location)).toEqual('46680, Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the label with city, province and country', () => {
|
||||||
|
const location = { ...locationBase, code: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.showLabel(location)).toEqual('Algemesi(Valencia), Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the label with country', () => {
|
||||||
|
const location = { ...locationBase, code: undefined, town: undefined, province: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.showLabel(location)).toEqual('Spain');
|
||||||
|
});
|
||||||
|
});
|
|
@ -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, te } = useI18n();
|
const { t, te } = useI18n();
|
||||||
|
const route = useRoute();
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -55,6 +57,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
arrayData: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
||||||
|
@ -67,52 +73,19 @@ const emit = defineEmits([
|
||||||
'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) {
|
||||||
|
@ -123,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');
|
||||||
|
@ -139,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)
|
||||||
|
@ -149,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 = [];
|
||||||
|
@ -214,21 +185,6 @@ function formatValue(value) {
|
||||||
return `"${value}"`;
|
return `"${value}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
const getLocale = (label) => {
|
const getLocale = (label) => {
|
||||||
const param = label.split('.').at(-1);
|
const param = label.split('.').at(-1);
|
||||||
const globalLocale = `globals.params.${param}`;
|
const globalLocale = `globals.params.${param}`;
|
||||||
|
@ -246,7 +202,11 @@ const getLocale = (label) => {
|
||||||
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">
|
||||||
|
@ -313,8 +273,9 @@ const getLocale = (label) => {
|
||||||
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
||||||
<slot
|
<slot
|
||||||
name="body"
|
name="body"
|
||||||
:params="sanitizer(userParams)"
|
|
||||||
:get-locale="getLocale"
|
:get-locale="getLocale"
|
||||||
|
:params="userParams"
|
||||||
|
:orders="userOrders"
|
||||||
:search-fn="search"
|
:search-fn="search"
|
||||||
></slot>
|
></slot>
|
||||||
</QList>
|
</QList>
|
||||||
|
|
|
@ -110,7 +110,7 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
:url="$props.url"
|
:url="$props.url"
|
||||||
order="created DESC"
|
order="created DESC"
|
||||||
:limit="0"
|
:limit="0"
|
||||||
:filter="$props.filter"
|
:user-filter="$props.filter"
|
||||||
auto-load
|
auto-load
|
||||||
ref="vnPaginateRef"
|
ref="vnPaginateRef"
|
||||||
class="show"
|
class="show"
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -65,6 +65,10 @@ const props = defineProps({
|
||||||
type: Function,
|
type: Function,
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
|
searchRemoveParams: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const searchText = ref();
|
const searchText = ref();
|
||||||
|
@ -109,17 +113,25 @@ 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: {
|
||||||
...Object.fromEntries(staticParams),
|
|
||||||
search: searchText.value,
|
search: searchText.value,
|
||||||
},
|
},
|
||||||
...{ filter: props.filter },
|
filter: props.filter,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!props.searchRemoveParams || !searchText.value) {
|
||||||
|
filter.params = {
|
||||||
|
...staticParams,
|
||||||
|
search: searchText.value,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (props.whereFilter) {
|
if (props.whereFilter) {
|
||||||
filter.filter = {
|
filter.filter = {
|
||||||
where: props.whereFilter(searchText.value),
|
where: props.whereFilter(searchText.value),
|
||||||
|
@ -127,6 +139,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>
|
||||||
|
|
|
@ -54,6 +54,7 @@ function formatNumber(number) {
|
||||||
:offset="100"
|
:offset="100"
|
||||||
:limit="5"
|
:limit="5"
|
||||||
auto-load
|
auto-load
|
||||||
|
map-key="smsFk"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QCard
|
<QCard
|
||||||
|
|
|
@ -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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,6 +127,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();
|
||||||
|
@ -145,7 +154,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 };
|
||||||
|
@ -172,7 +181,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++;
|
||||||
|
|
||||||
|
@ -255,7 +264,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,7 +308,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);
|
||||||
|
@ -333,5 +341,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
isLoading,
|
isLoading,
|
||||||
deleteOption,
|
deleteOption,
|
||||||
reset,
|
reset,
|
||||||
|
resetPagination,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,22 +3,23 @@
|
||||||
@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-search-color: #d4d4d4;
|
--vn-search-color: #d4d4d4;
|
||||||
--vn-search-color-hover: #cfcfcf;
|
--vn-search-color-hover: #cfcfcf;
|
||||||
--vn-empty-tag: #acacac;
|
--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 {
|
||||||
|
@ -32,6 +33,8 @@ body.body--dark {
|
||||||
--vn-search-color: #4b4b4b;
|
--vn-search-color: #4b4b4b;
|
||||||
--vn-search-color-hover: #5b5b5b;
|
--vn-search-color-hover: #5b5b5b;
|
||||||
--vn-empty-tag: #2d2d2d;
|
--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);
|
||||||
}
|
}
|
||||||
|
@ -90,6 +93,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);
|
||||||
}
|
}
|
||||||
|
@ -155,7 +162,8 @@ select:-webkit-autofill {
|
||||||
.q-card,
|
.q-card,
|
||||||
.q-table,
|
.q-table,
|
||||||
.q-table__bottom,
|
.q-table__bottom,
|
||||||
.q-drawer {
|
.q-drawer,
|
||||||
|
.bottomButton {
|
||||||
background-color: var(--vn-section-color);
|
background-color: var(--vn-section-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +200,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -611,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:
|
||||||
|
@ -857,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
|
||||||
|
|
|
@ -608,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
|
||||||
|
@ -849,10 +858,12 @@ 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
|
||||||
hasMinPrice: Precio mínimo
|
hasMinPrice: Precio mínimo
|
||||||
|
wareHouseFk: Almacén
|
||||||
# LatestBuysFilter
|
# LatestBuysFilter
|
||||||
salesPersonFk: Comprador
|
salesPersonFk: Comprador
|
||||||
active: Activo
|
active: Activo
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,19 +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 RightMenu from 'src/components/common/RightMenu.vue';
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.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',
|
||||||
|
@ -48,7 +49,7 @@ const columns = computed(() => [
|
||||||
component: 'select',
|
component: 'select',
|
||||||
name: 'roleFk',
|
name: 'roleFk',
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'VnRoles',
|
options: roles,
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: 'name',
|
optionLabel: 'name',
|
||||||
},
|
},
|
||||||
|
@ -116,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)
|
||||||
|
@ -133,52 +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"
|
|
||||||
:create="{
|
|
||||||
urlCreate: 'VnUsers',
|
|
||||||
title: t('Create user'),
|
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
|
||||||
formInitialData: {},
|
|
||||||
}"
|
|
||||||
: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 #more-create-dialog="{ data }">
|
<template #body>
|
||||||
<QCardSection>
|
<VnTable
|
||||||
<VnInput
|
ref="tableRef"
|
||||||
:label="t('Password')"
|
:data-key="dataKey"
|
||||||
v-model="data.password"
|
:columns="columns"
|
||||||
type="password"
|
:create="{
|
||||||
:required="true"
|
urlCreate: 'VnUsers',
|
||||||
autocomplete="new-password"
|
title: t('Create user'),
|
||||||
/>
|
onDataSaved: ({ id }) => $refs.tableRef.redirect(id),
|
||||||
</QCardSection>
|
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>
|
</template>
|
||||||
</VnTable>
|
</VnSection>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -53,7 +53,6 @@ const hasAccount = ref(false);
|
||||||
<AccountDescriptorMenu :has-account="hasAccount" />
|
<AccountDescriptorMenu :has-account="hasAccount" />
|
||||||
</template>
|
</template>
|
||||||
<template #before>
|
<template #before>
|
||||||
<!-- falla id :id="entityId.value" collection="user" size="160x160" -->
|
|
||||||
<VnImg :id="entityId" collection="user" resolution="520x520" class="photo">
|
<VnImg :id="entityId" collection="user" resolution="520x520" class="photo">
|
||||||
<template #error>
|
<template #error>
|
||||||
<div
|
<div
|
||||||
|
@ -75,7 +74,7 @@ const hasAccount = ref(false);
|
||||||
<VnLv :label="t('account.card.nickname')" :value="entity.name" />
|
<VnLv :label="t('account.card.nickname')" :value="entity.name" />
|
||||||
<VnLv :label="t('account.card.role')" :value="entity.role.name" />
|
<VnLv :label="t('account.card.role')" :value="entity.role.name" />
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ entity }">
|
<template #icons="{ entity }">
|
||||||
<QCardActions class="q-gutter-x-md">
|
<QCardActions class="q-gutter-x-md">
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="!entity.active"
|
v-if="!entity.active"
|
||||||
|
@ -83,7 +82,7 @@ const hasAccount = ref(false);
|
||||||
name="vn:disabled"
|
name="vn:disabled"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
size="sm"
|
size="xs"
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('account.card.deactivated') }}</QTooltip>
|
<QTooltip>{{ t('account.card.deactivated') }}</QTooltip>
|
||||||
|
@ -91,10 +90,10 @@ const hasAccount = ref(false);
|
||||||
<QIcon
|
<QIcon
|
||||||
color="primary"
|
color="primary"
|
||||||
name="contact_mail"
|
name="contact_mail"
|
||||||
v-if="entity.hasAccount"
|
v-if="hasAccount"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
size="sm"
|
size="xs"
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('account.card.enabled') }}</QTooltip>
|
<QTooltip>{{ t('account.card.enabled') }}</QTooltip>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -164,19 +164,7 @@ const columns = computed(() => [
|
||||||
:autofocus="col.tabIndex == 1"
|
:autofocus="col.tabIndex == 1"
|
||||||
input-debounce="0"
|
input-debounce="0"
|
||||||
hide-selected
|
hide-selected
|
||||||
>
|
/>
|
||||||
<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>
|
|
||||||
</VnSelectWorker>
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
v-else
|
v-else
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
|
|
|
@ -230,7 +230,7 @@ async function saveWhenHasChanges() {
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-discount="{ row, value, rowIndex }">
|
<template #body-cell-discount="{ row, value, rowIndex }">
|
||||||
<QTd auto-width align="right" class="text-primary shrink">
|
<QTd auto-width align="right" class="link shrink">
|
||||||
{{ value }}
|
{{ value }}
|
||||||
<VnDiscount
|
<VnDiscount
|
||||||
:quantity="row.quantity"
|
:quantity="row.quantity"
|
||||||
|
|
|
@ -30,7 +30,7 @@ defineExpose({ states });
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ params, searchFn }">
|
<template #body="{ params }">
|
||||||
<div class="q-pa-sm q-gutter-y-sm">
|
<div class="q-pa-sm q-gutter-y-sm">
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('claim.customerId')"
|
:label="t('claim.customerId')"
|
||||||
|
@ -49,12 +49,9 @@ defineExpose({ states });
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Salesperson')"
|
:label="t('Salesperson')"
|
||||||
v-model="params.salesPersonFk"
|
v-model="params.salesPersonFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
url="Workers/activeWithInheritedRole"
|
url="Workers/activeWithInheritedRole"
|
||||||
:filter="{ where: { role: 'salesPerson' } }"
|
:filter="{ where: { role: 'salesPerson' } }"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
option-filter="firstName"
|
option-filter="firstName"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
|
@ -63,12 +60,9 @@ defineExpose({ states });
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('claim.attendedBy')"
|
:label="t('claim.attendedBy')"
|
||||||
v-model="params.attenderFk"
|
v-model="params.attenderFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
url="Workers/activeWithInheritedRole"
|
url="Workers/activeWithInheritedRole"
|
||||||
:filter="{ where: { role: 'salesPerson' } }"
|
:filter="{ where: { role: 'salesPerson' } }"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
option-filter="firstName"
|
option-filter="firstName"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
|
@ -77,9 +71,7 @@ defineExpose({ states });
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('claim.state')"
|
:label="t('claim.state')"
|
||||||
v-model="params.claimStateFk"
|
v-model="params.claimStateFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
:options="states"
|
:options="states"
|
||||||
option-value="id"
|
|
||||||
option-label="description"
|
option-label="description"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
|
@ -87,7 +79,6 @@ defineExpose({ states });
|
||||||
/>
|
/>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
v-model="params.created"
|
v-model="params.created"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
:label="t('claim.created')"
|
:label="t('claim.created')"
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
|
@ -96,10 +87,7 @@ defineExpose({ states });
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Item')"
|
:label="t('Item')"
|
||||||
v-model="params.itemFk"
|
v-model="params.itemFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
url="Items/withName"
|
url="Items/withName"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
sort-by="id DESC"
|
sort-by="id DESC"
|
||||||
outlined
|
outlined
|
||||||
|
@ -118,21 +106,26 @@ defineExpose({ states });
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('claim.responsible')"
|
:label="t('claim.responsible')"
|
||||||
v-model="params.claimResponsibleFk"
|
v-model="params.claimResponsibleFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
url="Workers/activeWithInheritedRole"
|
url="Workers/activeWithInheritedRole"
|
||||||
:filter="{ where: { role: 'salesPerson' } }"
|
:filter="{ where: { role: 'salesPerson' } }"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
option-filter="firstName"
|
option-filter="firstName"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
/>
|
/>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('claim.zone')"
|
||||||
|
v-model="params.zoneFk"
|
||||||
|
url="Zones"
|
||||||
|
:use-like="false"
|
||||||
|
outlined
|
||||||
|
rounded
|
||||||
|
dense
|
||||||
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
v-model="params.myTeam"
|
v-model="params.myTeam"
|
||||||
:label="t('params.myTeam')"
|
:label="t('params.myTeam')"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -153,6 +146,7 @@ en:
|
||||||
created: Created
|
created: Created
|
||||||
myTeam: My team
|
myTeam: My team
|
||||||
itemFk: Item
|
itemFk: Item
|
||||||
|
zoneFk: Zone
|
||||||
es:
|
es:
|
||||||
params:
|
params:
|
||||||
search: Contiene
|
search: Contiene
|
||||||
|
@ -165,6 +159,7 @@ es:
|
||||||
created: Creada
|
created: Creada
|
||||||
myTeam: Mi equipo
|
myTeam: Mi equipo
|
||||||
itemFk: Artículo
|
itemFk: Artículo
|
||||||
|
zoneFk: Zona
|
||||||
Client Name: Nombre del cliente
|
Client Name: Nombre del cliente
|
||||||
Salesperson: Comercial
|
Salesperson: Comercial
|
||||||
Item: Artículo
|
Item: Artículo
|
||||||
|
|
|
@ -10,6 +10,7 @@ import ClaimSummary from './Card/ClaimSummary.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import ZoneDescriptorProxy from '../Zone/Card/ZoneDescriptorProxy.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
@ -95,7 +96,12 @@ const columns = computed(() => [
|
||||||
optionLabel: 'description',
|
optionLabel: 'description',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
orderBy: 'priority',
|
orderBy: 'cs.priority',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('claim.zone'),
|
||||||
|
name: 'zoneFk',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -132,7 +138,7 @@ const STATE_COLOR = {
|
||||||
<VnTable
|
<VnTable
|
||||||
data-key="ClaimList"
|
data-key="ClaimList"
|
||||||
url="Claims/filter"
|
url="Claims/filter"
|
||||||
:order="['priority ASC', 'created ASC']"
|
:order="['cs.priority ASC', 'created ASC']"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
redirect="claim"
|
redirect="claim"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
@ -148,6 +154,12 @@ const STATE_COLOR = {
|
||||||
<VnUserLink :name="row.workerName" :worker-id="row.workerFk" />
|
<VnUserLink :name="row.workerName" :worker-id="row.workerFk" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-zoneFk="{ row }">
|
||||||
|
<span class="link" @click.stop>
|
||||||
|
{{ row.zoneName }}
|
||||||
|
<ZoneDescriptorProxy :id="row.zoneId" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ const columns = computed(() => [
|
||||||
label: t('Creation date'),
|
label: t('Creation date'),
|
||||||
format: ({ created }) => toDateHourMin(created),
|
format: ({ created }) => toDateHourMin(created),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
|
style: 'color: var(--vn-label-color)',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
|
@ -16,14 +16,17 @@ const { t } = useI18n();
|
||||||
|
|
||||||
const businessTypes = ref([]);
|
const businessTypes = ref([]);
|
||||||
const contactChannels = ref([]);
|
const contactChannels = ref([]);
|
||||||
const handleSalesModelValue = (val) => ({
|
const handleSalesModelValue = (val) => {
|
||||||
or: [
|
if (!val) val = '';
|
||||||
{ id: val },
|
return {
|
||||||
{ name: val },
|
or: [
|
||||||
{ nickname: { like: '%' + val + '%' } },
|
{ id: val },
|
||||||
{ code: { like: `${val}%` } },
|
{ name: val },
|
||||||
],
|
{ nickname: { like: '%' + val + '%' } },
|
||||||
});
|
{ code: { like: `${val}%` } },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref, computed, onBeforeMount } from 'vue';
|
import { ref, computed, onBeforeMount } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { toDate } from 'src/filters/index';
|
import { dateRange, toDate } from 'src/filters/index';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
@ -104,18 +104,12 @@ function getParams() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const userParams = computed(() => {
|
const userParams = computed(() => {
|
||||||
const minDate = Date.vnNew();
|
const campaign = campaignList.value[0]?.id;
|
||||||
minDate.setHours(0, 0, 0, 0);
|
const userParams = {
|
||||||
minDate.setMonth(minDate.getMonth() - 2);
|
campaign,
|
||||||
|
...updateDateParams(campaign, { from: Date.vnNew(), to: Date.vnNew() }),
|
||||||
const maxDate = Date.vnNew();
|
|
||||||
maxDate.setHours(23, 59, 59, 59);
|
|
||||||
|
|
||||||
return {
|
|
||||||
campaign: campaignList.value[0]?.id,
|
|
||||||
from: minDate,
|
|
||||||
to: maxDate,
|
|
||||||
};
|
};
|
||||||
|
return userParams;
|
||||||
});
|
});
|
||||||
const openReportPdf = () => {
|
const openReportPdf = () => {
|
||||||
openReport(`Clients/${route.params.id}/campaign-metrics-pdf`, getParams());
|
openReport(`Clients/${route.params.id}/campaign-metrics-pdf`, getParams());
|
||||||
|
@ -134,6 +128,23 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
...getParams(),
|
...getParams(),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateDateParams = (value, params) => {
|
||||||
|
if (!value) {
|
||||||
|
params.from = null;
|
||||||
|
params.to = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const campaign = campaignList.value.find((c) => c.id === value);
|
||||||
|
if (!campaign) return;
|
||||||
|
|
||||||
|
const { dated, previousDays, scopeDays } = campaign;
|
||||||
|
const _date = new Date(dated);
|
||||||
|
const [from, to] = dateRange(_date);
|
||||||
|
params.from = new Date(from.setDate(from.getDate() - previousDays)).toISOString();
|
||||||
|
params.to = new Date(to.setDate(to.getDate() + scopeDays)).toISOString();
|
||||||
|
return params;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -144,7 +155,6 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
:order="['itemTypeFk', 'itemName', 'itemSize', 'description']"
|
:order="['itemTypeFk', 'itemName', 'itemSize', 'description']"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
search-url="consumption"
|
search-url="consumption"
|
||||||
:filter="filter"
|
|
||||||
:user-params="userParams"
|
:user-params="userParams"
|
||||||
:default-remove="false"
|
:default-remove="false"
|
||||||
:default-reset="false"
|
:default-reset="false"
|
||||||
|
@ -201,6 +211,7 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
class="q-px-sm q-pt-none fit"
|
class="q-px-sm q-pt-none fit"
|
||||||
dense
|
dense
|
||||||
option-label="code"
|
option-label="code"
|
||||||
|
@update:model-value="(data) => updateDateParams(data, params)"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
@ -14,7 +14,12 @@ import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
|
||||||
const customer = computed(() => state.get('customer'));
|
const customer = ref();
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
customer.value = state.get('customer');
|
||||||
|
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
|
||||||
|
});
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -38,7 +43,6 @@ const entityId = computed(() => {
|
||||||
const data = ref(useCardDescription());
|
const data = ref(useCardDescription());
|
||||||
const setData = (entity) => {
|
const setData = (entity) => {
|
||||||
data.value = useCardDescription(entity?.name, entity?.id);
|
data.value = useCardDescription(entity?.name, entity?.id);
|
||||||
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
|
|
||||||
};
|
};
|
||||||
const debtWarning = computed(() => {
|
const debtWarning = computed(() => {
|
||||||
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -12,14 +12,17 @@ defineProps({
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const handleSalesModelValue = (val) => ({
|
const handleSalesModelValue = (val) => {
|
||||||
or: [
|
if (!val) val = '';
|
||||||
{ id: val },
|
return {
|
||||||
{ name: val },
|
or: [
|
||||||
{ nickname: { like: '%' + val + '%' } },
|
{ id: val },
|
||||||
{ code: { like: `${val}%` } },
|
{ name: val },
|
||||||
],
|
{ nickname: { like: '%' + val + '%' } },
|
||||||
});
|
{ code: { like: `${val}%` } },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
return {
|
return {
|
||||||
|
@ -170,6 +173,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:
|
||||||
|
@ -181,6 +186,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
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -107,7 +107,7 @@ const setParams = (params) => {
|
||||||
|
|
||||||
const getPreview = async () => {
|
const getPreview = async () => {
|
||||||
const params = {
|
const params = {
|
||||||
recipientId: entityId,
|
recipientId: entityId.value,
|
||||||
};
|
};
|
||||||
const validationMessage = validateMessage();
|
const validationMessage = validateMessage();
|
||||||
if (validationMessage) return notify(t(validationMessage), 'negative');
|
if (validationMessage) return notify(t(validationMessage), 'negative');
|
||||||
|
|
|
@ -52,7 +52,7 @@ const { t } = useI18n();
|
||||||
<VnSelectWorker
|
<VnSelectWorker
|
||||||
:label="t('department.bossDepartment')"
|
:label="t('department.bossDepartment')"
|
||||||
v-model="data.workerFk"
|
v-model="data.workerFk"
|
||||||
:rules="validate('department.workerFk')"
|
:rules="validate('department.bossDepartment')"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('department.selfConsumptionCustomer')"
|
:label="t('department.selfConsumptionCustomer')"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -12,6 +12,8 @@ import { getUrl } from 'src/composables/getUrl';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import FetchedTags from 'src/components/ui/FetchedTags.vue';
|
import FetchedTags from 'src/components/ui/FetchedTags.vue';
|
||||||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||||
|
import VnRow from 'src/components/ui/VnRow.vue';
|
||||||
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -147,9 +149,8 @@ async function setEntryData(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchEntryBuys = async () => {
|
const fetchEntryBuys = async () => {
|
||||||
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
|
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
|
||||||
if (data) entryBuys.value = data;
|
if (data) entryBuys.value = data;
|
||||||
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -173,13 +174,10 @@ const fetchEntryBuys = async () => {
|
||||||
</template>
|
</template>
|
||||||
<template #body>
|
<template #body>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<router-link
|
<VnTitle
|
||||||
:to="{ name: 'EntryBasicData', params: { id: entityId } }"
|
:url="`#/entry/${entityId}/basic-data`"
|
||||||
class="header header-link"
|
:text="t('globals.summary.basicData')"
|
||||||
>
|
/>
|
||||||
{{ t('globals.summary.basicData') }}
|
|
||||||
<QIcon name="open_in_new" />
|
|
||||||
</router-link>
|
|
||||||
<VnLv :label="t('entry.summary.commission')" :value="entry.commission" />
|
<VnLv :label="t('entry.summary.commission')" :value="entry.commission" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('entry.summary.currency')"
|
:label="t('entry.summary.currency')"
|
||||||
|
@ -193,13 +191,10 @@ const fetchEntryBuys = async () => {
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<router-link
|
<VnTitle
|
||||||
:to="{ name: 'EntryBasicData', params: { id: entityId } }"
|
:url="`#/entry/${entityId}/basic-data`"
|
||||||
class="header header-link"
|
:text="t('globals.summary.basicData')"
|
||||||
>
|
/>
|
||||||
{{ t('globals.summary.basicData') }}
|
|
||||||
<QIcon name="open_in_new" />
|
|
||||||
</router-link>
|
|
||||||
<VnLv :label="t('entry.summary.travelReference')">
|
<VnLv :label="t('entry.summary.travelReference')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<span class="link">
|
<span class="link">
|
||||||
|
@ -212,61 +207,42 @@ 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"
|
||||||
/>
|
/>
|
||||||
<QCheckbox
|
<VnLv
|
||||||
:label="t('entry.summary.travelDelivered')"
|
:label="t('entry.summary.travelDelivered')"
|
||||||
v-model="entry.travel.isDelivered"
|
:value="entry.travel.isDelivered"
|
||||||
: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"
|
||||||
/>
|
/>
|
||||||
<QCheckbox
|
<VnLv
|
||||||
:label="t('entry.summary.travelReceived')"
|
:label="t('entry.summary.travelReceived')"
|
||||||
v-model="entry.travel.isReceived"
|
:value="entry.travel.isReceived"
|
||||||
:disable="true"
|
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<router-link
|
<VnTitle :url="`#/travel/${entityId}/summary`" :text="t('Travel data')" />
|
||||||
:to="{ name: 'TravelSummary', params: { id: entry.travel.id } }"
|
<VnRow class="block">
|
||||||
class="header header-link"
|
<VnLv :label="t('entry.summary.ordered')" :value="entry.isOrdered" />
|
||||||
>
|
<VnLv :label="t('globals.confirmed')" :value="entry.isConfirmed" />
|
||||||
{{ t('Travel data') }}
|
<VnLv :label="t('entry.summary.booked')" :value="entry.isBooked" />
|
||||||
<QIcon name="open_in_new" />
|
<VnLv
|
||||||
</router-link>
|
:label="t('entry.summary.excludedFromAvailable')"
|
||||||
<QCheckbox
|
:value="entry.isExcludedFromAvailable"
|
||||||
:label="t('entry.summary.ordered')"
|
/>
|
||||||
v-model="entry.isOrdered"
|
</VnRow>
|
||||||
:disable="true"
|
|
||||||
/>
|
|
||||||
<QCheckbox
|
|
||||||
:label="t('globals.confirmed')"
|
|
||||||
v-model="entry.isConfirmed"
|
|
||||||
:disable="true"
|
|
||||||
/>
|
|
||||||
<QCheckbox
|
|
||||||
:label="t('entry.summary.booked')"
|
|
||||||
v-model="entry.isBooked"
|
|
||||||
:disable="true"
|
|
||||||
/>
|
|
||||||
<QCheckbox
|
|
||||||
:label="t('entry.summary.excludedFromAvailable')"
|
|
||||||
v-model="entry.isExcludedFromAvailable"
|
|
||||||
:disable="true"
|
|
||||||
/>
|
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-two" style="min-width: 100%">
|
<QCard class="vn-max">
|
||||||
<a class="header header-link">
|
<VnTitle
|
||||||
{{ t('entry.summary.buys') }}
|
:url="`#/entry/${entityId}/buys`"
|
||||||
<QIcon name="open_in_new" />
|
:text="t('entry.summary.buys')"
|
||||||
</a>
|
/>
|
||||||
<QTable
|
<QTable
|
||||||
:rows="entryBuys"
|
:rows="entryBuys"
|
||||||
:columns="entriesTableColumns"
|
:columns="entriesTableColumns"
|
||||||
|
|
|
@ -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()"
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import EntryFilter from './EntryFilter.vue';
|
import EntryFilter from './EntryFilter.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
|
@ -12,7 +11,6 @@ import EntrySummary from './Card/EntrySummary.vue';
|
||||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||||
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
|
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
|
||||||
|
|
|
@ -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,6 +245,8 @@ 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"
|
||||||
|
@ -253,6 +256,8 @@ function deleteFile(dmsFk) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<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"
|
||||||
|
|
|
@ -161,7 +161,7 @@ const columns = computed(() => [
|
||||||
<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"
|
||||||
|
|
|
@ -108,19 +108,6 @@ const cols = computed(() => [
|
||||||
},
|
},
|
||||||
format: (row) => row.code,
|
format: (row) => row.code,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
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',
|
||||||
|
|
|
@ -126,6 +126,13 @@ const columns = computed(() => [
|
||||||
columnField: { component: null },
|
columnField: { component: null },
|
||||||
format: (row) => toDate(row.dued),
|
format: (row) => toDate(row.dued),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'customsAgentFk',
|
||||||
|
label: t('invoiceOutList.tableVisibleColumns.customsAgent'),
|
||||||
|
cardVisible: true,
|
||||||
|
format: (row, dashIfEmpty) => dashIfEmpty(row.customsAgentName),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
name: 'tableActions',
|
name: 'tableActions',
|
||||||
|
@ -346,7 +353,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"
|
||||||
|
|
|
@ -13,6 +13,7 @@ invoiceOutList:
|
||||||
invoiceOutSerial: Serial
|
invoiceOutSerial: Serial
|
||||||
ticket: Ticket
|
ticket: Ticket
|
||||||
taxArea: Tax area
|
taxArea: Tax area
|
||||||
|
customsAgent: Custom Agent
|
||||||
DownloadPdf: Download PDF
|
DownloadPdf: Download PDF
|
||||||
InvoiceOutSummary: Summary
|
InvoiceOutSummary: Summary
|
||||||
negativeBases:
|
negativeBases:
|
||||||
|
|
|
@ -15,6 +15,7 @@ invoiceOutList:
|
||||||
invoiceOutSerial: Serial
|
invoiceOutSerial: Serial
|
||||||
ticket: Ticket
|
ticket: Ticket
|
||||||
taxArea: Area
|
taxArea: Area
|
||||||
|
customsAgent: Agente de aduanas
|
||||||
DownloadPdf: Descargar PDF
|
DownloadPdf: Descargar PDF
|
||||||
InvoiceOutSummary: Resumen
|
InvoiceOutSummary: Resumen
|
||||||
negativeBases:
|
negativeBases:
|
||||||
|
|
|
@ -203,6 +203,12 @@ const onIntrastatCreated = (response, formData) => {
|
||||||
v-model="data.hasKgPrice"
|
v-model="data.hasKgPrice"
|
||||||
:label="t('item.basicData.hasKgPrice')"
|
:label="t('item.basicData.hasKgPrice')"
|
||||||
/>
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.isCustomInspectionRequired"
|
||||||
|
:label="t('item.basicData.isCustomInspectionRequired')"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div>
|
<div>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
v-model="data.isFragile"
|
v-model="data.isFragile"
|
||||||
|
|
|
@ -233,7 +233,7 @@ async function updateWarehouse(warehouseFk) {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="itemBalances"
|
:rows="itemBalances"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
|
|
@ -10,21 +10,12 @@ 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 axios from 'axios';
|
|
||||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const from = ref();
|
const from = ref();
|
||||||
const to = ref();
|
const to = ref();
|
||||||
const hideInventory = ref(true);
|
|
||||||
const inventorySupplierFk = ref();
|
|
||||||
|
|
||||||
async function getInventorySupplier() {
|
|
||||||
inventorySupplierFk.value = (
|
|
||||||
await axios.get(`InventoryConfigs`)
|
|
||||||
)?.data[0]?.supplierFk;
|
|
||||||
}
|
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -49,10 +40,6 @@ const where = {
|
||||||
itemFk: route.params.id,
|
itemFk: route.params.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (hideInventory.value) {
|
|
||||||
where.supplierFk = { neq: inventorySupplierFk };
|
|
||||||
}
|
|
||||||
|
|
||||||
const arrayData = useArrayData('ItemLastEntries', {
|
const arrayData = useArrayData('ItemLastEntries', {
|
||||||
url: 'Items/lastEntriesFilter',
|
url: 'Items/lastEntriesFilter',
|
||||||
order: ['landed DESC', 'buyFk DESC'],
|
order: ['landed DESC', 'buyFk DESC'],
|
||||||
|
@ -110,7 +97,7 @@ const columns = computed(() => [
|
||||||
format: (val) => dashIfEmpty(val),
|
format: (val) => dashIfEmpty(val),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.packing'),
|
label: 'Packing',
|
||||||
name: 'packing',
|
name: 'packing',
|
||||||
field: 'packing',
|
field: 'packing',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
@ -182,15 +169,11 @@ const updateFilter = async () => {
|
||||||
const userFilter = arrayData.store.userFilter.where;
|
const userFilter = arrayData.store.userFilter.where;
|
||||||
|
|
||||||
userFilter.landed = filter;
|
userFilter.landed = filter;
|
||||||
if (hideInventory.value) userFilter.supplierFk = { neq: inventorySupplierFk };
|
|
||||||
else delete userFilter.supplierFk;
|
|
||||||
|
|
||||||
await fetchItemLastEntries();
|
await fetchItemLastEntries();
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getInventorySupplier();
|
|
||||||
|
|
||||||
const _from = Date.vnNew();
|
const _from = Date.vnNew();
|
||||||
_from.setDate(_from.getDate() - 75);
|
_from.setDate(_from.getDate() - 75);
|
||||||
from.value = getDate(_from, 'from');
|
from.value = getDate(_from, 'from');
|
||||||
|
@ -200,12 +183,16 @@ onMounted(async () => {
|
||||||
|
|
||||||
updateFilter();
|
updateFilter();
|
||||||
|
|
||||||
watch([from, to, hideInventory], ([nFrom, nTo], [oFrom, oTo]) => {
|
watch([from, to], ([nFrom, nTo], [oFrom, oTo]) => {
|
||||||
if (nFrom && nFrom != oFrom) nFrom = getDate(new Date(nFrom), 'from');
|
if (nFrom && nFrom != oFrom) nFrom = getDate(new Date(nFrom), 'from');
|
||||||
if (nTo && nTo != oTo) nTo = getDate(new Date(nTo), 'to');
|
if (nTo && nTo != oTo) nTo = getDate(new Date(nTo), 'to');
|
||||||
updateFilter();
|
updateFilter();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getBadgeClass(groupingMode, expectedGrouping) {
|
||||||
|
return groupingMode === expectedGrouping ? 'accent-badge' : 'simple-badge';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSubToolbar>
|
<VnSubToolbar>
|
||||||
|
@ -224,13 +211,6 @@ onMounted(async () => {
|
||||||
class="q-mr-lg"
|
class="q-mr-lg"
|
||||||
data-cy="to"
|
data-cy="to"
|
||||||
/>
|
/>
|
||||||
<QCheckbox
|
|
||||||
:label="t('Hide inventory supplier')"
|
|
||||||
v-model="hideInventory"
|
|
||||||
dense
|
|
||||||
class="q-mr-lg"
|
|
||||||
data-cy="hideInventory"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<QPage class="column items-center q-pa-xd">
|
<QPage class="column items-center q-pa-xd">
|
||||||
|
@ -249,6 +229,11 @@ onMounted(async () => {
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
<template #body-cell-warehouse="{ row }">
|
||||||
|
<QTd>
|
||||||
|
<span>{{ row.warehouse }}</span>
|
||||||
|
</QTd>
|
||||||
|
</template>
|
||||||
<template #body-cell-date="{ row }">
|
<template #body-cell-date="{ row }">
|
||||||
<QTd class="text-center">
|
<QTd class="text-center">
|
||||||
<VnDateBadge :date="row.landed" />
|
<VnDateBadge :date="row.landed" />
|
||||||
|
@ -262,32 +247,37 @@ onMounted(async () => {
|
||||||
</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 class="text-center">
|
|
||||||
<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>
|
||||||
|
@ -315,13 +305,16 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-supplier="{ row }">
|
<template #body-cell-supplier="{ row }">
|
||||||
<QTd @click.stop>
|
<QTd @click.stop>
|
||||||
<div class="full-width flex justify-center">
|
<div class="full-width flex justify-left">
|
||||||
<SupplierDescriptorProxy
|
<QBadge
|
||||||
:id="row.supplierFk"
|
:class="
|
||||||
class="q-ma-none"
|
row.isInventorySupplier ? 'bg-vn-page' : 'transparent'
|
||||||
|
"
|
||||||
dense
|
dense
|
||||||
/>
|
>
|
||||||
<span class="link">{{ row.supplier }}</span>
|
<SupplierDescriptorProxy :id="row.supplierFk" />
|
||||||
|
<span class="link">{{ row.supplier }}</span>
|
||||||
|
</QBadge>
|
||||||
</div>
|
</div>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -349,4 +342,13 @@ onMounted(async () => {
|
||||||
background-color: red;
|
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>
|
||||||
|
|
|
@ -128,7 +128,7 @@ const submitTags = async (data) => {
|
||||||
<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"
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue