diff --git a/src/pages/08_request-list/RequestListAction .vue b/src/pages/08_request-list/RequestListAction .vue
index 814f4da3..7ec34ff4 100644
--- a/src/pages/08_request-list/RequestListAction .vue
+++ b/src/pages/08_request-list/RequestListAction .vue
@@ -1,5 +1,5 @@
@@ -89,6 +99,7 @@ function prev() {
hide-action
hide-view
checkable
+ :list-same-area="listSameArea"
:columns="column"
:rows="requestList"
:visible-columns="[...column.map((col) => col.name)]"
@@ -116,6 +127,7 @@ function prev() {
diff --git a/src/pages/08_request-list/TableRequestList.vue b/src/pages/08_request-list/TableRequestList.vue
index 0dc5b433..cbad4a7a 100644
--- a/src/pages/08_request-list/TableRequestList.vue
+++ b/src/pages/08_request-list/TableRequestList.vue
@@ -24,6 +24,7 @@ const props = withDefaults(
hideAction?: boolean;
hideView?: boolean;
checkable?: boolean;
+ listSameArea?: string[];
}>(),
{
row: () => [],
@@ -39,7 +40,7 @@ defineEmits<{
(e: 'rejectCancel', data: RequestData): void;
}>();
-const selected = defineModel('selected');
+const selected = defineModel('selected');
function responsiblePerson(quotation: QuotationFull): CreatedBy[] | undefined {
const productServiceList = quotation.productServiceList;
@@ -97,7 +98,7 @@ function getEmployeeName(
return (
{
['eng']: `${useOptionStore().mapOption(employee?.namePrefix || '')} ${employee?.firstNameEN} ${employee?.lastNameEN}`,
- ['tha']: `${useOptionStore().mapOption(employee?.namePrefix || '')} ${employee?.firstName} ${employee?.lastName}`,
+ ['tha']: `${useOptionStore().mapOption(employee?.namePrefix || '')} ${employee?.firstName || employee?.firstNameEN} ${employee?.lastName || employee?.lastNameEN}`,
}[opts?.locale || 'eng'] || '-'
);
}
@@ -119,6 +120,17 @@ function toEmployee(employee: RequestData['employee']) {
window.open(url.toString(), '_blank');
}
+
+function handleCheckAll() {
+ const filteredRows = props.rows.filter((row) =>
+ props.listSameArea?.includes(row.quotation.customerBranch.districtId),
+ );
+ if (selected.value.length === filteredRows.length) {
+ selected.value = [];
+ } else {
+ selected.value = filteredRows;
+ }
+}
-
+
+
{{ col.label && $t(col.label) }}
@@ -161,11 +184,29 @@ function toEmployee(employee: RequestData['employee']) {
} & Omit[0], 'row'>"
>
-
+
{{ props.rowIndex + 1 }}
@@ -487,4 +528,9 @@ function toEmployee(employee: RequestData['employee']) {
text-decoration: underline;
cursor: pointer;
}
+
+.disabled-row {
+ opacity: 0.3;
+ filter: grayscale(1);
+}
diff --git a/src/stores/address/index.ts b/src/stores/address/index.ts
index 975ca773..5cbbd14d 100644
--- a/src/stores/address/index.ts
+++ b/src/stores/address/index.ts
@@ -102,12 +102,25 @@ const useAddressStore = defineStore('api-address', () => {
return subDistrict.value[districtId];
}
+ async function listSameOfficeArea(districtId: string) {
+ const res = await api.post(
+ `/employment-office/list-same-office-area`,
+ { districtId: districtId },
+ );
+
+ if (!res) return false;
+
+ return res.data;
+ }
+
return {
fetchOffice,
fetchOfficeById,
fetchProvince,
fetchDistrictByProvinceId,
fetchSubDistrictByProvinceId,
+
+ listSameOfficeArea,
};
});