diff --git a/src/components/04_product-service/BasicInfoProduct.vue b/src/components/04_product-service/BasicInfoProduct.vue
index 948e6dc6..98124825 100644
--- a/src/components/04_product-service/BasicInfoProduct.vue
+++ b/src/components/04_product-service/BasicInfoProduct.vue
@@ -94,7 +94,7 @@ watch(
hide-bottom-space
input-debounce="0"
:disable="!readonly && disableCode"
- class="col-md-3 col-6"
+ class="col-md-4 col-12"
v-model="code"
id="select-br-id"
option-label="label"
@@ -123,7 +123,7 @@ watch(
:readonly="readonly"
:borderless="readonly"
hide-bottom-space
- class="col-6"
+ class="col-md-8 col-12"
:label="$t('productService.product.name')"
v-model="name"
:rules="[(val: string) => !!val || $t('form.error.required')]"
diff --git a/src/components/04_product-service/BasicInformation.vue b/src/components/04_product-service/BasicInformation.vue
index d4e59c4e..9f1afa7c 100644
--- a/src/components/04_product-service/BasicInformation.vue
+++ b/src/components/04_product-service/BasicInformation.vue
@@ -167,58 +167,12 @@ watch(
outlined
:readonly="readonly"
hide-bottom-space
- class="col-md-3 col-4"
+ class="col-md-4 col-12"
:label="$t('productService.service.code')"
v-model="serviceCode"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
-
-
-
-
- {{ $t('general.noData') }}
-
-
-
-
-
+
([]);
const stat = ref<
@@ -252,7 +245,6 @@ const formDataGroup = ref({
const formDataProduct = ref({
expenseType: '',
vatIncluded: true,
- registeredBranchId: '',
productGroupId: '',
remark: '',
serviceCharge: 0,
@@ -274,7 +266,6 @@ const formDataProductService = ref({
name: '',
code: '',
productGroupId: '',
- registeredBranchId: '',
});
const hideStat = ref(false);
@@ -473,21 +464,15 @@ const propertiesDialog = ref(false);
const totalProduct = ref(0);
const totalService = ref(0);
-const totalProductAndService = ref(0);
-
const filterStat = ref<('group' | 'service' | 'product')[]>([]);
// แบ่งหน้า
const currentPageGroup = ref(1);
const maxPageGroup = ref(1);
const pageSizeGroup = ref(30);
-const currentPageType = ref(1);
-const maxPageType = ref(1);
-const pageSizeType = ref(30);
const maxPageServiceAndProduct = ref(1);
const pageSizeServiceAndProduct = ref(10);
const currentPageServiceAndProduct = ref(1);
-const totalType = ref(0);
const totalGroup = ref(0);
const total = ref(0);
@@ -559,9 +544,7 @@ async function fetchListOfOptionBranch() {
if (result && result.total > 0) branchOption.value = result.result;
}
- formDataProduct.value.registeredBranchId = currentMyBranch.value?.id || '';
- formDataProductService.value.registeredBranchId =
- currentMyBranch.value?.id || '';
+ formDataGroup.value.registeredBranchId = currentMyBranch.value?.id || '';
}
async function fetchListGroups() {
@@ -878,7 +861,6 @@ const prevService = ref({
name: '',
code: '',
productGroupId: '',
- registeredBranchId: '',
});
const currentService = ref();
@@ -902,7 +884,6 @@ async function assignFormDataProductService(id: string) {
work: [],
status: res.status,
productGroupId: res.productGroupId,
- registeredBranchId: res.registeredBranchId,
};
formDataProductService.value = { ...prevService.value };
@@ -949,7 +930,6 @@ const prevProduct = ref({
name: '',
code: '',
image: undefined,
- registeredBranchId: '',
});
function assignFormDataProduct(data: ProductList) {
@@ -970,7 +950,6 @@ function assignFormDataProduct(data: ProductList) {
name: data.name,
code: data.code,
image: undefined,
- registeredBranchId: data.registeredBranchId,
status: data.status,
expenseType: data.expenseType,
vatIncluded: data.vatIncluded,
@@ -1003,7 +982,6 @@ function clearFormProduct() {
name: '',
code: '',
image: undefined,
- registeredBranchId: '',
expenseType: '',
vatIncluded: true,
};
@@ -1026,7 +1004,6 @@ function clearFormService() {
work: [],
status: undefined,
productGroupId: '',
- registeredBranchId: '',
};
workItems.value = [];
@@ -1060,10 +1037,6 @@ async function submitService() {
if (dialogService.value) {
formDataProductService.value.productGroupId = currentIdGrop.value;
- if (formDataProductService.value.registeredBranchId === '') {
- formDataProductService.value.registeredBranchId = null;
- }
-
if (
formDataProductService.value.code === '' ||
formDataProductService.value.name === ''
@@ -3449,8 +3422,6 @@ watch(productMode, async () => {
>
{
{
- const useMyBranch = useMyBranchStore();
-
- const recordTreeProductType = ref>({});
-
- // Product Type
const flowStore = useFlowStore();
- const workNameItems = ref<{ id: string; name: string; isEdit: boolean }[]>(
- [],
- );
-
- async function fetchStatsProductType() {
- const res = await api.get('/product-type/stats');
-
- if (!res) return false;
-
- if (res.status === 200) {
- return res.data;
- }
- }
-
- async function fetchListProductServiceByIdType(groupId: string) {
- const res = await api.get(
- `/product-type/${groupId}`,
- );
-
- if (!res) return false;
-
- if (res.status === 200) {
- return res.data;
- }
- }
-
- async function fetchListProductServiceType(
- opts?: {
- page?: number;
- pageSize?: number;
- query?: string;
- productGroupId?: string;
- status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
- },
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
- const params = new URLSearchParams();
-
- for (const [k, v] of Object.entries(opts || {})) {
- v !== undefined && params.append(k, v.toString());
- }
-
- const query = params.toString();
-
- const res = await api.get<
- Pagination<(ProductGroup & { productGroupId: string })[]>
- >(`/product-type${(params && '?'.concat(query)) || ''}`, {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- });
-
- if (!res) return false;
- if (res.status === 200) {
- if (!!opts?.productGroupId) {
- recordTreeProductType.value[opts?.productGroupId] = res.data.result;
- }
- return res.data;
- }
-
- return false;
- }
-
- async function createProductServiceType(
- id: string,
- data: ProductGroupCreate,
- ) {
- const { code, ...payload } = data;
-
- const res = await api.post(
- '/product-type',
- {
- productGroupId: id,
- ...payload,
- },
- );
-
- if (!res) return false;
-
- if (res.status === 201) {
- return res.data;
- }
-
- return false;
- }
-
- async function editProductServiceType(
- groupId: string,
- data: Partial,
- ) {
- const { code, ...payload } = data;
-
- const res = await api.put(
- `/product-type/${groupId}`,
- {
- ...payload,
- },
- );
-
- if (!res) return false;
-
- if (res.status === 200) {
- return res.data;
- }
-
- return false;
- }
-
- async function deleteProductServiceType(groupId: string) {
- const res = await api.delete(`/product-type/${groupId}`);
-
- if (!res) return false;
-
- if (res.status === 200) {
- return res.data;
- }
-
- return false;
- }
+ const workNameItems = ref<
+ {
+ id: string;
+ name: string;
+ isEdit: boolean;
+ }[]
+ >([]);
// Product Group
@@ -182,19 +55,12 @@ const useProductServiceStore = defineStore('api-product-service', () => {
}
}
- async function fetchListProductService(
- opts?: {
- page?: number;
- pageSize?: number;
- query?: string;
- status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
- },
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
+ async function fetchListProductService(opts?: {
+ page?: number;
+ pageSize?: number;
+ query?: string;
+ status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
+ }) {
const params = new URLSearchParams();
for (const [k, v] of Object.entries(opts || {})) {
@@ -207,9 +73,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
`/product-group${(params && '?'.concat(query)) || ''}`,
{
headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
+ 'X-Rtid': flowStore.rtid,
},
},
);
@@ -291,40 +155,25 @@ const useProductServiceStore = defineStore('api-product-service', () => {
}
}
- async function fetchListProduct(
- opts?: {
- query?: string;
- page?: number;
- pageSize?: number;
- productGroupId?: string;
- status?: string;
- },
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
+ async function fetchListProduct(opts?: {
+ query?: string;
+ page?: number;
+ pageSize?: number;
+ productGroupId?: string;
+ status?: string;
+ }) {
const params = new URLSearchParams();
for (const [k, v] of Object.entries(opts || {})) {
v !== undefined && params.append(k, v.toString());
}
- if (useMyBranch.myBranch?.length !== 0 && useMyBranch.myBranch) {
- params.append('registeredBranchId', useMyBranch.myBranch[0].id);
- }
-
const query = params.toString();
const res = await api.get>(
`/product${(params && '?'.concat(query)) || ''}`,
{
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
+ headers: { 'X-Rtid': flowStore.rtid },
},
);
@@ -433,39 +282,26 @@ const useProductServiceStore = defineStore('api-product-service', () => {
}
}
- async function fetchListService(
- opts?: {
- query?: string;
- page?: number;
- pageSize?: number;
- productGroupId?: string;
- status?: string;
- },
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
- ) {
+ async function fetchListService(opts?: {
+ query?: string;
+ page?: number;
+ pageSize?: number;
+ productGroupId?: string;
+ status?: string;
+ }) {
const params = new URLSearchParams();
for (const [k, v] of Object.entries(opts || {})) {
v !== undefined && params.append(k, v.toString());
}
- if (useMyBranch.myBranch?.length !== 0 && useMyBranch.myBranch) {
- params.append('registeredBranchId', useMyBranch.myBranch[0].id);
- }
-
const query = params.toString();
const res = await api.get>(
`/service${(params && '?'.concat(query)) || ''}`,
{
headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
+ 'X-Rtid': flowStore.rtid,
},
},
);
@@ -508,11 +344,6 @@ const useProductServiceStore = defineStore('api-product-service', () => {
async function fetchListServiceByIdWork(
serviceId: string,
opts?: { query?: string; page?: number; pageSize?: number },
- flow?: {
- sessionId?: string;
- refTransactionId?: string;
- transactionId?: string;
- },
) {
const params = new URLSearchParams();
@@ -526,9 +357,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
`/service/${serviceId}/work${(params && '?'.concat(query)) || ''}`,
{
headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
+ 'X-Rtid': flowStore.rtid,
},
},
);
@@ -598,19 +427,12 @@ const useProductServiceStore = defineStore('api-product-service', () => {
}
// work
- async function fetchListWork(
- opts?: {
- query?: string;
- page?: number;
- pageSize?: number;
- baseOnly?: boolean;
- },
- flow?: {
- sessionId: string;
- refTransactionId: string;
- transactionId: string;
- },
- ) {
+ async function fetchListWork(opts?: {
+ query?: string;
+ page?: number;
+ pageSize?: number;
+ baseOnly?: boolean;
+ }) {
const params = new URLSearchParams();
for (const [k, v] of Object.entries(opts || {})) {
@@ -623,9 +445,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
Pagination<(Work & { productOnWork: ProductOnWork[] })[]>
>(`/work${(params && '?'.concat(query)) || ''}`, {
headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
+ 'X-Rtid': flowStore.rtid,
},
});
@@ -698,11 +518,6 @@ const useProductServiceStore = defineStore('api-product-service', () => {
async function fetchListProductByIdWork(
workId: string,
opts?: { query?: string; page?: number; pageSize?: number },
- flow?: {
- sessionId: string;
- refTransactionId: string;
- transactionId: string;
- },
) {
const params = new URLSearchParams();
@@ -716,9 +531,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
`/work/${workId}/product${(params && '?'.concat(query)) || ''}`,
{
headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
+ 'X-Rtid': flowStore.rtid,
},
},
);
@@ -741,60 +554,8 @@ const useProductServiceStore = defineStore('api-product-service', () => {
}
}
- async function fetchListProductAndService(
- opts?: {
- query?: string;
- page?: number;
- pageSize?: number;
- productGroupId?: string;
- status?: string;
- },
- flow?: {
- sessionId: string;
- refTransactionId: string;
- transactionId: string;
- },
- ) {
- const params = new URLSearchParams();
-
- for (const [k, v] of Object.entries(opts || {})) {
- v !== undefined && params.append(k, v.toString());
- }
-
- if (useMyBranch.myBranch?.length !== 0 && useMyBranch.myBranch) {
- params.append('registeredBranchId', useMyBranch.myBranch[0].id);
- }
-
- const query = params.toString();
-
- const res = await api.get>(
- `/product-service${(params && '?'.concat(query)) || ''}`,
- {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
- },
- },
- );
-
- if (!res) return false;
- if (res.status === 200) {
- return res.data;
- }
- return false;
- }
-
return {
workNameItems,
- recordTreeProductType,
-
- fetchStatsProductType,
- fetchListProductServiceByIdType,
- fetchListProductServiceType,
- createProductServiceType,
- editProductServiceType,
- deleteProductServiceType,
fetchStatsProductGroup,
fetchListProductServiceById,
@@ -826,8 +587,6 @@ const useProductServiceStore = defineStore('api-product-service', () => {
fetchListProductByIdWork,
fetchListOfWork,
-
- fetchListProductAndService,
};
});
diff --git a/src/stores/product-service/types.ts b/src/stores/product-service/types.ts
index 9c57677d..de072012 100644
--- a/src/stores/product-service/types.ts
+++ b/src/stores/product-service/types.ts
@@ -1,9 +1,5 @@
import { Status } from '../types';
-import { Pagination, UpdatedBy, CreatedBy } from 'stores/types';
-
-export type ServiceAndProduct =
- | (Service & { type: 'service' })
- | (ProductList & { type: 'product' });
+import { UpdatedBy, CreatedBy } from 'stores/types';
export interface TreeProduct {
name: string;
@@ -63,7 +59,6 @@ export interface ServiceCreate {
image?: File;
status?: Status;
productGroupId: string;
- registeredBranchId: string | null;
}
export interface Attributes {
@@ -154,13 +149,11 @@ export interface ProductList {
code: string;
id: string;
imageUrl: string;
- registeredBranchId: string;
}
export interface ProductCreate {
expenseType: string;
vatIncluded: boolean;
- registeredBranchId: string;
productGroupId: string;
remark: string;
serviceCharge: number;