refactor: misc

This commit is contained in:
Methapon Metanipat 2024-10-03 11:22:21 +07:00
parent a4ff3052fe
commit 4e4aa92680

View file

@ -6,7 +6,7 @@ import { onMounted, reactive, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
// NOTE at stores // NOTE: Import stores
import useProductServiceStore from 'src/stores/product-service'; import useProductServiceStore from 'src/stores/product-service';
import { useQuotationStore } from 'src/stores/quotations'; import { useQuotationStore } from 'src/stores/quotations';
import { baseUrl, waitAll } from 'src/stores/utils'; import { baseUrl, waitAll } from 'src/stores/utils';
@ -16,11 +16,11 @@ import useFlowStore from 'src/stores/flow';
import useOcrStore from 'stores/ocr'; import useOcrStore from 'stores/ocr';
import useMyBranch from 'stores/my-branch'; import useMyBranch from 'stores/my-branch';
// NOTE at type // NOTE Import Types
import { CustomerBranchCreate } from 'stores/customer/types'; import { CustomerBranchCreate } from 'stores/customer/types';
import { Employee } from 'src/stores/employee/types'; import { Employee } from 'src/stores/employee/types';
// NOTE at component // NOTE: Import Components
import BasicInformation from 'components/03_customer-management/employee/BasicInformation.vue'; import BasicInformation from 'components/03_customer-management/employee/BasicInformation.vue';
import FormReferDocument from 'src/components/05_quotation/FormReferDocument.vue'; import FormReferDocument from 'src/components/05_quotation/FormReferDocument.vue';
import { UploadFileGroup, noticeJobEmployment } from 'components/upload-file'; import { UploadFileGroup, noticeJobEmployment } from 'components/upload-file';
@ -701,8 +701,9 @@ watch(() => pageState.currentTab, fetchQuotationList);
:name="tab" :name="tab"
:key="tab" :key="tab"
@click=" @click="
async () => { () => {
pageState.currentPage = 1; quotationPage = 1;
pageState.currentTab = tab; pageState.currentTab = tab;
pageState.inputSearch = ''; pageState.inputSearch = '';
pageState.statusFilter = 'all'; pageState.statusFilter = 'all';
@ -735,7 +736,7 @@ watch(() => pageState.currentTab, fetchQuotationList);
</article> </article>
<article v-else class="col q-pa-md surface-2 scroll"> <article v-else class="col q-pa-md surface-2 scroll">
<div class="row q-col-gutter-md"> <div class="row q-col-gutter-md">
<div v-for="n in quotationData" :key="n.id" class="col-md-4 col-12"> <div v-for="v in quotationData" :key="v.id" class="col-md-4 col-12">
<QuotationCard <QuotationCard
:type=" :type="
pageState.currentTab !== 'all' pageState.currentTab !== 'all'
@ -745,18 +746,18 @@ watch(() => pageState.currentTab, fetchQuotationList);
Split: 'installmentsCash', Split: 'installmentsCash',
BillFull: 'fullAmountBill', BillFull: 'fullAmountBill',
BillSplit: 'installmentsBill', BillSplit: 'installmentsBill',
}[n.payCondition] }[v.payCondition]
" "
:code="n.code" :code="v.code"
:title="n.workName" :title="v.workName"
:date="new Date(n.createdAt).toLocaleString()" :date="new Date(v.createdAt).toLocaleString()"
:amount="n.workerCount" :amount="v.workerCount"
:customer-name=" :customer-name="
n.customerBranch?.registerName || v.customerBranch?.registerName ||
`${n.customerBranch?.firstName || '-'} ${n.customerBranch?.lastName || ''}` `${v.customerBranch?.firstName || '-'} ${v.customerBranch?.lastName || ''}`
" "
:reporter="n.actorName" :reporter="v.actorName"
:total-price="n.totalPrice" :total-price="v.totalPrice"
@view="console.log('view')" @view="console.log('view')"
@edit="console.log('edit')" @edit="console.log('edit')"
@link="console.log('link')" @link="console.log('link')"
@ -771,7 +772,7 @@ watch(() => pageState.currentTab, fetchQuotationList);
<!-- SEC: footer content --> <!-- SEC: footer content -->
<footer <footer
class="row justify-between items-center q-px-md q-py-sm surface-2" class="row justify-between items-center q-px-md q-py-sm surface-2"
v-if="pageState.currentMaxPage > 0" v-if="quotationPageMax > 0"
> >
<div class="col-4"> <div class="col-4">
<div class="row items-center no-wrap"> <div class="row items-center no-wrap">
@ -782,7 +783,7 @@ watch(() => pageState.currentTab, fetchQuotationList);
<q-btn-dropdown <q-btn-dropdown
dense dense
unelevated unelevated
:label="pageState.pageSize" :label="quotationPageSize"
class="bordered q-pl-md" class="bordered q-pl-md"
> >
<q-list> <q-list>
@ -791,11 +792,7 @@ watch(() => pageState.currentTab, fetchQuotationList);
:key="v" :key="v"
clickable clickable
v-close-popup v-close-popup
@click=" @click="quotationPageSize = v"
async () => {
pageState.pageSize = v;
}
"
> >
<q-item-section> <q-item-section>
<q-item-label>{{ v }}</q-item-label> <q-item-label>{{ v }}</q-item-label>
@ -826,8 +823,10 @@ watch(() => pageState.currentTab, fetchQuotationList);
</header> </header>
</div> </div>
<!-- SEC: Dialog --> <!-- NOTE: SEC START - Dialog -->
<!-- add quotation -->
<!-- NOTE: START - Quotation Form -->
<DialogForm <DialogForm
:title="$t('general.add', { text: $t('quotation.title') })" :title="$t('general.add', { text: $t('quotation.title') })"
v-model:modal="pageState.addModal" v-model:modal="pageState.addModal"
@ -870,7 +869,10 @@ watch(() => pageState.currentTab, fetchQuotationList);
</section> </section>
</DialogForm> </DialogForm>
<!-- add employee quotation --> <!-- NOTE: END - Quotation Form -->
<!-- NOTE: START - Employee Select Form -->
<DialogForm <DialogForm
:title="$t('general.select', { msg: $t('quotation.employeeList') })" :title="$t('general.select', { msg: $t('quotation.employeeList') })"
v-model:modal="pageState.employeeModal" v-model:modal="pageState.employeeModal"
@ -937,6 +939,8 @@ watch(() => pageState.currentTab, fetchQuotationList);
</section> </section>
</DialogForm> </DialogForm>
<!-- NOTE: END - Employee Select Form -->
<!-- NOTE: START - Customer / Employer Type Select Form --> <!-- NOTE: START - Customer / Employer Type Select Form -->
<DialogForm <DialogForm