fix: แก้สร้าง สาขา ไม่ได้
This commit is contained in:
parent
735ab8f251
commit
b5925cb6ee
1 changed files with 50 additions and 51 deletions
|
|
@ -4,7 +4,7 @@ import { computed, ref, watch, toRaw } from 'vue';
|
||||||
import useCustomerStore from 'src/stores/customer';
|
import useCustomerStore from 'src/stores/customer';
|
||||||
import useEmployeeStore from 'src/stores/employee';
|
import useEmployeeStore from 'src/stores/employee';
|
||||||
import useOptionStore from 'src/stores/options';
|
import useOptionStore from 'src/stores/options';
|
||||||
import useBranchStore from 'src/stores/branch';
|
import useMyBranchStore from 'src/stores/my-branch';
|
||||||
|
|
||||||
import { Status } from 'src/stores/types';
|
import { Status } from 'src/stores/types';
|
||||||
|
|
||||||
|
|
@ -63,9 +63,9 @@ import useFlowStore from 'src/stores/flow';
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const utilsStore = useUtilsStore();
|
const utilsStore = useUtilsStore();
|
||||||
const userCustomer = useCustomerStore();
|
const userCustomer = useCustomerStore();
|
||||||
const userBranch = useBranchStore();
|
const useMyBranch = useMyBranchStore();
|
||||||
|
|
||||||
const { fetchList: fetchListBranch } = userBranch;
|
const { fetchListOptionBranch } = useMyBranch;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
create,
|
create,
|
||||||
|
|
@ -242,7 +242,7 @@ const formDataEmployee = ref<EmployeeCreate>({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const allBranch = ref<{ id: string; name: string }[]>();
|
const branchOption = ref<{ id: string; name: string }[]>();
|
||||||
const indexTab = ref<number>(0);
|
const indexTab = ref<number>(0);
|
||||||
const statusToggle = ref<boolean>(false);
|
const statusToggle = ref<boolean>(false);
|
||||||
const profileSubmit = ref<boolean>(false);
|
const profileSubmit = ref<boolean>(false);
|
||||||
|
|
@ -390,7 +390,7 @@ const employeeHistory = ref<EmployeeHistory[]>();
|
||||||
|
|
||||||
async function triggerCreate(type: CustomerType) {
|
async function triggerCreate(type: CustomerType) {
|
||||||
customerType.value = type;
|
customerType.value = type;
|
||||||
await fetchListOfBranch();
|
await fetchListOfOptionBranch();
|
||||||
openDialogInputForm();
|
openDialogInputForm();
|
||||||
dialogCustomerType.value = false;
|
dialogCustomerType.value = false;
|
||||||
}
|
}
|
||||||
|
|
@ -413,7 +413,7 @@ async function openDialogInputForm(
|
||||||
if (action === 'INFO') {
|
if (action === 'INFO') {
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
if (selectorLabel.value === 'EMPLOYER') {
|
if (selectorLabel.value === 'EMPLOYER') {
|
||||||
await fetchListOfBranch();
|
await fetchListOfOptionBranch();
|
||||||
infoDrawer.value = true;
|
infoDrawer.value = true;
|
||||||
}
|
}
|
||||||
if (selectorLabel.value === 'EMPLOYEE') {
|
if (selectorLabel.value === 'EMPLOYEE') {
|
||||||
|
|
@ -448,7 +448,7 @@ async function openDialogInputForm(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (selectorLabel.value === 'EMPLOYER') {
|
if (selectorLabel.value === 'EMPLOYER') {
|
||||||
await fetchListOfBranch();
|
await fetchListOfOptionBranch();
|
||||||
dialogInputForm.value = true;
|
dialogInputForm.value = true;
|
||||||
}
|
}
|
||||||
if (selectorLabel.value === 'EMPLOYEE') {
|
if (selectorLabel.value === 'EMPLOYEE') {
|
||||||
|
|
@ -711,12 +711,10 @@ async function onSubmitCustomerBranch() {
|
||||||
flowStore.rotate();
|
flowStore.rotate();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchListOfBranch() {
|
async function fetchListOfOptionBranch() {
|
||||||
const res = await fetchListBranch({ pageSize: 999 });
|
const res = await fetchListOptionBranch({ pageSize: 999 });
|
||||||
|
|
||||||
if (res) allBranch.value = res.result;
|
if (res) branchOption.value = res.result;
|
||||||
|
|
||||||
console.log(allBranch.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchListCustomer() {
|
async function fetchListCustomer() {
|
||||||
|
|
@ -1354,8 +1352,7 @@ watch([inputSearch, currentStatus], async () => {
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="scroll">
|
<div class="q-px-md scroll">
|
||||||
<div class="q-mx-md" style="display: inline-block">
|
|
||||||
<StatCardComponent
|
<StatCardComponent
|
||||||
v-if="customerStats && selectorLabel === 'EMPLOYER'"
|
v-if="customerStats && selectorLabel === 'EMPLOYER'"
|
||||||
labelI18n
|
labelI18n
|
||||||
|
|
@ -1394,7 +1391,6 @@ watch([inputSearch, currentStatus], async () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- main -->
|
<!-- main -->
|
||||||
<div class="surface-1 bordered rounded q-pa-md scroll col">
|
<div class="surface-1 bordered rounded q-pa-md scroll col">
|
||||||
|
|
@ -1841,7 +1837,7 @@ watch([inputSearch, currentStatus], async () => {
|
||||||
outlined
|
outlined
|
||||||
separator
|
separator
|
||||||
:type-customer="customerType"
|
:type-customer="customerType"
|
||||||
:options-branch="allBranch"
|
:options-branch="branchOption"
|
||||||
v-model:registered-branch-id="formData.registeredBranchId"
|
v-model:registered-branch-id="formData.registeredBranchId"
|
||||||
v-model:customer-name="formData.customerName"
|
v-model:customer-name="formData.customerName"
|
||||||
v-model:customer-name-en="formData.customerNameEN"
|
v-model:customer-name-en="formData.customerNameEN"
|
||||||
|
|
@ -2326,6 +2322,7 @@ watch([inputSearch, currentStatus], async () => {
|
||||||
indexTab !== undefined && formData.customerBranch?.[indexTab]
|
indexTab !== undefined && formData.customerBranch?.[indexTab]
|
||||||
"
|
"
|
||||||
:type-customer="customerType"
|
:type-customer="customerType"
|
||||||
|
v-model:branch-no="formData.customerBranch[indexTab].branchNo"
|
||||||
v-model:tax-no="formData.customerBranch[indexTab].taxNo"
|
v-model:tax-no="formData.customerBranch[indexTab].taxNo"
|
||||||
v-model:customer-name="formData.customerBranch[indexTab].name"
|
v-model:customer-name="formData.customerBranch[indexTab].name"
|
||||||
v-model:customer-english-name="
|
v-model:customer-english-name="
|
||||||
|
|
@ -2440,7 +2437,7 @@ watch([inputSearch, currentStatus], async () => {
|
||||||
separator
|
separator
|
||||||
:readonly="!infoDrawerEdit"
|
:readonly="!infoDrawerEdit"
|
||||||
:type-customer="customerType"
|
:type-customer="customerType"
|
||||||
:options-branch="allBranch"
|
:options-branch="branchOption"
|
||||||
v-model:registered-branch-id="formData.registeredBranchId"
|
v-model:registered-branch-id="formData.registeredBranchId"
|
||||||
v-model:customer-name="formData.customerName"
|
v-model:customer-name="formData.customerName"
|
||||||
v-model:customer-name-en="formData.customerNameEN"
|
v-model:customer-name-en="formData.customerNameEN"
|
||||||
|
|
@ -2743,6 +2740,8 @@ watch([inputSearch, currentStatus], async () => {
|
||||||
<AboutComponent
|
<AboutComponent
|
||||||
v-if="formData.customerBranch?.[0]"
|
v-if="formData.customerBranch?.[0]"
|
||||||
:type-customer="customerType"
|
:type-customer="customerType"
|
||||||
|
v-model:branch-code="formData.customerBranch[indexTab].code"
|
||||||
|
v-model:branch-no="formData.customerBranch[indexTab].branchNo"
|
||||||
v-model:customer-name="formData.customerBranch[indexTab].name"
|
v-model:customer-name="formData.customerBranch[indexTab].name"
|
||||||
v-model:customer-english-name="
|
v-model:customer-english-name="
|
||||||
formData.customerBranch[indexTab].nameEN
|
formData.customerBranch[indexTab].nameEN
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue