Merge branch 'master' into hotfix-AddItemToOrder
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Jon Elias 2025-02-12 07:32:31 +00:00
commit 61199d456e
3 changed files with 21 additions and 18 deletions

View File

@ -34,6 +34,12 @@ account.value.hasAccount = hasAccount.value;
const entityId = computed(() => +route.params.id); const entityId = computed(() => +route.params.id);
const hasitManagementAccess = ref(); const hasitManagementAccess = ref();
const hasSysadminAccess = ref(); const hasSysadminAccess = ref();
const isHimself = computed(() => user.value.id === account.value.id);
const url = computed(() =>
isHimself.value
? 'Accounts/change-password'
: `Accounts/${entityId.value}/setPassword`
);
async function updateStatusAccount(active) { async function updateStatusAccount(active) {
if (active) { if (active) {
@ -106,11 +112,8 @@ onMounted(() => {
:ask-old-pass="askOldPass" :ask-old-pass="askOldPass"
:submit-fn=" :submit-fn="
async (newPassword, oldPassword) => { async (newPassword, oldPassword) => {
await axios.patch(`Accounts/change-password`, { const body = isHimself ? { userId: entityId, oldPassword } : {};
userId: entityId, await axios.patch(url, { ...body, newPassword });
newPassword,
oldPassword,
});
} }
" "
/> />
@ -158,16 +161,10 @@ onMounted(() => {
> >
<QItemSection>{{ t('globals.delete') }}</QItemSection> <QItemSection>{{ t('globals.delete') }}</QItemSection>
</QItem> </QItem>
<QItem <QItem v-if="hasSysadminAccess" v-ripple clickable>
v-if="hasSysadminAccess" <QItemSection @click="onChangePass(isHimself)">
v-ripple {{ isHimself ? t('globals.changePass') : t('globals.setPass') }}
clickable
@click="user.id === account.id ? onChangePass(true) : onChangePass(false)"
>
<QItemSection v-if="user.id === account.id">
{{ t('globals.changePass') }}
</QItemSection> </QItemSection>
<QItemSection v-else>{{ t('globals.setPass') }}</QItemSection>
</QItem> </QItem>
<QItem <QItem
v-if="!account.hasAccount && hasSysadminAccess" v-if="!account.hasAccount && hasSysadminAccess"

View File

@ -9,6 +9,7 @@ import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnLocation from 'src/components/common/VnLocation.vue'; import VnLocation from 'src/components/common/VnLocation.vue';
import { getDifferences, getUpdatedValues } from 'src/filters';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -23,6 +24,12 @@ function handleLocation(data, location) {
data.provinceFk = provinceFk; data.provinceFk = provinceFk;
data.countryFk = countryFk; data.countryFk = countryFk;
} }
function onBeforeSave(formData, originalData) {
return getUpdatedValues(
Object.keys(getDifferences(formData, originalData)),
formData,
);
}
</script> </script>
<template> <template>
@ -36,6 +43,7 @@ function handleLocation(data, location) {
:url-update="`Clients/${route.params.id}/updateFiscalData`" :url-update="`Clients/${route.params.id}/updateFiscalData`"
auto-load auto-load
model="customer" model="customer"
:mapper="onBeforeSave"
> >
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow> <VnRow>

View File

@ -31,20 +31,18 @@ onMounted(async () => {
ref="summary" ref="summary"
:url="`Departments/${entityId}`" :url="`Departments/${entityId}`"
class="full-width" class="full-width"
style="max-width: 900px"
module-name="Department"
> >
<template #header="{ entity }"> <template #header="{ entity }">
<div>{{ entity.name }}</div> <div>{{ entity.name }}</div>
</template> </template>
<template #body="{ entity: department }"> <template #body="{ entity: department }">
<QCard class="column"> <QCard class="vn-one">
<VnTitle <VnTitle
:url="`#/worker/department/${entityId}/basic-data`" :url="`#/worker/department/${entityId}/basic-data`"
:text="t('Basic data')" :text="t('Basic data')"
/> />
<div class="full-width row wrap justify-between content-between"> <div class="full-width row wrap justify-between content-between">
<div class="column" style="min-width: 50%"> <div class="column">
<VnLv :label="t('globals.name')" :value="department.name" dash /> <VnLv :label="t('globals.name')" :value="department.name" dash />
<VnLv :label="t('globals.code')" :value="department.code" dash /> <VnLv :label="t('globals.code')" :value="department.code" dash />
<VnLv <VnLv