Add projected cost and revenue

This commit is contained in:
2025-07-04 17:04:11 +02:00
parent 63f3db6197
commit 6f6e599db0
4 changed files with 69 additions and 6 deletions

View File

@@ -1,4 +1,3 @@
import React from 'react';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
@@ -160,6 +159,17 @@ const JobCard: React.FC<JobCardProps> = ({ job, onEdit, onDelete }) => {
<span className="text-sm">Expenditure</span>
</div>
<div className="font-semibold">{formatISK(totalExpenditure)}</div>
{job.projectedCost > 0 && (
<div className="text-xs text-gray-400">
vs Projected: {formatISK(job.projectedCost)}
<Badge
variant={totalExpenditure <= job.projectedCost ? 'default' : 'destructive'}
className="ml-1 text-xs"
>
{((totalExpenditure / job.projectedCost) * 100).toFixed(1)}%
</Badge>
</div>
)}
</div>
<div className="text-center">
<div className="flex items-center justify-center gap-1 text-green-400">
@@ -167,6 +177,17 @@ const JobCard: React.FC<JobCardProps> = ({ job, onEdit, onDelete }) => {
<span className="text-sm">Income</span>
</div>
<div className="font-semibold">{formatISK(totalIncome)}</div>
{job.projectedRevenue > 0 && (
<div className="text-xs text-gray-400">
vs Projected: {formatISK(job.projectedRevenue)}
<Badge
variant={totalIncome >= job.projectedRevenue ? 'default' : 'destructive'}
className="ml-1 text-xs"
>
{((totalIncome / job.projectedRevenue) * 100).toFixed(1)}%
</Badge>
</div>
)}
</div>
<div className="text-center">
<div className="text-sm text-gray-400">Profit</div>
@@ -176,6 +197,11 @@ const JobCard: React.FC<JobCardProps> = ({ job, onEdit, onDelete }) => {
<Badge variant={profit >= 0 ? 'default' : 'destructive'} className="text-xs">
{margin.toFixed(1)}%
</Badge>
{job.projectedRevenue > 0 && job.projectedCost > 0 && (
<div className="text-xs text-gray-400 mt-1">
vs Projected: {formatISK(job.projectedRevenue - job.projectedCost)}
</div>
)}
</div>
</div>
</CardContent>