refactor: clean code
This commit is contained in:
parent
c452f8b915
commit
548f10feab
1 changed files with 36 additions and 32 deletions
|
|
@ -1,35 +1,42 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { QSelect, useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { nextTick, onMounted, reactive, ref } from 'vue';
|
import { nextTick, onMounted, reactive, ref } from 'vue';
|
||||||
|
|
||||||
import { baseUrl } from 'src/stores/utils';
|
// NOTE: Import stores
|
||||||
import { setLocale, dateFormat, calculateAge } from 'src/utils/datetime';
|
import { setLocale, dateFormat, calculateAge } from 'src/utils/datetime';
|
||||||
|
import useProductServiceStore from 'stores/product-service';
|
||||||
|
import useCustomerStore from 'stores/customer';
|
||||||
|
import useEmployeeStore from 'stores/employee';
|
||||||
import useOptionStore from 'stores/options';
|
import useOptionStore from 'stores/options';
|
||||||
import useEmployeeStore from 'src/stores/employee';
|
import { baseUrl } from 'src/stores/utils';
|
||||||
import { useQuotationForm } from './form';
|
import { useQuotationForm } from './form';
|
||||||
|
|
||||||
|
// NOTE Import Types
|
||||||
|
import { QuotationPayload } from 'src/stores/quotations/types';
|
||||||
import { Employee } from 'src/stores/employee/types';
|
import { Employee } from 'src/stores/employee/types';
|
||||||
import {
|
import {
|
||||||
ProductGroup,
|
ProductGroup,
|
||||||
ProductList,
|
ProductList,
|
||||||
Service,
|
Service,
|
||||||
} from 'src/stores/product-service/types';
|
} from 'src/stores/product-service/types';
|
||||||
import { QuotationPayload } from 'src/stores/quotations/types';
|
|
||||||
|
|
||||||
import ProductServiceForm from './ProductServiceForm.vue';
|
// NOTE: Import Components
|
||||||
|
import ProductItem from 'components/05_quotation/ProductItem.vue';
|
||||||
import WorkerItem from 'components/05_quotation/WorkerItem.vue';
|
import WorkerItem from 'components/05_quotation/WorkerItem.vue';
|
||||||
import QuotationFormInfo from './QuotationFormInfo.vue';
|
import ToggleButton from 'components/button/ToggleButton.vue';
|
||||||
import ToggleButton from 'src/components/button/ToggleButton.vue';
|
import FormAbout from 'components/05_quotation/FormAbout.vue';
|
||||||
import ProductItem from 'src/components/05_quotation/ProductItem.vue';
|
import SelectZone from 'components/shared/SelectZone.vue';
|
||||||
import FormAbout from 'src/components/05_quotation/FormAbout.vue';
|
import PersonCard from 'components/shared/PersonCard.vue';
|
||||||
import DialogForm from 'src/components/DialogForm.vue';
|
|
||||||
import SelectZone from 'src/components/shared/SelectZone.vue';
|
|
||||||
import PersonCard from 'src/components/shared/PersonCard.vue';
|
|
||||||
import { AddButton, SaveButton } from 'components/button';
|
import { AddButton, SaveButton } from 'components/button';
|
||||||
import useProductServiceStore from 'src/stores/product-service';
|
import DialogForm from 'components/DialogForm.vue';
|
||||||
import useCustomerStore from 'src/stores/customer';
|
import ProductServiceForm from './ProductServiceForm.vue';
|
||||||
|
import QuotationFormInfo from './QuotationFormInfo.vue';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
readonly?: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
type Node = {
|
type Node = {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
|
|
@ -41,41 +48,41 @@ type Node = {
|
||||||
children?: Node[];
|
children?: Node[];
|
||||||
};
|
};
|
||||||
|
|
||||||
defineProps<{
|
type ProductGroupId = string;
|
||||||
readonly?: boolean;
|
type Id = string;
|
||||||
}>();
|
|
||||||
|
|
||||||
const optionStore = useOptionStore();
|
|
||||||
const customerStore = useCustomerStore();
|
|
||||||
const productServiceStore = useProductServiceStore();
|
const productServiceStore = useProductServiceStore();
|
||||||
|
const customerStore = useCustomerStore();
|
||||||
const quotationForm = useQuotationForm();
|
const quotationForm = useQuotationForm();
|
||||||
const employeeStore = useEmployeeStore();
|
const employeeStore = useEmployeeStore();
|
||||||
|
const optionStore = useOptionStore();
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const { currentFormData: quotationFormData } = storeToRefs(quotationForm);
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
|
const { currentFormData: quotationFormData } = storeToRefs(quotationForm);
|
||||||
|
|
||||||
const refSelectZoneEmployee = ref<InstanceType<typeof SelectZone>>();
|
const refSelectZoneEmployee = ref<InstanceType<typeof SelectZone>>();
|
||||||
const date = ref();
|
|
||||||
const rows = ref<Node[]>([]);
|
|
||||||
const selectedBranchIssuer = ref('');
|
const selectedBranchIssuer = ref('');
|
||||||
const selectedCustomer = ref('');
|
const selectedCustomer = ref('');
|
||||||
const toggleWorker = ref(true);
|
const toggleWorker = ref(true);
|
||||||
|
const rows = ref<Node[]>([]);
|
||||||
const branchId = ref('');
|
const branchId = ref('');
|
||||||
|
const date = ref();
|
||||||
|
|
||||||
const selectedWorker = ref<Employee[]>([]);
|
|
||||||
const preSelectedWorker = ref<Employee[]>([]);
|
const preSelectedWorker = ref<Employee[]>([]);
|
||||||
|
const selectedWorker = ref<Employee[]>([]);
|
||||||
const workerList = ref<Employee[]>([]);
|
const workerList = ref<Employee[]>([]);
|
||||||
|
|
||||||
|
const documentReceivePoint = ref('');
|
||||||
|
const paySplitCount = ref(1);
|
||||||
const quotationNo = ref('');
|
const quotationNo = ref('');
|
||||||
const actor = ref('');
|
|
||||||
const workName = ref('');
|
const workName = ref('');
|
||||||
const contactor = ref('');
|
const contactor = ref('');
|
||||||
const telephone = ref('');
|
const telephone = ref('');
|
||||||
const documentReceivePoint = ref('');
|
|
||||||
const dueDate = ref('');
|
const dueDate = ref('');
|
||||||
const payType = ref('');
|
const payType = ref('');
|
||||||
const paySplitCount = ref(1);
|
|
||||||
const payBank = ref('');
|
const payBank = ref('');
|
||||||
|
const actor = ref('');
|
||||||
|
|
||||||
const pageState = reactive({
|
const pageState = reactive({
|
||||||
hideStat: false,
|
hideStat: false,
|
||||||
|
|
@ -91,18 +98,15 @@ const pageState = reactive({
|
||||||
productServiceModal: false,
|
productServiceModal: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
type ProductGroupId = string;
|
|
||||||
|
|
||||||
const productGroup = ref<ProductGroup[]>([]);
|
|
||||||
const productList = ref<Partial<Record<ProductGroupId, ProductList[]>>>({});
|
const productList = ref<Partial<Record<ProductGroupId, ProductList[]>>>({});
|
||||||
const serviceList = ref<Partial<Record<ProductGroupId, Service[]>>>({});
|
const serviceList = ref<Partial<Record<ProductGroupId, Service[]>>>({});
|
||||||
|
const productGroup = ref<ProductGroup[]>([]);
|
||||||
|
|
||||||
type Id = string;
|
|
||||||
const product = ref<Record<Id, ProductList>>({});
|
const product = ref<Record<Id, ProductList>>({});
|
||||||
const service = ref<Record<Id, Service>>({});
|
const service = ref<Record<Id, Service>>({});
|
||||||
|
|
||||||
const selectedGroup = ref<ProductGroup | null>(null);
|
|
||||||
const selectedGroupSub = ref<'product' | 'service' | null>(null);
|
const selectedGroupSub = ref<'product' | 'service' | null>(null);
|
||||||
|
const selectedGroup = ref<ProductGroup | null>(null);
|
||||||
const selectedProductServiceId = ref('');
|
const selectedProductServiceId = ref('');
|
||||||
|
|
||||||
const productServiceList = ref<
|
const productServiceList = ref<
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue