mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
chore(FE-199,207): adjust expense type according to the API need
This commit is contained in:
Vendored
+89
-36
@@ -1,54 +1,107 @@
|
|||||||
import { BaseApproval, BaseMetadata } from '@/types/api/api-general';
|
import { BaseApproval, BaseMetadata } from '@/types/api/api-general';
|
||||||
import { Location } from '@/types/api/master-data/location';
|
import { BaseLocation, Location } from '@/types/api/master-data/location';
|
||||||
import { Kandang } from '@/types/api/master-data/kandang';
|
import { BaseKandang, Kandang } from '@/types/api/master-data/kandang';
|
||||||
import { Supplier } from '@/types/api/master-data/supplier';
|
import { BaseSupplier, Supplier } from '@/types/api/master-data/supplier';
|
||||||
import { Nonstock } from '@/types/api/master-data/nonstock';
|
import { BaseNonstock, Nonstock } from '@/types/api/master-data/nonstock';
|
||||||
|
import { BaseUser } from '@/types/api/user';
|
||||||
|
|
||||||
export type BaseExpense = {
|
export type BaseExpense = {
|
||||||
id: number;
|
id: number;
|
||||||
reference_number: string;
|
reference_number: string;
|
||||||
po_number?: string;
|
po_number: string | null;
|
||||||
location: Location;
|
category: 'BOP' | 'NON-BOP';
|
||||||
transaction_date: string;
|
documents?: {
|
||||||
realization_date?: string;
|
id: number;
|
||||||
kandangs: Kandang[];
|
path: string;
|
||||||
vendor: Supplier;
|
|
||||||
request_documents: {
|
|
||||||
name: string;
|
|
||||||
url: string;
|
|
||||||
}[];
|
}[];
|
||||||
kandang_expenses: {
|
realization_docs?: {
|
||||||
kandang: Kandang;
|
id: number;
|
||||||
expenses: {
|
path: string;
|
||||||
nonstock: Nonstock;
|
}[];
|
||||||
total_quantity: number;
|
expense_date: string;
|
||||||
total_expense: number;
|
realization_date?: string;
|
||||||
notes?: string;
|
grand_total: number;
|
||||||
|
location: BaseLocation;
|
||||||
|
supplier: BaseSupplier;
|
||||||
|
kandangs: {
|
||||||
|
id: number;
|
||||||
|
kandang_id: number;
|
||||||
|
name: string;
|
||||||
|
pengajuans?: {
|
||||||
|
id: number;
|
||||||
|
qty: number;
|
||||||
|
unit_price: number;
|
||||||
|
total_price: number;
|
||||||
|
note?: string;
|
||||||
|
nonstock: Pick<BaseNonstock, 'id' | 'name' | 'flags'>;
|
||||||
|
project_flock_kandang: {
|
||||||
|
id: number;
|
||||||
|
kandang_id: number;
|
||||||
|
};
|
||||||
|
}[];
|
||||||
|
realisasi?: {
|
||||||
|
id: number;
|
||||||
|
qty: number;
|
||||||
|
unit_price: number;
|
||||||
|
total_price: number;
|
||||||
|
date: string;
|
||||||
|
note?: string;
|
||||||
|
nonstock: Pick<BaseNonstock, 'id' | 'name' | 'flags'>;
|
||||||
|
project_flock_kandang: {
|
||||||
|
id: number;
|
||||||
|
kandang_id: number;
|
||||||
|
};
|
||||||
}[];
|
}[];
|
||||||
}[];
|
}[];
|
||||||
nominal: number;
|
total_pengajuan: number;
|
||||||
paid?: number;
|
total_realisasi: number;
|
||||||
remaining_cost?: number;
|
latest_approval: BaseApproval;
|
||||||
approval: BaseApproval;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Expense = BaseMetadata & BaseExpense;
|
export type Expense = BaseMetadata & BaseExpense;
|
||||||
|
|
||||||
export type CreateExpensePayload = {
|
export type CreateExpensePayload = {
|
||||||
locationId: number;
|
category: 'BOP' | 'NON-BOP';
|
||||||
transaction_date: string;
|
transaction_date: string;
|
||||||
kandangIds: number[];
|
supplier_id: number;
|
||||||
vendorId: number;
|
documents: File[];
|
||||||
request_documents: File[];
|
cost_per_kandangs: {
|
||||||
kandang_expenses: {
|
kandang_id: number;
|
||||||
kandangId: number;
|
cost_items: {
|
||||||
expenses: {
|
nonstock_id: number;
|
||||||
nonstockId: number;
|
quantity: number;
|
||||||
total_quantity: number;
|
total_cost: number;
|
||||||
total_expense: number;
|
notes: string;
|
||||||
notes?: string;
|
|
||||||
}[];
|
}[];
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdateExpensePayload = CreateExpensePayload;
|
export type UpdateExpensePayload = {
|
||||||
|
category: 'BOP' | 'NON-BOP';
|
||||||
|
transaction_date: string;
|
||||||
|
supplier_id: number;
|
||||||
|
documents: File[];
|
||||||
|
cost_per_kandang: {
|
||||||
|
kandang_id: number;
|
||||||
|
cost_items: {
|
||||||
|
nonstock_id: number;
|
||||||
|
quantity: number;
|
||||||
|
total_cost: number;
|
||||||
|
notes: string;
|
||||||
|
}[];
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateExpenseRealizationPayload = {
|
||||||
|
realization_date: string;
|
||||||
|
documents: File[];
|
||||||
|
realizations: {
|
||||||
|
expense_nonstock_id: number;
|
||||||
|
qty: number;
|
||||||
|
unit_price: number;
|
||||||
|
total_price: number;
|
||||||
|
notes: string;
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateExpenseRealizationPayload = CreateExpenseRealizationPayload;
|
||||||
|
|||||||
Reference in New Issue
Block a user