Description
Implement contract start and end date fields for users, allowing admins and moderators to manage and track contract durations. This enhancement will include visual indicators in the UsersTable to highlight contract status.
Features to Implement
- Add contract start date and end date fields to the User model.
- Update EditUser component to include calendar dropdowns for these new fields.
- Modify UsersTable to display contract status with color-coded badges.
- Implement logic to determine contract status based on end date.
Technical Tasks
- Update Prisma schema to include new date fields for User model.
- Modify EditUser component to add new date picker fields.
- Update UsersTable to display contract status with appropriate colors.
- Implement server-side logic to handle the new date fields.
- Update any relevant API routes and actions.
Database Schema Updates
Update the User model in schema.prisma:
model User {
// ... existing fields
contractStartDate DateTime?
contractEndDate DateTime?
}
File Updates
-
Update EditUser component:
- app/(dashboard)/dashboard/users/EditUser.tsx
-
Modify UsersTable component:
- app/(dashboard)/dashboard/users/UsersTable.tsx
-
Update userActions.ts to handle new fields.
Implementation Details
EditUser Component
- Add two new FormField components for contractStartDate and contractEndDate.
- Use the Calendar component from shadcn/ui, similar to the implementation in RequestForm.
UsersTable Component
- Add a new column for Contract Status.
- Implement logic to determine status color:
- Red: contract expired
- Yellow: contract expires within one month
- Green: contract valid for more than a month
Acceptance Criteria
Related Files
- app/(portal)/portal/RequestForm.tsx
- prisma/schema.prisma
Please update these files and any others necessary to fully integrate the new contract date fields and status display functionality.
Description
Implement contract start and end date fields for users, allowing admins and moderators to manage and track contract durations. This enhancement will include visual indicators in the UsersTable to highlight contract status.
Features to Implement
Technical Tasks
Database Schema Updates
Update the User model in schema.prisma:
File Updates
Update EditUser component:
Modify UsersTable component:
Update userActions.ts to handle new fields.
Implementation Details
EditUser Component
UsersTable Component
Acceptance Criteria
Related Files
Please update these files and any others necessary to fully integrate the new contract date fields and status display functionality.