Merge branch 'dev' into 8441-createVehicleInvoiceInSection
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
commit
cf92ea8f47
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted, computed } from 'vue';
|
import { ref, onMounted, onUnmounted, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
@ -21,7 +21,6 @@ const stateStore = useStateStore();
|
||||||
const validationsStore = useValidator();
|
const validationsStore = useValidator();
|
||||||
const { models } = validationsStore;
|
const { models } = validationsStore;
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
model: {
|
model: {
|
||||||
|
@ -273,7 +272,7 @@ onUnmounted(() => {
|
||||||
:data-key
|
:data-key
|
||||||
:url="dataKey + 's'"
|
:url="dataKey + 's'"
|
||||||
:user-filter="filter"
|
:user-filter="filter"
|
||||||
:filter="{ where: { and: [{ originFk: route.params.id }] } }"
|
:user-params="{ originFk: route.params.id }"
|
||||||
:skeleton="false"
|
:skeleton="false"
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="setLogTree"
|
@on-fetch="setLogTree"
|
||||||
|
|
|
@ -313,6 +313,7 @@ export function useArrayData(key, userOptions) {
|
||||||
const { params, limit } = getCurrentFilter();
|
const { params, limit } = getCurrentFilter();
|
||||||
store.currentFilter = JSON.parse(JSON.stringify(params));
|
store.currentFilter = JSON.parse(JSON.stringify(params));
|
||||||
delete store.currentFilter.filter.include;
|
delete store.currentFilter.filter.include;
|
||||||
|
delete store.currentFilter.filter.fields;
|
||||||
store.currentFilter.filter = JSON.stringify(store.currentFilter.filter);
|
store.currentFilter.filter = JSON.stringify(store.currentFilter.filter);
|
||||||
return { params, limit };
|
return { params, limit };
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,20 @@
|
||||||
import { computed, 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 { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import { toCurrency, toDateHourMin } from 'src/filters';
|
import { toCurrency, toDateHourMin } from 'src/filters';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const quasar = useQuasar();
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
|
||||||
|
@ -45,26 +51,45 @@ const columns = computed(() => [
|
||||||
align: 'right',
|
align: 'right',
|
||||||
field: 'rating',
|
field: 'rating',
|
||||||
label: t('customer.summary.rating'),
|
label: t('customer.summary.rating'),
|
||||||
name: 'rating',
|
name: 'rating'
|
||||||
create: true,
|
|
||||||
columnCreate: {
|
|
||||||
component: 'number',
|
|
||||||
autofocus: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
field: 'recommendedCredit',
|
field: 'recommendedCredit',
|
||||||
format: ({ recommendedCredit }) => toCurrency(recommendedCredit),
|
format: ({ recommendedCredit }) => toCurrency(recommendedCredit),
|
||||||
label: t('customer.summary.recommendCredit'),
|
label: t('customer.summary.recommendCredit'),
|
||||||
name: 'recommendedCredit',
|
name: 'recommendedCredit'
|
||||||
create: true,
|
|
||||||
columnCreate: {
|
|
||||||
component: 'number',
|
|
||||||
autofocus: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const defaultInitialData = {
|
||||||
|
rating: null,
|
||||||
|
recommendedCredit: null
|
||||||
|
};
|
||||||
|
|
||||||
|
const createRating = async (data) => {
|
||||||
|
await axios.post(`Clients/${route.params.id}/setRating`, data);
|
||||||
|
tableRef.value?.reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSave = async (data) => {
|
||||||
|
if (data.rating || data.recommendedCredit) {
|
||||||
|
await createRating(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
quasar.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('terminationTitle'),
|
||||||
|
message: t('terminationMessage'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(async () => {
|
||||||
|
await createRating({ rating: 0, recommendedCredit: 0 });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -72,8 +97,7 @@ const columns = computed(() => [
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="ClientInformas"
|
data-key="ClientInformas"
|
||||||
url="ClientInformas"
|
url="ClientInformas"
|
||||||
:filter="filter"
|
:user-filter="filter"
|
||||||
:order="['created DESC']"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:is-editable="false"
|
:is-editable="false"
|
||||||
|
@ -82,22 +106,43 @@ const columns = computed(() => [
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
auto-load
|
auto-load
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: `Clients/${route.params.id}/setRating`,
|
|
||||||
title: 'Create rating',
|
title: 'Create rating',
|
||||||
onDataSaved: () => tableRef.reload(),
|
onDataSaved: ()=> tableRef.reload(),
|
||||||
formInitialData: {},
|
formInitialData: defaultInitialData,
|
||||||
|
saveFn: handleSave
|
||||||
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #column-employee="{ row }">
|
<template #column-employee="{ row }">
|
||||||
<span class="link">{{ row.worker.user.nickname }}</span>
|
<span class="link">{{ row.worker.user.nickname }}</span>
|
||||||
<WorkerDescriptorProxy :id="row.worker.id" />
|
<WorkerDescriptorProxy :id="row.worker.id" />
|
||||||
</template>
|
</template>
|
||||||
|
<template #more-create-dialog="{ data }">
|
||||||
|
<VnRow>
|
||||||
|
<VnInputNumber
|
||||||
|
v-model="data.rating"
|
||||||
|
:label="t('customer.summary.rating')"
|
||||||
|
:required="!!data.recommendedCredit"
|
||||||
|
/>
|
||||||
|
<VnInputNumber
|
||||||
|
v-model="data.recommendedCredit"
|
||||||
|
:label="t('customer.summary.recommendCredit')"
|
||||||
|
:required="!!data.rating"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
en:
|
||||||
|
terminationTitle: Confirm contract termination
|
||||||
|
terminationMessage: Are you sure you want to terminate the contract? This action will set the rating and recommended credit to 0.
|
||||||
es:
|
es:
|
||||||
Recommended credit: Crédito recomendado
|
Recommended credit: Crédito recomendado
|
||||||
Since: Desde
|
Since: Desde
|
||||||
Employee: Empleado
|
Employee: Empleado
|
||||||
|
Create rating: Crear calificación
|
||||||
|
terminationTitle: Confirmar baja de contrato
|
||||||
|
terminationMessage: ¿Está seguro que desea dar de baja el contrato? Esta acción establecerá la calificación y el crédito recomendado en 0.
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -46,6 +46,28 @@ const { openConfirmationModal } = useVnConfirm();
|
||||||
:summary="$props.summary"
|
:summary="$props.summary"
|
||||||
:to-module="{ name: 'WorkerDepartment' }"
|
:to-module="{ name: 'WorkerDepartment' }"
|
||||||
data-key="Department"
|
data-key="Department"
|
||||||
|
:filter="{
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'client',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'worker',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
include: {
|
||||||
|
relation: 'user',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<template #menu="{}">
|
<template #menu="{}">
|
||||||
<QItem
|
<QItem
|
||||||
|
|
Loading…
Reference in New Issue