diff --git a/src/pages/11_credit-note/document-view/MainPage.vue b/src/pages/11_credit-note/document-view/MainPage.vue
index f87d4b3b..e15fe13d 100644
--- a/src/pages/11_credit-note/document-view/MainPage.vue
+++ b/src/pages/11_credit-note/document-view/MainPage.vue
@@ -248,6 +248,7 @@ function calcPricePerUnit(product: RequestWork['productService']['product']) {
function calcPrice(
product: RequestWork['productService']['product'],
amount: number,
+ vat: number = 0,
) {
const pricePerUnit = agentPrice.value ? product.agentPrice : product.price;
@@ -256,7 +257,8 @@ function calcPrice(
: pricePerUnit;
const priceDiscountNoVat = priceNoVat * amount - 0;
- const rawVatTotal = priceDiscountNoVat * (config.value?.vat || 0.07);
+ const rawVatTotal =
+ vat === 0 ? 0 : priceDiscountNoVat * (config.value?.vat || 0.07);
return precisionRound(priceNoVat * amount + rawVatTotal);
}
@@ -346,7 +348,7 @@ function closeAble() {
{{
formatNumberDecimal(
- calcPrice(v.product.product, v.list.length),
+ calcPrice(v.product.product, v.list.length, v.product.vat),
2,
)
}}
@@ -431,7 +433,7 @@ function closeAble() {
class="column set-width bg-color full-height"
style="padding: 12px"
>
- ({{ ThaiBahtText(summaryPrice.finalPrice) }})
+ ({{ ThaiBahtText(precisionRound(summaryPrice.finalPrice)) }})
`${i + 1}. ` +
- `${v.namePrefix}. ${v.firstNameEN} ${v.lastNameEN}`.toUpperCase(),
+ `${v.namePrefix}. ${v.firstNameEN ? `${v.firstNameEN} ${v.lastNameEN}` : `${v.firstName} ${v.lastName}`} `.toUpperCase(),
) || [],
},
}) || '-'
diff --git a/src/pages/12_debit-note/MainPage.vue b/src/pages/12_debit-note/MainPage.vue
index cd022dfa..15e2fc32 100644
--- a/src/pages/12_debit-note/MainPage.vue
+++ b/src/pages/12_debit-note/MainPage.vue
@@ -24,6 +24,7 @@ import { pageTabs, columns, hslaColors } from './constants';
import { DebitNoteStatus, useDebitNote } from 'src/stores/debit-note';
import { dialogWarningClose } from 'src/stores/utils';
import { useQuasar } from 'quasar';
+import AdvanceSearch from 'src/components/shared/AdvanceSearch.vue';
const $q = useQuasar();
const { t } = useI18n();
@@ -46,6 +47,7 @@ const pageState = reactive({
total: 0,
debitDialog: false,
+ searchDate: [],
});
const fieldSelectedOption = computed(() => {
@@ -68,6 +70,8 @@ async function getList(opts?: { page?: number; pageSize?: number }) {
? undefined
: pageState.currentTab) as DebitNoteStatus,
includeRegisteredBranch: true,
+ startDate: pageState.searchDate[0],
+ endDate: pageState.searchDate[1],
});
if (res) {
@@ -149,6 +153,7 @@ watch(
() => pageState.inputSearch,
() => pageSize.value,
() => pageState.statusFilter,
+ () => pageState.searchDate,
],
() => getList(),
);
@@ -256,6 +261,10 @@ watch(
+
+
+
+
diff --git a/src/pages/12_debit-note/document-view/MainPage.vue b/src/pages/12_debit-note/document-view/MainPage.vue
index 7233ede7..563b4d02 100644
--- a/src/pages/12_debit-note/document-view/MainPage.vue
+++ b/src/pages/12_debit-note/document-view/MainPage.vue
@@ -501,7 +501,7 @@ function print() {
details?.worker.map(
(v, i) =>
`${i + 1}. ` +
- `${v.namePrefix}. ${v.firstNameEN} ${v.lastNameEN}`.toUpperCase(),
+ `${v.namePrefix}. ${v.firstNameEN ? `${v.firstNameEN} ${v.lastNameEN}` : `${v.firstName} ${v.lastName}`} `.toUpperCase(),
) || [],
},
}) || '-'
diff --git a/src/pages/13_receipt/MainPage.vue b/src/pages/13_receipt/MainPage.vue
index 8dede01c..3e6083ce 100644
--- a/src/pages/13_receipt/MainPage.vue
+++ b/src/pages/13_receipt/MainPage.vue
@@ -17,7 +17,8 @@ import { columns, hslaColors } from './constants';
import useFlowStore from 'src/stores/flow';
import { usePayment, useReceipt } from 'src/stores/payment';
import { PaymentDataStatus } from 'src/stores/payment/types';
-import { QSelect, useQuasar } from 'quasar';
+import { useQuasar } from 'quasar';
+import AdvanceSearch from 'src/components/shared/AdvanceSearch.vue';
const $q = useQuasar();
const navigatorStore = useNavigator();
@@ -26,7 +27,6 @@ const receiptStore = useReceipt();
const { data, page, pageMax, pageSize } = storeToRefs(receiptStore);
// NOTE: Variable
-const refFilter = ref >();
const pageState = reactive({
hideStat: false,
@@ -35,6 +35,7 @@ const pageState = reactive({
fieldSelected: [...columns.map((v) => v.name)],
gridView: false,
total: 0,
+ searchDate: [],
});
const fieldSelectedOption = computed(() => {
@@ -49,6 +50,8 @@ async function fetchList(opts?: { rotateFlowId?: boolean }) {
page: page.value,
pageSize: pageSize.value,
query: pageState.inputSearch,
+ startDate: pageState.searchDate[0],
+ endDate: pageState.searchDate[1],
});
if (ret) {
data.value = $q.screen.xs ? [...data.value, ...ret.result] : ret.result;
@@ -95,6 +98,7 @@ watch(
() => pageState.inputSearch,
() => pageState.statusFilter,
() => pageSize.value,
+ () => pageState.searchDate,
],
() => {
page.value = 1;
@@ -172,25 +176,43 @@ watch(
-
-
-
-
+
+
+
+ {{ $t('general.status') }}
+
+
-
+
import('pages/00_manual/ViewPage.vue'),
},
+ {
+ path: '/troubleshooting',
+ name: 'Troubleshooting',
+ component: () => import('pages/00_manual/MainPage.vue'),
+ },
+ {
+ path: '/troubleshooting/:category/:page',
+ name: 'TroubleshootingView',
+ component: () => import('pages/00_manual/ViewPage.vue'),
+ },
],
},
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,
};
});
diff --git a/src/stores/branch/index.ts b/src/stores/branch/index.ts
index db8a5b25..7225fb7d 100644
--- a/src/stores/branch/index.ts
+++ b/src/stores/branch/index.ts
@@ -39,6 +39,8 @@ const useBranchStore = defineStore('api-branch', () => {
withHead?: boolean;
activeOnly?: boolean;
headOfficeId?: string;
+ startDate?: string;
+ endDate?: string;
},
Data extends Pagination,
>(opts?: Options): Promise {
diff --git a/src/stores/credit-note/index.ts b/src/stores/credit-note/index.ts
index e732a204..24da139e 100644
--- a/src/stores/credit-note/index.ts
+++ b/src/stores/credit-note/index.ts
@@ -28,6 +28,8 @@ export async function getCreditNoteList(params?: {
pageSize?: number;
query?: string;
creditNoteStatus?: Status;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>(`/${ENDPOINT}`, {
params,
diff --git a/src/stores/customer/index.ts b/src/stores/customer/index.ts
index fe72a2a8..fe08b0ca 100644
--- a/src/stores/customer/index.ts
+++ b/src/stores/customer/index.ts
@@ -113,6 +113,8 @@ const useCustomerStore = defineStore('api-customer', () => {
includeBranch?: boolean;
status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
customerType?: CustomerType;
+ startDate?: string;
+ endDate?: string;
},
Data extends Pagination<
(Customer &
diff --git a/src/stores/debit-note/index.ts b/src/stores/debit-note/index.ts
index e9a71818..6d8638f8 100644
--- a/src/stores/debit-note/index.ts
+++ b/src/stores/debit-note/index.ts
@@ -28,6 +28,8 @@ export async function getDebitNoteList(params?: {
query?: string;
status?: Status;
includeRegisteredBranch?: boolean;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>(`/${ENDPOINT}`, {
params,
diff --git a/src/stores/employee/index.ts b/src/stores/employee/index.ts
index 41b766a8..73722d51 100644
--- a/src/stores/employee/index.ts
+++ b/src/stores/employee/index.ts
@@ -45,6 +45,8 @@ const useEmployeeStore = defineStore('api-employee', () => {
customerId?: string;
customerBranchId?: string;
activeOnly?: boolean;
+ startDate?: string;
+ endDate?: string;
payload?: { passport?: string[] };
}) {
const { payload, ...params } = opts || {};
diff --git a/src/stores/institution/index.ts b/src/stores/institution/index.ts
index dab8fc85..b9f8e18d 100644
--- a/src/stores/institution/index.ts
+++ b/src/stores/institution/index.ts
@@ -29,6 +29,9 @@ export const useInstitution = defineStore('institution-store', () => {
group?: string;
status?: Status;
payload?: { group?: string[] };
+ startDate?: string;
+ endDate?: string;
+ activeOnly?: boolean;
}) {
const { payload, ...params } = opts || {};
@@ -72,18 +75,67 @@ export const useInstitution = defineStore('institution-store', () => {
}
}
+ if (res.data.bank && data.bank.length > 0) {
+ for (let i = 0; i < data.bank?.length; i++) {
+ if (data.bank[i].bankQr) {
+ await api
+ .put(
+ `/institution/${res.data.id}/bank-qr/${res.data.bank[i].id}`,
+ data.bank[i].bankQr,
+ {
+ headers: { 'Content-Type': data.bank[i].bankQr?.type },
+ onUploadProgress: (e) => console.log(e),
+ },
+ )
+ .catch((e) => console.error(e));
+ }
+ }
+ }
+
if (res.status < 400) {
return res.data;
}
return null;
}
- async function editInstitution(data: InstitutionPayload & { id: string }) {
+ async function editInstitution(
+ data: InstitutionPayload & { id: string },
+ opts?: { indexDeleteQrCodeBank?: number[] },
+ ) {
const res = await api.put(`/institution/${data.id}`, {
...data,
id: undefined,
group: undefined,
});
+
+ if (!!res.data.bank && !!data.bank.length) {
+ for (let i = 0; i < data.bank?.length; i++) {
+ if (data.bank[i].bankQr) {
+ console.log(i);
+ console.log(data.bank[i].bankQr);
+ await api
+ .put(
+ `/institution/${res.data.id}/bank-qr/${res.data.bank[i].id}`,
+ data.bank[i].bankQr,
+ {
+ headers: { 'Content-Type': data.bank[i].bankQr?.type },
+ onUploadProgress: (e) => console.log(e),
+ },
+ )
+ .catch((e) => console.error(e));
+ }
+ }
+ }
+
+ if (opts.indexDeleteQrCodeBank && opts.indexDeleteQrCodeBank.length > 0) {
+ console.log('delete');
+ opts.indexDeleteQrCodeBank.forEach(async (i) => {
+ await api
+ .delete(`/institution/${res.data.id}/bank-qr/${res.data.bank[i].id}`)
+ .catch((e) => console.error(e));
+ });
+ }
+
if (res.status < 400) {
return res.data;
}
diff --git a/src/stores/manual/index.ts b/src/stores/manual/index.ts
index fef42284..e2842bd3 100644
--- a/src/stores/manual/index.ts
+++ b/src/stores/manual/index.ts
@@ -5,10 +5,11 @@ import { getToken } from 'src/services/keycloak';
import { Manual } from './types';
import { baseUrl } from '../utils';
-const ENDPOINT = 'manual';
+const MANUAL_ENDPOINT = 'manual';
+const TROUBLESHOOTING_ENDPOINT = 'troubleshooting';
export async function getManual() {
- const res = await api.get(`/${ENDPOINT}`);
+ const res = await api.get(`/${MANUAL_ENDPOINT}`);
if (res.status < 400) {
return res.data;
}
@@ -20,7 +21,28 @@ export async function getManualByPage(opt: {
pageName: string;
}) {
const res = await fetch(
- `${baseUrl}/${ENDPOINT}/${opt.category}/page/${opt.pageName}`,
+ `${baseUrl}/${MANUAL_ENDPOINT}/${opt.category}/page/${opt.pageName}`,
+ );
+ if (res.status < 400) {
+ return res;
+ }
+ return null;
+}
+
+export async function getTroubleshooting() {
+ const res = await api.get(`/${TROUBLESHOOTING_ENDPOINT}`);
+ if (res.status < 400) {
+ return res.data;
+ }
+ return null;
+}
+
+export async function getTroubleshootingByPage(opt: {
+ category: string;
+ pageName: string;
+}) {
+ const res = await fetch(
+ `${baseUrl}/${TROUBLESHOOTING_ENDPOINT}/${opt.category}/page/${opt.pageName}`,
);
if (res.status < 400) {
return res;
@@ -30,11 +52,15 @@ export async function getManualByPage(opt: {
export const useManualStore = defineStore('manual-store', () => {
const dataManual = ref([]);
+ const dataTroubleshooting = ref([]);
return {
getManual,
getManualByPage,
+ getTroubleshooting,
+ getTroubleshootingByPage,
dataManual,
+ dataTroubleshooting,
};
});
diff --git a/src/stores/payment/index.ts b/src/stores/payment/index.ts
index 93c210fc..960c8a23 100644
--- a/src/stores/payment/index.ts
+++ b/src/stores/payment/index.ts
@@ -101,6 +101,8 @@ export const useReceipt = defineStore('receipt-store', () => {
debitNoteId?: string;
debitNoteOnly?: boolean;
quotationOnly?: boolean;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>('/receipt', {
params: opts,
@@ -162,6 +164,8 @@ export const useInvoice = defineStore('invoice-store', () => {
debitNoteOnly?: boolean;
quotationId?: string;
debitNoteId?: string;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>('/invoice', {
params,
diff --git a/src/stores/product-service/index.ts b/src/stores/product-service/index.ts
index 1804b1cd..0405bf16 100644
--- a/src/stores/product-service/index.ts
+++ b/src/stores/product-service/index.ts
@@ -56,6 +56,8 @@ const useProductServiceStore = defineStore('api-product-service', () => {
query?: string;
status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
activeOnly?: boolean;
+ startDate?: string;
+ endDate?: string;
}) {
const params = new URLSearchParams();
@@ -142,6 +144,8 @@ const useProductServiceStore = defineStore('api-product-service', () => {
orderField?: string;
activeOnly?: boolean;
orderBy?: 'asc' | 'desc';
+ startDate?: string;
+ endDate?: string;
}) {
const params = new URLSearchParams();
@@ -190,6 +194,23 @@ const useProductServiceStore = defineStore('api-product-service', () => {
return false;
}
+ async function importProduct(
+ productGroupId: string,
+ files: File[],
+ fetch: (...args: unknown[]) => void,
+ ) {
+ const importTasks = files.map((f) => {
+ const formData = new FormData();
+ formData.append('file', f);
+ return api.post('/product/import-product', formData, {
+ params: { productGroupId },
+ });
+ });
+
+ await Promise.all(importTasks);
+ fetch?.();
+ }
+
async function fetchListProductById(productId: string) {
const res = await api.get(`/product/${productId}`);
@@ -249,6 +270,8 @@ const useProductServiceStore = defineStore('api-product-service', () => {
productGroupId?: string;
status?: string;
fullDetail?: boolean;
+ startDate?: string;
+ endDate?: string;
}) {
const params = new URLSearchParams();
@@ -543,6 +566,8 @@ const useProductServiceStore = defineStore('api-product-service', () => {
fetchImageListById,
addImageList,
deleteImageByName,
+
+ importProduct,
};
});
diff --git a/src/stores/property/index.ts b/src/stores/property/index.ts
index c840c053..2765ed80 100644
--- a/src/stores/property/index.ts
+++ b/src/stores/property/index.ts
@@ -25,6 +25,8 @@ export const useProperty = defineStore('property-store', () => {
query?: string;
status?: Status;
activeOnly?: boolean;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>('/property', {
params,
diff --git a/src/stores/quotations/index.ts b/src/stores/quotations/index.ts
index 3be79081..e7faca39 100644
--- a/src/stores/quotations/index.ts
+++ b/src/stores/quotations/index.ts
@@ -76,6 +76,8 @@ export const useQuotationStore = defineStore('quotation-store', () => {
includeRegisteredBranch?: boolean;
forDebitNote?: boolean;
cancelIncludeDebitNote?: boolean;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>('/quotation', {
params,
diff --git a/src/stores/request-list/index.ts b/src/stores/request-list/index.ts
index 4a5da14e..040c7077 100644
--- a/src/stores/request-list/index.ts
+++ b/src/stores/request-list/index.ts
@@ -209,6 +209,9 @@ export const useRequestList = defineStore('request-list', () => {
requestDataStatus?: RequestDataStatus;
responsibleOnly?: boolean;
quotationId?: string;
+ incomplete?: boolean;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>('/request-data', {
params,
@@ -325,6 +328,20 @@ export const useRequestList = defineStore('request-list', () => {
return false;
}
+ async function updateMessenger(
+ requestDataId: string[],
+ defaultMessengerId: string,
+ ) {
+ const res = await api.post('/request-data/update-messenger', {
+ requestDataId,
+ defaultMessengerId,
+ });
+
+ if (res.status < 400) return true;
+
+ return false;
+ }
+
return {
data,
page,
@@ -350,6 +367,8 @@ export const useRequestList = defineStore('request-list', () => {
rejectRequest,
rejectRequestWork,
+
+ updateMessenger,
};
});
diff --git a/src/stores/request-list/types.ts b/src/stores/request-list/types.ts
index f221b209..e3d8cd57 100644
--- a/src/stores/request-list/types.ts
+++ b/src/stores/request-list/types.ts
@@ -14,6 +14,8 @@ export type RequestData = {
rejectRequestCancel?: boolean;
rejectRequestCancelReason?: string;
+ defaultMessengerId?: string;
+
quotation: QuotationFull & {
debitNoteQuotationId: string;
isDebitNote: boolean;
@@ -26,6 +28,7 @@ export type RequestData = {
requestWork: RequestWork[];
requestDataStatus: RequestDataStatus;
+ dataOffice: { name: string; nameEN: string };
};
export enum RequestDataStatus {
diff --git a/src/stores/task-order/index.ts b/src/stores/task-order/index.ts
index acc7f7a1..abb6c553 100644
--- a/src/stores/task-order/index.ts
+++ b/src/stores/task-order/index.ts
@@ -48,6 +48,8 @@ export const useTaskOrderStore = defineStore('taskorder-store', () => {
query?: string;
taskOrderStatus?: TaskOrderStatus;
assignedUserId?: boolean;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>('/task-order', {
params,
@@ -161,6 +163,8 @@ export const useTaskOrderStore = defineStore('taskorder-store', () => {
pageSize?: number;
query?: string;
userTaskStatus?: UserTaskStatus;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>('/user-task-order', {
params,
diff --git a/src/stores/task-order/types.ts b/src/stores/task-order/types.ts
index 0b64dc90..8bac1f86 100644
--- a/src/stores/task-order/types.ts
+++ b/src/stores/task-order/types.ts
@@ -53,6 +53,7 @@ export interface TaskOrder {
contactName: string;
taskOrderStatus: TaskOrderStatus;
taskName: string;
+ codeProductReceived?: string;
code: string;
id: string;
userTask: UserTask[];
@@ -164,6 +165,8 @@ export interface TaskOrderPayload {
requestWorkId: string;
requestWorkStep?: Task;
taskStatus?: TaskStatus;
+ failedType?: string;
+ failedComment?: string;
}[];
taskProduct?: {
productId: string;
@@ -177,6 +180,7 @@ export interface TaskOrderPayload {
registeredBranchId?: string;
id?: string;
code?: string;
+ codeProductReceived?: string;
remark?: string;
}
diff --git a/src/stores/user/index.ts b/src/stores/user/index.ts
index 2cd894a4..ac0b4b00 100644
--- a/src/stores/user/index.ts
+++ b/src/stores/user/index.ts
@@ -16,6 +16,7 @@ import axios from 'axios';
import useBranchStore from '../branch';
import { Branch } from '../branch/types';
import { getSignature, setSignature } from './signature';
+import { getUserId } from 'src/services/keycloak';
const branchStore = useBranchStore();
@@ -38,6 +39,14 @@ const useUserStore = defineStore('api-user', () => {
const data = ref>();
+ async function fetchUserGroup(id?: string) {
+ return await api
+ .get<
+ { id: string; name: string; path: string }[]
+ >(`/user/${id || getUserId()}/group`)
+ .then((res) => res.data);
+ }
+
async function fetchHqOption() {
if (userOption.value.hqOpts.length === 0) {
const res = await branchStore.fetchList({
@@ -168,6 +177,8 @@ const useUserStore = defineStore('api-user', () => {
status?: Status;
responsibleDistrictId?: string;
activeBranchOnly?: boolean;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>('/user', { params: opts });
@@ -332,6 +343,8 @@ const useUserStore = defineStore('api-user', () => {
setSignature,
typeStats,
+
+ fetchUserGroup,
};
});
diff --git a/src/stores/user/types.ts b/src/stores/user/types.ts
index bb0395a9..2f6daeb5 100644
--- a/src/stores/user/types.ts
+++ b/src/stores/user/types.ts
@@ -13,7 +13,7 @@ export type User = {
createdBy: string;
status: Status;
trainingPlace: string | null;
- importNationality: string | null;
+ importNationality: [] | null;
sourceNationality: string | null;
licenseExpireDate: Date | null;
licenseIssueDate: Date | null;
@@ -57,7 +57,8 @@ export type User = {
citizenIssue?: Date | null;
citizenId: string;
branch: Branch[];
-
+ contactName?: string;
+ contactTel?: string;
remark?: string;
agencyStatus?: AgencyStatus;
};
@@ -81,7 +82,7 @@ export type UserCreate = {
streetEN: string;
street: string;
trainingPlace?: string | null;
- importNationality?: string | null;
+ importNationality?: string[] | null;
sourceNationality?: string | null;
licenseExpireDate?: Date | null;
licenseIssueDate?: Date | null;
@@ -108,7 +109,8 @@ export type UserCreate = {
citizenExpire?: Date | null;
citizenIssue?: Date | null;
citizenId: string;
-
+ contactName?: string;
+ contactTel?: string;
remark?: string;
agencyStatus?: AgencyStatus | string;
};
diff --git a/src/stores/utils/index.ts b/src/stores/utils/index.ts
index 84f504a7..39beb6d6 100644
--- a/src/stores/utils/index.ts
+++ b/src/stores/utils/index.ts
@@ -610,6 +610,26 @@ export function getEmployeeName(
}[opts?.locale || 'eng'];
}
+export function setPrefixName(
+ record: {
+ namePrefix: string;
+ firstName: string;
+ lastName: string;
+ firstNameEN: string;
+ lastNameEN: string;
+ },
+ opts?: {
+ locale?: string;
+ },
+) {
+ const data = record;
+
+ return {
+ ['eng']: `${typeof data.namePrefix === 'string' ? useOptionStore().mapOption(data.namePrefix) : ''} ${data.firstNameEN} ${data.lastNameEN}`,
+ ['tha']: `${typeof data.namePrefix === 'string' ? useOptionStore().mapOption(data.namePrefix) : ''} ${data.firstName} ${data.lastName}`,
+ }[opts?.locale || 'eng'];
+}
+
export function toCamelCase(text: string): string {
return text
.replace(/[^a-zA-Z0-9]+(.)/g, (match, chr) => chr.toUpperCase())
diff --git a/src/stores/workflow-template/index.ts b/src/stores/workflow-template/index.ts
index adabf939..ef1e83d5 100644
--- a/src/stores/workflow-template/index.ts
+++ b/src/stores/workflow-template/index.ts
@@ -2,7 +2,7 @@ import { ref } from 'vue';
import { defineStore } from 'pinia';
import { api } from 'src/boot/axios';
import { PaginationResult } from 'src/types';
-import { WorkflowTemplate, WorkflowTemplatePayload } from './types';
+import { Group, WorkflowTemplate, WorkflowTemplatePayload } from './types';
import { Status } from '../types';
export const useWorkflowTemplate = defineStore('workflow-store', () => {
@@ -25,6 +25,8 @@ export const useWorkflowTemplate = defineStore('workflow-store', () => {
query?: string;
status?: Status;
activeOnly?: boolean;
+ startDate?: string;
+ endDate?: string;
}) {
const res = await api.get>(
'/workflow-template',
@@ -36,7 +38,7 @@ export const useWorkflowTemplate = defineStore('workflow-store', () => {
return res.data;
}
- async function creatWorkflowTemplate(data: WorkflowTemplatePayload) {
+ async function createWorkflowTemplate(data: WorkflowTemplatePayload) {
const res = await api.post('/workflow-template', data);
if (res.status >= 400) return null;
return res;
@@ -62,6 +64,12 @@ export const useWorkflowTemplate = defineStore('workflow-store', () => {
return res;
}
+ async function getGroupList() {
+ const res = await api.get('/keycloak/group');
+ if (res.status >= 400) return null;
+ return res.data;
+ }
+
return {
data,
page,
@@ -70,8 +78,9 @@ export const useWorkflowTemplate = defineStore('workflow-store', () => {
getWorkflowTemplate,
getWorkflowTemplateList,
- creatWorkflowTemplate,
+ createWorkflowTemplate,
editWorkflowTemplate,
deleteWorkflowTemplate,
+ getGroupList,
};
});
diff --git a/src/stores/workflow-template/types.ts b/src/stores/workflow-template/types.ts
index e3750660..c2c64036 100644
--- a/src/stores/workflow-template/types.ts
+++ b/src/stores/workflow-template/types.ts
@@ -23,6 +23,7 @@ export type WorkflowStep = {
user: CreatedBy;
}[];
responsibleInstitution: (string | { group: string })[];
+ responsibleGroup: string[];
attributes: WorkFlowAttributes;
};
@@ -49,6 +50,7 @@ export type WorkflowTemplatePayload = {
export type WorkflowUserInTable = {
name: string;
+ responsibleGroup: string[];
responsiblePerson: {
id: string;
selectedImage?: string;
@@ -73,6 +75,15 @@ export type WorkFlowPayloadStep = {
value?: string[];
responsiblePersonId?: string[];
responsibleInstitution?: string[];
+ responsibleGroup?: string[];
attributes: WorkFlowAttributes;
messengerByArea?: boolean;
};
+
+export type Group = {
+ id: string;
+ name: string;
+ path: string;
+ subGroupCount: number;
+ subGroups: Group[];
+};
diff --git a/src/utils/string-template.ts b/src/utils/string-template.ts
index f7350d71..b62164f2 100644
--- a/src/utils/string-template.ts
+++ b/src/utils/string-template.ts
@@ -1,5 +1,7 @@
import { RequestWork } from 'src/stores/request-list';
+import { TaskStatus } from 'src/stores/task-order/types';
import { formatNumberDecimal } from 'src/stores/utils';
+import { i18n } from 'src/boot/i18n';
const templates = {
'quotation-labor': {
@@ -46,7 +48,12 @@ const templates = {
converter: (context?: {
items?: {
product: RequestWork['productService']['product'];
- list: RequestWork[];
+ list: (RequestWork & {
+ taskStatus?: TaskStatus;
+ failedComment?: string;
+ failedType?: string;
+ codeRequest?: string;
+ })[];
}[];
itemsDiscount?: {
productId: string;
@@ -67,8 +74,9 @@ const templates = {
const branch = v.request.quotation.customerBranch;
return (
`${i + 1}. ` +
+ ` ${v.request.code}_${branch.customer.customerType === 'PERS' ? `นายจ้าง ${branch.namePrefix}. ${branch.firstNameEN} ${branch.lastNameEN} `.toUpperCase() : branch.registerName}_` +
`${employee.namePrefix}. ${employee.firstNameEN} ${employee.lastNameEN} `.toUpperCase() +
- `(${branch.customer.customerType === 'PERS' ? `นายจ้าง ${branch.namePrefix}. ${branch.firstNameEN} ${branch.lastNameEN} `.toUpperCase() : branch.registerName})`
+ `${!!v.failedType && v.failedType !== 'other' ? `${i18n.global.t(`taskOrder.${v.failedType}`)}` : !!v.failedComment ? v.failedComment : ''}`
);
});
return [
|