mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 15:55:48 +00:00
feat(FE-42): add Product Category API and form validation schema
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
import * as Yup from 'yup';
|
||||||
|
|
||||||
|
export const ProductCategoryFormSchema = Yup.object({
|
||||||
|
code: Yup.string().required('Kode wajib diisi!').max(3, 'Kode kategori produk melebihi 3 karakter!'),
|
||||||
|
name: Yup.string().required('Nama wajib diisi!'),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const UpdateProductCategoryFormSchema = ProductCategoryFormSchema;
|
||||||
|
|
||||||
|
export type ProductCategoryFormValues = Yup.InferType<typeof ProductCategoryFormSchema>;
|
||||||
@@ -24,6 +24,11 @@ import {
|
|||||||
UpdateWarehousePayload,
|
UpdateWarehousePayload,
|
||||||
Warehouse,
|
Warehouse,
|
||||||
} from '@/types/api/master-data/warehouse';
|
} from '@/types/api/master-data/warehouse';
|
||||||
|
import {
|
||||||
|
CreateProductCategoryPayload,
|
||||||
|
ProductCategory,
|
||||||
|
UpdateProductCategoryPayload,
|
||||||
|
} from '@/types/api/master-data/product-category';
|
||||||
|
|
||||||
export const UomApi = new BaseApiService<
|
export const UomApi = new BaseApiService<
|
||||||
Uom,
|
Uom,
|
||||||
@@ -54,3 +59,9 @@ export const WarehouseApi = new BaseApiService<
|
|||||||
CreateWarehousePayload,
|
CreateWarehousePayload,
|
||||||
UpdateWarehousePayload
|
UpdateWarehousePayload
|
||||||
>('/master-data/warehouses');
|
>('/master-data/warehouses');
|
||||||
|
|
||||||
|
export const ProductCategoryApi = new BaseApiService<
|
||||||
|
ProductCategory,
|
||||||
|
CreateProductCategoryPayload,
|
||||||
|
UpdateProductCategoryPayload
|
||||||
|
>('/master-data/product-categories');
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
import { BaseMetadata } from '@/types/api/api-general';
|
||||||
|
|
||||||
|
export type BaseProductCategory = {
|
||||||
|
id: number;
|
||||||
|
code: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ProductCategory = BaseMetadata & BaseProductCategory;
|
||||||
|
|
||||||
|
export type CreateProductCategoryPayload = {
|
||||||
|
code: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateProductCategoryPayload = CreateProductCategoryPayload;
|
||||||
Reference in New Issue
Block a user