Events
View and manage school events.
Get Events
GET /teacher/co-curricular/get-events
{
"data": {
"events": [
{
"id": "uuid",
"title": "Annual Day",
"description": "Annual day celebration...",
"eventDate": "2024-04-20",
"startTime": "10:00",
"endTime": "14:00",
"venue": "School Auditorium",
"status": "UPCOMING"
}
]
}
}
Create Event
POST /teacher/co-curricular/add-event
{
"data": {
"title": "Science Exhibition",
"description": "Annual science exhibition...",
"eventDate": "2024-05-10",
"startTime": "09:00",
"endTime": "17:00",
"venue": "School Grounds",
"targetAudience": "ALL"
}
}
Update Event
PUT /teacher/co-curricular/update-event
UI — Event Card
class EventCard extends StatelessWidget {
final Event event;
@override
Widget build(BuildContext context) {
final authVM = context.watch<AuthViewModel>();
final canWrite = authVM.canWrite('event');
return Card(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
color: Colors.blue.shade50,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(child: Text(event.title, style: const TextStyle(fontWeight: FontWeight.bold))),
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
decoration: BoxDecoration(
color: event.status == 'UPCOMING' ? Colors.green : Colors.grey,
borderRadius: BorderRadius.circular(4),
),
child: Text(event.status, style: const TextStyle(color: Colors.white, fontSize: 10)),
),
],
),
const SizedBox(height: 4),
Text('${event.eventDate} • ${event.startTime} - ${event.endTime}'),
Text('Venue: ${event.venue}'),
],
),
),
Padding(
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(event.description),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (canWrite)
TextButton(
onPressed: () => _editEvent(event),
child: const Text('Edit'),
),
],
),
],
),
),
],
),
);
}
}