-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/components/ui/VnConfirm.vue b/src/components/ui/VnConfirm.vue
index f8715f685..0480650db 100644
--- a/src/components/ui/VnConfirm.vue
+++ b/src/components/ui/VnConfirm.vue
@@ -67,6 +67,7 @@ async function confirm() {
+
[],
+ default: () => ['filter'],
},
customTags: {
type: Array,
default: () => [],
},
+ disableSubmitEvent: {
+ type: Boolean,
+ default: false,
+ },
+ searchUrl: {
+ type: String,
+ default: 'params',
+ },
redirect: {
type: Boolean,
default: true,
@@ -54,61 +57,64 @@ const props = defineProps({
const emit = defineEmits(['refresh', 'clear', 'search', 'init', 'remove']);
-const arrayData = useArrayData(props.dataKey, {
- exprBuilder: props.exprBuilder,
+const arrayData = useArrayData($props.dataKey, {
+ exprBuilder: $props.exprBuilder,
+ searchUrl: $props.searchUrl,
+ navigate: {},
});
const route = useRoute();
const store = arrayData.store;
-const userParams = ref({});
-const { navigate } = useRedirect();
onMounted(() => {
- if (props.params) userParams.value = JSON.parse(JSON.stringify(props.params));
- if (Object.keys(store.userParams).length > 0) {
- userParams.value = JSON.parse(JSON.stringify(store.userParams));
- }
- emit('init', { params: userParams.value });
+ emit('init', { params: params.value });
});
+function setUserParams(watchedParams) {
+ if (!watchedParams) return;
+
+ if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
+ watchedParams = { ...watchedParams, ...watchedParams.filter?.where };
+ delete watchedParams.filter;
+ params.value = { ...params.value, ...watchedParams };
+}
+
watch(
- () => route.query.params,
- (val) => {
- if (!val) {
- userParams.value = {};
- } else {
- const parsedParams = JSON.parse(val);
- userParams.value = { ...parsedParams };
- }
- }
+ () => route.query[$props.searchUrl],
+ (val) => setUserParams(val)
+);
+
+watch(
+ () => arrayData.store.userParams,
+ (val) => setUserParams(val)
);
const isLoading = ref(false);
-async function search() {
+async function search(evt) {
+ if (evt && $props.disableSubmitEvent) return;
+
store.filter.where = {};
isLoading.value = true;
- const params = { ...userParams.value };
+ const filter = { ...params.value };
store.userParamsChanged = true;
store.filter.skip = 0;
store.skip = 0;
- const { params: newParams } = await arrayData.addFilter({ params });
- userParams.value = newParams;
+ const { params: newParams } = await arrayData.addFilter({ params: params.value });
+ params.value = newParams;
- if (!props.showAll && !Object.values(params).length) store.data = [];
+ if (!$props.showAll && !Object.values(filter).length) store.data = [];
isLoading.value = false;
emit('search');
- if (props.redirect) navigate(store.data, {});
}
async function reload() {
isLoading.value = true;
- const params = Object.values(userParams.value).filter((param) => param);
+ const params = Object.values(params.value).filter((param) => param);
await arrayData.fetch({ append: false });
- if (!props.showAll && !params.length) store.data = [];
+ if (!$props.showAll && !params.length) store.data = [];
isLoading.value = false;
emit('refresh');
- if (props.redirect) navigate(store.data, {});
}
async function clearFilters() {
@@ -117,18 +123,19 @@ async function clearFilters() {
store.filter.skip = 0;
store.skip = 0;
// Filtrar los params no removibles
- const removableFilters = Object.keys(userParams.value).filter((param) =>
- props.unremovableParams.includes(param)
+ const removableFilters = Object.keys(params.value).filter((param) =>
+ $props.unremovableParams.includes(param)
);
const newParams = {};
// Conservar solo los params que no son removibles
for (const key of removableFilters) {
- newParams[key] = userParams.value[key];
+ newParams[key] = params.value[key];
}
- userParams.value = { ...newParams }; // Actualizar los params con los removibles
- await arrayData.applyFilter({ params: userParams.value });
+ params.value = {};
+ params.value = { ...newParams }; // Actualizar los params con los removibles
+ await arrayData.applyFilter({ params: params.value });
- if (!props.showAll) {
+ if (!$props.showAll) {
store.data = [];
}
@@ -136,36 +143,32 @@ async function clearFilters() {
emit('clear');
}
-const tagsList = computed(() =>
- Object.entries(userParams.value)
- .filter(([key, value]) => value && !(props.hiddenTags || []).includes(key))
- .map(([key, value]) => ({
- label: key,
- value: value,
- }))
-);
+const tagsList = computed(() => {
+ const tagList = [];
+ for (const key of Object.keys(params.value)) {
+ const value = params.value[key];
+ if (value == null || ($props.hiddenTags || []).includes(key)) continue;
+ tagList.push({ label: key, value });
+ }
+ return tagList;
+});
-const tags = computed(() =>
- tagsList.value.filter((tag) => !(props.customTags || []).includes(tag.label))
-);
+const tags = computed(() => {
+ return tagsList.value.filter((tag) => !($props.customTags || []).includes(tag.key));
+});
const customTags = computed(() =>
- tagsList.value.filter((tag) => (props.customTags || []).includes(tag.label))
+ tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.key))
);
async function remove(key) {
- userParams.value[key] = null;
- await arrayData.applyFilter({ params: userParams.value });
+ params.value[key] = undefined;
+ search();
emit('remove', key);
}
function formatValue(value) {
- if (typeof value === 'boolean') {
- return value ? t('Yes') : t('No');
- }
-
- if (isNaN(value) && !isNaN(Date.parse(value))) {
- return toDate(value);
- }
+ if (typeof value === 'boolean') return value ? t('Yes') : t('No');
+ if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
return `"${value}"`;
}
@@ -226,14 +229,14 @@ function formatValue(value) {
{{ chip.label }}:
- "{{ chip.value }}"
+ "{{ formatValue(chip.value) }}"
-
+
-
+
@@ -269,7 +272,6 @@ function formatValue(value) {
color="primary"
/>
-
diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index 190393d2f..9a2c06b0c 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -58,14 +58,19 @@ const props = defineProps({
type: Function,
default: null,
},
+ searchUrl: {
+ type: String,
+ default: null,
+ },
disableInfiniteScroll: {
type: Boolean,
default: false,
},
});
-const emit = defineEmits(['onFetch', 'onPaginate']);
+const emit = defineEmits(['onFetch', 'onPaginate', 'onChange']);
const isLoading = ref(false);
+const mounted = ref(false);
const pagination = ref({
sortBy: props.order,
rowsPerPage: props.limit,
@@ -81,11 +86,13 @@ const arrayData = useArrayData(props.dataKey, {
userParams: props.userParams,
exprBuilder: props.exprBuilder,
keepOpts: props.keepOpts,
+ searchUrl: props.searchUrl,
});
const store = arrayData.store;
-onMounted(() => {
- if (props.autoLoad) fetch();
+onMounted(async () => {
+ if (props.autoLoad) await fetch();
+ mounted.value = true;
});
watch(
@@ -95,11 +102,22 @@ watch(
}
);
+watch(
+ () => store.data,
+ (data) => emit('onChange', data)
+);
+
+watch(
+ () => props.url,
+ (url) => fetch({ url })
+);
+
const addFilter = async (filter, params) => {
await arrayData.addFilter({ filter, params });
};
-async function fetch() {
+async function fetch(params) {
+ useArrayData(props.dataKey, params);
store.filter.skip = 0;
store.skip = 0;
await arrayData.fetch({ append: false });
@@ -107,6 +125,7 @@ async function fetch() {
isLoading.value = false;
}
emit('onFetch', store.data);
+ return store.data;
}
async function paginate() {
@@ -138,7 +157,7 @@ function endPagination() {
emit('onPaginate');
}
async function onLoad(index, done) {
- if (!store.data) return done();
+ if (!store.data || !mounted.value) return done();
if (store.data.length === 0 || !props.url) return done(false);
@@ -150,7 +169,7 @@ async function onLoad(index, done) {
done(isDone);
}
-defineExpose({ fetch, addFilter });
+defineExpose({ fetch, addFilter, paginate });
@@ -199,12 +218,6 @@ defineExpose({ fetch, addFilter });
-
-
-
+
+ en:
+ accountRate: Claming rate
+ es:
+ accountRate: Ratio de reclamación
+
diff --git a/src/pages/Account/Card/AccountDescriptorMenu.vue b/src/pages/Account/Card/AccountDescriptorMenu.vue
new file mode 100644
index 000000000..60510394d
--- /dev/null
+++ b/src/pages/Account/Card/AccountDescriptorMenu.vue
@@ -0,0 +1,187 @@
+
+
+
+
+ {{ shouldSyncPassword }}
+
+
+ {{ t('account.card.actions.sync.tooltip') }}
+
+
+
+
+
+ {{ t('account.card.actions.setPassword') }}
+
+ updateStatusAccount(true)
+ )
+ "
+ >
+ {{ t('account.card.actions.enableAccount.name') }}
+
+ updateStatusAccount(false)
+ )
+ "
+ >
+ {{ t('account.card.actions.disableAccount.name') }}
+
+
+ updateStatusUser(true)
+ )
+ "
+ >
+ {{ t('account.card.actions.activateUser.name') }}
+
+ updateStatusUser(false)
+ )
+ "
+ >
+ {{ t('account.card.actions.deactivateUser.name') }}
+
+
+ {{ t('account.card.actions.sync.name') }}
+
+
+
+
+
+
+
+ {{ t('account.card.actions.delete.name') }}
+
+
diff --git a/src/pages/Account/Card/AccountInheritedRoles.vue b/src/pages/Account/Card/AccountInheritedRoles.vue
new file mode 100644
index 000000000..530a35449
--- /dev/null
+++ b/src/pages/Account/Card/AccountInheritedRoles.vue
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/src/pages/Account/Card/AccountLog.vue b/src/pages/Account/Card/AccountLog.vue
new file mode 100644
index 000000000..0f6cfb93f
--- /dev/null
+++ b/src/pages/Account/Card/AccountLog.vue
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/src/pages/Account/Card/AccountMailAlias.vue b/src/pages/Account/Card/AccountMailAlias.vue
new file mode 100644
index 000000000..99ce3ab22
--- /dev/null
+++ b/src/pages/Account/Card/AccountMailAlias.vue
@@ -0,0 +1,187 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ row.alias?.alias }}
+ {{
+ row.alias?.description
+ }}
+
+
+
+ deleteMailAlias(row, rows, rowIndex)
+ )
+ "
+ >
+
+ {{ t('globals.delete') }}
+
+
+
+
+
+
+
+
+
+ {{ t('account.mailForwarding.accountNotEnabled') }}
+
+
+
+
+
+
+
+ {{ t('warehouses.add') }}
+
+
+
+
+
+
+es:
+ Unsubscribed from alias!: ¡Desuscrito del alias!
+ Subscribed to alias!: ¡Suscrito al alias!
+ User will be removed from alias: El usuario será borrado del alias
+ Are you sure you want to continue?: ¿Seguro que quieres continuar?
+
diff --git a/src/pages/Account/Card/AccountMailAliasCreateForm.vue b/src/pages/Account/Card/AccountMailAliasCreateForm.vue
new file mode 100644
index 000000000..8f6d57091
--- /dev/null
+++ b/src/pages/Account/Card/AccountMailAliasCreateForm.vue
@@ -0,0 +1,51 @@
+
+
+
+ (aliasOptions = data)"
+ />
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/Account/Card/AccountMailForwarding.vue b/src/pages/Account/Card/AccountMailForwarding.vue
new file mode 100644
index 000000000..24b30f2b3
--- /dev/null
+++ b/src/pages/Account/Card/AccountMailForwarding.vue
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('account.mailForwarding.accountNotEnabled') }}
+
+
+
diff --git a/src/pages/Account/Card/AccountPrivileges.vue b/src/pages/Account/Card/AccountPrivileges.vue
new file mode 100644
index 000000000..f1f24f19b
--- /dev/null
+++ b/src/pages/Account/Card/AccountPrivileges.vue
@@ -0,0 +1,49 @@
+
+
+ (rolesOptions = data)"
+ />
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/Account/Card/AccountSummary.vue b/src/pages/Account/Card/AccountSummary.vue
new file mode 100644
index 000000000..1901f9cde
--- /dev/null
+++ b/src/pages/Account/Card/AccountSummary.vue
@@ -0,0 +1,102 @@
+
+
+
+ (account = data)"
+ >
+ {{ account.id }} - {{ account.nickname }}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/Account/InheritedRoles.vue b/src/pages/Account/InheritedRoles.vue
new file mode 100644
index 000000000..41e718bb5
--- /dev/null
+++ b/src/pages/Account/InheritedRoles.vue
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ row.role?.name }}
+ {{
+ row.role?.description
+ }}
+
+
+
+
+
+
+
+
+
+
+
+
+es:
+ Role removed. Changes will take a while to fully propagate.: Rol eliminado. Los cambios tardaran un tiempo en propagarse completamente.
+ Role added! Changes will take a while to fully propagate.: ¡Rol añadido! Los cambios tardaran un tiempo en propagarse completamente.
+ El rol va a ser eliminado: Role will be removed
+ ¿Seguro que quieres continuar?: Are you sure you want to continue?
+
diff --git a/src/pages/Account/locale/en.yml b/src/pages/Account/locale/en.yml
index dca9b45d9..c7220d7c9 100644
--- a/src/pages/Account/locale/en.yml
+++ b/src/pages/Account/locale/en.yml
@@ -15,24 +15,75 @@ account:
privileges: Privileges
mailAlias: Mail Alias
mailForwarding: Mail Forwarding
+ accountCreate: New user
aliasUsers: Users
card:
name: Name
nickname: User
- role: Rol
+ role: Role
email: Email
alias: Alias
lang: Language
+ roleFk: Role
+ newUser: New user
+ ticketTracking: Ticket tracking
+ privileges:
+ delegate: Can delegate privileges
+ enabled: Account enabled!
+ disabled: Account disabled!
+ willActivated: User will activated
+ willDeactivated: User will be deactivated
+ activated: User activated!
+ deactivated: User deactivated!
actions:
setPassword: Set password
disableAccount:
name: Disable account
- title: La cuenta será deshabilitada
- subtitle: ¿Seguro que quieres continuar?
- disableUser: Disable user
- sync: Sync
- delete: Delete
+ title: The account will be disabled
+ subtitle: Are you sure you want to continue?
+ success: 'Account disabled!'
+ enableAccount:
+ name: Enable account
+ title: The account will be enabled
+ subtitle: Are you sure you want to continue?
+ success: 'Account enabled!'
+ deactivateUser:
+ name: Deactivate user
+ title: The user will be deactivated
+ subtitle: Are you sure you want to continue?
+ success: 'User deactivated!'
+ activateUser:
+ name: Activate user
+ title: The user will be disabled
+ subtitle: Are you sure you want to continue?
+ success: 'User activated!'
+ sync:
+ name: Sync
+ title: The account will be sync
+ subtitle: Are you sure you want to continue?
+ success: 'User synchronized!'
+ checkbox: Synchronize password
+ message: Do you want to synchronize user?
+ tooltip: If password is not specified, just user attributes are synchronized
+ delete:
+ name: Delete
+ title: The account will be deleted
+ subtitle: Are you sure you want to continue?
+ success: ''
search: Search user
+ searchInfo: You can search by id, name or nickname
+ create:
+ name: Name
+ nickname: Nickname
+ email: Email
+ role: Role
+ password: Password
+ active: Active
+ mailForwarding:
+ forwardingMail: Forward email
+ accountNotEnabled: Account not enabled
+ enableMailForwarding: Enable mail forwarding
+ mailInputInfo: All emails will be forwarded to the specified address.
role:
pageTitles:
inheritedRoles: Inherited Roles
diff --git a/src/pages/Account/locale/es.yml b/src/pages/Account/locale/es.yml
index 896cc8ea9..fcc4ce1c8 100644
--- a/src/pages/Account/locale/es.yml
+++ b/src/pages/Account/locale/es.yml
@@ -15,6 +15,7 @@ account:
privileges: Privilegios
mailAlias: Alias de correo
mailForwarding: Reenvío de correo
+ accountCreate: Nuevo usuario
aliasUsers: Usuarios
card:
nickname: Usuario
@@ -22,27 +23,66 @@ account:
role: Rol
email: Mail
alias: Alias
- lang: dioma
+ lang: Idioma
+ roleFk: Rol
+ enabled: ¡Cuenta habilitada!
+ disabled: ¡Cuenta deshabilitada!
+ willActivated: El usuario será activado
+ willDeactivated: El usuario será desactivado
+ activated: ¡Usuario activado!
+ deactivated: ¡Usuario desactivado!
+ newUser: Nuevo usuario
+ privileges:
+ delegate: Puede delegar privilegios
actions:
setPassword: Establecer contraseña
disableAccount:
name: Deshabilitar cuenta
title: La cuenta será deshabilitada
subtitle: ¿Seguro que quieres continuar?
- disableUser:
+ success: '¡Cuenta deshabilitada!'
+ enableAccount:
+ name: Habilitar cuenta
+ title: La cuenta será habilitada
+ subtitle: ¿Seguro que quieres continuar?
+ success: '¡Cuenta habilitada!'
+ deactivateUser:
name: Desactivar usuario
title: El usuario será deshabilitado
subtitle: ¿Seguro que quieres continuar?
+ success: '¡Usuario desactivado!'
+ activateUser:
+ name: Activar usuario
+ title: El usuario será activado
+ subtitle: ¿Seguro que quieres continuar?
+ success: '¡Usuario activado!'
sync:
name: Sincronizar
title: El usuario será sincronizado
subtitle: ¿Seguro que quieres continuar?
+ success: '¡Usuario sincronizado!'
+ checkbox: Sincronizar contraseña
+ message: ¿Quieres sincronizar el usuario?
+ tooltip: Si la contraseña no se especifica solo se sincronizarán lo atributos del usuario
delete:
name: Eliminar
title: El usuario será eliminado
subtitle: ¿Seguro que quieres continuar?
-
+ success: ''
search: Buscar usuario
+ searchInfo: Puedes buscar por id, nombre o usuario
+ create:
+ name: Nombre
+ nickname: Nombre mostrado
+ email: Email
+ role: Rol
+ password: Contraseña
+ active: Activo
+ mailForwarding:
+ forwardingMail: Dirección de reenvío
+ accountNotEnabled: Cuenta no habilitada
+ enableMailForwarding: Habilitar redirección de correo
+ mailInputInfo: Todos los correos serán reenviados a la dirección especificada, no se mantendrá copia de los mismos en el buzón del usuario.
role:
pageTitles:
inheritedRoles: Roles heredados
diff --git a/src/pages/Agency/AgencyList.vue b/src/pages/Agency/AgencyList.vue
index de335738d..ec6506ba0 100644
--- a/src/pages/Agency/AgencyList.vue
+++ b/src/pages/Agency/AgencyList.vue
@@ -33,7 +33,6 @@ function exprBuilder(param, value) {
url="Agencies"
order="name"
:expr-builder="exprBuilder"
- auto-load
>
$props.id || useRoute().params.id);
-
+
{{ agency.name }}
diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue
index 50c9502d2..4656980d9 100644
--- a/src/pages/Claim/Card/ClaimBasicData.vue
+++ b/src/pages/Claim/Card/ClaimBasicData.vue
@@ -10,32 +10,13 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import axios from 'axios';
-import { useSession } from 'src/composables/useSession';
+// import { useSession } from 'src/composables/useSession';
+import VnImg from 'src/components/ui/VnImg.vue';
const route = useRoute();
const { t } = useI18n();
-const { getTokenMultimedia } = useSession();
-const token = getTokenMultimedia();
-
-const claimFilter = {
- fields: [
- 'id',
- 'clientFk',
- 'created',
- 'workerFk',
- 'claimStateFk',
- 'packages',
- 'pickup',
- ],
- include: [
- {
- relation: 'client',
- scope: {
- fields: ['name'],
- },
- },
- ],
-};
+// const { getTokenMultimedia } = useSession();
+// const token = getTokenMultimedia();
const claimStates = ref([]);
const claimStatesCopy = ref([]);
@@ -87,11 +68,10 @@ const statesFilter = {
/>
@@ -118,9 +98,11 @@ const statesFilter = {
>
-
diff --git a/src/pages/Claim/Card/ClaimCard.vue b/src/pages/Claim/Card/ClaimCard.vue
index f38ab5484..19d63e3b2 100644
--- a/src/pages/Claim/Card/ClaimCard.vue
+++ b/src/pages/Claim/Card/ClaimCard.vue
@@ -2,6 +2,7 @@
import VnCard from 'components/common/VnCard.vue';
import ClaimDescriptor from './ClaimDescriptor.vue';
import ClaimFilter from '../ClaimFilter.vue';
+import filter from './ClaimFilter.js';
diff --git a/src/pages/Claim/Card/ClaimDescriptor.vue b/src/pages/Claim/Card/ClaimDescriptor.vue
index aae999117..5336c4427 100644
--- a/src/pages/Claim/Card/ClaimDescriptor.vue
+++ b/src/pages/Claim/Card/ClaimDescriptor.vue
@@ -12,6 +12,7 @@ import useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
import { getUrl } from 'src/composables/getUrl';
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
+import filter from './ClaimFilter.js';
const $props = defineProps({
id: {
@@ -29,49 +30,6 @@ const entityId = computed(() => {
return $props.id || route.params.id;
});
-const filter = {
- include: [
- {
- relation: 'client',
- scope: {
- include: [
- { relation: 'salesPersonUser' },
- {
- relation: 'claimsRatio',
- scope: {
- fields: ['claimingRate'],
- limit: 1,
- },
- },
- ],
- },
- },
- {
- relation: 'claimState',
- },
- {
- relation: 'ticket',
- scope: {
- include: [
- { relation: 'zone' },
- {
- relation: 'address',
- scope: {
- include: { relation: 'province' },
- },
- },
- ],
- },
- },
- {
- relation: 'worker',
- scope: {
- include: { relation: 'user' },
- },
- },
- ],
-};
-
const STATE_COLOR = {
pending: 'warning',
incomplete: 'info',
@@ -101,7 +59,7 @@ onMounted(async () => {
:title="data.title"
:subtitle="data.subtitle"
@on-fetch="setData"
- data-key="claimData"
+ data-key="Claim"
>
diff --git a/src/pages/Claim/Card/ClaimFilter.js b/src/pages/Claim/Card/ClaimFilter.js
new file mode 100644
index 000000000..50cabe228
--- /dev/null
+++ b/src/pages/Claim/Card/ClaimFilter.js
@@ -0,0 +1,52 @@
+export default {
+ fields: [
+ 'id',
+ 'clientFk',
+ 'created',
+ 'workerFk',
+ 'claimStateFk',
+ 'packages',
+ 'pickup',
+ 'ticketFk',
+ ],
+ include: [
+ {
+ relation: 'client',
+ scope: {
+ include: [
+ { relation: 'salesPersonUser' },
+ {
+ relation: 'claimsRatio',
+ scope: {
+ fields: ['claimingRate'],
+ limit: 1,
+ },
+ },
+ ],
+ },
+ },
+ {
+ relation: 'claimState',
+ },
+ {
+ relation: 'ticket',
+ scope: {
+ include: [
+ { relation: 'zone' },
+ {
+ relation: 'address',
+ scope: {
+ include: { relation: 'province' },
+ },
+ },
+ ],
+ },
+ },
+ {
+ relation: 'worker',
+ scope: {
+ include: { relation: 'user' },
+ },
+ },
+ ],
+};
diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue
index 36a26008e..1a2d3c251 100644
--- a/src/pages/Claim/Card/ClaimSummary.vue
+++ b/src/pages/Claim/Card/ClaimSummary.vue
@@ -185,6 +185,7 @@ async function changeState(value) {
:url="`Claims/${entityId}/getSummary`"
:entity-id="entityId"
@on-fetch="getClaimDms"
+ data-key="claimSummary"
>
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
diff --git a/src/pages/Customer/Card/CustomerBasicData.vue b/src/pages/Customer/Card/CustomerBasicData.vue
index b0c2d60e3..805795522 100644
--- a/src/pages/Customer/Card/CustomerBasicData.vue
+++ b/src/pages/Customer/Card/CustomerBasicData.vue
@@ -3,16 +3,14 @@ import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
-import { useSession } from 'src/composables/useSession';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
+import VnImg from 'src/components/ui/VnImg.vue';
const route = useRoute();
const { t } = useI18n();
-const { getTokenMultimedia } = useSession();
-const token = getTokenMultimedia();
const workers = ref([]);
const workersCopy = ref([]);
@@ -143,10 +141,11 @@ const filterOptions = {
>
-
diff --git a/src/pages/Customer/Card/CustomerCard.vue b/src/pages/Customer/Card/CustomerCard.vue
index 98842a0c7..17f123e7b 100644
--- a/src/pages/Customer/Card/CustomerCard.vue
+++ b/src/pages/Customer/Card/CustomerCard.vue
@@ -10,7 +10,7 @@ import CustomerFilter from '../CustomerFilter.vue';
:descriptor="CustomerDescriptor"
:filter-panel="CustomerFilter"
search-data-key="CustomerList"
- search-url="Clients/filter"
+ search-url="Clients/extendedListFilter"
searchbar-label="Search customer"
searchbar-info="You can search by customer id or name"
/>
diff --git a/src/pages/Customer/Card/CustomerFiscalData.vue b/src/pages/Customer/Card/CustomerFiscalData.vue
index deaaefc50..d8592421f 100644
--- a/src/pages/Customer/Card/CustomerFiscalData.vue
+++ b/src/pages/Customer/Card/CustomerFiscalData.vue
@@ -143,10 +143,6 @@ function handleLocation(data, location) {
-
{
-
+
{
:value="entity.recommendedCredit"
/>
-
-
+
+
diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue
index 9e534235c..33659dd77 100644
--- a/src/pages/Customer/Card/CustomerWebAccess.vue
+++ b/src/pages/Customer/Card/CustomerWebAccess.vue
@@ -28,7 +28,6 @@ const isLoading = ref(false);
const name = ref(null);
const usersPreviewRef = ref(null);
const user = ref([]);
-const userPasswords = ref(0);
const dataChanges = computed(() => {
return (
@@ -45,7 +44,6 @@ const showChangePasswordDialog = () => {
component: CustomerChangePassword,
componentProps: {
id: route.params.id,
- userPasswords: userPasswords.value,
promise: usersPreviewRef.value.fetch(),
},
});
@@ -97,11 +95,6 @@ const onSubmit = async () => {
@on-fetch="(data) => (canChangePassword = data)"
auto-load
/>
- (userPasswords = data[0])"
- auto-load
- url="UserPasswords"
- />
diff --git a/src/pages/Customer/CustomerFilter.vue b/src/pages/Customer/CustomerFilter.vue
index 206832f46..043bcdadb 100644
--- a/src/pages/Customer/CustomerFilter.vue
+++ b/src/pages/Customer/CustomerFilter.vue
@@ -29,7 +29,7 @@ const zones = ref();
@on-fetch="(data) => (workers = data)"
auto-load
/>
-
+
{{ t(`params.${tag.label}`) }}:
diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue
index 8677a77ca..ccd53e8b2 100644
--- a/src/pages/Customer/CustomerList.vue
+++ b/src/pages/Customer/CustomerList.vue
@@ -1,94 +1,439 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ t('customer.list.phone') }}
-
-
-
-
-
-
-
-
-
+
+
+ handleLocation(data, location)"
+ />
+
+
+
+
+ {{
+ t('customer.basicData.youCanSaveMultipleEmails')
+ }}
+
-
-
-
-
-
- {{ t('New client') }}
-
-
-
+
+
+
-
es:
- Search customer: Buscar cliente
- You can search by customer id or name: Puedes buscar por id o nombre del cliente
- New client: Nuevo cliente
+ Web user: Usuario Web
+
diff --git a/src/pages/Customer/Defaulter/CustomerDefaulter.vue b/src/pages/Customer/Defaulter/CustomerDefaulter.vue
index af7ce0a26..06732b944 100644
--- a/src/pages/Customer/Defaulter/CustomerDefaulter.vue
+++ b/src/pages/Customer/Defaulter/CustomerDefaulter.vue
@@ -22,7 +22,7 @@ const balanceDueTotal = ref(0);
const selected = ref([]);
const tableColumnComponents = {
- client: {
+ clientFk: {
component: QBtn,
props: () => ({ flat: true, class: 'link', noCaps: true }),
event: () => {},
@@ -40,7 +40,7 @@ const tableColumnComponents = {
props: () => ({ flat: true, class: 'link', noCaps: true }),
event: () => {},
},
- department: {
+ departmentName: {
component: 'span',
props: () => {},
event: () => {},
@@ -102,12 +102,12 @@ const columns = computed(() => [
align: 'left',
field: 'clientName',
label: t('Client'),
- name: 'client',
+ name: 'clientFk',
sortable: true,
},
{
align: 'left',
- field: 'isWorker',
+ field: ({ isWorker }) => Boolean(isWorker),
label: t('Is worker'),
name: 'isWorker',
},
@@ -122,7 +122,7 @@ const columns = computed(() => [
align: 'left',
field: 'departmentName',
label: t('Department'),
- name: 'department',
+ name: 'departmentName',
sortable: true,
},
{
@@ -204,48 +204,24 @@ const viewAddObservation = (rowsSelected) => {
});
};
-const departments = ref(new Map());
-
const onFetch = async (data) => {
- const salesPersonFks = data.map((item) => item.salesPersonFk);
- const departmentNames = salesPersonFks.map(async (salesPersonFk) => {
- try {
- const { data: workerDepartment } = await axios.get(
- `WorkerDepartments/${salesPersonFk}`
- );
- const { data: department } = await axios.get(
- `Departments/${workerDepartment.departmentFk}`
- );
- departments.value.set(salesPersonFk, department.name);
- } catch (error) {
- console.error('Err: ', error);
- }
- });
const recoveryData = await axios.get('Recoveries');
-
const recoveries = recoveryData.data.map(({ clientFk, finished }) => ({
clientFk,
finished,
}));
- await Promise.all(departmentNames);
-
data.forEach((item) => {
- item.departmentName = departments.value.get(item.salesPersonFk);
- item.isWorker = item.businessTypeFk === 'worker';
const recovery = recoveries.find(({ clientFk }) => clientFk === item.clientFk);
item.finished = recovery?.finished === null;
});
-
- for (const element of data) element.isWorker = element.businessTypeFk === 'worker';
-
balanceDueTotal.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0);
};
function exprBuilder(param, value) {
switch (param) {
case 'clientFk':
- return { [`d.${param}`]: value?.id };
+ return { [`d.${param}`]: value };
case 'creditInsurance':
case 'amount':
case 'workerFk':
diff --git a/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue b/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue
index 9220bd7c0..6b4d8baaa 100644
--- a/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue
+++ b/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue
@@ -1,7 +1,6 @@
- (clients = data)" auto-load url="Clients" />
(salespersons = data)"
@@ -36,6 +34,7 @@ const authors = ref();
auto-load
url="Workers/activeWithInheritedRole"
/>
+ (departments = data)" auto-load url="Departments" />
@@ -47,29 +46,22 @@ const authors = ref();
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
diff --git a/src/pages/Customer/ExtendedList/CustomerExtendedList.vue b/src/pages/Customer/ExtendedList/CustomerExtendedList.vue
deleted file mode 100644
index 79459d1a1..000000000
--- a/src/pages/Customer/ExtendedList/CustomerExtendedList.vue
+++ /dev/null
@@ -1,619 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- navigateToTravelId(row.id)"
- >
-
-
- {{ value }}
-
-
-
-
-
-
-
-
-
-
-
-
- {{ props.row.id }}
-
-
-
-
-
-
-
- {{ props.row.salesPerson }}
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/pages/Customer/ExtendedList/CustomerExtendedListActions.vue b/src/pages/Customer/ExtendedList/CustomerExtendedListActions.vue
deleted file mode 100644
index 8355c7560..000000000
--- a/src/pages/Customer/ExtendedList/CustomerExtendedListActions.vue
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
- {{ t('Client ticket list') }}
-
-
-
-
- {{ t('Preview') }}
-
-
-
-
-
-
-es:
- Client ticket list: Listado de tickets del cliente
- Preview: Vista previa
-
diff --git a/src/pages/Customer/ExtendedList/CustomerExtendedListFilter.vue b/src/pages/Customer/ExtendedList/CustomerExtendedListFilter.vue
deleted file mode 100644
index 1be20f26c..000000000
--- a/src/pages/Customer/ExtendedList/CustomerExtendedListFilter.vue
+++ /dev/null
@@ -1,571 +0,0 @@
-
-
-
- (clients = data)"
- auto-load
- />
- (workers = data)"
- auto-load
- />
- (workers = data)"
- auto-load
- />
- (countriesOptions = data)"
- auto-load
- />
- (provincesOptions = data)"
- auto-load
- url="Provinces"
- />
- (paymethodsOptions = data)"
- auto-load
- />
- (businessTypesOptions = data)"
- auto-load
- />
- (sageTaxTypesOptions = data)"
- />
- (sageTransactionTypesOptions = data)"
- />
-
-
-
- {{ t(`customer.extendedList.tableVisibleColumns.${tag.label}`) }}:
-
- {{ formatFn(tag.value) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-es:
- Social name: Razón social
-
diff --git a/src/pages/Customer/components/CustomerChangePassword.vue b/src/pages/Customer/components/CustomerChangePassword.vue
index f0be5e510..1bfc5e103 100644
--- a/src/pages/Customer/components/CustomerChangePassword.vue
+++ b/src/pages/Customer/components/CustomerChangePassword.vue
@@ -9,6 +9,7 @@ import useNotify from 'src/composables/useNotify';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
+import FetchData from 'src/components/FetchData.vue';
const { dialogRef } = useDialogPluginComponent();
const { notify } = useNotify();
@@ -19,15 +20,12 @@ const $props = defineProps({
type: String,
required: true,
},
- userPasswords: {
- type: Object,
- required: true,
- },
promise: {
type: Function,
required: true,
},
});
+const userPasswords = ref({});
const closeButton = ref(null);
const isLoading = ref(false);
@@ -60,6 +58,11 @@ const onSubmit = async () => {
+ (userPasswords = data[0])"
+ auto-load
+ url="UserPasswords"
+ />
@@ -71,7 +74,7 @@ const onSubmit = async () => {
-
+
{
{{
t('customer.card.passwordRequirements', {
- length: $props.userPasswords.length,
- nAlpha: $props.userPasswords.nAlpha,
- nDigits: $props.userPasswords.nDigits,
- nPunct: $props.userPasswords.nPunct,
- nUpper: $props.userPasswords.nUpper,
+ ...userPasswords,
})
}}
diff --git a/src/pages/Customer/components/CustomerSummaryTable.vue b/src/pages/Customer/components/CustomerSummaryTable.vue
index 6a33ebc88..dc9969b61 100644
--- a/src/pages/Customer/components/CustomerSummaryTable.vue
+++ b/src/pages/Customer/components/CustomerSummaryTable.vue
@@ -162,6 +162,7 @@ const navigateToticketSummary = (id) => {
params: { id },
});
};
+const commonColumns = (col) => ['date', 'state', 'total'].includes(col);
@@ -171,67 +172,68 @@ const navigateToticketSummary = (id) => {
auto-load
url="Tickets"
/>
-
-
-
-
-
-
+
+
+
+
+
- {{ props.value }}
-
-
-
- {{ props.value }}
-
-
-
-
- {{ props.value }}
-
-
-
-
- {{ toCurrency(props.value) }}
-
- {{ toCurrency(props.value) }}
-
-
-
-
-
-
-
-
+
+
+ {{ props.value }}
+
+
+
+
+ {{ props.value }}
+
+
+
+
+ {{ props.value }}
+
+
+
+
+ {{ toCurrency(props.value) }}
+
+ {{ toCurrency(props.value) }}
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/Department/Card/DepartmentDescriptorProxy.vue b/src/pages/Department/Card/DepartmentDescriptorProxy.vue
index 07a6b6af1..5b556f655 100644
--- a/src/pages/Department/Card/DepartmentDescriptorProxy.vue
+++ b/src/pages/Department/Card/DepartmentDescriptorProxy.vue
@@ -1,6 +1,6 @@
diff --git a/src/pages/InvoiceOut/Card/InvoiceOutSummary.vue b/src/pages/InvoiceOut/Card/InvoiceOutSummary.vue
index e98de6b30..c773c43cf 100644
--- a/src/pages/InvoiceOut/Card/InvoiceOutSummary.vue
+++ b/src/pages/InvoiceOut/Card/InvoiceOutSummary.vue
@@ -106,6 +106,7 @@ const ticketsColumns = ref([
ref="summary"
:url="`InvoiceOuts/${entityId}/summary`"
:entity-id="entityId"
+ data-key="InvoiceOutSummary"
>
{{ invoiceOut.ref }} - {{ invoiceOut.client?.socialName }}
diff --git a/src/pages/Item/Card/ItemDescriptor.vue b/src/pages/Item/Card/ItemDescriptor.vue
index 155c9eb4c..f3eba8c82 100644
--- a/src/pages/Item/Card/ItemDescriptor.vue
+++ b/src/pages/Item/Card/ItemDescriptor.vue
@@ -13,7 +13,6 @@ import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
import { useState } from 'src/composables/useState';
import useCardDescription from 'src/composables/useCardDescription';
-import { useSession } from 'src/composables/useSession';
import { getUrl } from 'src/composables/getUrl';
import axios from 'axios';
import { dashIfEmpty } from 'src/filters';
@@ -42,14 +41,12 @@ const quasar = useQuasar();
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
-const { getTokenMultimedia } = useSession();
const state = useState();
const user = state.getUser();
const entityId = computed(() => {
return $props.id || route.params.id;
});
-const image = ref(null);
const regularizeStockFormDialog = ref(null);
const item = ref(null);
const available = ref(null);
@@ -67,17 +64,10 @@ const warehouseFk = computed({
});
onMounted(async () => {
- await getItemAvatar();
warehouseFk.value = user.value.warehouseFk;
salixUrl.value = await getUrl('');
});
-const getItemAvatar = async () => {
- const token = getTokenMultimedia();
- const timeStamp = `timestamp=${Date.now()}`;
- image.value = `/api/Images/catalog/200x200/${entityId.value}/download?access_token=${token}&${timeStamp}`;
-};
-
const data = ref(useCardDescription());
const setData = (entity) => {
if (!entity) return;
diff --git a/src/pages/Item/Card/ItemDescriptorImage.vue b/src/pages/Item/Card/ItemDescriptorImage.vue
index f16a57548..aceede880 100644
--- a/src/pages/Item/Card/ItemDescriptorImage.vue
+++ b/src/pages/Item/Card/ItemDescriptorImage.vue
@@ -3,8 +3,7 @@ import { ref, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import EditPictureForm from 'components/EditPictureForm.vue';
-
-import { useSession } from 'src/composables/useSession';
+import VnImg from 'src/components/ui/VnImg.vue';
import axios from 'axios';
const $props = defineProps({
@@ -27,19 +26,12 @@ const $props = defineProps({
});
const { t } = useI18n();
-const { getTokenMultimedia } = useSession();
const image = ref(null);
const editPhotoFormDialog = ref(null);
const showEditPhotoForm = ref(false);
const warehouseName = ref(null);
-const getItemAvatar = async () => {
- const token = getTokenMultimedia();
- const timeStamp = `timestamp=${Date.now()}`;
- image.value = `/api/Images/catalog/200x200/${$props.entityId}/download?access_token=${token}&${timeStamp}`;
-};
-
const toggleEditPictureForm = () => {
showEditPhotoForm.value = !showEditPhotoForm.value;
};
@@ -62,14 +54,17 @@ const getWarehouseName = async (warehouseFk) => {
};
onMounted(async () => {
- getItemAvatar();
getItemConfigs();
});
+
+const handlePhotoUpdated = (evt = false) => {
+ image.value.reload(evt);
+};
-
+
@@ -82,7 +77,7 @@ onMounted(async () => {
-
+
{
collection="catalog"
:id="entityId"
@close-form="toggleEditPictureForm()"
- @on-photo-uploaded="getItemAvatar()"
+ @on-photo-uploaded="handlePhotoUpdated"
/>
diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue
index 97f40b84d..2ecd1f21b 100644
--- a/src/pages/Item/ItemFixedPrice.vue
+++ b/src/pages/Item/ItemFixedPrice.vue
@@ -33,7 +33,6 @@ const user = state.getUser();
const fixedPrices = ref([]);
const fixedPricesOriginalData = ref([]);
const warehousesOptions = ref([]);
-const itemsWithNameOptions = ref([]);
const rowsSelected = ref([]);
const exprBuilder = (param, value) => {
@@ -371,12 +370,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
auto-load
@on-fetch="(data) => onWarehousesFetched(data)"
/>
-
(itemsWithNameOptions = data)"
- />
(stateStore.rightDrawer = false));
(stateStore.rightDrawer = false));
-
+
{{ t('Edit fixed price(s)') }}
diff --git a/src/pages/Item/ItemList.vue b/src/pages/Item/ItemList.vue
index 0e40740b9..f1e3629cd 100644
--- a/src/pages/Item/ItemList.vue
+++ b/src/pages/Item/ItemList.vue
@@ -16,17 +16,15 @@ import ItemListFilter from './ItemListFilter.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDateFormat } from 'src/filters/date.js';
-import { useSession } from 'composables/useSession';
import { dashIfEmpty } from 'src/filters';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useVnConfirm } from 'composables/useVnConfirm';
import axios from 'axios';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
+import VnImg from 'src/components/ui/VnImg.vue';
const router = useRouter();
-const { getTokenMultimedia } = useSession();
-const token = getTokenMultimedia();
const stateStore = useStateStore();
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
@@ -491,10 +489,9 @@ onUnmounted(() => (stateStore.rightDrawer = false));
- {
+ if (val.length > 2) {
+ if (!tagOptions.value.includes(val)) {
+ done(tagOptions.value, 'add-unique');
+ }
+ tagValues.value.push({ value: val });
+ }
+};
const resetCategory = () => {
selectedCategoryFk.value = null;
typeList.value = null;
};
-const selectedOrder = ref(null);
-const orderList = [
- { way: 'ASC', name: 'Ascendant' },
- { way: 'DESC', name: 'Descendant' },
-];
-
-const selectedOrderField = ref(null);
-const OrderFields = [
- { field: 'relevancy DESC, name', name: 'Relevancy', priority: 999 },
- { field: 'showOrder, price', name: 'Color and price', priority: 999 },
- { field: 'name', name: 'Name', priority: 999 },
- { field: 'price', name: 'Price', priority: 999 },
-];
-
const clearFilter = (key) => {
if (key === 'categoryFk') {
resetCategory();
@@ -72,21 +75,6 @@ const loadTypes = async (categoryFk) => {
typeList.value = data;
};
-const onFilterInit = async ({ params }) => {
- if (params.typeFk) {
- selectedTypeFk.value = params.typeFk;
- }
- if (params.categoryFk) {
- await loadTypes(params.categoryFk);
- selectedCategoryFk.value = params.categoryFk;
- }
- if (params.orderBy) {
- orderByParam.value = JSON.parse(params.orderBy);
- selectedOrder.value = orderByParam.value?.way;
- selectedOrderField.value = orderByParam.value?.field;
- }
-};
-
const selectedCategory = computed(() =>
(categoryList.value || []).find(
(category) => category?.id === selectedCategoryFk.value
@@ -109,10 +97,7 @@ function exprBuilder(param, value) {
const selectedTag = ref(null);
const tagValues = ref([{}]);
-const tagOptions = ref(null);
-const isButtonDisabled = computed(
- () => !selectedTag.value || tagValues.value.some((item) => !item.value)
-);
+const tagOptions = ref([]);
const applyTagFilter = (params, search) => {
if (!tagValues.value?.length) {
@@ -125,12 +110,12 @@ const applyTagFilter = (params, search) => {
}
params.tagGroups.push(
JSON.stringify({
- values: tagValues.value,
+ values: tagValues.value.filter((obj) => Object.keys(obj).length > 0),
tagSelection: {
...selectedTag.value,
- orgShowField: selectedTag.value.name,
+ orgShowField: selectedTag?.value?.name,
},
- tagFk: selectedTag.value.tagFk,
+ tagFk: selectedTag?.value?.tagFk,
})
);
search();
@@ -147,20 +132,52 @@ const removeTagChip = (selection, params, search) => {
search();
};
-const orderByParam = ref(null);
-
-const onOrderFieldChange = (value, params, search) => {
- const orderBy = Object.assign({}, orderByParam.value, { field: value.field });
- params.orderBy = JSON.stringify(orderBy);
- search();
+const onOrderChange = (value, params) => {
+ const tagObj = JSON.parse(params.orderBy);
+ tagObj.way = value.name;
+ params.orderBy = JSON.stringify(tagObj);
};
-const onOrderChange = (value, params, search) => {
- const orderBy = Object.assign({}, orderByParam.value, { way: value.way });
- params.orderBy = JSON.stringify(orderBy);
- search();
+const onOrderFieldChange = (value, params) => {
+ const tagObj = JSON.parse(params.orderBy); // esto donde va
+ const fields = {
+ Relevancy: (value) => value + ' DESC, name',
+ ColorAndPrice: 'showOrder, price',
+ Name: 'name',
+ Price: 'price',
+ };
+ let tagField = fields[value];
+ if (!tagField) return;
+
+ if (typeof tagField === 'function') tagField = tagField(value);
+ tagObj.field = tagField;
+ params.orderBy = JSON.stringify(tagObj);
+ switch (value) {
+ case 'Relevancy':
+ tagObj.field = value + ' DESC, name';
+ params.orderBy = JSON.stringify(tagObj);
+ console.log('params: ', params);
+ break;
+ case 'ColorAndPrice':
+ tagObj.field = 'showOrder, price';
+ params.orderBy = JSON.stringify(tagObj);
+ console.log('params: ', params);
+ break;
+ case 'Name':
+ tagObj.field = 'name';
+ params.orderBy = JSON.stringify(tagObj);
+ console.log('params: ', params);
+ break;
+ case 'Price':
+ tagObj.field = 'price';
+ params.orderBy = JSON.stringify(tagObj);
+ console.log('params: ', params);
+ break;
+ }
};
+const _moreFields = ['ASC', 'DESC'];
+const _moreFieldsTypes = ['Relevancy', 'ColorAndPrice', 'Name', 'Price'];
const setCategoryList = (data) => {
categoryList.value = (data || [])
.filter((category) => category.display)
@@ -168,6 +185,8 @@ const setCategoryList = (data) => {
...category,
icon: `vn:${(category.icon || '').split('-')[1]}`,
}));
+ moreFields.value = useLang(_moreFields);
+ moreFieldsOrder.value = useLang(_moreFieldsTypes);
};
const getCategoryClass = (category, params) => {
@@ -175,6 +194,20 @@ const getCategoryClass = (category, params) => {
return 'active';
}
};
+
+const useLang = (values) => {
+ const { models } = validationsStore;
+ const properties = models.Item?.properties || {};
+ return values.map((name) => {
+ let prop = properties[name];
+ const label = t(`params.${name}`);
+ return {
+ name,
+ label,
+ type: prop ? prop.type : null,
+ };
+ });
+};
@@ -182,9 +215,9 @@ const getCategoryClass = (category, params) => {
@@ -274,40 +307,29 @@ const getCategoryClass = (category, params) => {
onOrderChange(value, params, searchFn)
- "
+ @update:model-value="(value) => onOrderChange(value, params)"
/>
onOrderFieldChange(value, params, searchFn)
- "
+ @update:model-value="(value) => onOrderFieldChange(value, params)"
/>
@@ -333,15 +355,30 @@ const getCategoryClass = (category, params) => {
:key="value"
class="q-mt-md filter-value"
>
- (tagOptions = data)"
/>
+ {
rounded
emit-value
use-input
- :disable="!selectedTag"
+ class="filter-input"
+ @new-value="createValue"
+ />
+
-
- (tagOptions = data)"
- />
-
{
rounded
type="button"
unelevated
- :disable="isButtonDisabled"
@click.stop="applyTagFilter(params, searchFn)"
/>
@@ -453,6 +489,12 @@ en:
tag: Tag
value: Value
order: Order
+ ASC: Ascendant
+ DESC: Descendant
+ Relevancy: Relevancy
+ ColorAndPrice: Color and price
+ Name: Name
+ Price: Price
es:
params:
type: Tipo
@@ -460,6 +502,14 @@ es:
tag: Etiqueta
value: Valor
order: Orden
+ ASC: Ascendiente
+ DESC: Descendiente
+ Relevancy: Relevancia
+ ColorAndPrice: Color y precio
+ Name: Nombre
+ Price: Precio
+ Order: Orden
+ Order by: Ordenar por
Plant: Planta
Flower: Flor
Handmade: Confección
diff --git a/src/pages/Order/Card/OrderCatalogItem.vue b/src/pages/Order/Card/OrderCatalogItem.vue
index 0e1005493..34e22915d 100644
--- a/src/pages/Order/Card/OrderCatalogItem.vue
+++ b/src/pages/Order/Card/OrderCatalogItem.vue
@@ -3,16 +3,14 @@ import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnLv from 'components/ui/VnLv.vue';
+import VnImg from 'src/components/ui/VnImg.vue';
import OrderCatalogItemDialog from 'pages/Order/Card/OrderCatalogItemDialog.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
-import { useSession } from 'composables/useSession';
import toCurrency from '../../../filters/toCurrency';
const DEFAULT_PRICE_KG = 0;
-const { getTokenMultimedia } = useSession();
-const token = getTokenMultimedia();
const { t } = useI18n();
defineProps({
@@ -29,14 +27,7 @@ const dialog = ref(null);