- Implemented TransactionIndex component for displaying transactions with pagination and filtering options. - Created TransactionCardRow component for rendering individual transaction details. - Added TransactionItemSubRow component for displaying detailed order items within a transaction. - Integrated delete confirmation dialog for transaction deletion. - Updated routes to include transaction management with appropriate permissions.
135 lines
3.2 KiB
TypeScript
135 lines
3.2 KiB
TypeScript
export type TransactionStockType = 'good' | 'reject';
|
|
|
|
export type TransactionChannel = 'offline' | 'online' | 'whatsapp' | 'shopee' | 'tiktok';
|
|
|
|
export type TransactionPriceType = 'distributor' | 'agent' | 'sub_agent' | 'wholesale' | 'retail' | 'tiktok' | 'shopee';
|
|
|
|
export type TransactionPaymentType = 'cash' | 'transfer' | 'marketplace' | 'qris';
|
|
|
|
export type TransactionStatus = 'pending' | 'processing' | 'completed' | 'cancelled' | 'refunded';
|
|
|
|
export type TransactionItem = {
|
|
id: number;
|
|
product_variant_id: number;
|
|
stock_quality: TransactionStockType;
|
|
quantity: number;
|
|
unit_price: number;
|
|
subtotal: number;
|
|
product_variant: {
|
|
id: number;
|
|
name: string;
|
|
photo_url: string | null;
|
|
product: {
|
|
id: number;
|
|
name: string;
|
|
};
|
|
};
|
|
};
|
|
|
|
export type Transaction = {
|
|
id: number;
|
|
created_by_id: number;
|
|
customer_id: number | null;
|
|
marketing_id: number | null;
|
|
order_number: string;
|
|
channel: TransactionChannel;
|
|
price_type: TransactionPriceType;
|
|
status: TransactionStatus;
|
|
status_label: string;
|
|
payment_type: TransactionPaymentType;
|
|
payment_type_label: string;
|
|
channel_label: string;
|
|
price_type_label: string;
|
|
profit: number;
|
|
cogs: number;
|
|
subtotal: number;
|
|
discount: number;
|
|
nego_price: number | null;
|
|
total_amount: number;
|
|
notes: string | null;
|
|
created_at: string;
|
|
created_by: {
|
|
id: number;
|
|
user_profile: {
|
|
full_name: string;
|
|
};
|
|
};
|
|
customer: {
|
|
id: number;
|
|
name: string;
|
|
} | null;
|
|
marketing: {
|
|
id: number;
|
|
user_profile: {
|
|
full_name: string;
|
|
};
|
|
} | null;
|
|
order_items: TransactionItem[];
|
|
};
|
|
|
|
export type TransactionForEdit = {
|
|
id: number;
|
|
order_number: string;
|
|
stock_type: TransactionStockType;
|
|
channel: TransactionChannel;
|
|
price_type: TransactionPriceType;
|
|
payment_type: TransactionPaymentType;
|
|
customer_id: number | null;
|
|
marketing_id: number | null;
|
|
discount: number;
|
|
nego_price: number | null;
|
|
is_completed: boolean;
|
|
is_affiliate: boolean;
|
|
tiktok_order_id: string | null;
|
|
shopee_order_id: string | null;
|
|
notes: string | null;
|
|
photo_key: string | null;
|
|
photo_url: string | null;
|
|
items: {
|
|
id: number;
|
|
product_variant_id: number;
|
|
quantity: number;
|
|
unit_price: number;
|
|
}[];
|
|
};
|
|
|
|
export type ProductForTransaction = {
|
|
id: number;
|
|
name: string;
|
|
status: string;
|
|
product_variants: {
|
|
id: number;
|
|
name: string;
|
|
stock: number;
|
|
reject_stock: number;
|
|
photo_url: string | null;
|
|
prices: Record<string, number>;
|
|
}[];
|
|
};
|
|
|
|
export type CustomerForTransaction = {
|
|
id: number;
|
|
name: string;
|
|
};
|
|
|
|
export type EmployeeForTransaction = {
|
|
id: number;
|
|
user_profile: {
|
|
full_name: string;
|
|
} | null;
|
|
};
|
|
|
|
export type OptionItem = {
|
|
value: string;
|
|
label: string;
|
|
};
|
|
|
|
export type TransactionCreateData = {
|
|
products: ProductForTransaction[];
|
|
customers: CustomerForTransaction[];
|
|
employees: EmployeeForTransaction[];
|
|
channelOptions: OptionItem[];
|
|
paymentTypeOptions: OptionItem[];
|
|
priceTypeOptions: OptionItem[];
|
|
};
|