Skip to content

Add Contract Start and End Date Fields to User Management #14

@Dark-Developer93

Description

@Dark-Developer93

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

  1. Add contract start date and end date fields to the User model.
  2. Update EditUser component to include calendar dropdowns for these new fields.
  3. Modify UsersTable to display contract status with color-coded badges.
  4. Implement logic to determine contract status based on end date.

Technical Tasks

  1. Update Prisma schema to include new date fields for User model.
  2. Modify EditUser component to add new date picker fields.
  3. Update UsersTable to display contract status with appropriate colors.
  4. Implement server-side logic to handle the new date fields.
  5. 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

  1. Update EditUser component:

    • app/(dashboard)/dashboard/users/EditUser.tsx
  2. Modify UsersTable component:

    • app/(dashboard)/dashboard/users/UsersTable.tsx
  3. 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

  • Admins and moderators can set and update contract start and end dates for users.
  • UsersTable displays contract status with appropriate color-coding.
  • The system accurately calculates and displays contract status based on end date.
  • All new fields are properly saved and retrieved from the database.
  • The user interface for editing dates is intuitive and consistent with existing design.

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.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions