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() {
|
||||
if (quotationFormData.value.customerBranchId) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
selectedWorker.value = quotationFormData.value.worker;
|
||||
}
|
||||
|
||||
function convertToTable(nodes: Node[]) {
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ import { ref } from 'vue';
|
|||
// NOTE: Import types
|
||||
import {
|
||||
QuotationPayload,
|
||||
EmployeeWorker,
|
||||
QuotationFull,
|
||||
EmployeeWorker,
|
||||
} from 'src/stores/quotations/types';
|
||||
import { Employee } from 'src/stores/employee/types';
|
||||
|
||||
import { InvoicePayload } from 'src/stores/payment/types';
|
||||
|
||||
|
|
@ -139,15 +140,13 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
|||
name: p.name,
|
||||
amount: p.amount,
|
||||
})),
|
||||
worker: data.worker.map((v) =>
|
||||
Object.assign(v.employee, {
|
||||
dateOfBirth: new Date(v.employee.dateOfBirth),
|
||||
}),
|
||||
),
|
||||
worker: data.worker.map((v) => v.employee),
|
||||
});
|
||||
|
||||
currentFormData.value = structuredClone(resetFormData);
|
||||
|
||||
console.log(currentFormData.value);
|
||||
|
||||
currentFormState.value.createdBy = (locale) =>
|
||||
locale === 'eng'
|
||||
? data.createdBy.firstNameEN + ' ' + data.createdBy.lastNameEN
|
||||
|
|
@ -203,7 +202,7 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
|||
|
||||
function injectNewEmployee(
|
||||
obj: {
|
||||
data: EmployeeWorker & {
|
||||
data: Employee & {
|
||||
attachment?: {
|
||||
name?: string;
|
||||
group?: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue