Merge branch 'test' into 6943_re_propagate
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Javier Segarra 2025-02-17 00:40:08 +01:00
commit a3804d5e10
15 changed files with 83 additions and 65 deletions

View File

@ -304,6 +304,10 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
}
}
}
function cardClick(_, row) {
if ($props.redirect) router.push({ path: `/${$props.redirect}/${row.id}` });
}
</script>
<template>
<QDrawer
@ -494,18 +498,13 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
</template>
<template #item="{ row, colsMap }">
<component
:is="$props.redirect ? 'router-link' : 'span'"
:to="`/${$props.redirect}/` + row.id"
v-bind:is="'div'"
@click="(event) => cardClick(event, row)"
>
<QCard
bordered
flat
class="row no-wrap justify-between cursor-pointer q-pa-sm"
@click="
(_, row) => {
$props.rowClick && $props.rowClick(row);
}
"
style="height: 100%"
>
<QCardSection

View File

@ -11,6 +11,7 @@ export async function useCau(res, message) {
const { config, headers, request, status, statusText, data } = res || {};
const { params, url, method, signal, headers: confHeaders } = config || {};
const { message: resMessage, code, name } = data?.error || {};
delete confHeaders.Authorization;
const additionalData = {
path: location.hash,
@ -40,7 +41,7 @@ export async function useCau(res, message) {
handler: async () => {
const locale = i18n.global.t;
const reason = ref(
code == 'ACCESS_DENIED' ? locale('cau.askPrivileges') : ''
code == 'ACCESS_DENIED' ? locale('cau.askPrivileges') : '',
);
openConfirmationModal(
locale('cau.title'),
@ -59,10 +60,9 @@ export async function useCau(res, message) {
'onUpdate:modelValue': (val) => (reason.value = val),
label: locale('cau.inputLabel'),
class: 'full-width',
required: true,
autofocus: true,
},
}
},
);
},
},

View File

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

View File

