enh
This commit is contained in:
parent
df114be912
commit
764806db74
4 changed files with 11 additions and 10 deletions
|
|
@ -58,7 +58,6 @@ export default function Dashboard() {
|
|||
|
||||
const { data: essentialsData } = trpc.admin.user.getEssentials.useQuery();
|
||||
|
||||
console.log({essentialsData})
|
||||
|
||||
const menuItems: MenuItem[] = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ const OrderItem = ({ order, refetch }: { order: OrderType; refetch: () => void }
|
|||
<View style={tw`flex-row justify-between items-start`}>
|
||||
<View style={tw`flex-1`}>
|
||||
<View style={tw`flex-row items-center mb-1`}>
|
||||
<MyText style={tw`font-bold text-lg text-gray-900 mr-2`}>
|
||||
<MyText style={tw`font-bold text-lg mr-2 ${order.status === 'cancelled' ? 'text-red-600' : 'text-gray-900'}`}>
|
||||
{order.customerName || 'Unknown Customer'}
|
||||
</MyText>
|
||||
<View style={tw`bg-gray-200 px-2 py-0.5 rounded mr-2`}>
|
||||
|
|
@ -231,6 +231,11 @@ const OrderItem = ({ order, refetch }: { order: OrderType; refetch: () => void }
|
|||
checkColor="#FFFFFF"
|
||||
/>
|
||||
</View>
|
||||
{order.status === 'cancelled' && (
|
||||
<View style={tw`border border-red-500 px-2 py-0.5 rounded-full`}>
|
||||
<MyText style={tw`text-xs font-bold text-red-600`}>CANCELLED</MyText>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* Delivery Info */}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { router, protectedProcedure } from '../trpc-index';
|
|||
import { z } from 'zod';
|
||||
import { db } from '../../db/db_index';
|
||||
import { complaints, users } from '../../db/schema';
|
||||
import { eq } from 'drizzle-orm';
|
||||
import { eq, desc } from 'drizzle-orm';
|
||||
import { generateSignedUrlsFromS3Urls } from '../../lib/s3-client';
|
||||
|
||||
export const complaintRouter = router({
|
||||
|
|
@ -30,7 +30,7 @@ export const complaintRouter = router({
|
|||
})
|
||||
.from(complaints)
|
||||
.leftJoin(users, eq(complaints.userId, users.id))
|
||||
.orderBy(complaints.createdAt)
|
||||
.orderBy(desc(complaints.createdAt))
|
||||
.limit(limit)
|
||||
.offset(offset),
|
||||
db
|
||||
|
|
|
|||
|
|
@ -54,13 +54,10 @@ export const userRouter = {
|
|||
|
||||
getEssentials: protectedProcedure
|
||||
.query(async () => {
|
||||
const [result] = await db
|
||||
.select({ count: db.$count(complaints) })
|
||||
.from(complaints)
|
||||
.where(eq(complaints.isResolved, false));
|
||||
const count = await db.$count(complaints, eq(complaints.isResolved, false));
|
||||
|
||||
return {
|
||||
unresolvedComplaints: result.count || 0,
|
||||
unresolvedComplaints: count || 0,
|
||||
};
|
||||
}),
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue