mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
feat(FE-62,65): add inventory movement management with API and form validation
This commit is contained in:
@@ -0,0 +1,67 @@
|
|||||||
|
import * as Yup from 'yup';
|
||||||
|
|
||||||
|
export const MovementFormSchema = Yup.object({
|
||||||
|
alasan_transfer: Yup.string()
|
||||||
|
.required('Alasan Transfer wajib diisi!'),
|
||||||
|
tanggal_transfer: Yup.date()
|
||||||
|
.required('Tanggal Transfer wajib diisi!')
|
||||||
|
.typeError('Tanggal Transfer tidak valid!'),
|
||||||
|
warehouse_asal: Yup.object({
|
||||||
|
value: Yup.number().min(1).required(),
|
||||||
|
label: Yup.string().required(),
|
||||||
|
}).nullable(),
|
||||||
|
warehouse_asal_id: Yup.number()
|
||||||
|
.required('Gudang Asal wajib diisi!'),
|
||||||
|
warehouse_tujuan: Yup.object({
|
||||||
|
value: Yup.number().min(1).required(),
|
||||||
|
label: Yup.string().required(),
|
||||||
|
}).nullable(),
|
||||||
|
warehouse_tujuan_id: Yup.number()
|
||||||
|
.required('Gudang Tujuan wajib diisi!'),
|
||||||
|
alasan: Yup.string()
|
||||||
|
.required('Alasan wajib diisi!'),
|
||||||
|
product: Yup.object({
|
||||||
|
value: Yup.number().min(1).required(),
|
||||||
|
label: Yup.string().required(),
|
||||||
|
}).nullable(),
|
||||||
|
product_id: Yup.array()
|
||||||
|
.of(Yup.number()).min(1, 'Pilih minimal 1 produk')
|
||||||
|
.required('Produk wajib diisi!'),
|
||||||
|
qty_product: Yup.array()
|
||||||
|
.of(Yup.number().min(1, 'Kuantitas minimal 1'))
|
||||||
|
.min(1, 'Pilih minimal 1 produk')
|
||||||
|
.required('Kuantitas wajib diisi!'),
|
||||||
|
ekspedisi: Yup.array().of(
|
||||||
|
Yup.object({
|
||||||
|
product: Yup.object({
|
||||||
|
value: Yup.number().min(1).required(),
|
||||||
|
label: Yup.string().required(),
|
||||||
|
}).nullable(),
|
||||||
|
product_id: Yup.number()
|
||||||
|
.required('Produk wajib diisi!'),
|
||||||
|
qty: Yup.number().min(1, 'Kuantitas minimal 1')
|
||||||
|
.required('Kuantitas wajib diisi!'),
|
||||||
|
supplier: Yup.object({
|
||||||
|
value: Yup.number().min(1).required(),
|
||||||
|
label: Yup.string().required(),
|
||||||
|
}).nullable(),
|
||||||
|
supplier_id: Yup.number()
|
||||||
|
.required('Supplier wajib diisi!'),
|
||||||
|
plat_nomor: Yup.string()
|
||||||
|
.required('Plat Nomor wajib diisi!'),
|
||||||
|
no_surat_jalan: Yup.string()
|
||||||
|
.required('No Surat Jalan wajib diisi!'),
|
||||||
|
dokumen: Yup.mixed()
|
||||||
|
.required('Dokumen wajib diisi!'),
|
||||||
|
biaya_ekspedisi: Yup.number()
|
||||||
|
.min(0, 'Biaya Ekspedisi minimal 0')
|
||||||
|
.required('Biaya Ekspedisi wajib diisi!'),
|
||||||
|
nama_sopir: Yup.string()
|
||||||
|
.required('Nama Sopir wajib diisi!'),
|
||||||
|
})
|
||||||
|
).min(1, 'Pilih minimal 1 ekspedisi').required('Ekspedisi wajib diisi!'),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const UpdateMovementFormSchema = MovementFormSchema;
|
||||||
|
|
||||||
|
export type MovementFormValues = Yup.InferType<typeof MovementFormSchema>;
|
||||||
+132
-109
@@ -1,122 +1,145 @@
|
|||||||
export const MAIN_DRAWER_LINKS = [
|
export const MAIN_DRAWER_LINKS = [
|
||||||
{
|
{
|
||||||
title: 'Dashboard',
|
title: 'Dashboard',
|
||||||
link: '/dashboard',
|
link: '/dashboard',
|
||||||
icon: 'gg:chart',
|
icon: 'gg:chart',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: 'Master Data',
|
title: 'Persediaan',
|
||||||
link: '/master-data',
|
link: '/inventory',
|
||||||
icon: 'majesticons:data-line',
|
icon: 'mdi:warehouse',
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
title: 'Product',
|
title: 'Product',
|
||||||
link: '/master-data/product',
|
link: '/inventory/product',
|
||||||
icon: 'fluent-mdl2:product-variant',
|
icon: 'mdi:package-variant-closed',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Product Category',
|
title: 'Penyesuaian Stok',
|
||||||
link: '/master-data/product-category',
|
link: '/inventory/adjustment',
|
||||||
icon: 'carbon:categories',
|
icon: 'mdi:database-edit',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Bank',
|
title: 'Transfer Stok',
|
||||||
link: '/master-data/bank',
|
link: '/inventory/movement',
|
||||||
icon: 'mdi:bank-outline',
|
icon: 'mdi:swap-horizontal',
|
||||||
},
|
},
|
||||||
{
|
],
|
||||||
title: 'Area',
|
},
|
||||||
link: '/master-data/area',
|
|
||||||
icon: 'majesticons:map-marker-area-line',
|
{
|
||||||
},
|
title: 'Master Data',
|
||||||
{
|
link: '/master-data',
|
||||||
title: 'Location',
|
icon: 'majesticons:data-line',
|
||||||
link: '/master-data/location',
|
submenu: [
|
||||||
icon: 'mingcute:location-line',
|
{
|
||||||
},
|
title: 'Product',
|
||||||
{
|
link: '/master-data/product',
|
||||||
title: 'Kandang',
|
icon: 'fluent-mdl2:product-variant',
|
||||||
link: '/master-data/kandang',
|
},
|
||||||
icon: 'mdi:farm-home-outline',
|
{
|
||||||
},
|
title: 'Product Category',
|
||||||
{
|
link: '/master-data/product-category',
|
||||||
title: 'Warehouse',
|
icon: 'carbon:categories',
|
||||||
link: '/master-data/warehouse',
|
},
|
||||||
icon: 'hugeicons:warehouse',
|
{
|
||||||
},
|
title: 'Bank',
|
||||||
{
|
link: '/master-data/bank',
|
||||||
title: 'Customer',
|
icon: 'mdi:bank-outline',
|
||||||
link: '/master-data/customer',
|
},
|
||||||
icon: 'ix:customer',
|
{
|
||||||
},
|
title: 'Area',
|
||||||
{
|
link: '/master-data/area',
|
||||||
title: 'UOM',
|
icon: 'majesticons:map-marker-area-line',
|
||||||
link: '/master-data/uom',
|
},
|
||||||
icon: 'lsicon:measure-outline',
|
{
|
||||||
},
|
title: 'Location',
|
||||||
{
|
link: '/master-data/location',
|
||||||
title: 'Non-Stock',
|
icon: 'mingcute:location-line',
|
||||||
link: '/master-data/nonstock',
|
},
|
||||||
icon: 'fluent:box-32-regular',
|
{
|
||||||
},
|
title: 'Kandang',
|
||||||
{
|
link: '/master-data/kandang',
|
||||||
title: 'FCR',
|
icon: 'mdi:farm-home-outline',
|
||||||
link: '/master-data/FCR',
|
},
|
||||||
icon: 'fluent:food-chicken-leg-16-regular',
|
{
|
||||||
},
|
title: 'Warehouse',
|
||||||
{
|
link: '/master-data/warehouse',
|
||||||
title: 'Supplier',
|
icon: 'hugeicons:warehouse',
|
||||||
link: '/master-data/supplier',
|
},
|
||||||
icon: 'material-symbols:add-business-outline-rounded',
|
{
|
||||||
},
|
title: 'Customer',
|
||||||
],
|
link: '/master-data/customer',
|
||||||
},
|
icon: 'ix:customer',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'UOM',
|
||||||
|
link: '/master-data/uom',
|
||||||
|
icon: 'lsicon:measure-outline',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Non-Stock',
|
||||||
|
link: '/master-data/nonstock',
|
||||||
|
icon: 'fluent:box-32-regular',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'FCR',
|
||||||
|
link: '/master-data/FCR',
|
||||||
|
icon: 'fluent:food-chicken-leg-16-regular',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Supplier',
|
||||||
|
link: '/master-data/supplier',
|
||||||
|
icon: 'material-symbols:add-business-outline-rounded',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export const ROWS_OPTIONS = [
|
export const ROWS_OPTIONS = [
|
||||||
{
|
{
|
||||||
label: '10',
|
label: '10',
|
||||||
value: 10,
|
value: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '20',
|
label: '20',
|
||||||
value: 20,
|
value: 20,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '50',
|
label: '50',
|
||||||
value: 50,
|
value: 50,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '100',
|
label: '100',
|
||||||
value: 100,
|
value: 100,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const WAREHOUSE_TYPE_OPTIONS = [
|
export const WAREHOUSE_TYPE_OPTIONS = [
|
||||||
{
|
{
|
||||||
label: 'AREA',
|
label: 'AREA',
|
||||||
value: 'AREA',
|
value: 'AREA',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'LOKASI',
|
label: 'LOKASI',
|
||||||
value: 'LOKASI',
|
value: 'LOKASI',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'KANDANG',
|
label: 'KANDANG',
|
||||||
value: 'KANDANG',
|
value: 'KANDANG',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const PRODUCT_FLAG_OPTIONS = [
|
export const PRODUCT_FLAG_OPTIONS = [
|
||||||
{ label: 'DOC', value: 'DOC' },
|
{label: 'DOC', value: 'DOC'},
|
||||||
{ label: 'PAKAN', value: 'PAKAN' },
|
{label: 'PAKAN', value: 'PAKAN'},
|
||||||
{ label: 'PRE-STARTER', value: 'PRE-STARTER' },
|
{label: 'PRE-STARTER', value: 'PRE-STARTER'},
|
||||||
{ label: 'STARTER', value: 'STARTER' },
|
{label: 'STARTER', value: 'STARTER'},
|
||||||
{ label: 'FINISHER', value: 'FINISHER' },
|
{label: 'FINISHER', value: 'FINISHER'},
|
||||||
{ label: 'OVK', value: 'OVK' },
|
{label: 'OVK', value: 'OVK'},
|
||||||
{ label: 'OBAT', value: 'OBAT' },
|
{label: 'OBAT', value: 'OBAT'},
|
||||||
{ label: 'VITAMIN', value: 'VITAMIN' },
|
{label: 'VITAMIN', value: 'VITAMIN'},
|
||||||
{ label: 'KIMIA', value: 'KIMIA' },
|
{label: 'KIMIA', value: 'KIMIA'},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import {
|
||||||
|
CreateMovementPayload,
|
||||||
|
Movement,
|
||||||
|
UpdateMovementPayload,
|
||||||
|
} from "@/types/api/inventory/movement";
|
||||||
|
import {BaseApiService} from "@/services/api/base";
|
||||||
|
|
||||||
|
export const MovementApi = new BaseApiService<
|
||||||
|
Movement,
|
||||||
|
CreateMovementPayload,
|
||||||
|
UpdateMovementPayload
|
||||||
|
>('/inventory/movements');
|
||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
import {BaseMetadata} from '@/types/api/api-general';
|
||||||
|
import {Product} from "@/types/api/master-data/product";
|
||||||
|
import {Supplier} from "@/types/api/master-data/supplier";
|
||||||
|
import {Warehouse} from "@/types/api/master-data/warehouse";
|
||||||
|
|
||||||
|
export type BaseMovement = {
|
||||||
|
id: number;
|
||||||
|
alasan_transfer: string;
|
||||||
|
tanggal_transfer: string;
|
||||||
|
warehouse_asal: Warehouse;
|
||||||
|
warehouse_tujuan: Warehouse;
|
||||||
|
product: Array<{
|
||||||
|
product: Product;
|
||||||
|
qty_product: number;
|
||||||
|
}>;
|
||||||
|
ekspedisi: Array<{
|
||||||
|
product_id: number;
|
||||||
|
qty: number;
|
||||||
|
supplier: Supplier;
|
||||||
|
plat_nomor: string;
|
||||||
|
no_surat_jalan: string;
|
||||||
|
dokumen: string;
|
||||||
|
biaya_ekspedisi: number;
|
||||||
|
nama_sopir: string;
|
||||||
|
}>;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Movement = BaseMetadata & BaseMovement;
|
||||||
|
|
||||||
|
export type CreateMovementPayload = {
|
||||||
|
alasan: string;
|
||||||
|
warehouse_asal_id: number;
|
||||||
|
warehouse_tujuan_id: number;
|
||||||
|
product: Array<{
|
||||||
|
product_id: number;
|
||||||
|
qty_product: number;
|
||||||
|
}>;
|
||||||
|
ekspedisi: Array<{
|
||||||
|
product_id: number;
|
||||||
|
qty: number;
|
||||||
|
supplier_id: number;
|
||||||
|
plat_nomor: string;
|
||||||
|
no_surat_jalan: string;
|
||||||
|
dokumen: string;
|
||||||
|
biaya_ekspedisi: number;
|
||||||
|
nama_sopir: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UpdateMovementPayload = CreateMovementPayload;
|
||||||
Reference in New Issue
Block a user