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