refactor: type name
This commit is contained in:
parent
548f10feab
commit
f26f6b51d6
7 changed files with 24 additions and 24 deletions
|
|
@ -4,7 +4,7 @@ import { formatNumberDecimal } from 'stores/utils';
|
||||||
|
|
||||||
import useProductServiceStore from 'stores/product-service';
|
import useProductServiceStore from 'stores/product-service';
|
||||||
import useOptionStore from 'stores/options';
|
import useOptionStore from 'stores/options';
|
||||||
import { Attributes, ProductList } from 'stores/product-service/types';
|
import { Attributes, Product } from 'stores/product-service/types';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ withDefaults(
|
||||||
|
|
||||||
const workName = defineModel<string>('workName');
|
const workName = defineModel<string>('workName');
|
||||||
const attributes = defineModel<Attributes>('attributes', { required: true });
|
const attributes = defineModel<Attributes>('attributes', { required: true });
|
||||||
const productItems = defineModel<(ProductList & { nameEn: string })[]>(
|
const productItems = defineModel<(Product & { nameEn: string })[]>(
|
||||||
'productItems',
|
'productItems',
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ import {
|
||||||
ProductGroup,
|
ProductGroup,
|
||||||
ProductGroupCreate,
|
ProductGroupCreate,
|
||||||
ProductCreate,
|
ProductCreate,
|
||||||
ProductList,
|
Product,
|
||||||
ServiceCreate,
|
ServiceCreate,
|
||||||
Service,
|
Service,
|
||||||
ServiceById,
|
ServiceById,
|
||||||
|
|
@ -227,10 +227,10 @@ const productMode = ref<'group' | 'service' | 'product'>('group');
|
||||||
|
|
||||||
const productTab = ref(1);
|
const productTab = ref(1);
|
||||||
const productGroup = ref<ProductGroup[]>();
|
const productGroup = ref<ProductGroup[]>();
|
||||||
const product = ref<(ProductList & { type: 'product' })[]>();
|
const product = ref<(Product & { type: 'product' })[]>();
|
||||||
const productIsAdd = ref<(ProductList & { type: 'product' })[]>();
|
const productIsAdd = ref<(Product & { type: 'product' })[]>();
|
||||||
const service = ref<(Service & { type: 'service' })[]>();
|
const service = ref<(Service & { type: 'service' })[]>();
|
||||||
const resultSearchProduct = ref<ProductList[]>();
|
const resultSearchProduct = ref<Product[]>();
|
||||||
|
|
||||||
const productAndServiceTab = ref<'product' | 'service'>('service');
|
const productAndServiceTab = ref<'product' | 'service'>('service');
|
||||||
const manageWorkNameDialog = ref(false);
|
const manageWorkNameDialog = ref(false);
|
||||||
|
|
@ -460,7 +460,7 @@ const $q = useQuasar();
|
||||||
|
|
||||||
const workItems = ref<WorkItems[]>([]);
|
const workItems = ref<WorkItems[]>([]);
|
||||||
const workNameRef = ref();
|
const workNameRef = ref();
|
||||||
const selectProduct = ref<ProductList[]>([]);
|
const selectProduct = ref<Product[]>([]);
|
||||||
const currentWorkIndex = ref<number>(0);
|
const currentWorkIndex = ref<number>(0);
|
||||||
|
|
||||||
const serviceTab = ref(1);
|
const serviceTab = ref(1);
|
||||||
|
|
@ -525,7 +525,7 @@ async function searchProduct(isAdd: boolean = true) {
|
||||||
flowStore.rotate();
|
flowStore.rotate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectAllProduct(list: ProductList[]) {
|
function selectAllProduct(list: Product[]) {
|
||||||
list
|
list
|
||||||
?.filter((i) => {
|
?.filter((i) => {
|
||||||
if (i.status === 'INACTIVE') {
|
if (i.status === 'INACTIVE') {
|
||||||
|
|
@ -964,7 +964,7 @@ const prevProduct = ref<ProductCreate>({
|
||||||
image: undefined,
|
image: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function assignFormDataProduct(data: ProductList) {
|
async function assignFormDataProduct(data: Product) {
|
||||||
productTab.value = 1;
|
productTab.value = 1;
|
||||||
statusToggle.value = data.status === 'INACTIVE' ? false : true;
|
statusToggle.value = data.status === 'INACTIVE' ? false : true;
|
||||||
profileUrl.value = `${baseUrl.value}/product/${data?.id}/image/${data?.selectedImage}`;
|
profileUrl.value = `${baseUrl.value}/product/${data?.id}/image/${data?.selectedImage}`;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ import {
|
||||||
} from 'src/pages/03_customer-management/constant';
|
} from 'src/pages/03_customer-management/constant';
|
||||||
import {
|
import {
|
||||||
ProductGroup,
|
ProductGroup,
|
||||||
ProductList,
|
Product,
|
||||||
Service,
|
Service,
|
||||||
} from 'src/stores/product-service/types';
|
} from 'src/stores/product-service/types';
|
||||||
|
|
||||||
|
|
@ -121,11 +121,11 @@ const router = useRouter();
|
||||||
type ProductGroupId = string;
|
type ProductGroupId = string;
|
||||||
|
|
||||||
const productGroup = ref<ProductGroup[]>([]);
|
const productGroup = ref<ProductGroup[]>([]);
|
||||||
const productList = ref<Partial<Record<ProductGroupId, ProductList[]>>>({});
|
const productList = ref<Partial<Record<ProductGroupId, Product[]>>>({});
|
||||||
const serviceList = ref<Partial<Record<ProductGroupId, Service[]>>>({});
|
const serviceList = ref<Partial<Record<ProductGroupId, Service[]>>>({});
|
||||||
|
|
||||||
type Id = string;
|
type Id = string;
|
||||||
const product = ref<Record<Id, ProductList>>({});
|
const product = ref<Record<Id, Product>>({});
|
||||||
const service = ref<Record<Id, Service>>({});
|
const service = ref<Record<Id, Service>>({});
|
||||||
|
|
||||||
const selectedGroup = ref<ProductGroup | null>(null);
|
const selectedGroup = ref<ProductGroup | null>(null);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import DeleteButton from 'src/components/button/DeleteButton.vue';
|
||||||
import { isRoleInclude } from 'src/stores/utils';
|
import { isRoleInclude } from 'src/stores/utils';
|
||||||
import {
|
import {
|
||||||
ProductGroup,
|
ProductGroup,
|
||||||
ProductList,
|
Product,
|
||||||
Service,
|
Service,
|
||||||
Work,
|
Work,
|
||||||
} from 'src/stores/product-service/types';
|
} from 'src/stores/product-service/types';
|
||||||
|
|
@ -40,7 +40,7 @@ const inputSearch = defineModel<string>('inputSearch');
|
||||||
const productGroup = defineModel<ProductGroup[]>('productGroup', {
|
const productGroup = defineModel<ProductGroup[]>('productGroup', {
|
||||||
default: [],
|
default: [],
|
||||||
});
|
});
|
||||||
const productList = defineModel<Partial<Record<ProductGroupId, ProductList[]>>>(
|
const productList = defineModel<Partial<Record<ProductGroupId, Product[]>>>(
|
||||||
'productList',
|
'productList',
|
||||||
{ default: {} },
|
{ default: {} },
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { QuotationPayload } from 'src/stores/quotations/types';
|
||||||
import { Employee } from 'src/stores/employee/types';
|
import { Employee } from 'src/stores/employee/types';
|
||||||
import {
|
import {
|
||||||
ProductGroup,
|
ProductGroup,
|
||||||
ProductList,
|
Product,
|
||||||
Service,
|
Service,
|
||||||
} from 'src/stores/product-service/types';
|
} from 'src/stores/product-service/types';
|
||||||
|
|
||||||
|
|
@ -98,11 +98,11 @@ const pageState = reactive({
|
||||||
productServiceModal: false,
|
productServiceModal: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const productList = ref<Partial<Record<ProductGroupId, ProductList[]>>>({});
|
const productList = ref<Partial<Record<ProductGroupId, Product[]>>>({});
|
||||||
const serviceList = ref<Partial<Record<ProductGroupId, Service[]>>>({});
|
const serviceList = ref<Partial<Record<ProductGroupId, Service[]>>>({});
|
||||||
const productGroup = ref<ProductGroup[]>([]);
|
const productGroup = ref<ProductGroup[]>([]);
|
||||||
|
|
||||||
const product = ref<Record<Id, ProductList>>({});
|
const product = ref<Record<Id, Product>>({});
|
||||||
const service = ref<Record<Id, Service>>({});
|
const service = ref<Record<Id, Service>>({});
|
||||||
|
|
||||||
const selectedGroupSub = ref<'product' | 'service' | null>(null);
|
const selectedGroupSub = ref<'product' | 'service' | null>(null);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import {
|
||||||
ProductGroup,
|
ProductGroup,
|
||||||
ProductGroupCreate,
|
ProductGroupCreate,
|
||||||
ProductGroupUpdate,
|
ProductGroupUpdate,
|
||||||
ProductList,
|
Product,
|
||||||
ProductCreate,
|
ProductCreate,
|
||||||
ProductUpdate,
|
ProductUpdate,
|
||||||
Service,
|
Service,
|
||||||
|
|
@ -170,7 +170,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
|
|
||||||
const query = params.toString();
|
const query = params.toString();
|
||||||
|
|
||||||
const res = await api.get<Pagination<ProductList[]>>(
|
const res = await api.get<Pagination<Product[]>>(
|
||||||
`/product${(params && '?'.concat(query)) || ''}`,
|
`/product${(params && '?'.concat(query)) || ''}`,
|
||||||
{
|
{
|
||||||
headers: { 'X-Rtid': flowStore.rtid },
|
headers: { 'X-Rtid': flowStore.rtid },
|
||||||
|
|
@ -222,7 +222,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchListProductById(productId: string) {
|
async function fetchListProductById(productId: string) {
|
||||||
const res = await api.get<ProductList>(`/product/${productId}`);
|
const res = await api.get<Product>(`/product/${productId}`);
|
||||||
|
|
||||||
if (!res) return false;
|
if (!res) return false;
|
||||||
|
|
||||||
|
|
@ -534,7 +534,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
|
|
||||||
const query = params.toString();
|
const query = params.toString();
|
||||||
|
|
||||||
const res = await api.get<Pagination<ProductList[]>>(
|
const res = await api.get<Pagination<Product[]>>(
|
||||||
`/work/${workId}/product${(params && '?'.concat(query)) || ''}`,
|
`/work/${workId}/product${(params && '?'.concat(query)) || ''}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ export interface ServiceById {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductOnWork {
|
export interface ProductOnWork {
|
||||||
product: ProductList;
|
product: Product;
|
||||||
registeredBranchId: string;
|
registeredBranchId: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
updatedBy: UpdatedBy;
|
updatedBy: UpdatedBy;
|
||||||
|
|
@ -131,10 +131,10 @@ export interface WorkItems {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
attributes: Attributes;
|
attributes: Attributes;
|
||||||
product: (ProductList & { nameEn: string })[];
|
product: (Product & { nameEn: string })[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductList {
|
export interface Product {
|
||||||
selectedImage?: string;
|
selectedImage?: string;
|
||||||
expenseType: string;
|
expenseType: string;
|
||||||
vatIncluded: boolean;
|
vatIncluded: boolean;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue