feat: integrate ownership-costs UI into vehicle detail pages (refs #15)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 4m43s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 38s
Deploy to Staging / Verify Staging (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 6s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped

- Add OwnershipCostsList to desktop VehicleDetailPage
- Add OwnershipCostsList to mobile VehicleDetailMobile
- Users can now view, add, edit, and delete recurring costs directly
  from the vehicle detail view
This commit is contained in:
Eric Gullickson
2026-01-13 07:57:23 -06:00
parent a8c4eba8d1
commit cb93e3ccc5
2 changed files with 19 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ import { FuelLogResponse, UpdateFuelLogRequest } from '../../fuel-logs/types/fue
import { FuelLogEditDialog } from '../../fuel-logs/components/FuelLogEditDialog'; import { FuelLogEditDialog } from '../../fuel-logs/components/FuelLogEditDialog';
import { fuelLogsApi } from '../../fuel-logs/api/fuel-logs.api'; import { fuelLogsApi } from '../../fuel-logs/api/fuel-logs.api';
import { VehicleImage } from '../components/VehicleImage'; import { VehicleImage } from '../components/VehicleImage';
import { OwnershipCostsList } from '../../ownership-costs';
interface VehicleDetailMobileProps { interface VehicleDetailMobileProps {
vehicle: Vehicle; vehicle: Vehicle;
@@ -224,7 +225,15 @@ export const VehicleDetailMobile: React.FC<VehicleDetailMobileProps> = ({
</CardContent> </CardContent>
</Card> </Card>
</Section> </Section>
<Section title="Recurring Costs">
<Card>
<CardContent>
<OwnershipCostsList vehicleId={vehicle.id} />
</CardContent>
</Card>
</Section>
<Section title="Vehicle Records"> <Section title="Vehicle Records">
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 1 }}> <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 1 }}>
<Typography variant="body2" color="text.secondary"> <Typography variant="body2" color="text.secondary">

View File

@@ -22,6 +22,7 @@ import { FuelLogEditDialog } from '../../fuel-logs/components/FuelLogEditDialog'
import { FuelLogForm } from '../../fuel-logs/components/FuelLogForm'; import { FuelLogForm } from '../../fuel-logs/components/FuelLogForm';
// Unit conversions now handled by backend // Unit conversions now handled by backend
import { fuelLogsApi } from '../../fuel-logs/api/fuel-logs.api'; import { fuelLogsApi } from '../../fuel-logs/api/fuel-logs.api';
import { OwnershipCostsList } from '../../ownership-costs';
const DetailField: React.FC<{ const DetailField: React.FC<{
label: string; label: string;
@@ -356,14 +357,19 @@ export const VehicleDetailPage: React.FC = () => {
<DetailField label="License Plate" value={vehicle.licensePlate} /> <DetailField label="License Plate" value={vehicle.licensePlate} />
</div> </div>
<DetailField <DetailField
label="Current Odometer Reading" label="Current Odometer Reading"
value={vehicle.odometerReading ? `${vehicle.odometerReading.toLocaleString()} mi` : undefined} value={vehicle.odometerReading ? `${vehicle.odometerReading.toLocaleString()} mi` : undefined}
/> />
</form> </form>
<Divider sx={{ my: 4 }} /> <Divider sx={{ my: 4 }} />
{/* Recurring Ownership Costs */}
<OwnershipCostsList vehicleId={vehicle.id} />
<Divider sx={{ my: 4 }} />
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2 }}> <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2 }}>
<Typography variant="h6" sx={{ fontWeight: 600 }}> <Typography variant="h6" sx={{ fontWeight: 600 }}>
Vehicle Records Vehicle Records