Solucion a comentarios 9
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
ab20ec1738
commit
5e2c668fec
|
@ -114,7 +114,7 @@ const toCustomerCreditCreate = () => {
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
|
||||||
<h5 class="flex justify-center label-color" v-else>
|
<h5 class="flex justify-center color-vn-label" v-else>
|
||||||
{{ t('globals.noResults') }}
|
{{ t('globals.noResults') }}
|
||||||
</h5>
|
</h5>
|
||||||
</QPage>
|
</QPage>
|
||||||
|
@ -127,12 +127,6 @@ const toCustomerCreditCreate = () => {
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.label-color {
|
|
||||||
color: var(--vn-label);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Since: Desde
|
Since: Desde
|
||||||
|
|
|
@ -22,7 +22,6 @@ const quasar = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const showSmsDialog = () => {
|
const showSmsDialog = () => {
|
||||||
console.log('showSmsDialog()');
|
|
||||||
quasar.dialog({
|
quasar.dialog({
|
||||||
component: VnSmsDialog,
|
component: VnSmsDialog,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
|
|
@ -226,7 +226,7 @@ const toCustomerFileManagementCreate = () => {
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
|
||||||
<h5 class="flex justify-center label-color" v-else>
|
<h5 class="flex justify-center color-vn-label" v-else>
|
||||||
{{ t('globals.noResults') }}
|
{{ t('globals.noResults') }}
|
||||||
</h5>
|
</h5>
|
||||||
</QPage>
|
</QPage>
|
||||||
|
@ -244,12 +244,6 @@ const toCustomerFileManagementCreate = () => {
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.label-color {
|
|
||||||
color: var(--vn-label);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Id: Id
|
Id: Id
|
||||||
|
|
|
@ -119,7 +119,7 @@ const columns = computed(() => [
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
|
||||||
<h5 class="flex justify-center label-color" v-else>
|
<h5 class="flex justify-center color-vn-label" v-else>
|
||||||
{{ t('globals.noResults') }}
|
{{ t('globals.noResults') }}
|
||||||
</h5>
|
</h5>
|
||||||
</QPage>
|
</QPage>
|
||||||
|
|
|
@ -1,24 +1,41 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
|
import useNotify from 'src/composables/useNotify';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
|
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
|
||||||
|
|
||||||
|
const { notify } = useNotify();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { validate } = useValidator();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const updateUserRef = ref(null);
|
const active = ref(false);
|
||||||
const canChangePassword = ref(0);
|
const canChangePassword = ref(0);
|
||||||
const userPasswords = ref(0);
|
const email = ref(null);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
const name = ref(null);
|
||||||
|
const usersPreviewRef = ref(null);
|
||||||
|
const user = ref([]);
|
||||||
|
const userPasswords = ref(0);
|
||||||
|
|
||||||
|
const dataChanges = computed(() => {
|
||||||
|
return (
|
||||||
|
user.value.active !== active.value ||
|
||||||
|
user.value.email !== email.value ||
|
||||||
|
user.value.name !== name.value
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
const filter = { where: { id: `${route.params.id}` } };
|
const filter = { where: { id: `${route.params.id}` } };
|
||||||
|
|
||||||
|
@ -28,17 +45,46 @@ const showChangePasswordDialog = () => {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
id: route.params.id,
|
id: route.params.id,
|
||||||
userPasswords: userPasswords.value,
|
userPasswords: userPasswords.value,
|
||||||
promise: refreshData,
|
promise: getData,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const refreshData = () => {
|
const getData = (data) => {
|
||||||
updateUserRef.value.fetch();
|
active.value = data[0].active;
|
||||||
|
email.value = data[0].email;
|
||||||
|
name.value = data[0].name;
|
||||||
|
user.value = data[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSubmit = async () => {
|
||||||
|
isLoading.value = true;
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
active: active.value,
|
||||||
|
email: email.value,
|
||||||
|
name: name.value,
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
await axios.patch(`Clients/${route.params.id}/updateUser`, payload);
|
||||||
|
notify('globals.dataSaved', 'positive');
|
||||||
|
if (usersPreviewRef.value) usersPreviewRef.value.fetch();
|
||||||
|
} catch (error) {
|
||||||
|
notify('errors.create', 'negative');
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
:filter="filter"
|
||||||
|
@on-fetch="getData"
|
||||||
|
auto-load
|
||||||
|
ref="usersPreviewRef"
|
||||||
|
url="VnUsers/preview"
|
||||||
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
:url="`Clients/${route.params.id}/hasCustomerRole`"
|
:url="`Clients/${route.params.id}/hasCustomerRole`"
|
||||||
@on-fetch="(data) => (canChangePassword = data)"
|
@on-fetch="(data) => (canChangePassword = data)"
|
||||||
|
@ -50,58 +96,39 @@ const refreshData = () => {
|
||||||
url="UserPasswords"
|
url="UserPasswords"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormModel
|
<QCard class="q-pa-lg">
|
||||||
:default-actions="false"
|
<QCardSection>
|
||||||
:filter="filter"
|
<QForm @submit.prevent="onSubmit">
|
||||||
:observe-form-changes="false"
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
:url-update="`Clients/${route.params.id}/updateUser`"
|
<div class="col">
|
||||||
:url="'VnUsers/preview'"
|
<QCheckbox :label="t('Enable web access')" v-model="active" />
|
||||||
model="client"
|
</div>
|
||||||
ref="updateUserRef"
|
</VnRow>
|
||||||
>
|
|
||||||
<template #form="{ data, validate }">
|
|
||||||
<div v-if="data?.length">
|
|
||||||
<div
|
|
||||||
v-for="(item, index) in data"
|
|
||||||
:key="index"
|
|
||||||
:class="{
|
|
||||||
'q-mb-md': index < data.length - 1,
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
|
||||||
<div class="col">
|
|
||||||
<QCheckbox
|
|
||||||
:label="t('Enable web access')"
|
|
||||||
v-model="item.active"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput :label="t('User')" clearable v-model="item.name" />
|
<VnInput :label="t('User')" clearable v-model="name" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Recovery email')"
|
:label="t('Recovery email')"
|
||||||
:rules="validate('client.email')"
|
:rules="validate('client.email')"
|
||||||
clearable
|
clearable
|
||||||
type="email"
|
type="email"
|
||||||
v-model="item.email"
|
v-model="email"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon name="info" class="cursor-pointer">
|
<QIcon name="info" class="cursor-pointer">
|
||||||
<QTooltip>{{
|
<QTooltip>{{
|
||||||
t(
|
t(
|
||||||
'This email is used for user to regain access their account'
|
'This email is used for user to regain access their account'
|
||||||
)
|
)
|
||||||
}}</QTooltip>
|
}}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="q-mt-lg row justify-end">
|
<div class="q-mt-lg row justify-end">
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -124,16 +151,16 @@ const refreshData = () => {
|
||||||
v-if="canChangePassword"
|
v-if="canChangePassword"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:disabled="isLoading || canChangePassword"
|
:disabled="isLoading || !dataChanges"
|
||||||
:label="t('globals.save')"
|
:label="t('globals.save')"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</QForm>
|
||||||
</template>
|
</QCardSection>
|
||||||
</FormModel>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -129,7 +129,7 @@ const refreshData = () => {
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
|
||||||
<h5 class="flex justify-center label-color" v-else>
|
<h5 class="flex justify-center color-vn-label" v-else>
|
||||||
{{ t('globals.noResults') }}
|
{{ t('globals.noResults') }}
|
||||||
</h5>
|
</h5>
|
||||||
</QPage>
|
</QPage>
|
||||||
|
|
Loading…
Reference in New Issue