forked from verdnatura/salix-front
fix: refs #7529 front
This commit is contained in:
parent
eea6276264
commit
8b2fbefc35
|
@ -1,21 +1,48 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
import axios from 'axios';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import FormModel from 'src/components/FormModel.vue';
|
import FormModel from 'src/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 VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import CrudModel from 'components/CrudModel.vue';
|
import CrudModel from 'components/CrudModel.vue';
|
||||||
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
const { notify } = useNotify();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
|
||||||
const disabilityGradesOptions = ref();
|
const disabilityGradesOptions = ref();
|
||||||
const toCustomerAddressCreate = () => {
|
const workerPitCrudRef = ref({});
|
||||||
router.push({ name: 'CustomerAddressCreate' });
|
const insertTag = () => {
|
||||||
|
workerPitCrudRef.value.insert();
|
||||||
|
};
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const deleteRelative = async (id) => {
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
quasar
|
||||||
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('Remove Relative'),
|
||||||
|
message: t('Do you want to remove this relative?'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(() => {
|
||||||
|
resolve(true);
|
||||||
|
})
|
||||||
|
.onCancel(() => {
|
||||||
|
resolve(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await axios.delete(`WorkerRelatives/${id}`);
|
||||||
|
workerPitCrudRef.value.reload();
|
||||||
|
notify('Relative removed', 'positive');
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -25,100 +52,170 @@ const toCustomerAddressCreate = () => {
|
||||||
@on-fetch="(data) => (disabilityGradesOptions = data)"
|
@on-fetch="(data) => (disabilityGradesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormModel
|
<FormModel
|
||||||
url="WorkerIrpfs"
|
url="WorkerIrpfs"
|
||||||
:filter="{ where: { workerFk: route.params.id } }"
|
:filter="{ where: { workerFk: route.params.id } }"
|
||||||
auto-load
|
auto-load
|
||||||
model="WorkerIrpfs"
|
data-key="workerIrpfs"
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
<QCard class="q-px-lg q-py-lg">
|
||||||
<VnInput
|
<VnTitle :text="t('IRPF')" />
|
||||||
:label="t('familySituation')"
|
<VnRow>
|
||||||
clearable
|
<VnInput
|
||||||
v-model="data.familySituation"
|
:label="t('familySituation')"
|
||||||
/>
|
clearable
|
||||||
<VnInput :label="t('spouseNif')" clearable v-model="data.spouseNif" />
|
v-model="data.familySituation"
|
||||||
</VnRow>
|
/>
|
||||||
<VnRow>
|
<VnInput :label="t('spouseNif')" clearable v-model="data.spouseNif" />
|
||||||
<VnSelect
|
</VnRow>
|
||||||
:label="t('disabilityGrades')"
|
<VnRow>
|
||||||
:options="disabilityGradesOptions"
|
<VnSelect
|
||||||
hide-selected
|
:label="t('disabilityGrades')"
|
||||||
option-label="description"
|
:options="disabilityGradesOptions"
|
||||||
option-value="id"
|
option-label="description"
|
||||||
v-model="data.disabilityGradeFk"
|
option-value="id"
|
||||||
/>
|
v-model="data.disabilityGradeFk"
|
||||||
|
/>
|
||||||
|
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('geographicMobilityDate')"
|
:label="t('geographicMobilityDate')"
|
||||||
v-model="data.geographicMobilityDate"
|
v-model="data.geographicMobilityDate"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
clearable
|
||||||
|
v-model="data.childPension"
|
||||||
|
:label="t(`childPension`)"
|
||||||
|
/>
|
||||||
|
<VnInput
|
||||||
|
clearable
|
||||||
|
v-model="data.spousePension"
|
||||||
|
:label="t(`spousePension`)"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<QCheckbox v-model="data.isDependend" :label="t(`isDependend`)" />
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.hasHousingPaymentBefore"
|
||||||
|
:label="t(`hasHousingPaymentBefore`)"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.hasHousingPaymentAfter"
|
||||||
|
:label="t(`hasHousingPaymentAfter`)"
|
||||||
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.hasExtendedWorking"
|
||||||
|
:label="t(`hasExtendedWorking`)"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</QCard>
|
||||||
|
|
||||||
<VnRow>
|
<CrudModel
|
||||||
<VnInput
|
ref="workerPitCrudRef"
|
||||||
clearable
|
data-key="workerPit"
|
||||||
v-model="data.childPension"
|
url="WorkerRelatives"
|
||||||
:label="t(`childPension`)"
|
auto-load
|
||||||
/>
|
:filter="{
|
||||||
<VnInput
|
where: { workerFk: route.params.id },
|
||||||
clearable
|
}"
|
||||||
v-model="data.spousePension"
|
:data-required="{ workerFk: route.params.id }"
|
||||||
:label="t(`spousePension`)"
|
:has-sub-toolbar="false"
|
||||||
/>
|
>
|
||||||
</VnRow>
|
<template #body="{ rows }">
|
||||||
|
<QCard class="q-px-lg q-py-lg" flat>
|
||||||
|
<div class="row no-wrap justify-between q-pb-md">
|
||||||
|
<VnTitle :text="t('Relatives')" />
|
||||||
|
<QBtnGroup push style="column-gap: 10px">
|
||||||
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
icon="restart_alt"
|
||||||
|
flat
|
||||||
|
@click="workerPitCrudRef.reset"
|
||||||
|
:disable="!workerPitCrudRef.hasChanges"
|
||||||
|
:title="t('globals.reset')"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
ref="saveButtonRef"
|
||||||
|
color="primary"
|
||||||
|
icon="save"
|
||||||
|
@click="workerPitCrudRef.onSubmit"
|
||||||
|
:disable="!workerPitCrudRef.hasChanges"
|
||||||
|
:title="t('globals.save')"
|
||||||
|
/>
|
||||||
|
</QBtnGroup>
|
||||||
|
</div>
|
||||||
|
<VnRow
|
||||||
|
v-for="(row, index) in rows"
|
||||||
|
:key="index"
|
||||||
|
class="row q-gutter-lg q-mb-lg"
|
||||||
|
padding="none"
|
||||||
|
>
|
||||||
|
<VnSelect
|
||||||
|
:options="[
|
||||||
|
{ id: 0, name: 'Ascendiente' },
|
||||||
|
{ id: 1, name: 'Descendiente' },
|
||||||
|
]"
|
||||||
|
:label="t('isDescendant')"
|
||||||
|
v-model="row.isDescendant"
|
||||||
|
/>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('disabilityGrades')"
|
||||||
|
:options="disabilityGradesOptions"
|
||||||
|
option-label="description"
|
||||||
|
option-value="id"
|
||||||
|
v-model="row.disabilityGradeFk"
|
||||||
|
padding="none"
|
||||||
|
/>
|
||||||
|
<VnInput
|
||||||
|
type="number"
|
||||||
|
v-model="row.birthed"
|
||||||
|
:label="t(`birthed`)"
|
||||||
|
/>
|
||||||
|
|
||||||
<VnRow>
|
<VnInput
|
||||||
<QCheckbox
|
type="number"
|
||||||
size="sm"
|
v-model="row.adoptionYear"
|
||||||
v-model="data.isDependend"
|
:label="t(`adoptionYear`)"
|
||||||
:label="t(`isDependend`)"
|
/>
|
||||||
/>
|
<QCheckbox
|
||||||
<QCheckbox
|
v-model="row.isDependend"
|
||||||
size="sm"
|
:label="t(`isDependend`)"
|
||||||
v-model="data.hasHousingPaymentBefore"
|
/>
|
||||||
:label="t(`hasHousingPaymentBefore`)"
|
<QCheckbox
|
||||||
/>
|
v-model="row.isJointCustody"
|
||||||
</VnRow>
|
:label="t(`isJointCustody`)"
|
||||||
<VnRow>
|
size="xs"
|
||||||
<QCheckbox
|
/>
|
||||||
size="sm"
|
<QBtn
|
||||||
v-model="data.hasHousingPaymentAfter"
|
@click="deleteRelative(rows[0].id)"
|
||||||
:label="t(`hasHousingPaymentAfter`)"
|
class="cursor-pointer"
|
||||||
/>
|
color="primary"
|
||||||
|
flat
|
||||||
<QCheckbox
|
icon="delete"
|
||||||
size="sm"
|
style="flex: 0"
|
||||||
v-model="data.hasExtendedWorking"
|
/>
|
||||||
:label="t(`hasExtendedWorking`)"
|
</VnRow>
|
||||||
/>
|
<VnRow class="justify-left items-center">
|
||||||
</VnRow>
|
<QBtn
|
||||||
<QSeparator class="q-mx-lg" vertical />
|
@click="insertTag(rows)"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
|
style="flex: 0"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</QCard>
|
||||||
|
</template>
|
||||||
|
</CrudModel>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
<CrudModel
|
|
||||||
ref="workerPitCrudRef"
|
|
||||||
data-key="workerPit"
|
|
||||||
url="WorkerRelatives"
|
|
||||||
auto-load
|
|
||||||
>
|
|
||||||
<template #body="{ rows }">
|
|
||||||
<QTable
|
|
||||||
:columns="columns"
|
|
||||||
:rows="rows"
|
|
||||||
row-key="$index"
|
|
||||||
selection="multiple"
|
|
||||||
v-model:selected="selected"
|
|
||||||
table-header-class="text-left"
|
|
||||||
></QTable>
|
|
||||||
</template>
|
|
||||||
<!-- <VnRow>
|
|
||||||
<VnInputDate size="sm" v-model="data.birthed" :label="t(`birthed`)" />
|
|
||||||
|
|
||||||
<VnInput size="sm" v-model="data.adoptionYear" :label="t(`adoptionYear`)" />
|
|
||||||
</VnRow> -->
|
|
||||||
</CrudModel>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
@ -133,6 +230,12 @@ es:
|
||||||
hasHousingPaymentBefore: Pagos vivienda anterior 2011
|
hasHousingPaymentBefore: Pagos vivienda anterior 2011
|
||||||
hasHousingPaymentAfter: Pagos vivienda posterior 2011
|
hasHousingPaymentAfter: Pagos vivienda posterior 2011
|
||||||
hasExtendedWorking: Prolongación actividad laboral
|
hasExtendedWorking: Prolongación actividad laboral
|
||||||
|
isDescendant: Descen/Ascen
|
||||||
|
disabilityGradeFk: Discapacidad
|
||||||
|
birthed: Año nacimiento
|
||||||
|
adoptionYear: Año adopción
|
||||||
|
isJointCustody: Computo por entero
|
||||||
|
Relatives: Relacionados
|
||||||
en:
|
en:
|
||||||
familySituation: Family Situation
|
familySituation: Family Situation
|
||||||
disabilityGrades: Disability Grades
|
disabilityGrades: Disability Grades
|
||||||
|
@ -144,4 +247,10 @@ en:
|
||||||
hasHousingPaymentBefore: Housing Payments Before 2011
|
hasHousingPaymentBefore: Housing Payments Before 2011
|
||||||
hasHousingPaymentAfter: Housing Payments After 2011
|
hasHousingPaymentAfter: Housing Payments After 2011
|
||||||
hasExtendedWorking: Extended Work Activity
|
hasExtendedWorking: Extended Work Activity
|
||||||
|
isDescendant: Descendant/Ascendant
|
||||||
|
disabilityGradeFk: Disability Grade
|
||||||
|
birthed: Birth Year
|
||||||
|
adoptionYear: Adoption Year
|
||||||
|
isJointCustody: Joint custody
|
||||||
|
Relatives: Relatives
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
Loading…
Reference in New Issue