forked from verdnatura/salix-front
feat: CustomerCredit section
This commit is contained in:
parent
4762c9fa53
commit
00acd5b0ab
|
@ -17,7 +17,7 @@ const routeName = computed(() => route.name);
|
||||||
:filter-panel="routeName != 'CustomerConsumption' && CustomerFilter"
|
:filter-panel="routeName != 'CustomerConsumption' && CustomerFilter"
|
||||||
search-data-key="CustomerList"
|
search-data-key="CustomerList"
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
url: 'Clients/extendedListFilter',
|
url: 'Clients/filter',
|
||||||
label: 'Search customer',
|
label: 'Search customer',
|
||||||
info: 'You can search by customer id or name',
|
info: 'You can search by customer id or name',
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import ModalCloseContract from 'src/pages/Customer/components/ModalCloseContract.vue';
|
import ModalCloseContract from 'src/pages/Customer/components/ModalCloseContract.vue';
|
||||||
|
@ -72,6 +73,28 @@ const updateData = () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<!-- <VnTable
|
||||||
|
ref="tableRef"
|
||||||
|
data-key="Greuges"
|
||||||
|
url="Greuges"
|
||||||
|
search-url="greuges"
|
||||||
|
:filter="filter"
|
||||||
|
:order="['shipped DESC', 'amount']"
|
||||||
|
:columns="columns"
|
||||||
|
:right-search="false"
|
||||||
|
:is-editable="false"
|
||||||
|
:use-model="true"
|
||||||
|
:column-search="false"
|
||||||
|
@on-fetch="(data) => setRows(data)"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
|
:create="{
|
||||||
|
urlCreate: `Greuges`,
|
||||||
|
title: t('New greuge'),
|
||||||
|
onDataSaved: () => tableRef.reload(),
|
||||||
|
formInitialData: { shipped: new Date(), clientFk: route.params.id },
|
||||||
|
}"
|
||||||
|
auto-load
|
||||||
|
></VnTable> -->
|
||||||
<div class="full-width flex justify-center">
|
<div class="full-width flex justify-center">
|
||||||
<QCard class="card-width q-pa-lg">
|
<QCard class="card-width q-pa-lg">
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
|
|
|
@ -3,9 +3,8 @@ import { computed, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import { QBtn } from 'quasar';
|
|
||||||
|
|
||||||
import { toCurrency, toDateHourMin } from 'src/filters';
|
import { toCurrency, toDateHourMin } from 'src/filters';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
|
@ -16,8 +15,8 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const clientInformasRef = ref();
|
const tableRef = ref();
|
||||||
const rows = ref([]);
|
// const rows = ref([]);
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -37,10 +36,9 @@ const filter = {
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'created',
|
format: ({ created }) => toDateHourMin(created),
|
||||||
format: (value) => toDateHourMin(value),
|
|
||||||
label: t('Since'),
|
label: t('Since'),
|
||||||
name: 'since',
|
name: 'created',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -53,59 +51,63 @@ const columns = computed(() => [
|
||||||
field: 'rating',
|
field: 'rating',
|
||||||
label: t('Rating'),
|
label: t('Rating'),
|
||||||
name: 'rating',
|
name: 'rating',
|
||||||
|
create: true,
|
||||||
|
columnCreate: {
|
||||||
|
component: 'number',
|
||||||
|
autofocus: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
field: 'recommendedCredit',
|
field: 'recommendedCredit',
|
||||||
format: (value) => toCurrency(value),
|
format: ({ recommendedCredit }) => toCurrency(recommendedCredit),
|
||||||
label: t('Recommended credit'),
|
label: t('Recommended credit'),
|
||||||
name: 'recommendedCredit',
|
name: 'recommendedCredit',
|
||||||
|
create: true,
|
||||||
|
columnCreate: {
|
||||||
|
component: 'number',
|
||||||
|
autofocus: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
watch(
|
// watch(
|
||||||
() => route.params.id,
|
// () => route.params.id,
|
||||||
(newValue) => {
|
// (newValue) => {
|
||||||
if (!newValue) return;
|
// if (!newValue) return;
|
||||||
filter.where.clientFk = newValue;
|
// filter.where.clientFk = newValue;
|
||||||
clientInformasRef.value?.fetch();
|
// clientInformasRef.value?.fetch();
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<VnTable
|
||||||
ref="clientInformasRef"
|
ref="tableRef"
|
||||||
|
data-key="ClientInformas"
|
||||||
url="ClientInformas"
|
url="ClientInformas"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
@on-fetch="(data) => (rows = data)"
|
:order="['created DESC']"
|
||||||
|
:columns="columns"
|
||||||
|
:right-search="false"
|
||||||
|
:is-editable="false"
|
||||||
|
:use-model="true"
|
||||||
|
:column-search="false"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
:create="{
|
||||||
<FormModel
|
urlCreate: `Clients/${route.params.id}/setRating`,
|
||||||
:form-initial-data="{}"
|
title: 'Create rating',
|
||||||
:url-create="`Clients/${route.params.id}/setRating`"
|
onDataSaved: () => tableRef.reload(),
|
||||||
@on-data-saved="clientInformasRef.fetch()"
|
formInitialData: {},
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #column-employee="{ row }">
|
||||||
<VnRow>
|
<span class="link" @click.stop>{{ row.worker.user.nickname }}</span>
|
||||||
<VnInput
|
<WorkerDescriptorProxy :id="row.clientFk" />
|
||||||
:label="t('Rating')"
|
|
||||||
clearable
|
|
||||||
type="number"
|
|
||||||
v-model.number="data.rating"
|
|
||||||
/>
|
|
||||||
<VnInput
|
|
||||||
:label="t('Recommended credit')"
|
|
||||||
clearable
|
|
||||||
type="number"
|
|
||||||
v-model.number="data.recommendedCredit"
|
|
||||||
/>
|
|
||||||
</VnRow>
|
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</VnTable>
|
||||||
|
<!-- <QTable
|
||||||
<div class="full-width flex justify-center" v-if="rows.length">
|
|
||||||
<QTable
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
|
@ -120,8 +122,7 @@ watch(
|
||||||
<WorkerDescriptorProxy :id="row.clientFk" />
|
<WorkerDescriptorProxy :id="row.clientFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable> -->
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -48,6 +48,7 @@ const toCustomerCreditContracts = () => {
|
||||||
clearable
|
clearable
|
||||||
type="number"
|
type="number"
|
||||||
v-model.number="data.credit"
|
v-model.number="data.credit"
|
||||||
|
autofocus
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
|
@ -1,47 +1,26 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import { toCurrency, toDateHourMinSec } from 'src/filters';
|
import { toCurrency, toDate } from 'src/filters';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const rows = ref([]);
|
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {
|
where: {
|
||||||
creditClassificationFk: `${route.params.creditId}`,
|
creditClassificationFk: `${route.params.creditId}`,
|
||||||
},
|
},
|
||||||
limit: 20,
|
limit: 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
const tableColumnComponents = {
|
|
||||||
created: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
grade: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
credit: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'created',
|
field: 'created',
|
||||||
format: (value) => toDateHourMinSec(value),
|
format: ({ created }) => toDate(created),
|
||||||
label: t('Created'),
|
label: t('Created'),
|
||||||
name: 'created',
|
name: 'created',
|
||||||
},
|
},
|
||||||
|
@ -53,8 +32,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'credit',
|
format: ({ credit }) => toCurrency(credit),
|
||||||
format: (value) => toCurrency(value),
|
|
||||||
label: t('Credit'),
|
label: t('Credit'),
|
||||||
name: 'credit',
|
name: 'credit',
|
||||||
},
|
},
|
||||||
|
@ -62,41 +40,19 @@ const columns = computed(() => [
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<VnTable
|
||||||
:filter="filter"
|
|
||||||
@on-fetch="(data) => (rows = data)"
|
|
||||||
auto-load
|
|
||||||
url="CreditInsurances"
|
url="CreditInsurances"
|
||||||
/>
|
ref="tableRef"
|
||||||
|
data-key="creditInsurances"
|
||||||
<QPage class="column items-center q-pa-md" v-if="rows.length">
|
:filter="filter"
|
||||||
<QTable
|
:columns="columns"
|
||||||
:columns="columns"
|
:right-search="false"
|
||||||
:pagination="{ rowsPerPage: 12 }"
|
:is-editable="false"
|
||||||
:rows="rows"
|
:use-model="true"
|
||||||
class="full-width q-mt-md"
|
:column-search="false"
|
||||||
row-key="id"
|
:disable-option="{ card: true }"
|
||||||
>
|
auto-load
|
||||||
<template #body-cell="props">
|
></VnTable>
|
||||||
<QTd :props="props">
|
|
||||||
<QTr :props="props" class="cursor-pointer">
|
|
||||||
<component
|
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
|
||||||
class="col-content"
|
|
||||||
v-bind="tableColumnComponents[props.col.name].props(props)"
|
|
||||||
@click="tableColumnComponents[props.col.name].event(props)"
|
|
||||||
>
|
|
||||||
{{ props.value }}
|
|
||||||
</component>
|
|
||||||
</QTr>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
</QTable>
|
|
||||||
</QPage>
|
|
||||||
|
|
||||||
<h5 class="flex justify-center color-vn-label" v-else>
|
|
||||||
{{ t('globals.noResults') }}
|
|
||||||
</h5>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
Loading…
Reference in New Issue