Latest Changes of Finance book Table
This commit is contained in:
parent
fc091eb666
commit
29ded9f6a6
@ -26,6 +26,15 @@ const AssetDetail: React.FC = () => {
|
|||||||
const { asset, loading, error } = useAssetDetails(
|
const { asset, loading, error } = useAssetDetails(
|
||||||
isDuplicating ? duplicateFromAsset : (isNewAsset ? null : assetName || null)
|
isDuplicating ? duplicateFromAsset : (isNewAsset ? null : assetName || null)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add this after the hook call
|
||||||
|
useEffect(() => {
|
||||||
|
if (asset) {
|
||||||
|
console.log('Full asset object:', asset);
|
||||||
|
console.log('Finance books:', asset.finance_books);
|
||||||
|
}
|
||||||
|
}, [asset]);
|
||||||
|
|
||||||
const { createAsset, updateAsset, loading: saving } = useAssetMutations();
|
const { createAsset, updateAsset, loading: saving } = useAssetMutations();
|
||||||
|
|
||||||
const [isEditing, setIsEditing] = useState(isNewAsset);
|
const [isEditing, setIsEditing] = useState(isNewAsset);
|
||||||
@ -53,17 +62,10 @@ const AssetDetail: React.FC = () => {
|
|||||||
custom_site_contractor: '',
|
custom_site_contractor: '',
|
||||||
custom_total_amount: 0,
|
custom_total_amount: 0,
|
||||||
calculate_depreciation: false,
|
calculate_depreciation: false,
|
||||||
available_for_use_date: isNewAsset ? new Date().toISOString().split('T')[0] : undefined
|
available_for_use_date: isNewAsset ? new Date().toISOString().split('T')[0] : undefined,
|
||||||
|
finance_books:[]
|
||||||
});
|
});
|
||||||
|
|
||||||
const emptyFinanceRow = {
|
|
||||||
finance_book: "",
|
|
||||||
depreciation_method: "",
|
|
||||||
total_number_of_depreciations: 0,
|
|
||||||
frequency_of_depreciation: "",
|
|
||||||
depreciation_start_date: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Load user details on mount
|
// Load user details on mount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -171,7 +173,8 @@ const AssetDetail: React.FC = () => {
|
|||||||
custom_total_amount: asset.custom_total_amount || 0,
|
custom_total_amount: asset.custom_total_amount || 0,
|
||||||
gross_purchase_amount:asset.gross_purchase_amount || 0,
|
gross_purchase_amount:asset.gross_purchase_amount || 0,
|
||||||
available_for_use_date: asset.available_for_use_date || '',
|
available_for_use_date: asset.available_for_use_date || '',
|
||||||
calculate_depreciation: asset.calculate_depreciation || false
|
calculate_depreciation: asset.calculate_depreciation || false,
|
||||||
|
finance_books: asset.finance_books || []
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [asset, isDuplicating]);
|
}, [asset, isDuplicating]);
|
||||||
|
|||||||
@ -30,6 +30,7 @@ export interface Asset {
|
|||||||
calculate_depreciation?: boolean;
|
calculate_depreciation?: boolean;
|
||||||
gross_purchase_amount?: number;
|
gross_purchase_amount?: number;
|
||||||
available_for_use_date?:string;
|
available_for_use_date?:string;
|
||||||
|
finance_books?: AssetFinanceBookRow[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AssetListResponse {
|
export interface AssetListResponse {
|
||||||
@ -72,7 +73,7 @@ export interface AssetFinanceBookRow {
|
|||||||
finance_book?: string;
|
finance_book?: string;
|
||||||
depreciation_method?: string;
|
depreciation_method?: string;
|
||||||
total_number_of_depreciations?: number;
|
total_number_of_depreciations?: number;
|
||||||
frequency_of_depreciation?: string;
|
frequency_of_depreciation?: number;
|
||||||
depreciation_start_date?: string; // YYYY-MM-DD
|
depreciation_start_date?: string; // YYYY-MM-DD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user