@ -57,7 +57,6 @@ function onFetch(rows, newRows) {
const price = row.quantity * sale.price;
const discount = (sale.discount * price) / 100;
amountClaimed.value = amountClaimed.value + (price - discount);
}
}
@ -191,7 +190,7 @@ async function saveWhenHasChanges() {
ref="claimLinesForm"
:url="`Claims/${route.params.id}/lines`"
save-url="ClaimBeginnings/crud"
:filter="linesFilter"
:user-filter="linesFilter"
@on-fetch="onFetch"
v-model:selected="selected"
:default-save="false"
@ -208,7 +207,6 @@ async function saveWhenHasChanges() {
selection="multiple"
v-model:selected="selected"
:grid="$q.screen.lt.md"
>
<template #body-cell-claimed="{ row }">
<QTd auto-width align="right" class="text-primary shrink">
@ -330,9 +328,10 @@ async function saveWhenHasChanges() {
width: 100%;
}
.grid-style-transition {
transition: transform 0.28s, background-color 0.28s;
transition:
transform 0.28s,
background-color 0.28s;
}
</style>
<i18n>

View File

@ -1,8 +1,6 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
@ -14,15 +12,14 @@ const props = defineProps({
type: String,
required: true,
},
states: {
type: Array,
default: () => [],
},
});
const states = ref([]);
defineExpose({ states });
</script>
<template>
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">

View File

@ -10,12 +10,13 @@ import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import VnTable from 'src/components/VnTable/VnTable.vue';
import ZoneDescriptorProxy from '../Zone/Card/ZoneDescriptorProxy.vue';
import VnSection from 'src/components/common/VnSection.vue';
import FetchData from 'src/components/FetchData.vue';
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const dataKey = 'ClaimList';
const claimFilterRef = ref();
const states = ref([]);
const columns = computed(() => [
{
align: 'left',
@ -81,8 +82,7 @@ const columns = computed(() => [
align: 'left',
label: t('claim.state'),
format: ({ stateCode }) =>
claimFilterRef.value?.states.find(({ code }) => code === stateCode)
?.description,
states.value?.find(({ code }) => code === stateCode)?.description,
name: 'stateCode',
chip: {
condition: () => true,
@ -92,7 +92,7 @@ const columns = computed(() => [
name: 'claimStateFk',
component: 'select',
attrs: {
options: claimFilterRef.value?.states,
options: states.value,
optionLabel: 'description',
},
},
@ -125,6 +125,7 @@ const STATE_COLOR = {
</script>
<template>
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
<VnSection
:data-key="dataKey"
:columns="columns"
@ -135,7 +136,7 @@ const STATE_COLOR = {
}"
>
<template #advanced-menu>
<ClaimFilter data-key="ClaimList" ref="claimFilterRef" />
<ClaimFilter :data-key ref="claimFilterRef" :states />
</template>
<template #body>
<VnTable

View File

@ -12,6 +12,7 @@ import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnLocation from 'src/components/common/VnLocation.vue';
import { getDifferences, getUpdatedValues } from 'src/filters';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
const quasar = useQuasar();
@ -29,6 +30,12 @@ function handleLocation(data, location) {
data.provinceFk = provinceFk;
data.countryFk = countryFk;
}
function onBeforeSave(formData, originalData) {
return getUpdatedValues(
Object.keys(getDifferences(formData, originalData)),
formData,
);
}
async function checkEtChanges(data, _, originalData) {
const equalizatedHasChanged = originalData.isEqualizated != data.isEqualizated;
@ -67,6 +74,7 @@ async function acceptPropagate({ isEqualizated }) {
:url-update="`Clients/${route.params.id}/updateFiscalData`"
auto-load
model="customer"
:mapper="onBeforeSave"
observe-form-changes
@on-data-saved="checkEtChanges"
>

View File

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

View File

@ -61,6 +61,7 @@ function exprBuilder(param, value) {
case 'nickname':
return { [`t.nickname`]: { like: `%${value}%` } };
case 'zoneFk':
return { 't.zoneFk': value };
case 'department':
return { 'd.name': value };
case 'totalWithVat':

View File

@ -43,10 +43,9 @@ const addToOrder = async () => {
);
state.set('orderTotal', orderTotal);
const rows = orderData.value.rows.push(...items) || [];
state.set('orderData', {
...orderData.value,
rows,
items,
});
notify(t('globals.dataSaved'), 'positive');
emit('added', -totalQuantity(items));

View File

@ -15,7 +15,7 @@ const sectors = ref([]);
const sectorFilter = { fields: ['id', 'description'] };
const filter = {
fields: ['sectorFk', 'code', 'pickingOrder', 'row', 'column'],
fields: ['sectorFk', 'code', 'pickingOrder'],
include: [{ relation: 'sector', scope: sectorFilter }],
};
</script>
@ -33,10 +33,6 @@ const filter = {
<VnInput v-model="data.code" :label="t('globals.code')" />
<VnInput v-model="data.pickingOrder" :label="t('parking.pickingOrder')" />
</VnRow>
<VnRow>
<VnInput v-model="data.row" :label="t('parking.row')" />
<VnInput v-model="data.column" :label="t('parking.column')" />
</VnRow>
<VnRow>
<VnSelect
v-model="data.sectorFk"

View File

@ -1,7 +1,5 @@
parking:
pickingOrder: Picking order
sector: Sector
row: Row
column: Column
search: Search parking
searchInfo: You can search by parking code

View File

@ -1,7 +1,5 @@
parking:
pickingOrder: Orden de recogida
row: Fila
sector: Sector
column: Columna
search: Buscar parking
searchInfo: Puedes buscar por código de parking

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed } from 'vue';
import { ref, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
@ -7,7 +7,7 @@ import VnLv from 'components/ui/VnLv.vue';
import useCardDescription from 'composables/useCardDescription';
import { dashIfEmpty, toDate } from 'src/filters';
import RouteDescriptorMenu from 'pages/Route/Card/RouteDescriptorMenu.vue';
import axios from 'axios';
const $props = defineProps({
id: {
type: Number,
@ -18,10 +18,24 @@ const $props = defineProps({
const route = useRoute();
const { t } = useI18n();
const zone = ref();
const zoneId = ref();
const entityId = computed(() => {
return $props.id || route.params.id;
});
const getZone = async () => {
const filter = {
where: { routeFk: $props.id ? $props.id : route.params.id },
};
const { data } = await axios.get('Tickets/findOne', {
params: {
filter: JSON.stringify(filter),
},
});
zoneId.value = data.zoneFk;
const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`);
zone.value = zoneData.name;
};
const filter = {
fields: [
@ -38,7 +52,6 @@ const filter = {
'started',
'finished',
'cost',
'zoneFk',
'isOk',
],
include: [
@ -47,7 +60,13 @@ const filter = {
relation: 'vehicle',
scope: { fields: ['id', 'm3'] },
},
{ relation: 'zone', scope: { fields: ['id', 'name'] } },
{
relation: 'ticket',
scope: {
fields: ['id', 'name', 'zoneFk'],
include: { relation: 'zone', scope: { fields: ['id', 'name'] } },
},
},
{
relation: 'worker',
scope: {
@ -65,6 +84,9 @@ const filter = {
};
const data = ref(useCardDescription());
const setData = (entity) => (data.value = useCardDescription(entity.code, entity.id));
onMounted(async () => {
getZone();
});
</script>
<template>
@ -81,11 +103,11 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
<template #body="{ entity }">
<VnLv :label="t('Date')" :value="toDate(entity?.dated)" />
<VnLv :label="t('Agency')" :value="entity?.agencyMode?.name" />
<VnLv :label="t('Zone')" :value="entity?.zone?.name" />
<VnLv :label="t('Zone')" :value="zone" />
<VnLv
:label="t('Volume')"
:value="`${dashIfEmpty(entity?.m3)} / ${dashIfEmpty(
entity?.vehicle?.m3
entity?.vehicle?.m3,
)} `"
/>
<VnLv :label="t('Description')" :value="entity?.description" />

View File

@ -43,7 +43,6 @@ const routeFilter = {
'started',
'finished',
'cost',
'zoneFk',
'isOk',
],
include: [
@ -52,7 +51,13 @@ const routeFilter = {
relation: 'vehicle',
scope: { fields: ['id', 'm3'] },
},
{ relation: 'zone', scope: { fields: ['id', 'name'] } },
{
relation: 'ticket',
scope: {
fields: ['id', 'name', 'zoneFk'],
include: { relation: 'zone', scope: { fields: ['id', 'name'] } },
},
},
{
relation: 'worker',
scope: {