fix: search no data, data length display
This commit is contained in:
parent
484bc2b0e5
commit
b6e2ae3d08
1 changed files with 37 additions and 4 deletions
|
|
@ -6,7 +6,7 @@ import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
// NOTE: Import stores
|
// NOTE: Import stores
|
||||||
import { useQuotationStore } from 'src/stores/quotations';
|
import { useQuotationStore } from 'src/stores/quotations';
|
||||||
import { isRoleInclude } from 'stores/utils';
|
import useUtilsStore, { isRoleInclude } from 'stores/utils';
|
||||||
import useFlowStore from 'src/stores/flow';
|
import useFlowStore from 'src/stores/flow';
|
||||||
import useMyBranch from 'stores/my-branch';
|
import useMyBranch from 'stores/my-branch';
|
||||||
import { useQuotationForm } from './form';
|
import { useQuotationForm } from './form';
|
||||||
|
|
@ -25,6 +25,7 @@ import CreateButton from 'src/components/AddButton.vue';
|
||||||
import ItemCard from 'src/components/ItemCard.vue';
|
import ItemCard from 'src/components/ItemCard.vue';
|
||||||
import DialogForm from 'components/DialogForm.vue';
|
import DialogForm from 'components/DialogForm.vue';
|
||||||
import SideMenu from 'components/SideMenu.vue';
|
import SideMenu from 'components/SideMenu.vue';
|
||||||
|
import NoData from 'src/components/NoData.vue';
|
||||||
|
|
||||||
import { dialogCreateCustomerItem } from 'src/pages/03_customer-management/constant';
|
import { dialogCreateCustomerItem } from 'src/pages/03_customer-management/constant';
|
||||||
|
|
||||||
|
|
@ -44,6 +45,7 @@ const quotationFormStore = useQuotationForm();
|
||||||
const customerFormStore = useCustomerForm();
|
const customerFormStore = useCustomerForm();
|
||||||
const flowStore = useFlowStore();
|
const flowStore = useFlowStore();
|
||||||
const userBranch = useMyBranch();
|
const userBranch = useMyBranch();
|
||||||
|
const utilsStore = useUtilsStore();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
currentFormData: quotationFormData,
|
currentFormData: quotationFormData,
|
||||||
|
|
@ -68,6 +70,7 @@ const pageState = reactive({
|
||||||
inputSearch: '',
|
inputSearch: '',
|
||||||
fieldSelected: [],
|
fieldSelected: [],
|
||||||
gridView: true,
|
gridView: true,
|
||||||
|
total: 0,
|
||||||
|
|
||||||
currentTab: 'all',
|
currentTab: 'all',
|
||||||
addModal: false,
|
addModal: false,
|
||||||
|
|
@ -218,6 +221,17 @@ const {
|
||||||
} = storeToRefs(quotationStore);
|
} = storeToRefs(quotationStore);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
utilsStore.currentTitle.title = 'quotation.title';
|
||||||
|
utilsStore.currentTitle.path = [
|
||||||
|
{
|
||||||
|
text: 'quotation.caption',
|
||||||
|
i18n: true,
|
||||||
|
handler: () => {
|
||||||
|
pageState.currentTab = 'all';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
{
|
{
|
||||||
const ret = await quotationStore.getQuotationStats();
|
const ret = await quotationStore.getQuotationStats();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
@ -234,6 +248,7 @@ onMounted(async () => {
|
||||||
if (ret) {
|
if (ret) {
|
||||||
quotationData.value = ret.result;
|
quotationData.value = ret.result;
|
||||||
quotationPageMax.value = Math.ceil(ret.total / quotationPageSize.value);
|
quotationPageMax.value = Math.ceil(ret.total / quotationPageSize.value);
|
||||||
|
pageState.total = ret.total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -315,7 +330,19 @@ async function storeDataLocal(id: string) {
|
||||||
color: hsl(var(--info-bg));
|
color: hsl(var(--info-bg));
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ '0' }}
|
{{
|
||||||
|
pageState.currentTab === 'all'
|
||||||
|
? pageState.total
|
||||||
|
: pageState.currentTab === 'fullAmountCash'
|
||||||
|
? quotationStats.full
|
||||||
|
: pageState.currentTab === 'installmentsCash'
|
||||||
|
? quotationStats.split
|
||||||
|
: pageState.currentTab === 'fullAmountBill'
|
||||||
|
? quotationStats.billFull
|
||||||
|
: pageState.currentTab === 'installmentsBill'
|
||||||
|
? quotationStats.billSplit
|
||||||
|
: 0
|
||||||
|
}}
|
||||||
</q-badge>
|
</q-badge>
|
||||||
<q-btn
|
<q-btn
|
||||||
class="q-ml-sm"
|
class="q-ml-sm"
|
||||||
|
|
@ -522,7 +549,13 @@ async function storeDataLocal(id: string) {
|
||||||
v-if="!quotationData || quotationData.length === 0"
|
v-if="!quotationData || quotationData.length === 0"
|
||||||
class="col surface-2 flex items-center justify-center"
|
class="col surface-2 flex items-center justify-center"
|
||||||
>
|
>
|
||||||
|
<NoData
|
||||||
|
v-if="pageState.inputSearch"
|
||||||
|
:not-found="!!pageState.inputSearch"
|
||||||
|
/>
|
||||||
|
|
||||||
<CreateButton
|
<CreateButton
|
||||||
|
v-if="!pageState.inputSearch"
|
||||||
@click="triggerAddQuotationDialog"
|
@click="triggerAddQuotationDialog"
|
||||||
label="general.add"
|
label="general.add"
|
||||||
:i18n-args="{ text: $t('quotation.title') }"
|
:i18n-args="{ text: $t('quotation.title') }"
|
||||||
|
|
@ -623,8 +656,8 @@ async function storeDataLocal(id: string) {
|
||||||
<div class="col-4 row justify-center app-text-muted">
|
<div class="col-4 row justify-center app-text-muted">
|
||||||
{{
|
{{
|
||||||
$t('general.recordsPage', {
|
$t('general.recordsPage', {
|
||||||
resultcurrentPage: 0,
|
resultcurrentPage: quotationData.length,
|
||||||
total: 0,
|
total: pageState.total,
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue