add timeline
This commit is contained in:
@@ -289,7 +289,7 @@ def enroll_later(enrollment: Enrollment, context: Context):
|
|||||||
},
|
},
|
||||||
'subscription_billing_day': subscription.billing_day,
|
'subscription_billing_day': subscription.billing_day,
|
||||||
'ttl': ttl(start_dt=scheduled_for),
|
'ttl': ttl(start_dt=scheduled_for),
|
||||||
'created_at': now_,
|
'scheduled_at': now_,
|
||||||
}
|
}
|
||||||
| (
|
| (
|
||||||
{'dedup_window_offset_days': deduplication_window.offset_days}
|
{'dedup_window_offset_days': deduplication_window.offset_days}
|
||||||
|
|||||||
@@ -1,10 +1,23 @@
|
|||||||
import type { Route } from './+types/route'
|
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 { Await } from 'react-router'
|
||||||
|
|
||||||
import { Skeleton } from '@repo/ui/components/skeleton'
|
import { Skeleton } from '@repo/ui/components/skeleton'
|
||||||
import { request as req } from '@repo/util/request'
|
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) {
|
export function meta({}: Route.MetaArgs) {
|
||||||
return [{ title: 'Matrículas agendadas' }]
|
return [{ title: 'Matrículas agendadas' }]
|
||||||
@@ -36,13 +49,71 @@ export default function Route({
|
|||||||
matricule imediatamente.
|
matricule imediatamente.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Await resolve={scheduled}>
|
<Await resolve={scheduled}>
|
||||||
{({ items }) =>
|
{({ items }) => {
|
||||||
items.map((props, index) => {
|
return (
|
||||||
return <div key={index}>{console.log(props)}</div>
|
<div className="space-y-5 lg:max-w-4xl mx-auto">
|
||||||
})
|
{grouping(items).map(([run_at, items]) => (
|
||||||
}
|
<div className="grid grid-cols-5 gap-2.5">
|
||||||
|
<div>
|
||||||
|
{DateTime.fromISO(run_at)
|
||||||
|
.setLocale('pt-BR')
|
||||||
|
.toFormat('cccc, dd LLL yyyy')}
|
||||||
|
</div>
|
||||||
|
<Card className="col-span-4">
|
||||||
|
<CardContent>
|
||||||
|
<ItemGroup>
|
||||||
|
{items.map(({ user, course, scheduled_at }, index) => (
|
||||||
|
<Fragment key={index}>
|
||||||
|
<Item>
|
||||||
|
<ItemContent>
|
||||||
|
<ItemTitle>{course.name}</ItemTitle>
|
||||||
|
<ItemDescription>{user.name}</ItemDescription>
|
||||||
|
</ItemContent>
|
||||||
|
<ItemActions>
|
||||||
|
<Button variant="ghost" size="icon-sm">
|
||||||
|
<EllipsisIcon />
|
||||||
|
</Button>
|
||||||
|
</ItemActions>
|
||||||
|
</Item>
|
||||||
|
{index !== items.length - 1 && <ItemSeparator />}
|
||||||
|
</Fragment>
|
||||||
|
))}
|
||||||
|
</ItemGroup>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}}
|
||||||
</Await>
|
</Await>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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'
|
||||||
|
})
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|||||||
subscription=subscription,
|
subscription=subscription,
|
||||||
cancel_policy=bool(subscription),
|
cancel_policy=bool(subscription),
|
||||||
created_by=created_by,
|
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
|
# Transfer the deduplication window if it exists
|
||||||
deduplication_window={'offset_days': offset_days} if offset_days else None,
|
deduplication_window={'offset_days': offset_days} if offset_days else None,
|
||||||
persistence_layer=dyn,
|
persistence_layer=dyn,
|
||||||
|
|||||||
Reference in New Issue
Block a user