Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8388-fineTunningInvoiceIn
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
13f461f878
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import { date } from 'quasar';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
@ -21,7 +21,6 @@ const stateStore = useStateStore();
|
|||
const validationsStore = useValidator();
|
||||
const { models } = validationsStore;
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
model: {
|
||||
|
@ -273,7 +272,7 @@ onUnmounted(() => {
|
|||
:data-key
|
||||
:url="dataKey + 's'"
|
||||
:user-filter="filter"
|
||||
:filter="{ where: { and: [{ originFk: route.params.id }] } }"
|
||||
:user-params="{ originFk: route.params.id }"
|
||||
:skeleton="false"
|
||||
auto-load
|
||||
@on-fetch="setLogTree"
|
||||
|
|
|
@ -313,6 +313,7 @@ export function useArrayData(key, userOptions) {
|
|||
const { params, limit } = getCurrentFilter();
|
||||
store.currentFilter = JSON.parse(JSON.stringify(params));
|
||||
delete store.currentFilter.filter.include;
|
||||
delete store.currentFilter.filter.fields;
|
||||
store.currentFilter.filter = JSON.stringify(store.currentFilter.filter);
|
||||
return { params, limit };
|
||||
}
|
||||
|
|
|
@ -2,14 +2,20 @@
|
|||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import { toCurrency, toDateHourMin } from 'src/filters';
|
||||
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 VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const quasar = useQuasar();
|
||||
|
||||
const tableRef = ref();
|
||||
|
||||
|
@ -45,26 +51,45 @@ const columns = computed(() => [
|
|||
align: 'right',
|
||||
field: 'rating',
|
||||
label: t('customer.summary.rating'),
|
||||
name: 'rating',
|
||||
create: true,
|
||||
columnCreate: {
|
||||
component: 'number',
|
||||
autofocus: true,
|
||||
},
|
||||
name: 'rating'
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
field: 'recommendedCredit',
|
||||
format: ({ recommendedCredit }) => toCurrency(recommendedCredit),
|
||||
label: t('customer.summary.recommendCredit'),
|
||||
name: 'recommendedCredit',
|
||||
create: true,
|
||||
columnCreate: {
|
||||
component: 'number',
|
||||
autofocus: true,
|
||||
},
|
||||
name: 'recommendedCredit'
|
||||
},
|
||||
]);
|
||||
|
||||
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>
|
||||
|
||||
<template>
|
||||
|
@ -72,8 +97,7 @@ const columns = computed(() => [
|
|||
ref="tableRef"
|
||||
data-key="ClientInformas"
|
||||
url="ClientInformas"
|
||||
:filter="filter"
|
||||
:order="['created DESC']"
|
||||
:user-filter="filter"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="false"
|
||||
|
@ -82,22 +106,43 @@ const columns = computed(() => [
|
|||
:disable-option="{ card: true }"
|
||||
auto-load
|
||||
:create="{
|
||||
urlCreate: `Clients/${route.params.id}/setRating`,
|
||||
title: 'Create rating',
|
||||
onDataSaved: () => tableRef.reload(),
|
||||
formInitialData: {},
|
||||
onDataSaved: ()=> tableRef.reload(),
|
||||
formInitialData: defaultInitialData,
|
||||
saveFn: handleSave
|
||||
|
||||
}"
|
||||
>
|
||||
<template #column-employee="{ row }">
|
||||
<span class="link">{{ row.worker.user.nickname }}</span>
|
||||
<WorkerDescriptorProxy :id="row.worker.id" />
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<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:
|
||||
Recommended credit: Crédito recomendado
|
||||
Since: Desde
|
||||
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>
|
||||
|
|
|
@ -46,6 +46,28 @@ const { openConfirmationModal } = useVnConfirm();
|
|||
:summary="$props.summary"
|
||||
:to-module="{ name: 'WorkerDepartment' }"
|
||||
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="{}">
|
||||
<QItem
|
||||
|
|
Loading…
Reference in New Issue