refactor: get customerBranch by id
This commit is contained in:
parent
425fd71d2c
commit
34eeb20ea6
1 changed files with 12 additions and 3 deletions
|
|
@ -11,9 +11,11 @@ import { useQuotationForm } from 'pages/05_quotation/form';
|
||||||
import { useConfigStore } from 'stores/config';
|
import { useConfigStore } from 'stores/config';
|
||||||
import useBranchStore from 'stores/branch';
|
import useBranchStore from 'stores/branch';
|
||||||
import { baseUrl } from 'stores/utils';
|
import { baseUrl } from 'stores/utils';
|
||||||
|
import useCustomerStore from 'stores/customer';
|
||||||
import { commaInput } from 'stores/utils';
|
import { commaInput } from 'stores/utils';
|
||||||
|
|
||||||
// NOTE Import Types
|
// NOTE Import Types
|
||||||
|
import { CustomerBranch } from 'stores/customer/types';
|
||||||
import { BankBook, Branch } from 'stores/branch/types';
|
import { BankBook, Branch } from 'stores/branch/types';
|
||||||
import {
|
import {
|
||||||
QuotationPayload,
|
QuotationPayload,
|
||||||
|
|
@ -31,6 +33,7 @@ const quotationForm = useQuotationForm();
|
||||||
const optionStore = useOptionStore();
|
const optionStore = useOptionStore();
|
||||||
const configStore = useConfigStore();
|
const configStore = useConfigStore();
|
||||||
const branchStore = useBranchStore();
|
const branchStore = useBranchStore();
|
||||||
|
const customerStore = useCustomerStore();
|
||||||
|
|
||||||
const { data: config } = storeToRefs(configStore);
|
const { data: config } = storeToRefs(configStore);
|
||||||
|
|
||||||
|
|
@ -53,7 +56,7 @@ type SummaryPrice = {
|
||||||
finalPrice: number;
|
finalPrice: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const customer = ref<CustomerBranchRelation>();
|
const customer = ref<CustomerBranch>();
|
||||||
const branch = ref<Branch>();
|
const branch = ref<Branch>();
|
||||||
const productList = ref<Product[]>([]);
|
const productList = ref<Product[]>([]);
|
||||||
const bankList = ref<BankBook[]>([]);
|
const bankList = ref<BankBook[]>([]);
|
||||||
|
|
@ -128,9 +131,15 @@ onMounted(async () => {
|
||||||
|
|
||||||
data.value = 'data' in parsed ? parsed.data : undefined;
|
data.value = 'data' in parsed ? parsed.data : undefined;
|
||||||
|
|
||||||
customer.value = parsed.meta.source.customerBranch;
|
|
||||||
|
|
||||||
if (data.value) {
|
if (data.value) {
|
||||||
|
const resCustomerBranch = await customerStore.getBranchById(
|
||||||
|
data.value.customerBranchId,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (resCustomerBranch) {
|
||||||
|
customer.value = resCustomerBranch;
|
||||||
|
}
|
||||||
|
|
||||||
details.value = {
|
details.value = {
|
||||||
code: parsed.meta.source.code,
|
code: parsed.meta.source.code,
|
||||||
createdAt: parsed.meta.source.createdAt,
|
createdAt: parsed.meta.source.createdAt,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue