pmtool / ASSET_REQUEST_UPDATES.md
devarshia5's picture
Upload 487 files
d97b8f9 verified
|
Raw
History Blame Contribute Delete
3.65 kB

Asset Request Management Updates

Summary of Changes

1. Custom Action Dialog Component

Created a new custom dialog component (ActionDialog.tsx) for approve/reject actions that:

  • Provides a better user experience with custom styling
  • Shows request details (ID and employee name) prominently
  • Has built-in validation and error handling
  • Displays character count for comments
  • Uses backdrop blur effect for better focus
  • Includes loading states during submission

2. Acknowledgement Status Added

Extended the asset request lifecycle to include an "acknowledged" status:

Type Updates (asset-request.ts):

  • Added 'acknowledged' to RequestStatus type
  • Added new fields to AssetRequest interface:
    • acknowledgedDate: string | null
    • acknowledgedBy: number | null
    • acknowledgementComments: string | null
  • Updated status transition rules: assigned β†’ acknowledged
  • Added label: "Acknowledged"
  • Added color: purple theme for acknowledged status

Status Flow:

pending β†’ approved β†’ assigned β†’ acknowledged
       β†˜ rejected

3. Updated Components

AssetRequestReview.tsx:

  • Replaced shadcn Dialog with custom ActionDialog component
  • Simplified approve/reject handlers
  • Removed local state management for comments (now handled by ActionDialog)
  • Cleaner code with better separation of concerns

MyAssetRequests.tsx:

  • Added acknowledgement status icon and color
  • Added "Acknowledged" tab to display acknowledged requests
  • Added acknowledgement information section showing:
    • Acknowledged date
    • Acknowledgement comments
  • Updated tab grid from 5 to 6 columns

assetRequestApi.ts:

  • Updated createSafeAssetRequest helper to include acknowledgement fields
  • Ensures backward compatibility with API responses

4. Features

Custom Dialog Benefits:

  • βœ… Better visual hierarchy
  • βœ… Clearer action context
  • βœ… Inline validation feedback
  • βœ… Improved accessibility
  • βœ… Consistent styling across approve/reject actions
  • βœ… Backdrop click to close
  • βœ… Escape key support (via onClose)

Acknowledgement Status Benefits:

  • βœ… Employees can confirm receipt of assigned assets
  • βœ… Complete audit trail of asset request lifecycle
  • βœ… Optional comments for acknowledgement
  • βœ… Clear visual distinction with purple badge
  • βœ… Separate tab for tracking acknowledged requests

Usage

Approve/Reject Dialog

The custom dialog automatically handles:

  • Comment validation (minimum 5 characters)
  • Character count display
  • Loading states
  • Error messages
  • Form submission

Acknowledgement Flow

  1. Admin assigns assets to approved request (status: assigned)
  2. Employee receives notification
  3. Employee acknowledges receipt (status: acknowledged)
  4. Optional: Employee can add comments during acknowledgement

API Integration Notes

The frontend now expects these additional fields in API responses:

{
  acknowledgedDate: string | null,
  acknowledgedBy: number | null,
  acknowledgementComments: string | null
}

If the backend doesn't provide these fields yet, the frontend will safely default them to null.

Next Steps

To fully implement acknowledgement functionality:

  1. Add acknowledgement API endpoint (e.g., PUT /api/AssetRequests/{id}/acknowledge)
  2. Add acknowledgement button in MyAssetRequests for assigned requests
  3. Create acknowledgement dialog similar to approve/reject
  4. Update backend to support acknowledgement status transition
  5. Add notifications for acknowledgement events