fix: worker missing
This commit is contained in:
parent
e76077ba08
commit
127d8c0ebc
2 changed files with 7 additions and 22 deletions
|
|
@ -674,21 +674,7 @@ function toggleDeleteProduct(index: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function assignWorkerToSelectedWorker() {
|
async function assignWorkerToSelectedWorker() {
|
||||||
if (quotationFormData.value.customerBranchId) {
|
selectedWorker.value = quotationFormData.value.worker;
|
||||||
const retEmp = await customerStore.fetchBranchEmployee(
|
|
||||||
quotationFormData.value.customerBranchId,
|
|
||||||
{ passport: true },
|
|
||||||
);
|
|
||||||
if (retEmp) {
|
|
||||||
workerList.value = retEmp.data.result;
|
|
||||||
quotationFormData.value.worker.forEach((value) => {
|
|
||||||
const tempValue: Employee | undefined = retEmp.data.result.find(
|
|
||||||
(v) => v.id === value.id,
|
|
||||||
);
|
|
||||||
if (tempValue !== undefined) selectedWorker.value.push(tempValue);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertToTable(nodes: Node[]) {
|
function convertToTable(nodes: Node[]) {
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,10 @@ import { ref } from 'vue';
|
||||||
// NOTE: Import types
|
// NOTE: Import types
|
||||||
import {
|
import {
|
||||||
QuotationPayload,
|
QuotationPayload,
|
||||||
EmployeeWorker,
|
|
||||||
QuotationFull,
|
QuotationFull,
|
||||||
|
EmployeeWorker,
|
||||||
} from 'src/stores/quotations/types';
|
} from 'src/stores/quotations/types';
|
||||||
|
import { Employee } from 'src/stores/employee/types';
|
||||||
|
|
||||||
import { InvoicePayload } from 'src/stores/payment/types';
|
import { InvoicePayload } from 'src/stores/payment/types';
|
||||||
|
|
||||||
|
|
@ -139,15 +140,13 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
name: p.name,
|
name: p.name,
|
||||||
amount: p.amount,
|
amount: p.amount,
|
||||||
})),
|
})),
|
||||||
worker: data.worker.map((v) =>
|
worker: data.worker.map((v) => v.employee),
|
||||||
Object.assign(v.employee, {
|
|
||||||
dateOfBirth: new Date(v.employee.dateOfBirth),
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
currentFormData.value = structuredClone(resetFormData);
|
currentFormData.value = structuredClone(resetFormData);
|
||||||
|
|
||||||
|
console.log(currentFormData.value);
|
||||||
|
|
||||||
currentFormState.value.createdBy = (locale) =>
|
currentFormState.value.createdBy = (locale) =>
|
||||||
locale === 'eng'
|
locale === 'eng'
|
||||||
? data.createdBy.firstNameEN + ' ' + data.createdBy.lastNameEN
|
? data.createdBy.firstNameEN + ' ' + data.createdBy.lastNameEN
|
||||||
|
|
@ -203,7 +202,7 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
|
|
||||||
function injectNewEmployee(
|
function injectNewEmployee(
|
||||||
obj: {
|
obj: {
|
||||||
data: EmployeeWorker & {
|
data: Employee & {
|
||||||
attachment?: {
|
attachment?: {
|
||||||
name?: string;
|
name?: string;
|
||||||
group?: string;
|
group?: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue