Admin Fixes, Performance Improvements & Next Steps

 

Major Issue Found

The biggest issue discovered during testing was:

  • Users could not create a medication when the inventory table was empty

This completely blocked basic functionality for new setups.

This has now been fixed, and medications can be created properly even when starting from an empty state.

Admin Improvements

A large portion of the work focused on cleaning up the employee management flow:

  • Added automatic UserProfile creation during registration
  • Implemented a displayName update endpoint using userId
  • Refactored the Admin workflow to support:
    • Creating users with a name + role
    • Updating the display name directly from the table
    • Proper role assignment with cleanup of old roles
  • Replaced the role input with a dropdown instead of a text box
  • Added logic to detect what actually changed:
    • Name only
    • Role only
    • Both
    • No changes
  • Updated notifications so they reflect the correct action

Bug Fixes

User testing helped uncover and fix several issues:

  • Fixed duplicate user errors during registration
  • Fixed incorrect role reassignment when saving
  • Fixed display names not persisting
  • Fixed Admin modal behavior after actions
  • Ensured updates only run when changes are actually made

Also updated the Employee model to include:

  • id
  • originalRole
  • originalName

Layout Refactor & Performance Improvements

To improve navigation and reduce unnecessary reloads:

  • Moved MainLayoutComponent to a route-level wrapper
  • Removed <app-main-layout> from individual pages
  • Replaced ng-content with router-outlet

Profile Caching (UX Improvement)

A major issue during testing was UI flickering and repeated profile loading when switching pages.

This was fixed by caching profile data in ProfileService:

  • Implemented BehaviorSubject-based caching
  • Cached both profile data and profile image
  • Removed duplicate API calls on navigation
  • Fixed side navigation image flicker
  • Next Steps

    With the main functionality stabilized, the next focus is improving user feedback and UI consistency:

    • Improve notifications for temporary employee password errors
      • Show clear reasons for failure (validation, mismatch, requirements)
    • Update the UI color scheme
      • Improve consistency and contrast
      • Align with accepted design standards
      • Make the app feel more polished overall
  • Outcome

    After these updates:

    • Core functionality is no longer blocked (medication creation fixed)
    • Admin workflows are more reliable and easier to use
    • Role and name updates behave correctly
    • Navigation is smoother with no unnecessary reloads
    • UI flickering has been eliminated

    Overall, the app feels much more stable and closer to a production-ready experience.

Comments

Popular posts from this blog

PharmaStock: Backend Infrastructure & Database Connectivity

PharmaStock Backend Progress Complete all backend endpoints

PharmaStock: Sprint Planning Complete