Remove days/item/day wtf?
This commit is contained in:
@@ -62,15 +62,6 @@ const JobCardDetails: React.FC<JobCardDetailsProps> = ({ job }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const sortedIncome = [...job.income].sort((a, b) =>
|
||||
new Date(b.date).getTime() - new Date(a.date).getTime()
|
||||
);
|
||||
|
||||
const itemsSold = sortedIncome.reduce((sum, tx) => sum + tx.quantity, 0);
|
||||
const saleStartTime = job.saleStart ? new Date(job.saleStart).getTime() : null;
|
||||
const daysSinceStart = saleStartTime ? Math.max(1, Math.ceil((Date.now() - saleStartTime) / (1000 * 60 * 60 * 24))) : 0;
|
||||
const itemsPerDay = daysSinceStart > 0 ? itemsSold / daysSinceStart : 0;
|
||||
|
||||
const DateField = ({ label, value, fieldName, icon }: { label: string; value: string | null; fieldName: string; icon: React.ReactNode }) => (
|
||||
<div className="flex items-center gap-2 text-sm text-gray-400">
|
||||
{icon}
|
||||
@@ -112,7 +103,7 @@ const JobCardDetails: React.FC<JobCardDetailsProps> = ({ job }) => {
|
||||
<span className="w-16">Created:</span>
|
||||
<span>{formatDateTime(job.created)}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<DateField
|
||||
label="Start"
|
||||
value={job.jobStart}
|
||||
@@ -126,7 +117,7 @@ const JobCardDetails: React.FC<JobCardDetailsProps> = ({ job }) => {
|
||||
fieldName="jobEnd"
|
||||
icon={<Clock className="w-4 h-4" />}
|
||||
/>
|
||||
|
||||
|
||||
<DateField
|
||||
label="Sale Start"
|
||||
value={job.saleStart}
|
||||
@@ -142,12 +133,6 @@ const JobCardDetails: React.FC<JobCardDetailsProps> = ({ job }) => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{itemsPerDay > 0 && (
|
||||
<div className="text-sm text-gray-400 mt-2">
|
||||
Items/Day: {itemsPerDay.toFixed(2)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{job.billOfMaterials && job.billOfMaterials.length > 0 && (
|
||||
<HoverCard>
|
||||
<HoverCardTrigger asChild>
|
||||
|
||||
Reference in New Issue
Block a user