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
|
||||
import { useQuotationStore } from 'src/stores/quotations';
|
||||
import { isRoleInclude } from 'stores/utils';
|
||||
import useUtilsStore, { isRoleInclude } from 'stores/utils';
|
||||
import useFlowStore from 'src/stores/flow';
|
||||
import useMyBranch from 'stores/my-branch';
|
||||
import { useQuotationForm } from './form';
|
||||
|
|
@ -25,6 +25,7 @@ import CreateButton from 'src/components/AddButton.vue';
|
|||
import ItemCard from 'src/components/ItemCard.vue';
|
||||
import DialogForm from 'components/DialogForm.vue';
|
||||
import SideMenu from 'components/SideMenu.vue';
|
||||
import NoData from 'src/components/NoData.vue';
|
||||
|
||||
import { dialogCreateCustomerItem } from 'src/pages/03_customer-management/constant';
|
||||
|
||||
|
|
@ -44,6 +45,7 @@ const quotationFormStore = useQuotationForm();
|
|||
const customerFormStore = useCustomerForm();
|
||||
const flowStore = useFlowStore();
|
||||
const userBranch = useMyBranch();
|
||||
const utilsStore = useUtilsStore();
|
||||
|
||||
const {
|
||||
currentFormData: quotationFormData,
|
||||
|
|
@ -68,6 +70,7 @@ const pageState = reactive({
|
|||
inputSearch: '',
|
||||
fieldSelected: [],
|
||||
gridView: true,
|
||||
total: 0,
|
||||
|
||||
currentTab: 'all',
|
||||
addModal: false,
|
||||
|
|
@ -218,6 +221,17 @@ const {
|
|||
} = storeToRefs(quotationStore);
|
||||
|
||||
onMounted(async () => {
|
||||
utilsStore.currentTitle.title = 'quotation.title';
|
||||
utilsStore.currentTitle.path = [
|
||||
{
|
||||
text: 'quotation.caption',
|
||||
i18n: true,
|
||||
handler: () => {
|
||||
pageState.currentTab = 'all';
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
{
|
||||
const ret = await quotationStore.getQuotationStats();
|
||||
if (ret) {
|
||||
|
|
@ -234,6 +248,7 @@ onMounted(async () => {
|
|||
if (ret) {
|
||||
quotationData.value = ret.result;
|
||||
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));
|
||||
"
|
||||
>
|
||||
{{ '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-btn
|
||||
class="q-ml-sm"
|
||||
|
|
@ -522,7 +549,13 @@ async function storeDataLocal(id: string) {
|
|||
v-if="!quotationData || quotationData.length === 0"
|
||||
class="col surface-2 flex items-center justify-center"
|
||||
>
|
||||
<NoData
|
||||
v-if="pageState.inputSearch"
|
||||
:not-found="!!pageState.inputSearch"
|
||||
/>
|
||||
|
||||
<CreateButton
|
||||
v-if="!pageState.inputSearch"
|
||||
@click="triggerAddQuotationDialog"
|
||||
label="general.add"
|
||||
: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">
|
||||
{{
|
||||
$t('general.recordsPage', {
|
||||
resultcurrentPage: 0,
|
||||
total: 0,
|
||||
resultcurrentPage: quotationData.length,
|
||||
total: pageState.total,
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue