forked from verdnatura/salix-front
updates
This commit is contained in:
parent
0bb6498061
commit
3227d299e9
|
@ -7,6 +7,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
dataKey: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
url: {
|
url: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -49,7 +53,7 @@ async function fetch(fetchFilter = {}) {
|
||||||
if ($props.sortBy) filter.order = $props.sortBy;
|
if ($props.sortBy) filter.order = $props.sortBy;
|
||||||
if ($props.limit) filter.limit = $props.limit;
|
if ($props.limit) filter.limit = $props.limit;
|
||||||
|
|
||||||
const { data } = await axios.get($props.url, {
|
const { data } = await axios($props.url, {
|
||||||
params: { filter: JSON.stringify(filter), ...$props.params },
|
params: { filter: JSON.stringify(filter), ...$props.params },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,7 @@ function copyUserToken() {
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Warehouses"
|
url="Warehouses"
|
||||||
|
data-key
|
||||||
order="name"
|
order="name"
|
||||||
@on-fetch="(data) => (warehousesData = data)"
|
@on-fetch="(data) => (warehousesData = data)"
|
||||||
auto-load
|
auto-load
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
|
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -33,16 +34,22 @@ function getAccountAvatar() {
|
||||||
const token = getTokenMultimedia();
|
const token = getTokenMultimedia();
|
||||||
return `/api/Images/user/160x160/${entityId.value}/download?access_token=${token}`;
|
return `/api/Images/user/160x160/${entityId.value}/download?access_token=${token}`;
|
||||||
}
|
}
|
||||||
|
const hasAccount = ref(false);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
:url="`Accounts/${entityId}/exists`"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="(data) => (hasAccount = data.exists)"
|
||||||
|
/>
|
||||||
<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"
|
||||||
data-key="accountData"
|
data-key="AccountId"
|
||||||
:title="data.title"
|
:title="data.title"
|
||||||
:subtitle="data.subtitle"
|
:subtitle="data.subtitle"
|
||||||
>
|
>
|
||||||
|
@ -60,6 +67,10 @@ function getAccountAvatar() {
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</template>
|
</template>
|
||||||
|
<template #menu>
|
||||||
|
{{}}
|
||||||
|
<AccountDescriptorMenu />
|
||||||
|
</template>
|
||||||
<template #before>
|
<template #before>
|
||||||
<QImg :src="getAccountAvatar()" class="photo">
|
<QImg :src="getAccountAvatar()" class="photo">
|
||||||
<template #error>
|
<template #error>
|
||||||
|
@ -83,18 +94,40 @@ function getAccountAvatar() {
|
||||||
<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 #actions="{ entity }">
|
||||||
<QCardActions>
|
<QCardActions class="q-gutter-x-md">
|
||||||
<QBtn
|
<QIcon
|
||||||
round
|
v-if="entity.hasAccount"
|
||||||
flat
|
|
||||||
size="md"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
|
name="contact_mail"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
size="sm"
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
icon="contact_mail"
|
|
||||||
:href="salixUrl + 'ticket/' + entity.ticketFk + '/tracking/index'"
|
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('account.card.ticketTracking') }}</QTooltip>
|
<QTooltip>{{ t('account.card.enabled') }}</QTooltip>
|
||||||
</QBtn>
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="!entity.hasAccount"
|
||||||
|
color="primary"
|
||||||
|
name="contact_mail"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
size="sm"
|
||||||
|
class="fill-icon"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('account.card.disabled') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="!entity.active"
|
||||||
|
color="primary"
|
||||||
|
name="vn:disabled"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
size="sm"
|
||||||
|
class="fill-icon"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('account.card.deactivated') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
</template>
|
</template>
|
||||||
</CardDescriptor>
|
</CardDescriptor>
|
||||||
|
|
|
@ -1,26 +1,62 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
|
|
||||||
const $props = defineProps({
|
|
||||||
account: {
|
|
||||||
type: Object,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
|
||||||
|
const quasar = useQuasar();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openReport } = usePrintService();
|
const { openReport } = usePrintService();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
const account = ref($props.account);
|
const account = computed(() => useArrayData('AccountId').store.data[0]);
|
||||||
|
const entityId = computed(() => route.params.id);
|
||||||
|
|
||||||
|
async function setPassword() {
|
||||||
|
await axios.post(`Accounts`, { id: entityId });
|
||||||
|
}
|
||||||
|
async function enableAccount() {
|
||||||
|
await axios.post(`Accounts`, { id: entityId });
|
||||||
|
account.value.hasAccount = true;
|
||||||
|
quasar.notify({
|
||||||
|
message: t('globals.dataSaved'),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async function disableAccount() {
|
||||||
|
await axios.post(`Accounts`, { id: entityId });
|
||||||
|
account.value.hasAccount = false;
|
||||||
|
quasar.notify({
|
||||||
|
message: t('globals.dataSaved'),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async function activateUser() {
|
||||||
|
await axios.patch(`VnUsers/${entityId.value}`, { active: true });
|
||||||
|
account.value.active = true;
|
||||||
|
// quasar.notify({
|
||||||
|
// message: t('globals.dataSaved'),
|
||||||
|
// type: 'positive',
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
async function deactivateUser() {
|
||||||
|
await axios.patch(`VnUsers/${entityId.value}`, { active: false });
|
||||||
|
account.value.active = false;
|
||||||
|
// quasar.notify({
|
||||||
|
// message: t('globals.dataSaved'),
|
||||||
|
// type: 'positive',
|
||||||
|
// });
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
{{ account }}
|
||||||
<QItem
|
<QItem
|
||||||
v-ripple
|
v-ripple
|
||||||
clickable
|
clickable
|
||||||
|
@ -35,6 +71,21 @@ const account = ref($props.account);
|
||||||
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
|
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem
|
<QItem
|
||||||
|
v-if="!account.hasAccount"
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="
|
||||||
|
openConfirmationModal(
|
||||||
|
t('account.card.actions.enableAccount.title'),
|
||||||
|
t('account.card.actions.enableAccount.subtitle'),
|
||||||
|
enableAccount
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<QItemSection>{{ t('account.card.actions.enableAccount.name') }}</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem
|
||||||
|
v-if="account.hasAccount"
|
||||||
v-ripple
|
v-ripple
|
||||||
clickable
|
clickable
|
||||||
@click="
|
@click="
|
||||||
|
@ -48,17 +99,32 @@ const account = ref($props.account);
|
||||||
<QItemSection>{{ t('account.card.actions.disableAccount.name') }}</QItemSection>
|
<QItemSection>{{ t('account.card.actions.disableAccount.name') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem
|
<QItem
|
||||||
|
v-if="account.active"
|
||||||
v-ripple
|
v-ripple
|
||||||
clickable
|
clickable
|
||||||
@click="
|
@click="
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('account.card.actions.disableUser.title'),
|
t('account.card.actions.deactivateUser.title'),
|
||||||
t('account.card.actions.disableUser.title'),
|
t('account.card.actions.deactivateUser.title'),
|
||||||
actiondisableUser
|
deactivateUser
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<QItemSection>{{ t('account.card.actions.disableUser.name') }}</QItemSection>
|
<QItemSection>{{ t('account.card.actions.deactivateUser.name') }}</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem
|
||||||
|
v-if="!account.active"
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="
|
||||||
|
openConfirmationModal(
|
||||||
|
t('account.card.actions.activateUser.title'),
|
||||||
|
t('account.card.actions.activateUser.title'),
|
||||||
|
activateUser
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<QItemSection>{{ t('account.card.actions.activateUser.name') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem
|
<QItem
|
||||||
v-ripple
|
v-ripple
|
||||||
|
|
|
@ -28,14 +28,28 @@ account:
|
||||||
ticketTracking: Ticket tracking
|
ticketTracking: Ticket tracking
|
||||||
privileges:
|
privileges:
|
||||||
delegate: Can delegate 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:
|
actions:
|
||||||
setPassword: Set password
|
setPassword: Set password
|
||||||
disableAccount:
|
disableAccount:
|
||||||
name: Disable account
|
name: Disable account
|
||||||
title: The account will be disabled
|
title: The account will be disabled
|
||||||
subtitle: Are you sure you want to continue?
|
subtitle: Are you sure you want to continue?
|
||||||
disableUser:
|
enableAccount:
|
||||||
name: Disable user
|
name: Enable account
|
||||||
|
title: The account will be enabled
|
||||||
|
subtitle: Are you sure you want to continue?
|
||||||
|
deactivateUser:
|
||||||
|
name: Deactivate user
|
||||||
|
title: The user will be deactivated
|
||||||
|
subtitle: Are you sure you want to continue?
|
||||||
|
activateUser:
|
||||||
|
name: Activate user
|
||||||
title: The user will be disabled
|
title: The user will be disabled
|
||||||
subtitle: Are you sure you want to continue?
|
subtitle: Are you sure you want to continue?
|
||||||
sync:
|
sync:
|
||||||
|
|
|
@ -24,7 +24,12 @@ account:
|
||||||
alias: Alias
|
alias: Alias
|
||||||
lang: Idioma
|
lang: Idioma
|
||||||
roleFk: Rol
|
roleFk: Rol
|
||||||
ticketTracking: Estados del ticket
|
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
|
newUser: Nuevo usuario
|
||||||
privileges:
|
privileges:
|
||||||
delegate: Puede delegar privilegios
|
delegate: Puede delegar privilegios
|
||||||
|
@ -34,10 +39,18 @@ account:
|
||||||
name: Deshabilitar cuenta
|
name: Deshabilitar cuenta
|
||||||
title: La cuenta será deshabilitada
|
title: La cuenta será deshabilitada
|
||||||
subtitle: ¿Seguro que quieres continuar?
|
subtitle: ¿Seguro que quieres continuar?
|
||||||
disableUser:
|
enableAccount:
|
||||||
|
name: Habilitar cuenta
|
||||||
|
title: La cuenta será habilitada
|
||||||
|
subtitle: ¿Seguro que quieres continuar?
|
||||||
|
deactivateUser:
|
||||||
name: Desactivar usuario
|
name: Desactivar usuario
|
||||||
title: El usuario será deshabilitado
|
title: El usuario será deshabilitado
|
||||||
subtitle: ¿Seguro que quieres continuar?
|
subtitle: ¿Seguro que quieres continuar?
|
||||||
|
activateUser:
|
||||||
|
name: Activar usuario
|
||||||
|
title: El usuario será activado
|
||||||
|
subtitle: ¿Seguro que quieres continuar?
|
||||||
sync:
|
sync:
|
||||||
name: Sincronizar
|
name: Sincronizar
|
||||||
title: El usuario será sincronizado
|
title: El usuario será sincronizado
|
||||||
|
|
|
@ -21,6 +21,13 @@ const filter = {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="Countries"
|
||||||
|
data-key
|
||||||
|
auto-load
|
||||||
|
@on-fetch="(data) => (countries = data)"
|
||||||
|
sort-by="name"
|
||||||
|
/>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="InvoiceIn"
|
data-key="InvoiceIn"
|
||||||
base-url="InvoiceIns"
|
base-url="InvoiceIns"
|
||||||
|
|
|
@ -16,7 +16,7 @@ const currency = computed(
|
||||||
);
|
);
|
||||||
const invoceInIntrastat = ref([]);
|
const invoceInIntrastat = ref([]);
|
||||||
const rowsSelected = ref([]);
|
const rowsSelected = ref([]);
|
||||||
const countries = ref([]);
|
const countries = computed(() => useArrayData('Countries').store.data);
|
||||||
const intrastats = ref([]);
|
const intrastats = ref([]);
|
||||||
const invoiceInFormRef = ref();
|
const invoiceInFormRef = ref();
|
||||||
const invoiceInId = computed(() => +route.params.id);
|
const invoiceInId = computed(() => +route.params.id);
|
||||||
|
@ -76,12 +76,6 @@ const getTotal = (data, key) =>
|
||||||
data.reduce((acc, cur) => acc + +String(cur[key]).replace(',', '.'), 0);
|
data.reduce((acc, cur) => acc + +String(cur[key]).replace(',', '.'), 0);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
url="Countries"
|
|
||||||
auto-load
|
|
||||||
@on-fetch="(data) => (countries = data)"
|
|
||||||
sort-by="name"
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Intrastats"
|
url="Intrastats"
|
||||||
sort-by="id"
|
sort-by="id"
|
||||||
|
|
|
@ -182,6 +182,12 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="Countries"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="(data) => (countries = data)"
|
||||||
|
sort-by="name"
|
||||||
|
/>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
data-key="InvoiceInSummary"
|
data-key="InvoiceInSummary"
|
||||||
:url="`InvoiceIns/${entityId}/summary`"
|
:url="`InvoiceIns/${entityId}/summary`"
|
||||||
|
|
Loading…
Reference in New Issue