Add soonest column to list view

This commit is contained in:
2026-01-21 11:53:51 -07:00
parent b3f607b0fc
commit e79f28f52b

View File

@ -397,6 +397,7 @@ const ApartmentDashboard = () => {
case 'price': return dir * ((a.currentPrice || 0) - (b.currentPrice || 0)); case 'price': return dir * ((a.currentPrice || 0) - (b.currentPrice || 0));
case 'pricePerSqft': return dir * (((a.currentPrice || 0) / (a.area || 1)) - ((b.currentPrice || 0) / (b.area || 1))); case 'pricePerSqft': return dir * (((a.currentPrice || 0) / (a.area || 1)) - ((b.currentPrice || 0) / (b.area || 1)));
case 'daysAvailable': return dir * ((a.daysAvailable || 0) - (b.daysAvailable || 0)); case 'daysAvailable': return dir * ((a.daysAvailable || 0) - (b.daysAvailable || 0));
case 'soonest': return dir * (a.soonest || '').localeCompare(b.soonest || '');
default: return 0; default: return 0;
} }
}); });
@ -858,6 +859,15 @@ const ApartmentDashboard = () => {
{sortBy === 'daysAvailable' && (sortDirection === 'asc' ? <ArrowUp className="w-4 h-4 ml-1" /> : <ArrowDown className="w-4 h-4 ml-1" />)} {sortBy === 'daysAvailable' && (sortDirection === 'asc' ? <ArrowUp className="w-4 h-4 ml-1" /> : <ArrowDown className="w-4 h-4 ml-1" />)}
</span> </span>
</th> </th>
<th
className="text-center py-3 px-4 font-semibold text-gray-700 cursor-pointer hover:bg-gray-100 select-none"
onClick={() => handleSort('soonest')}
>
<span className="flex items-center justify-center">
Soonest
{sortBy === 'soonest' && (sortDirection === 'asc' ? <ArrowUp className="w-4 h-4 ml-1" /> : <ArrowDown className="w-4 h-4 ml-1" />)}
</span>
</th>
<th className="text-center py-3 px-4 font-semibold text-gray-700">Actions</th> <th className="text-center py-3 px-4 font-semibold text-gray-700">Actions</th>
</tr> </tr>
</thead> </thead>
@ -874,6 +884,7 @@ const ApartmentDashboard = () => {
<td className="py-3 px-4 text-right font-bold text-green-600">{formatPrice(unit.currentPrice)}</td> <td className="py-3 px-4 text-right font-bold text-green-600">{formatPrice(unit.currentPrice)}</td>
<td className="py-3 px-4 text-right text-gray-500">${((unit.currentPrice || 0) / (unit.area || 1)).toFixed(2)}</td> <td className="py-3 px-4 text-right text-gray-500">${((unit.currentPrice || 0) / (unit.area || 1)).toFixed(2)}</td>
<td className="py-3 px-4 text-center">{unit.daysAvailable || 0}</td> <td className="py-3 px-4 text-center">{unit.daysAvailable || 0}</td>
<td className="py-3 px-4 text-center">{unit.soonest ? formatDate(unit.soonest) : '-'}</td>
<td className="py-3 px-4"> <td className="py-3 px-4">
<div className="flex justify-center space-x-2"> <div className="flex justify-center space-x-2">
<button <button