From 54f8f843dfa4173c1ce405860bc85badc3ccdf0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9rgio=20Rafael=20Siqueira?=
Date: Sun, 14 Dec 2025 21:17:21 -0300
Subject: [PATCH] add timeline
---
.../app/routes/enrollments/enroll.py | 2 +-
.../app/routes/_.$orgid.scheduled/route.tsx | 83 +++++++++++++++++--
.../app/events/enroll_scheduled.py | 2 +-
3 files changed, 79 insertions(+), 8 deletions(-)
diff --git a/api.saladeaula.digital/app/routes/enrollments/enroll.py b/api.saladeaula.digital/app/routes/enrollments/enroll.py
index 508c30b..3203a68 100644
--- a/api.saladeaula.digital/app/routes/enrollments/enroll.py
+++ b/api.saladeaula.digital/app/routes/enrollments/enroll.py
@@ -289,7 +289,7 @@ def enroll_later(enrollment: Enrollment, context: Context):
},
'subscription_billing_day': subscription.billing_day,
'ttl': ttl(start_dt=scheduled_for),
- 'created_at': now_,
+ 'scheduled_at': now_,
}
| (
{'dedup_window_offset_days': deduplication_window.offset_days}
diff --git a/apps/admin.saladeaula.digital/app/routes/_.$orgid.scheduled/route.tsx b/apps/admin.saladeaula.digital/app/routes/_.$orgid.scheduled/route.tsx
index d6a0038..f931afc 100644
--- a/apps/admin.saladeaula.digital/app/routes/_.$orgid.scheduled/route.tsx
+++ b/apps/admin.saladeaula.digital/app/routes/_.$orgid.scheduled/route.tsx
@@ -1,10 +1,23 @@
import type { Route } from './+types/route'
-import { Suspense } from 'react'
+import { EllipsisIcon } from 'lucide-react'
+import { DateTime } from 'luxon'
+import { Fragment, Suspense } from 'react'
import { Await } from 'react-router'
import { Skeleton } from '@repo/ui/components/skeleton'
import { request as req } from '@repo/util/request'
+import { Card, CardContent } from '@repo/ui/components/ui/card'
+import {
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemGroup,
+ ItemSeparator,
+ ItemTitle
+} from '@repo/ui/components/ui/item'
+import { Button } from '@repo/ui/components/ui/button'
export function meta({}: Route.MetaArgs) {
return [{ title: 'MatrĂculas agendadas' }]
@@ -36,13 +49,71 @@ export default function Route({
matricule imediatamente.
+
- {({ items }) =>
- items.map((props, index) => {
- return {console.log(props)}
- })
- }
+ {({ items }) => {
+ return (
+
+ {grouping(items).map(([run_at, items]) => (
+
+
+ {DateTime.fromISO(run_at)
+ .setLocale('pt-BR')
+ .toFormat('cccc, dd LLL yyyy')}
+
+
+
+
+ {items.map(({ user, course, scheduled_at }, index) => (
+
+ -
+
+ {course.name}
+ {user.name}
+
+
+
+
+
+ {index !== items.length - 1 && }
+
+ ))}
+
+
+
+
+ ))}
+
+ )
+ }}
)
}
+
+function grouping(items) {
+ const newItems = Object.entries(
+ items.reduce((acc, item) => {
+ const [run_at] = item.sk.split('#')
+
+ if (!acc[run_at]) {
+ acc[run_at] = []
+ }
+
+ acc[run_at].push(item)
+
+ return acc
+ }, [])
+ )
+ return newItems.sort((x, y) => x[0].localeCompare(y[0]))
+}
+
+const datetime = new Intl.DateTimeFormat('pt-BR', {
+ day: '2-digit',
+ month: '2-digit',
+ year: 'numeric',
+ hour: '2-digit',
+ minute: '2-digit'
+})
diff --git a/enrollments-events/app/events/enroll_scheduled.py b/enrollments-events/app/events/enroll_scheduled.py
index 8fd6000..8963d6c 100644
--- a/enrollments-events/app/events/enroll_scheduled.py
+++ b/enrollments-events/app/events/enroll_scheduled.py
@@ -52,7 +52,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
subscription=subscription,
cancel_policy=bool(subscription),
created_by=created_by,
- scheduled_at=datetime.fromisoformat(old_image['created_at']),
+ scheduled_at=datetime.fromisoformat(old_image['scheduled_at']),
# Transfer the deduplication window if it exists
deduplication_window={'offset_days': offset_days} if offset_days else None,
persistence_layer=dyn,