fix: CAPA owner dashboard — priority null guard, nulls-last due_date sort
This commit is contained in:
@@ -37,7 +37,7 @@ export default async function CapaOwnerPage() {
|
||||
.from('capa_actions')
|
||||
.select('id, description, due_date, priority, status, incident_id, incidents (reference_no)')
|
||||
.eq('owner_user_id', user.id)
|
||||
.order('due_date', { ascending: true })
|
||||
.order('due_date', { ascending: true, nullsFirst: false })
|
||||
|
||||
const rows = capas ?? []
|
||||
const openCount = rows.filter(c => ['open', 'in_progress', 'reopened'].includes(c.status)).length
|
||||
@@ -90,9 +90,11 @@ export default async function CapaOwnerPage() {
|
||||
<p className={`text-xs mt-1 ${isOverdue ? 'text-red-600 font-semibold' : 'text-gray-400'}`}>
|
||||
{capa.due_date ? `Due ${new Date(capa.due_date as string).toLocaleDateString('en-MY')}` : 'No due date'}
|
||||
</p>
|
||||
<p className={`text-xs mt-0.5 ${PRIORITY_COLORS[capa.priority as string] ?? ''}`}>
|
||||
{(capa.priority as string)?.toUpperCase()} priority
|
||||
</p>
|
||||
{capa.priority && (
|
||||
<p className={`text-xs mt-0.5 ${PRIORITY_COLORS[capa.priority as string] ?? ''}`}>
|
||||
{(capa.priority as string).toUpperCase()} priority
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user