Merge branch 'feat/FE/US-280/project-flock-budget' of gitlab.com:mbugroup/lti-web-client into feat/FE/US-278/TASK-311-adjustment-purchase-and-expense

This commit is contained in:
rstubryan
2025-12-08 16:28:09 +07:00
55 changed files with 4116 additions and 1106 deletions
+48
View File
@@ -0,0 +1,48 @@
import { BaseMetadata, CreatedUser } from '@/types/api/api-general';
import { ProductWarehouse } from '@/types/api/inventory/product-warehouse';
import { ProductCategory } from '@/types/api/master-data/product-category';
import { Supplier } from '@/types/api/master-data/supplier';
import { Uom } from '@/types/api/master-data/uom';
import { Location } from '@/types/api/master-data/location';
export type BaseInventoryProduct = {
id: number;
name: string;
brand: string;
sku: string;
product_price: number;
selling_price?: number;
tax?: number;
expiry_period?: number;
uom: Uom;
product_category: ProductCategory;
suppliers: Supplier[];
flags: string[];
product_warehouses?: ProductWarehouseStock[];
total_stock?: number;
};
export type ProductWarehouseStock = {
id: number;
product_id: number;
warehouse_id: number;
warehouse_name: string;
location: Location | null;
current_stock: number;
stock_logs: StockLog[];
};
export type StockLog = {
id: number;
increase: number;
decrease: number;
loggable_type: string;
loggable_id: number;
notes: string;
product_warehouse_id: number;
created_by: number;
created_user: CreatedUser;
created_at: string;
};
export type InventoryProduct = BaseInventoryProduct & BaseMetadata;
+22
View File
@@ -39,3 +39,25 @@ export type LookupProjectFlockKandangPayload = {
project_flock_id: number;
kandang_id: number;
};
export type ClosingProjectFlockKandangPayload = {
action: 'close' | 'unclose';
closed_date?: string; // YYYY-MM-DD, DD-MM-YYYY, or RFC3339
};
export type ClosingExpense = {
id: number;
po_number: string;
category: string;
total: number;
status: string;
step_name: string;
step: number;
reference_number: string;
};
export type CheckClosingResponse = {
unfinished_expenses: number;
stock_remaining: ProductWarehouse[];
expenses: ClosingExpense[];
};
+12
View File
@@ -4,6 +4,7 @@ import { Flock } from '@/types/api/master-data/flock';
import { Kandang } from '@/types/api/master-data/kandang';
import { Location } from '@/types/api/master-data/location';
import { BaseApproval, BaseMetadata } from '@/types/api/api-general';
import { Nonstock } from '@/types/api/master-data/nonstock';
export type BaseProjectFlock = {
id: number;
@@ -22,6 +23,7 @@ export type BaseProjectFlock = {
kandangs: (Kandang & {
project_flock_kandang_id: number;
})[];
project_budgets?: ProjectFlockBudget[];
approval: BaseApproval;
};
@@ -30,6 +32,15 @@ export type PeriodFlock = {
next_period: number;
};
export type ProjectFlockBudget = {
id?: number;
project_flock_id?: number;
nonstock_id: number;
nonstock?: Nonstock;
qty: number;
price: number;
};
export type ProjectFlock = BaseMetadata & BaseProjectFlock;
export type CreateProjectFlockPayload = {
@@ -39,6 +50,7 @@ export type CreateProjectFlockPayload = {
fcr_id: number;
location_id: number;
kandang_ids: number[];
project_budgets?: ProjectFlockBudget[];
};
export type UpdateProjectFlockPayload = CreateProjectFlockPayload;
+10 -1
View File
@@ -3,4 +3,13 @@ type MainUiSlice = {
setMainDrawerOpen: (open: boolean) => void;
};
export type UIStore = MainUiSlice;
type DrawerUISlice = {
triggerValidate: boolean;
toggleValidate: () => void;
subscribeValidate: (callback: () => void) => void;
isValid: boolean;
setIsValid: (v: boolean) => void;
subscribeIsValid: (callback: (isValid: boolean) => void) => () => void;
};
export type UIStore = MainUiSlice & DrawerUISlice;