- 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.
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { createDraftStore } from '@/lib/draft-store';
|
|
|
|
export type TransactionDraftData = {
|
|
stockType: 'good' | 'reject';
|
|
channel: string;
|
|
priceType: string;
|
|
paymentType: string;
|
|
customerId: number | null;
|
|
marketingId: number | null;
|
|
discount: number;
|
|
negoPrice: number | null;
|
|
isCompleted: boolean;
|
|
isAffiliate: boolean;
|
|
tiktokOrderId: string;
|
|
shopeeOrderId: string;
|
|
selectedProductId: string;
|
|
quantities: Record<string, number>;
|
|
notes: string;
|
|
photo?: string;
|
|
};
|
|
|
|
export const transactionDraftStore =
|
|
createDraftStore<TransactionDraftData>('transaction-draft');
|
|
|
|
export function saveTransactionDraft(
|
|
type: 'create' | 'edit',
|
|
data: TransactionDraftData,
|
|
userId?: number,
|
|
): boolean {
|
|
return transactionDraftStore.save(type, data, userId);
|
|
}
|
|
|
|
export function loadTransactionDraft(
|
|
type: 'create' | 'edit',
|
|
userId?: number,
|
|
): TransactionDraftData | null {
|
|
return transactionDraftStore.load(type, userId);
|
|
}
|
|
|
|
export function clearTransactionDraft(
|
|
type: 'create' | 'edit',
|
|
userId?: number,
|
|
): void {
|
|
transactionDraftStore.clear(type, userId);
|
|
}
|