diff --git a/src/pages/11_credit-note/TableCreditNote.vue b/src/pages/11_credit-note/TableCreditNote.vue
index ed82be7d..32668a27 100644
--- a/src/pages/11_credit-note/TableCreditNote.vue
+++ b/src/pages/11_credit-note/TableCreditNote.vue
@@ -4,7 +4,7 @@ import { storeToRefs } from 'pinia';
import { QTableSlots } from 'quasar';
import { CreditNote, useCreditNote } from 'src/stores/credit-note';
-import { columns } from './constants.ts';
+import { columns } from './constants';
import KebabAction from 'src/components/shared/KebabAction.vue';
const creditNote = useCreditNote();
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/TableDebitNote.vue b/src/pages/12_debit-note/TableDebitNote.vue
index de3d6907..4df008ca 100644
--- a/src/pages/12_debit-note/TableDebitNote.vue
+++ b/src/pages/12_debit-note/TableDebitNote.vue
@@ -4,7 +4,7 @@ import { storeToRefs } from 'pinia';
import { QTableSlots } from 'quasar';
import { DebitNote, useDebitNote } from 'src/stores/debit-note';
-import { columns } from './constants.ts';
+import { columns } from './constants';
import KebabAction from 'src/components/shared/KebabAction.vue';
const debitNote = useDebitNote();
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') }}
+
+
-
+
diff --git a/src/router/index.ts b/src/router/index.ts
index 88456704..2b416040 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -1,4 +1,4 @@
-import { route } from 'quasar/wrappers';
+import { defineRouter } from '#q-app/wrappers';
import {
createMemoryHistory,
createRouter,
@@ -17,7 +17,7 @@ import routes from './routes';
* with the Router instance.
*/
-export default route(function (/* { store, ssrContext } */) {
+export default defineRouter(function (/* { store, ssrContext } */) {
const createHistory = process.env.SERVER
? createMemoryHistory
: process.env.VUE_ROUTER_MODE === 'history'
diff --git a/src/router/routes.ts b/src/router/routes.ts
index e05049fd..c3ef0438 100644
--- a/src/router/routes.ts
+++ b/src/router/routes.ts
@@ -155,6 +155,16 @@ const routes: RouteRecordRaw[] = [
name: 'ManualView',
component: () => 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/shims-vue.d.ts b/src/shims-vue.d.ts
deleted file mode 100644
index 4e6894b2..00000000
--- a/src/shims-vue.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/* eslint-disable */
-
-///
-
-// Mocks all files ending in `.vue` showing them as plain Vue instances
-declare module '*.vue' {
- import type { DefineComponent } from 'vue';
- const component: DefineComponent<{}, {}, any>;
- export default component;
-}
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/config/index.ts b/src/stores/config/index.ts
index 9ab43cda..c57eb1d6 100644
--- a/src/stores/config/index.ts
+++ b/src/stores/config/index.ts
@@ -1,6 +1,7 @@
import { defineStore } from 'pinia';
import { api } from 'src/boot/axios';
import { ref } from 'vue';
+import type { AppConfig } from './types';
export const useConfigStore = defineStore('config-store', () => {
const data = ref();
diff --git a/src/stores/config/types.ts b/src/stores/config/types.ts
index 5090f8d4..819910b7 100644
--- a/src/stores/config/types.ts
+++ b/src/stores/config/types.ts
@@ -1,3 +1,3 @@
-type AppConfig = {
+export type AppConfig = {
vat: number;
};
diff --git a/src/stores/credit-note/index.ts b/src/stores/credit-note/index.ts
index 72ae3977..24da139e 100644
--- a/src/stores/credit-note/index.ts
+++ b/src/stores/credit-note/index.ts
@@ -3,17 +3,17 @@ import {
CreditNoteStatus as Status,
CreditNotePayload as Payload,
CreditNotePaybackStatus,
-} from './types.ts';
+} from './types';
import { ref } from 'vue';
import { defineStore } from 'pinia';
-import { api } from 'src/boot/axios.ts';
-import { PaginationResult } from 'src/types.ts';
-import { manageAttachment, manageFile } from '../utils/index.ts';
+import { api } from 'src/boot/axios';
+import { PaginationResult } from 'src/types';
+import { manageAttachment, manageFile } from '../utils';
const ENDPOINT = 'credit-note';
-export * from './types.ts';
+export * from './types';
export async function getCreditNoteStats() {
const res = await api.get>(`/${ENDPOINT}/stats`);
@@ -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 132cd0c6..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 &
@@ -500,6 +502,6 @@ const useCustomerStore = defineStore('api-customer', () => {
};
});
-export * from './types.ts';
+export * from './types';
export default useCustomerStore;
diff --git a/src/stores/debit-note/index.ts b/src/stores/debit-note/index.ts
index a943e932..6d8638f8 100644
--- a/src/stores/debit-note/index.ts
+++ b/src/stores/debit-note/index.ts
@@ -2,17 +2,17 @@ import {
DebitNote as Data,
DebitNoteStatus as Status,
DebitNotePayload as Payload,
-} from './types.ts';
+} from './types';
import { ref } from 'vue';
import { defineStore } from 'pinia';
-import { api } from 'src/boot/axios.ts';
-import { PaginationResult } from 'src/types.ts';
-import { manageAttachment, manageFile } from '../utils/index.ts';
+import { api } from 'src/boot/axios';
+import { PaginationResult } from 'src/types';
+import { manageAttachment, manageFile } from '../utils';
const ENDPOINT = 'debit-note';
-export * from './types.ts';
+export * from './types';
export async function getDebitNoteStats() {
const res = await api.get>(`/${ENDPOINT}/stats`);
@@ -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/institution/types.ts b/src/stores/institution/types.ts
index 7bd6287f..9a3877a5 100644
--- a/src/stores/institution/types.ts
+++ b/src/stores/institution/types.ts
@@ -1,4 +1,5 @@
import { District, Province, SubDistrict } from '../address';
+import { BankBook } from '../branch/types';
import { Status } from '../types';
export type Institution = {
@@ -25,6 +26,11 @@ export type Institution = {
districtId: string;
provinceId: string;
status: Status;
+
+ contactName?: string | null;
+ contactEmail?: string | null;
+ contactTel?: string | null;
+ bank: BankBook[];
};
export type InstitutionPayload = {
@@ -34,6 +40,11 @@ export type InstitutionPayload = {
group?: string;
selectedImage?: string | null;
+ contactName?: string | null;
+ contactEmail?: string | null;
+ contactTel?: string | null;
+ bank: BankBook[];
+
addressEN: string;
address: string;
soi?: string | null;
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/options/index.ts b/src/stores/options/index.ts
index d425389b..469d991f 100644
--- a/src/stores/options/index.ts
+++ b/src/stores/options/index.ts
@@ -75,6 +75,7 @@ const useOptionStore = defineStore('optionStore', () => {
}
return {
+ rawOption,
globalOption,
mapOption,
};
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/payment/types.ts b/src/stores/payment/types.ts
index f8c73b81..53a855d3 100644
--- a/src/stores/payment/types.ts
+++ b/src/stores/payment/types.ts
@@ -52,8 +52,4 @@ export type Payment = {
};
};
-export enum PaymentDataStatus {
- Success = 'PaymentSuccess',
- Wait = 'PaymentWait',
-}
export type Receipt = Payment;
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 133b160c..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,
@@ -237,4 +239,4 @@ export const useQuotationPayment = defineStore('quotation-payment', () => {
};
});
-export * from './types.ts';
+export * from './types';
diff --git a/src/stores/request-list/index.ts b/src/stores/request-list/index.ts
index a05cedc2..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,7 +367,9 @@ export const useRequestList = defineStore('request-list', () => {
rejectRequest,
rejectRequestWork,
+
+ updateMessenger,
};
});
-export * from './types.ts';
+export * from './types';
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 c4aeb682..abb6c553 100644
--- a/src/stores/task-order/index.ts
+++ b/src/stores/task-order/index.ts
@@ -27,6 +27,7 @@ export const useTaskOrderStore = defineStore('taskorder-store', () => {
[TaskOrderStatus.Complete]: 0,
[TaskOrderStatus.Accept]: 0,
[TaskOrderStatus.Submit]: 0,
+ [TaskOrderStatus.Restart]: 0,
});
const fileManager = manageAttachment(api, 'task-order');
@@ -47,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,
@@ -160,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 1d26ea90..ac0b4b00 100644
--- a/src/stores/user/index.ts
+++ b/src/stores/user/index.ts
@@ -15,12 +15,12 @@ import {
import axios from 'axios';
import useBranchStore from '../branch';
import { Branch } from '../branch/types';
-import useFlowStore from '../flow';
+import { getSignature, setSignature } from './signature';
+import { getUserId } from 'src/services/keycloak';
const branchStore = useBranchStore();
const useUserStore = defineStore('api-user', () => {
- const flowStore = useFlowStore();
const userOption = ref({
hqOpts: [],
brOpts: [],
@@ -39,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({
@@ -95,37 +103,15 @@ const useUserStore = defineStore('api-user', () => {
});
}
- async function fetchAttachment(
- userId: string,
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
- const res = await api.get(`/user/${userId}/attachment`, {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- });
-
+ async function fetchAttachment(userId: string) {
+ const res = await api.get(`/user/${userId}/attachment`);
if (res && res.status === 200) {
return res.data;
}
return false;
}
- async function addAttachment(
- userId: string,
- payload: UserAttachmentCreate,
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
+ async function addAttachment(userId: string, payload: UserAttachmentCreate) {
const list: { name: string; file: File }[] = [];
payload.file.forEach((v) => {
@@ -156,13 +142,6 @@ const useUserStore = defineStore('api-user', () => {
const res = await api.post<(UserAttachment & { uploadUrl: string })[]>(
`/user/${userId}/attachment`,
{ file: list.map((v) => v.name) },
- {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- },
);
await Promise.all(
@@ -182,19 +161,9 @@ const useUserStore = defineStore('api-user', () => {
async function deleteAttachment(
userId: string,
payload: UserAttachmentDelete,
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
) {
await api.delete(`/user/${userId}/attachment`, {
data: payload,
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
});
}
@@ -208,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 });
@@ -217,21 +188,8 @@ const useUserStore = defineStore('api-user', () => {
return false;
}
- async function fetchById(
- id: string,
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
- const res = await api.get(`/user/${id}`, {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- });
+ async function fetchById(id: string) {
+ const res = await api.get(`/user/${id}`);
if (!res) return false;
if (res.status === 200) return res.data;
@@ -240,21 +198,8 @@ const useUserStore = defineStore('api-user', () => {
return false;
}
- async function fetchImageListById(
- id: string,
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
- const res = await api.get(`/user/${id}/profile-image`, {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- });
+ async function fetchImageListById(id: string) {
+ const res = await api.get(`/user/${id}/profile-image`);
if (!res) return false;
if (res.status === 200) return res.data;
@@ -274,22 +219,8 @@ const useUserStore = defineStore('api-user', () => {
return name;
}
- async function deleteImageByName(
- id: string,
- name: string,
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
- const res = await api.delete(`/user/${id}/profile-image/${name}`, {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- });
+ async function deleteImageByName(id: string, name: string) {
+ const res = await api.delete(`/user/${id}/profile-image/${name}`);
if (!res) return false;
}
@@ -300,27 +231,12 @@ const useUserStore = defineStore('api-user', () => {
selectedImage: string;
list: { url: string; imgFile: File | null; name: string }[];
},
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
) {
const { zipCode, ...payload } = data;
- const res = await api.post(
- '/user',
- {
- ...payload,
- selectedImage: imgList.selectedImage || '',
- },
- {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- },
- );
+ const res = await api.post('/user', {
+ ...payload,
+ selectedImage: imgList.selectedImage || '',
+ });
if (imgList.list.length > 0 && res.data.id) {
for (let index = 0; index < imgList.list.length; index++) {
@@ -338,42 +254,18 @@ const useUserStore = defineStore('api-user', () => {
async function editById(
id: string,
data: Partial,
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
) {
- const { zipCode, ...paylond } = data;
+ const { zipCode, ...payload } = data;
- const res = await api.put(`/user/${id}`, paylond, {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- });
+ const res = await api.put(`/user/${id}`, payload);
if (!res) return false;
return res.data;
}
- async function deleteById(
- id: string,
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
- const res = await api.delete(`/user/${id}`, {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- });
+ async function deleteById(id: string) {
+ const res = await api.delete(`/user/${id}`);
if (!res) return false;
if (res.status === 200) return res.data;
@@ -381,21 +273,8 @@ const useUserStore = defineStore('api-user', () => {
return false;
}
- async function getBranch(
- userId: string,
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
- const res = await api.get>(`/user/${userId}/branch`, {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- });
+ async function getBranch(userId: string) {
+ const res = await api.get>(`/user/${userId}/branch`);
if (!res) return false;
if (res.status === 200) return res.data;
@@ -403,26 +282,10 @@ const useUserStore = defineStore('api-user', () => {
return false;
}
- async function addBranch(
- userId: string,
- branchId: string | string[],
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
- const res = await api.post(
- `/user/${userId}/branch`,
- { branch: ([] as string[]).concat(branchId) },
- {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- },
- );
+ async function addBranch(userId: string, branchId: string | string[]) {
+ const res = await api.post(`/user/${userId}/branch`, {
+ branch: ([] as string[]).concat(branchId),
+ });
if (!res) return false;
if (res.status >= 400) return false;
@@ -430,21 +293,8 @@ const useUserStore = defineStore('api-user', () => {
return res.data || true;
}
- async function removeBranch(
- userId: string,
- branchId: string | string[],
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
+ async function removeBranch(userId: string, branchId: string | string[]) {
const res = await api.delete(`/user/${userId}/branch`, {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
data: { branch: ([] as string[]).concat(branchId) },
});
@@ -454,18 +304,8 @@ const useUserStore = defineStore('api-user', () => {
return res.data || true;
}
- async function typeStats(flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- }) {
- const res = await api.get('/user/type-stats', {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- });
+ async function typeStats() {
+ const res = await api.get('/user/type-stats');
if (!res) return false;
if (res.status === 200) return res.data;
@@ -499,7 +339,12 @@ const useUserStore = defineStore('api-user', () => {
addAttachment,
deleteAttachment,
+ getSignature,
+ setSignature,
+
typeStats,
+
+ fetchUserGroup,
};
});
diff --git a/src/stores/user/signature.ts b/src/stores/user/signature.ts
new file mode 100644
index 00000000..da9486c6
--- /dev/null
+++ b/src/stores/user/signature.ts
@@ -0,0 +1,50 @@
+import axios from 'axios';
+import { api } from 'src/boot/axios';
+import { getUserId } from 'src/services/keycloak';
+
+export async function getSignature() {
+ const userId = getUserId();
+
+ if (!userId) return;
+
+ const responseSignature = await api.get(
+ '/user/' + userId + '/signature',
+ );
+
+ if (!responseSignature.data) return '';
+
+ const responseBlob = await axios.get(responseSignature.data, {
+ responseType: 'blob',
+ });
+
+ if (responseBlob.status < 400) {
+ return await new Promise((resolve, reject) => {
+ const reader = new FileReader();
+ reader.addEventListener('error', reject);
+ reader.addEventListener('load', () => resolve(reader.result as string));
+ reader.readAsDataURL(responseBlob.data);
+ });
+ } else {
+ return '';
+ }
+}
+
+export async function setSignature(image: string) {
+ const userId = getUserId();
+
+ if (!userId) return;
+
+ if (image === '') {
+ return await deleteSignature();
+ } else {
+ return await api.put('/user/' + userId + '/signature', { data: image });
+ }
+}
+
+export async function deleteSignature() {
+ const userId = getUserId();
+
+ if (!userId) return;
+
+ return await api.delete('/user/' + userId + '/signature');
+}
diff --git a/src/stores/user/types.ts b/src/stores/user/types.ts
index 7ce8ee7e..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,6 +57,10 @@ export type User = {
citizenIssue?: Date | null;
citizenId: string;
branch: Branch[];
+ contactName?: string;
+ contactTel?: string;
+ remark?: string;
+ agencyStatus?: AgencyStatus;
};
export type UserCreate = {
@@ -78,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;
@@ -105,8 +109,18 @@ export type UserCreate = {
citizenExpire?: Date | null;
citizenIssue?: Date | null;
citizenId: string;
+ contactName?: string;
+ contactTel?: string;
+ remark?: string;
+ agencyStatus?: AgencyStatus | string;
};
+export enum AgencyStatus {
+ Normal = 'Normal',
+ Canceled = 'Canceled',
+ Blacklist = 'Blacklist',
+}
+
export type UserAttachment = {
name: string;
url: 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/address.ts b/src/utils/address.ts
index a66ac185..2ee2da4b 100644
--- a/src/utils/address.ts
+++ b/src/utils/address.ts
@@ -19,34 +19,34 @@ export function formatAddress(opt: {
let addressParts: string[];
if (opt.en) {
// en
- addressParts = [`${opt.addressEN},`];
- if (opt.mooEN) addressParts.push(`Moo ${opt.mooEN},`);
- if (opt.soiEN) addressParts.push(`Soi ${opt.soiEN},`);
+ addressParts = [`${opt.addressEN}`];
+ if (opt.mooEN) addressParts.push(`Moo ${opt.mooEN}`);
+ if (opt.soiEN) addressParts.push(`Soi ${opt.soiEN}`);
if (opt.streetEN) addressParts.push(`${opt.streetEN} Rd.`);
if (opt.subDistrict) {
- addressParts.push(`${opt.subDistrict.nameEN} sub-district,`);
+ addressParts.push(`${opt.subDistrict.nameEN} sub-district`);
}
- if (opt.district) addressParts.push(`${opt.district.nameEN} district,`);
- if (opt.province) addressParts.push(`${opt.province.nameEN},`);
+ if (opt.district) addressParts.push(`${opt.district.nameEN} distric`);
+ if (opt.province) addressParts.push(`${opt.province.nameEN}`);
} else {
// th
- addressParts = [`${opt.address},`];
- if (opt.moo) addressParts.push(`หมู่ ${opt.moo},`);
- if (opt.soi) addressParts.push(`ซอย ${opt.soi},`);
- if (opt.street) addressParts.push(`ถนน${opt.street},`);
+ addressParts = [`${opt.address}`];
+ if (opt.moo) addressParts.push(`หมู่ ${opt.moo}`);
+ if (opt.soi) addressParts.push(`ซอย ${opt.soi}`);
+ if (opt.street) addressParts.push(`ถนน${opt.street}`);
if (opt.subDistrict) {
addressParts.push(
- `${opt.province?.id === '10' ? 'แขวง' : 'ตำบล'}${opt.subDistrict.name},`,
+ `${opt.province?.id === '10' ? 'แขวง' : 'ตำบล'}${opt.subDistrict.name}`,
);
}
if (opt.district) {
addressParts.push(
- `${opt.province?.id === '10' ? 'เขต' : 'อำเภอ'}${opt.district.name},`,
+ `${opt.province?.id === '10' ? 'เขต' : 'อำเภอ'}${opt.district.name}`,
);
}
- if (opt.province) addressParts.push(`จังหวัด${opt.province.name},`);
+ if (opt.province) addressParts.push(`จังหวัด${opt.province.name}`);
// addressParts.push(
// `${opt.province.id === '10' ? t('address.subArea') : t('address.subDistrict')}${opt.subDistrict.name},`,
// );
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 [
diff --git a/src/utils/ui.ts b/src/utils/ui.ts
index d3dec4be..cc3b644d 100644
--- a/src/utils/ui.ts
+++ b/src/utils/ui.ts
@@ -42,7 +42,7 @@ export function setTheme(theme: Theme): Theme {
export enum Lang {
English = 'eng',
- Thai = 'tha',
+ Thai = 'tha', // spellchecker:disable-line
}
/**
diff --git a/tsconfig.json b/tsconfig.json
index 86e4d41d..839896a0 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,7 +1,4 @@
{
- "extends": "@quasar/app-vite/tsconfig-preset",
- "compilerOptions": {
- "baseUrl": "."
- },
- "exclude": ["tests"]
+ "extends": "./.quasar/tsconfig.json",
+ "exclude": ["./tests"]
}
|