diff --git a/src/components/02_personnel-management/FormPerson.vue b/src/components/02_personnel-management/FormPerson.vue
index 1aee5b95..cb0463af 100644
--- a/src/components/02_personnel-management/FormPerson.vue
+++ b/src/components/02_personnel-management/FormPerson.vue
@@ -293,15 +293,11 @@ watch(
:readonly="readonly"
:label="$t('form.birthDate')"
:disabled-dates="disabledAfterToday"
- :rules="
- employee
- ? []
- : [
- (val: string) =>
- !!val ||
- $t('form.error.selectField', { field: $t('form.birthDate') }),
- ]
- "
+ :rules="[
+ (val: string) =>
+ !!val ||
+ $t('form.error.selectField', { field: $t('form.birthDate') }),
+ ]"
/>
-import { CustomerBranch } from 'src/stores/customer';
-
import SelectCustomer from '../shared/select/SelectCustomer.vue';
import SelectBranch from '../shared/select/SelectBranch.vue';
+import { CustomerBranch } from 'src/stores/customer';
+import { ref } from 'vue';
+
const branchId = defineModel('branchId');
const customerBranchId = defineModel('customerBranchId');
const agentPrice = defineModel('agentPrice');
@@ -73,6 +74,7 @@ defineEmits<{
required
:readonly
/>
+
import { QTableProps } from 'quasar';
-import { dateFormat } from 'src/utils/datetime';
+import { dateFormat, dateFormatJS } from 'src/utils/datetime';
import { formatNumberDecimal } from 'stores/utils';
@@ -86,11 +86,11 @@ defineEmits<{
- {{ dateFormat(props.row.createdAt) }}
+ {{ dateFormatJS({ date: props.row.createdAt }) }}
- {{ dateFormat(props.row.dueDate) }}
+ {{ dateFormatJS({ date: props.row.dueDate }) }}
diff --git a/src/components/08_request-list/DataDisplay.vue b/src/components/08_request-list/DataDisplay.vue
index a52060f3..f36acb4f 100644
--- a/src/components/08_request-list/DataDisplay.vue
+++ b/src/components/08_request-list/DataDisplay.vue
@@ -27,26 +27,38 @@ withDefaults(
class="app-text-muted q-pr-sm"
:width="iconSize || '2rem'"
/>
-
-
+
+
{{ label }}
-
+
{{ value }}
{{ value }}
-
+
{{ item }}
,
diff --git a/src/components/TreeComponent.vue b/src/components/TreeComponent.vue
index 6abff3d4..fca14f27 100644
--- a/src/components/TreeComponent.vue
+++ b/src/components/TreeComponent.vue
@@ -96,7 +96,9 @@ defineEmits<{
expandedTree[expandedTree.length - 1] === node.id,
}"
>
- {{ node.name }}
+ {{
+ $i18n.locale === 'eng' ? node.nameEN || node.name : node.name
+ }}
{{ node.code }}
diff --git a/src/components/button/MainButton.vue b/src/components/button/MainButton.vue
index 836abe32..08233063 100644
--- a/src/components/button/MainButton.vue
+++ b/src/components/button/MainButton.vue
@@ -5,6 +5,7 @@ defineEmits<{
(e: 'click', v: MouseEvent): void;
}>();
defineProps<{
+ id?: string;
icon?: string;
color: string;
iconOnly?: boolean;
@@ -18,6 +19,7 @@ defineProps<{
diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts
index 9afb6737..3379ba60 100644
--- a/src/i18n/eng.ts
+++ b/src/i18n/eng.ts
@@ -161,6 +161,7 @@ export default {
documentStatus: 'Document Status',
advanceSearch: 'Advance Search',
totalPeople: '{meg} people',
+ price: 'Price {price} Baht',
},
menu: {
@@ -1233,6 +1234,9 @@ export default {
taskListNotPending: 'One or more task is not pending.',
reqNotMet: 'Not Match',
systemError: 'A system error occurred.',
+ taskOrderInvalid: 'Please select the product and the organization.',
+
+ flowAccountProductIdNotFound: 'Product not found in flow account',
},
},
diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts
index 3430d2f6..921e25fd 100644
--- a/src/i18n/tha.ts
+++ b/src/i18n/tha.ts
@@ -161,6 +161,7 @@ export default {
documentStatus: 'สถานะเอกสาร',
advanceSearch: 'ค้นหาขั้นสูง',
totalPeople: '{meg} คน',
+ price: 'ราคา {price} บาท',
},
menu: {
@@ -1219,6 +1220,8 @@ export default {
'มีงานหนึ่งงานหรือมากกว่าที่ไม่อยู่ในสถานะรอดำเนินการ',
reqNotMet: 'ไม่ตรงกัน',
systemError: 'ระบบเกิดข้อผิดพลาด',
+ taskOrderInvalid: 'โปรดเลือก สินค้าเเละสาขา',
+ flowAccountProductIdNotFound: 'ไม่พบสินค้าใน flow account',
},
},
diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue
index c09effed..29e106bc 100644
--- a/src/layouts/MainLayout.vue
+++ b/src/layouts/MainLayout.vue
@@ -2,7 +2,7 @@
import { ref, onMounted, computed, reactive } from 'vue';
import { storeToRefs } from 'pinia';
import { useQuasar } from 'quasar';
-import { getUserId, getUsername, logout, getRole } from 'src/services/keycloak';
+import { getUserId, getUsername, getName, logout, getRole } from 'src/services/keycloak';
import { Icon } from '@iconify/vue';
import { useI18n } from 'vue-i18n';
import moment from 'moment';
@@ -39,7 +39,7 @@ const configStore = useConfigStore();
const { data: notificationData } = storeToRefs(notificationStore);
const { visible } = storeToRefs(loaderStore);
-const { t } = useI18n({ useScope: 'global' });
+const { t, locale } = useI18n({ useScope: 'global' });
const userStore = useUserStore();
const canvasModal = ref(false);
@@ -52,8 +52,14 @@ const unread = computed(
);
const userImage = ref();
const userGender = ref('');
+const userName = ref({ th: '', en: '' });
const canvasRef = ref();
+const displayName = computed(() => {
+ if (!userName.value.th && !userName.value.en) return getName() || 'Guest';
+ return locale.value === 'eng' ? userName.value.en : userName.value.th;
+});
+
const language: {
value: Lang;
label: string;
@@ -161,9 +167,14 @@ onMounted(async () => {
if (user === 'admin') return;
if (uid) {
const res = await userStore.fetchById(uid);
- if (res && res.gender) {
- userGender.value = res.gender;
- userImage.value = `${baseUrl}/user/${uid}/profile-image/${res.selectedImage}`;
+ if (res) {
+ if (res.gender) {
+ userGender.value = res.gender;
+ userImage.value = `${baseUrl}/user/${uid}/profile-image/${res.selectedImage}`;
+ }
+ // เก็บชื่อทั้งสองภาษา
+ userName.value.th = `${res.firstName || ''} ${res.lastName || ''}`.trim();
+ userName.value.en = `${res.firstNameEN || ''} ${res.lastNameEN || ''}`.trim();
}
}
});
@@ -484,6 +495,7 @@ onMounted(async () => {
-
+
+
@@ -4357,6 +4385,7 @@ watch(
-import { onMounted, reactive, ref, watch, computed } from 'vue';
+import { onMounted, onUnmounted, reactive, ref, watch, computed } from 'vue';
import { storeToRefs } from 'pinia';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
@@ -275,6 +275,10 @@ const customerNameInfo = computed(() => {
return name || '-';
});
+function handleWindowFocus() {
+ fetchQuotationList();
+}
+
onMounted(async () => {
pageState.gridView = $q.screen.lt.md ? true : false;
navigatorStore.current.title = 'quotation.title';
@@ -312,6 +316,12 @@ onMounted(async () => {
}
flowStore.rotate();
+
+ window.addEventListener('focus', handleWindowFocus);
+});
+
+onUnmounted(() => {
+ window.removeEventListener('focus', handleWindowFocus);
});
async function fetchQuotationList(mobileFetch?: boolean) {
@@ -767,8 +777,13 @@ async function filterBySellerId() {
:worker-count="item.row._count.worker"
:worker-max="item.row.workerMax || item.row._count.worker"
:customer-name="
- item.row.customerBranch.registerName ||
- `${item.row.customerBranch.firstName || '-'} ${item.row.customerBranch.lastName || ''}`
+ item.row.customerBranch.customer.customerType === 'CORP'
+ ? $i18n.locale === 'tha'
+ ? item.row.customerBranch.registerName
+ : item.row.customerBranch.registerNameEN
+ : $i18n.locale === 'tha'
+ ? `${item.row.customerBranch.firstName || '-'} ${item.row.customerBranch.lastName || ''}`
+ : `${item.row.customerBranch.firstNameEN || '-'} ${item.row.customerBranch.lastNameEN || ''}`
"
:reporter="
$i18n.locale === 'eng'
diff --git a/src/pages/05_quotation/PaymentForm.vue b/src/pages/05_quotation/PaymentForm.vue
index 2d5f1579..cf3d7c63 100644
--- a/src/pages/05_quotation/PaymentForm.vue
+++ b/src/pages/05_quotation/PaymentForm.vue
@@ -1,16 +1,9 @@
@@ -640,95 +661,115 @@ onMounted(async () => {
-
- {{ $t('quotation.receiptDialog.paymentMethod') }}
-
-
-
{
- if (formPaymentMethod[i].channel === 'Cash') {
- formPaymentMethod[i].reference = null;
- formPaymentMethod[i].account = null;
- }
- }
- "
- />
-
-
-
- {
- formPaymentMethod[i].isEdit = false;
- formPaymentMethod[i].channel = payment.channel;
- formPaymentMethod[i].reference = payment.reference;
- formPaymentMethod[i].account = payment.account;
- }
- "
- />
-
-
-
-
+
+
+ {{ $t('quotation.receiptDialog.paymentMethod') }}
+
+
+
+
+
{
+ if (formPaymentMethod[i].channel === 'Cash') {
+ formPaymentMethod[i].reference = null;
+ formPaymentMethod[i].account = null;
+ }
+ }
+ "
+ />
+
+
+
+ {
+ formPaymentMethod[i].isEdit = false;
+ formPaymentMethod[i].channel = payment.channel;
+ formPaymentMethod[i].reference = payment.reference;
+ formPaymentMethod[i].account = payment.account;
+ }
+ "
+ />
+
+
+
+
+
+
();
+
const employeeStore = useEmployeeStore();
const route = useRoute();
const useReceiptStore = useReceipt();
@@ -113,8 +115,6 @@ const $q = useQuasar();
const openQuotation = ref(false);
const formMetadata = ref();
-const customerBranchOption = ref();
-
const rowsRequestList = ref([]);
const {
@@ -161,49 +161,7 @@ const selectedWorker = ref<
}[];
})[]
>([]);
-const selectedWorkerItem = computed(() => {
- return [
- ...selectedWorker.value.map((e) => ({
- foreignRefNo: e.employeePassport
- ? e.employeePassport[0]?.number || '-'
- : '-',
- employeeName:
- locale.value === Lang.English
- ? `${e.firstNameEN} ${e.lastNameEN}`
- : e.firstName
- ? `${e.firstName} ${e.lastName}`
- : `${e.firstNameEN} ${e.lastNameEN}`,
- birthDate: dateFormatJS({ date: e.dateOfBirth }),
- gender: e.gender,
- age: calculateAge(e.dateOfBirth),
- nationality: optionStore.mapOption(e.nationality),
- documentExpireDate:
- e.employeePassport !== undefined &&
- e.employeePassport[0]?.expireDate !== undefined
- ? dateFormatJS({ date: e.employeePassport[0]?.expireDate })
- : '-',
- imgUrl: e.selectedImage
- ? `${API_BASE_URL}/employee/${e.id}/image/${e.selectedImage}`
- : '',
- status: e.status,
- })),
-
- ...newWorkerList.value.map((v: any) => ({
- foreignRefNo: v.passportNo,
- employeeName:
- locale.value === Lang.English
- ? `${v.firstNameEN} ${v.lastNameEN}`
- : `${v.firstName} ${v.lastName}`,
- birthDate: dateFormatJS({ date: v.dateOfBirth }),
- gender: v.gender,
- age: calculateAge(v.dateOfBirth),
- nationality: optionStore.mapOption(v.nationality),
- documentExpireDate: '-',
- imgUrl: '',
- status: 'CREATED',
- })),
- ];
-});
+const selectedWorkerItem = ref([]);
const firstCodePayment = ref('');
const selectedProductGroup = ref('');
const selectedInstallmentNo = ref([]);
@@ -238,7 +196,7 @@ function getPrice(
) {
if (filterHook) list = list.filter(filterHook);
- return list.reduce(
+ const value = list.reduce(
(a, c) => {
if (
selectedInstallmentNo.value.length > 0 &&
@@ -278,6 +236,8 @@ function getPrice(
finalPrice: 0,
},
);
+
+ return value;
}
const summaryPrice = computed(() => getPrice(productServiceList.value));
@@ -556,7 +516,7 @@ async function convertDataToFormSubmit() {
),
);
- selectedWorker.value.forEach((v, i) => {
+ selectedWorkerItem.value.forEach((v, i) => {
if (v.attachment !== undefined) {
v.attachment.forEach((value) => {
fileItemNewWorker.value.push({
@@ -573,7 +533,7 @@ async function convertDataToFormSubmit() {
quotationFormData.value.worker = JSON.parse(
JSON.stringify([
- ...selectedWorker.value.map((v) => {
+ ...selectedWorkerItem.value.map((v) => {
{
return v.id;
}
@@ -806,7 +766,40 @@ function toggleDeleteProduct(index: number) {
}
async function assignWorkerToSelectedWorker() {
- selectedWorker.value = quotationFormData.value.worker;
+ selectedWorkerItem.value = quotationFormData.value.worker.map((e) => {
+ return {
+ id: e.id,
+ foreignRefNo: e.employeePassport
+ ? e.employeePassport[0]?.number || '-'
+ : '-',
+ employeeName:
+ locale.value === Lang.English
+ ? `${e.firstNameEN} ${e.lastNameEN}`
+ : `${e.firstName || e.firstNameEN} ${e.lastName || e.lastNameEN}`,
+ birthDate: dateFormatJS({ date: e.dateOfBirth }),
+ gender: e.gender,
+ age: calculateAge(e.dateOfBirth),
+ nationality: optionStore.mapOption(e.nationality),
+ documentExpireDate:
+ e.employeePassport !== undefined &&
+ e.employeePassport[0]?.expireDate !== undefined
+ ? dateFormatJS({ date: e.employeePassport[0]?.expireDate })
+ : '-',
+ imgUrl: e.selectedImage
+ ? `${API_BASE_URL}/employee/${e.id}/image/${e.selectedImage}`
+ : '',
+ employeePassport: e.employeePassport,
+ status: e.status,
+ workerNew: false,
+ lastNameEN: e.lastNameEN,
+ lastName: e.lastName,
+ middleNameEN: e.middleNameEN,
+ middleName: e.middleName,
+ firstNameEN: e.firstNameEN,
+ firstName: e.firstName,
+ namePrefix: e.namePrefix,
+ };
+ });
}
function convertToTable(nodes: Node[]) {
@@ -865,21 +858,21 @@ function convertToTable(nodes: Node[]) {
function convertEmployeeToTable(selected: Employee[]) {
productServiceList.value.forEach((v) => {
- if (selectedWorker.value.length === 0 && v.amount === 1) v.amount -= 1;
+ if (selectedWorkerItem.value.length === 0 && v.amount === 1) v.amount -= 1;
v.amount = Math.max(
- v.amount + selected.length - selectedWorker.value.length,
+ v.amount + selected.length - selectedWorkerItem.value.length,
1,
);
const oldWorkerId: string[] = [];
const newWorkerIndex: number[] = [];
- selectedWorker.value.forEach((item, i) => {
+ selectedWorkerItem.value.forEach((item, i) => {
if (v.workerIndex.includes(i)) oldWorkerId.push(item.id);
});
selected.forEach((item, i) => {
- if (selectedWorker.value.find((n) => item.id === n.id)) return;
+ if (selectedWorkerItem.value.find((n) => item.id === n.id)) return;
newWorkerIndex.push(i);
});
@@ -892,7 +885,7 @@ function convertEmployeeToTable(selected: Employee[]) {
pageState.employeeModal = false;
quotationFormData.value.workerMax = Math.max(
quotationFormData.value.workerMax || 1,
- selectedWorker.value.length,
+ selectedWorkerItem.value.length,
);
}
@@ -965,6 +958,71 @@ function viewProductFile(data: ProductRelation) {
pageState.imageDialogUrl = base64 ? base64[1] : '';
}
+function combineWorker(newWorker: any, oldWorker: any) {
+ selectedWorkerItem.value = [
+ ...oldWorker.map((e) => ({
+ id: e.id,
+ foreignRefNo: e.employeePassport
+ ? e.employeePassport[0]?.number || '-'
+ : '-',
+ employeeName:
+ locale.value === Lang.English
+ ? `${e.firstNameEN} ${e.lastNameEN}`
+ : `${e.firstName || e.firstNameEN} ${e.lastName || e.lastNameEN}`,
+ birthDate: dateFormatJS({ date: e.dateOfBirth }),
+ gender: e.gender,
+ age: calculateAge(e.dateOfBirth),
+ nationality: optionStore.mapOption(e.nationality),
+ documentExpireDate:
+ e.employeePassport !== undefined &&
+ e.employeePassport[0]?.expireDate !== undefined
+ ? dateFormatJS({ date: e.employeePassport[0]?.expireDate })
+ : '-',
+ imgUrl: e.selectedImage
+ ? `${API_BASE_URL}/employee/${e.id}/image/${e.selectedImage}`
+ : '',
+
+ employeePassport: e.employeePassport,
+ status: e.status,
+ workerNew: false,
+ lastNameEN: e.lastNameEN,
+ lastName: e.lastName,
+ middleNameEN: e.middleNameEN,
+ middleName: e.middleName,
+ firstNameEN: e.firstNameEN,
+ firstName: e.firstName,
+ namePrefix: e.namePrefix,
+ })),
+
+ ...newWorker.map((v: any) => ({
+ id: v.id,
+ foreignRefNo: v.passportNo || '-',
+ employeeName:
+ locale.value === Lang.English
+ ? `${v.firstNameEN} ${v.lastNameEN}`
+ : `${v.firstName || v.firstNameEN} ${v.lastName || v.lastNameEN}`,
+ birthDate: dateFormatJS({ date: v.dateOfBirth }),
+ gender: v.gender,
+ age: calculateAge(v.dateOfBirth),
+ nationality: optionStore.mapOption(v.nationality),
+ documentExpireDate: '-',
+ imgUrl: '',
+ status: 'CREATED',
+
+ lastNameEN: v.lastNameEN,
+ lastName: v.lastName,
+ middleNameEN: v.middleNameEN,
+ middleName: v.middleName,
+ firstNameEN: v.firstNameEN,
+ firstName: v.firstName,
+ namePrefix: v.namePrefix,
+
+ dateOfBirth: v.dateOfBirth,
+ workerNew: true,
+ })),
+ ];
+}
+
const sessionData = ref>();
onMounted(async () => {
@@ -1036,7 +1094,7 @@ watch(
() => quotationFormData.value.customerBranchId,
async (v) => {
if (!v) return;
- selectedWorker.value = [];
+ selectedWorkerItem.value = [];
},
);
@@ -1052,6 +1110,15 @@ watch(
const productServiceNodes = ref([]);
+watch(customerBranchOption, () => {
+ if (!customerBranchOption.value) return;
+
+ quotationFormData.value.contactName =
+ customerBranchOption.value.contactName || '';
+ quotationFormData.value.contactTel =
+ customerBranchOption.value.contactTel || '';
+});
+
watch(
() => productServiceList.value,
() => {
@@ -1087,7 +1154,19 @@ watch(customerBranchOption, () => {
// }
function storeDataLocal() {
- quotationFormData.value.productServiceList = productService.value;
+ const tempProductService = productService.value.map((v) => {
+ return {
+ ...v,
+ vat: v.product[agentPrice ? 'agentPriceCalcVat' : 'calcVat']
+ ? precisionRound(
+ ((v.pricePerUnit * (1 + (config?.value.vat || 0.07)) * v.amount -
+ v.discount) /
+ (1 + (config?.value.vat || 0.07))) *
+ 0.07,
+ )
+ : 0,
+ };
+ });
localStorage.setItem(
'quotation-preview',
@@ -1096,7 +1175,7 @@ function storeDataLocal() {
codeInvoice: code.value,
codePayment: firstCodePayment.value,
...quotationFormData.value,
- productServiceList: productService.value,
+ productServiceList: tempProductService,
},
meta: {
source: {
@@ -1116,7 +1195,7 @@ function storeDataLocal() {
workName: quotationFormData.value.workName,
dueDate: quotationFormData.value.dueDate,
},
- selectedWorker: selectedWorker.value,
+ selectedWorker: selectedWorkerItem.value,
createdBy: quotationFormState.value.createdBy('tha'),
agentPrice: agentPrice.value,
},
@@ -1201,10 +1280,10 @@ async function getWorkerFromCriteria(
if (!ret) return false; // error, do not close dialog
const deduplicate = ret.result.filter(
- (a) => !selectedWorker.value.find((b) => a.id === b.id),
+ (a) => !selectedWorkerItem.value.find((b) => a.id === b.id),
);
- convertEmployeeToTable([...deduplicate, ...selectedWorker.value]);
+ convertEmployeeToTable([...deduplicate, ...selectedWorkerItem.value]);
return true;
}
@@ -1594,15 +1673,15 @@ function covertToNode() {
(v) =>
(quotationFormData.workerMax = Math.max(
v,
- selectedWorker.length,
+ selectedWorkerItem.length,
))
"
:employee-amount="
- quotationFormData.workerMax || selectedWorker.length
+ quotationFormData.workerMax || selectedWorkerItem.length
"
:readonly="readonly"
:rows="selectedWorkerItem"
- @delete="(i) => deleteItem(selectedWorker, i)"
+ @delete="(i) => deleteItem(selectedWorkerItem, i)"
/>
@@ -1846,7 +1925,7 @@ function covertToNode() {
installments: quotationFormData.paySplit,
},
'quotation-labor': {
- name: selectedWorker.map(
+ name: selectedWorkerItem.map(
(v, i) =>
`${i + 1}. ` +
`${v.employeePassport.length !== 0 ? v.employeePassport[0].number + '_' : ''}${v.namePrefix}.${v.firstNameEN ? `${v.firstNameEN} ${v.lastNameEN}` : `${v.firstName} ${v.lastName}`} `.toUpperCase(),
@@ -1939,6 +2018,7 @@ function covertToNode() {
view !== View.Receipt &&
view !== View.Complete
"
+ :branch-id="quotationFull.registeredBranchId"
:readonly="
isRoleInclude(['sale', 'head_of_sale']) ||
!canAccess('quotation', 'edit')
@@ -2389,13 +2469,12 @@ function covertToNode() {
{
- selectedWorker = v.worker;
+ combineWorker(v.newWorker, v.worker);
}
"
/>
@@ -2438,7 +2517,7 @@ function covertToNode() {
{
@@ -275,6 +275,7 @@ watch(
{{ $t('quotation.totalPriceBaht') }}
-
+
{{
payType === 'SplitCustom' && view === View.Invoice
? formatNumberDecimal(Math.max(installmentAmount || 0, 0), 2) || 0
diff --git a/src/pages/05_quotation/QuotationFormWorkerAddDialog.vue b/src/pages/05_quotation/QuotationFormWorkerAddDialog.vue
index 89904bbf..64a7fbbf 100644
--- a/src/pages/05_quotation/QuotationFormWorkerAddDialog.vue
+++ b/src/pages/05_quotation/QuotationFormWorkerAddDialog.vue
@@ -341,12 +341,13 @@ watch(() => state.search, getWorkerList);
>
(),
{},
);
@@ -133,7 +133,7 @@ const optionStore = useOptionStore();
const employeeStore = useEmployeeStore();
const open = defineModel('open', { default: false });
-const newWorkerList = defineModel<
+const newWorkerList = ref<
(EmployeeWorker & {
attachment?: {
name?: string;
@@ -143,7 +143,7 @@ const newWorkerList = defineModel<
_meta?: Record;
}[];
})[]
->('newWorkerList', { default: [] });
+>([]);
const workerSelected = ref([]);
const workerList = ref([]);
const importWorkerCriteria = ref<{
@@ -208,7 +208,13 @@ function getEmployeeImageUrl(item: Employee) {
function init() {
if (props.preselectWorker) {
- workerSelected.value = JSON.parse(JSON.stringify(props.preselectWorker));
+ workerSelected.value = JSON.parse(
+ JSON.stringify(props.preselectWorker.filter((v) => !v.workerNew)),
+ );
+
+ newWorkerList.value = JSON.parse(
+ JSON.stringify(props.preselectWorker.filter((v) => v.workerNew)),
+ );
}
getWorkerList();
}
@@ -608,11 +614,14 @@ watch(
solid
id="btn-success"
@click="
- (emits('success', {
- worker: workerSelected,
- newWorker: newWorkerList,
- }),
- (open = false))
+ () => {
+ $emit('success', {
+ worker: workerSelected,
+ newWorker: newWorkerList,
+ });
+
+ open = false;
+ }
"
>
{{ $t('general.select', { msg: $t('quotation.employeeList') }) }}
@@ -634,9 +643,11 @@ watch(
if (employeeFormState.currentTab === 'personalInfo') {
const currentEmployeeId =
await employeeFormStore.submitPersonal(onCreateImageList);
- quotationForm.injectNewEmployee({
- data: { ...currentFromDataEmployee, id: currentEmployeeId },
- });
+ newWorkerList.push(
+ quotationForm.injectNewEmployee({
+ data: { ...currentFromDataEmployee, id: currentEmployeeId },
+ }),
+ );
employeeFormState.isEmployeeEdit = false;
employeeFormState.dialogType = 'info';
}
diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts
index e44fa747..5b16785a 100644
--- a/src/pages/05_quotation/form.ts
+++ b/src/pages/05_quotation/form.ts
@@ -69,6 +69,7 @@ export const useQuotationForm = defineStore('form-quotation', () => {
file?: File;
_meta?: Record;
}[];
+ workerNew: boolean;
})[]
>([]);
@@ -220,7 +221,7 @@ export const useQuotationForm = defineStore('form-quotation', () => {
},
callback?: () => void,
) {
- newWorkerList.value.push({
+ const temp = {
//passportNo: obj.data.passportNo,
//documentExpireDate: obj.data.documentExpireDate,
id: obj.data.id,
@@ -235,9 +236,12 @@ export const useQuotationForm = defineStore('form-quotation', () => {
gender: obj.data.gender,
dateOfBirth: obj.data.dateOfBirth,
attachment: obj.data.attachment,
- });
+ workerNew: true,
+ };
callback?.();
+
+ return temp;
}
function dialogDelete(callback: () => void) {
diff --git a/src/pages/08_request-list/DocumentExpansion.vue b/src/pages/08_request-list/DocumentExpansion.vue
index d262d953..5ac5208c 100644
--- a/src/pages/08_request-list/DocumentExpansion.vue
+++ b/src/pages/08_request-list/DocumentExpansion.vue
@@ -61,6 +61,7 @@ const props = withDefaults(
readonly?: boolean;
listDocument: string[];
currentId: { customer: string; employee: string };
+ prefix?: string;
}>(),
{
listDocument: () => [],
@@ -244,14 +245,14 @@ function changeCustomerTab(opts: { tab: 'customer' | 'employee' }) {