diff --git a/src/pages/AssetDetail.tsx b/src/pages/AssetDetail.tsx index fb59400..16ce0de 100644 --- a/src/pages/AssetDetail.tsx +++ b/src/pages/AssetDetail.tsx @@ -80,17 +80,22 @@ const AssetDetail: React.FC = () => { }, []); const addFinanceRow = () => { + // Get today's date in YYYY-MM-DD format for date input + const today = new Date().toISOString().split('T')[0]; + + const newRow: AssetFinanceBookRow = { + finance_book: 'Depreciation Entries', + depreciation_method: 'Straight Line', + total_number_of_depreciations: 10, + frequency_of_depreciation: 12, + depreciation_start_date: today + }; + setFormData(prev => ({ ...prev, finance_books: [ ...(prev.finance_books || []), - { - finance_book: '', - depreciation_method: '', - total_number_of_depreciations: 0, - frequency_of_depreciation: '', - depreciation_start_date: '' - } + newRow ] })); }; @@ -956,323 +961,191 @@ const AssetDetail: React.FC = () => { - {/* Financial Details */} + {/* Updated Financial Details */}
The depreciation method is an accounting method used to allocate the cost of a tangible asset over its useful life.
-| + Finance Book + | ++ Depreciation Method* + | ++ Total Depreciations* + | ++ Frequency (Months)* + | ++ Depreciation Posting Date* + | + {isEditing && ( ++ Action + | + )} +
|---|---|---|---|---|---|
|
+
+
+ |
+
+ {/* Depreciation Method */}
+ + + | + + {/* Total Depreciations */} ++ + updateFinanceRow(idx, { + total_number_of_depreciations: Number(e.target.value), + }) + } + disabled={!isEditing} + placeholder="0" + className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white" + /> + | + + {/* Frequency */} ++ + updateFinanceRow(idx, { + frequency_of_depreciation: Number(e.target.value), + }) + } + disabled={!isEditing} + placeholder="0" + className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white" + /> + | + + {/* Start Date */} ++ + updateFinanceRow(idx, { depreciation_start_date: e.target.value }) + } + disabled={!isEditing} + className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white" + /> + | + + {/* REMOVE BUTTON */} + {isEditing && ( ++ + | + )} +