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