chore: clean quotation main page

This commit is contained in:
Methapon Metanipat 2024-10-11 11:25:47 +07:00
parent 98c10c2fa1
commit c020a3acbd

View file

@ -2,24 +2,20 @@
import { pageTabs, fieldSelectedOption } from './constants';
import { onMounted, reactive, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { storeToRefs } from 'pinia';
// NOTE: Import stores
import useProductServiceStore from 'src/stores/product-service';
import { useQuotationStore } from 'src/stores/quotations';
import { isRoleInclude } from 'stores/utils';
import useFlowStore from 'src/stores/flow';
import useMyBranch from 'stores/my-branch';
import { useQuotationForm } from './form';
import useOcrStore from 'stores/ocr';
// NOTE Import Types
import { CustomerBranchCreate } from 'stores/customer/types';
import { Employee } from 'src/stores/employee/types';
// NOTE: Import Components
import TreeView from 'src/components/shared/TreeView.vue';
import QuotationCard from 'src/components/05_quotation/QuotationCard.vue';
import PaginationComponent from 'src/components/PaginationComponent.vue';
import StatCardComponent from 'src/components/StatCardComponent.vue';
@ -44,19 +40,12 @@ import {
EmployerFormAbout,
} from 'src/pages/03_customer-management/components';
import {
useCustomerForm,
useEmployeeForm,
} from 'src/pages/03_customer-management/form';
import QuotationView from './QuotationView.vue';
import { quotationProductTree } from './utils';
import { useCustomerForm } from 'src/pages/03_customer-management/form';
const quotationFormStore = useQuotationForm();
const customerFormStore = useCustomerForm();
const employeeFormStore = useEmployeeForm();
const flowStore = useFlowStore();
const userBranch = useMyBranch();
const ocrStore = useOcrStore();
const {
currentFormData: quotationFormData,
@ -69,33 +58,12 @@ const { currentMyBranch } = storeToRefs(userBranch);
const special = ref(false);
const branchId = ref('');
const agentPrice = ref<boolean>(false);
const currentCustomerId = ref<string | undefined>();
const refreshImageState = ref(false);
const emptyCreateDialog = ref(false);
const onCreateImageList = ref<{
selectedImage: string;
list: { url: string; imgFile: File | null; name: string }[];
}>({ selectedImage: '', list: [] });
const tabFieldRequired = ref<{ [key: string]: (keyof CustomerBranchCreate)[] }>(
{
main: [],
business: ['businessType', 'jobPosition'],
address: [
'homeCode',
'address',
'addressEN',
'provinceId',
'districtId',
'subDistrictId',
],
contact: [],
},
);
const productServiceStore = useProductServiceStore();
const router = useRouter();
const selectedEmployee = ref<Employee[]>([]);
const pageState = reactive({
@ -242,16 +210,6 @@ function triggerQuotationDialog(opts: {
window.open(url.toString(), '_blank');
}
function triggerSelectEmployeeDialog() {
pageState.employeeModal = true;
// TODO: form and state controll
}
function triggerProductServiceDialog() {
pageState.productServiceModal = true;
// TODO: form and state controll
}
const quotationStore = useQuotationStore();
const {
data: quotationData,
@ -345,39 +303,6 @@ watch(() => pageState.currentTab, fetchQuotationList);
:style="pageState.hideStat ? 'rotate: 90deg' : ''"
style="transition: 0.1s ease-in-out"
/>
<q-btn
class="q-ml-sm"
label="add"
color="primary"
size="sm"
flat
dense
@click="triggerSelectEmployeeDialog"
:style="pageState.hideStat ? 'rotate: 90deg' : ''"
style="transition: 0.1s ease-in-out"
/>
<q-btn
class="q-ml-sm"
label="quo"
color="primary"
size="sm"
flat
dense
@click="triggerQuotationDialog('create')"
:style="pageState.hideStat ? 'rotate: 90deg' : ''"
style="transition: 0.1s ease-in-out"
/>
<q-btn
class="q-ml-sm"
label="proserv"
color="primary"
size="sm"
flat
dense
@click="triggerProductServiceDialog"
:style="pageState.hideStat ? 'rotate: 90deg' : ''"
style="transition: 0.1s ease-in-out"
/>
</section>
<transition name="slide">