USER ID / Login ID Update for Mobile Number Change - #160
Merged
Conversation
…pping Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat: Facility Hierarchy, Work Location Mapping & Inventory changes for HWC
Add service line dropdown to item-to-facility-mapping
#133) * fix: wrap SaveWorkLocationMapping payload in array for grouped role update The userRoleMappings API expects an array but was receiving a single object when adding new roles during grouped edit, causing "Failed to update mapping" error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add search to dropdowns, Volunteer role logic, Select All and compareWith fixes - Add search filter to User, State, District, Block dropdowns in work location mapping - Add search icon to all dropdown search boxes across components - Show village dropdown instead of facility for Volunteer role in FLW/HWC - Fix Select All villages not updating UI (new array reference for change detection) - Fix village search losing selection in facility creation (add compareWith) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: select all facilities by ID, move village after role for volunteer - fix select all facilities using ID-based comparison instead of reference/length so filtered search selections are preserved across different searches - move village dropdown after role in both create and edit modes so it appears only after volunteer role is selected Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: keep selected items visible in search dropdowns across all components Selected items no longer disappear when typing in search — filter always includes already-selected items so mat-select retains the selection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: enable Block and Village dropdowns for Stop TB serviceline Add 'Stop TB' to showBlockDrop and showEditBlockDrop so the work-location form renders Block (required) and Village (required, multi-select) for the new Stop TB serviceline, matching the FLW non-facility flow used by the Volunteer role. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: show Work Location dropdown for non-facility servicelines Re-add Select Work Location field in both create and edit forms, shown only when !isFacilityServiceline. HWC and FLW keep their facility sub-component; TM, MMU, Stop TB and other non-facility servicelines see the dropdown backed by showofficedetails / m_providerserviceaddmapping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: remove Volunteer special-case from FLW/HWC flow Volunteer role now belongs to the new Stop TB serviceline (non-facility flow), not to FLW/HWC. Drop all isVolunteerSelected / isVolunteerSelectedEdit branches that previously routed Volunteer users around the Facility sub-component. FLW and HWC always use Facility hierarchy; Stop TB uses the old Block/Village/Work Location flow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add Search and Select All to create-form Village dropdown Mirror the UX of the facility picker and the edit-form village dropdown: the create-form multi-select for Village now has an in-dropdown search box and a Select All checkbox. Affects Stop TB, TM, MMU flows where Village is picked via the parent form (non-facility servicelines). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: hide Work Location dropdown for Stop TB in create and edit forms Stop TB uses block+village mapping, not work location. Work Location is now hidden (create and edit) when isBlockRequired/isBlockRequiredEdit is true, keeping it visible for all other non-facility servicelines. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: show Village for Stop TB by guarding against stale villageFlag Village *ngIf now uses (villageFlag || isBlockRequired) so it renders even when villageFlag is out of sync with isBlockRequired. Also reset isBlockRequired and isVillageRequired in resetAllFields() and in the showBlockDrop else-branch to prevent stale state for non-block servicelines. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: load Block/Village in edit mode for Stop TB serviceline getEditBlockPatchMaster was not called for Stop TB, so the Block and Village dropdowns never appeared when editing a Stop TB mapping. Added Stop TB to the serviceline guard alongside FLW/HWC/TM/MMU. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: pom version * AMM-118: Add employee lock controls in admin UI * fix: amm-2343 fixed the active deactive functionality * fix: amm-2343 lock/unlock application crash fix --------- Co-authored-by: vishwab1 <vishwanath@navadhiti.com> Co-authored-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com> Co-authored-by: Sneha <sneha@ADMINs-MacBook-Pro.local>
New cascading multi-select dropdowns (TU, Health Facility, Village), shown only for Stop TB, sourced from Admin-API's new Nikshay endpoints. Create flow saves one row per TU x Facility combination, same pattern already used for ASHA Supervisor's multi-facility mapping. Edit flow pre-fills existing selections (including for pre-Nikshay users, who see empty-but-usable dropdowns to migrate onto the new fields), and reconciles changes on save by deactivating old rows and creating fresh ones for the current selection. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The nikshay tu/facility/village dropdown feature only had its endpoint urls defined in the gitignored environment.ts, so ng build failed against every real environment config (production, ci, test, local).
saveWorkLocations() built the request payload before the Nikshay TU/ Facility fields existed on the buffer object, so it only referenced facilityID (unused by Stop TB) and never sent nikshayTUID or nikshayFacilityID. The Admin-API backend already accepts and persists both fields, so mappings saved with a NULL facility/TU (shown as N/A in the grid). Also stop showing the standard block/village "Select Village" field for Stop TB in both create and edit mode, since that service line now has its own Nikshay TU -> Facility -> Village cascade; the extra field was redundant and blocked Save until filled. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
setWorkLocationObject()'s Stop TB branch built the buffer row without blockID/blockName, so every Stop TB mapping saved those columns as NULL even though the Select Block field is filled in and required in the UI. saveWorkLocations() already reads blockID/blockName generically for every service line, so this just supplies the values using the same objectToBeAdded.Serviceblock pattern other service lines use. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
AMRIT's own Block master is sparser than Nikshay's TU list per district, so the generic Block dropdown often had no matching entry for Stop TB users. Hide it for Stop TB and derive blockID/blockName from the selected Nikshay TU instead, in both create and edit flows. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…archy - Fix Roles loading: move getAllRoles() trigger from District's selectionChange to State's, since it only depends on State.providerServiceMapID — was previously empty if District hadn't been selected yet, for every service line. - Add resolveNikshayDistrictAndLoadTUs(): bridges AMRIT's selected State/District to Nikshay's own State/District by name match, then loads the TU list. AMRIT's State/District dropdowns stay as the single source of truth (still drive getAllRoles/getAllWorkLocations/ getBlockMaster for every service line) — this only resolves the corresponding Nikshay IDs, no new dropdowns added. - Add a genuine single-select "Block" field (TU-sourced) alongside the existing multi-select "TU" field, per updated Stop TB requirements. - Fix 3 leftover districtBranchID references (old AMRIT-village ID field) to nikshayVillageID in Nikshay-specific save/edit code paths, matching the new NikshayVillage entity built in Admin-API today.
…opdowns Remove resolveNikshayDistrictAndLoadTUs (bridged AMRIT's District to Nikshay's by name match). AMRIT's own m_District proved unreliable for this: 144 orphaned district rows across all 10 covered states from an earlier abandoned import attempt, plus inconsistent data between dev environments (one had Andhra Pradesh's post-2022 districts, another didn't). Bridging through it meant inheriting that unreliability. Add dedicated "Select State (Nikshay)" / "Select District (Nikshay)" dropdowns instead, shown only for Stop TB, sourced entirely from the independent m_nikshay_state/m_nikshay_district tables — zero AMRIT dependency. AMRIT's own State/District dropdowns are untouched, still driving getAllRoles/getAllWorkLocations/getBlockMaster for every service line as before.
Live testing showed a real bug from the separate Nikshay State/District dropdowns added previously: getAllRoles() only fires on AMRIT State's selectionChange, so if an admin filled the Nikshay-labeled fields but skipped the plain AMRIT ones, Role stayed empty with no explanation. Restore resolveNikshayDistrictAndLoadTUs as the single bridge: AMRIT's State/District are the only fields shown (unchanged, still drive getAllRoles/getAllWorkLocations/getBlockMaster), and selecting District silently resolves the matching Nikshay State/District by name to load the TU list. Shows a clear error if either isn't in Nikshay's data yet, instead of failing silently. Removed the now-dead selectedNikshayState/ selectedNikshayDistrict/nikshayDistrictList/nikshayStateSearch/ nikshayDistrictSearch fields and their filtered-list getters.
New cascading multi-select dropdowns (TU, Health Facility, Village), shown only for Stop TB, sourced from Admin-API's new Nikshay endpoints. Create flow saves one row per TU x Facility combination, same pattern already used for ASHA Supervisor's multi-facility mapping. Edit flow pre-fills existing selections (including for pre-Nikshay users, who see empty-but-usable dropdowns to migrate onto the new fields), and reconciles changes on save by deactivating old rows and creating fresh ones for the current selection. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The nikshay tu/facility/village dropdown feature only had its endpoint urls defined in the gitignored environment.ts, so ng build failed against every real environment config (production, ci, test, local).
Valid Till previously defaulted to the creation date, so a provider created without the admin explicitly extending it would fail login the very next day (validTill > now() check in Common-API login). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts: # pom.xml # src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.html # src/app/app-provider-admin/provider-admin/activities/services/work-location-mapping.service.ts # src/app/app-provider-admin/provider-admin/activities/work-location-mapping/work-location-mapping.component.html # src/app/app-provider-admin/provider-admin/activities/work-location-mapping/work-location-mapping.component.ts # src/environments/environment.ci.ts.template # src/environments/environment.local.ts # src/environments/environment.prod.ts # src/environments/environment.test.ts
Vb/release 3.8.2 merge
- Stop TB Create was hardcoding villageID/villageName to null, silently dropping the admin's village selection; it now saves them the same way Edit already does. - Old-style (pre-Nikshay) Stop TB users no longer get a guessed district auto-selected on Edit via AMRIT name-matching, and no longer inherit a stale AMRIT district ID into the Nikshay district field. District/TU/Facility/Village now come up blank for these rows so the admin picks fresh Nikshay values. - Edit's Stop TB Block/TU/Facility/Village dropdowns now have the same search box and Select All control Create already has. - MMU/TM's Edit Village dropdown was also missing search (had Select All only) - added for consistency. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Long comma-joined village lists (especially Stop TB's, sourced from an entire TU/facility) were either blowing out row height or, via the table-responsive wrapper, forcing the whole table to scroll horizontally past Edit/Deactivate. The Village cell now gets its own fixed-width, scrollable/draggable box with a hover tooltip showing the full list, so the rest of the columns stay on screen. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix: stop tb village save on create + edit dropdown gaps - Stop TB Create was hardcoding villageID/villageName to null, silently dropping the admin's village selection; it now saves them the same way Edit already does. - Old-style (pre-Nikshay) Stop TB users no longer get a guessed district auto-selected on Edit via AMRIT name-matching, and no longer inherit a stale AMRIT district ID into the Nikshay district field. District/TU/Facility/Village now come up blank for these rows so the admin picks fresh Nikshay values. - Edit's Stop TB Block/TU/Facility/Village dropdowns now have the same search box and Select All control Create already has. - MMU/TM's Edit Village dropdown was also missing search (had Select All only) - added for consistency. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix: scrollable village cell in work location mapping tables Long comma-joined village lists (especially Stop TB's, sourced from an entire TU/facility) were either blowing out row height or, via the table-responsive wrapper, forcing the whole table to scroll horizontally past Edit/Deactivate. The Village cell now gets its own fixed-width, scrollable/draggable box with a hover tooltip showing the full list, so the rest of the columns stay on screen. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…mapping Stop TB's Select Block is a single-select quick-add convenience over the same TU list Select TU manages (see onNikshayBlockChange) — it isn't a separate saved value. loadNikshayTUsForEditContinued() restored selectedNikshayTUs (so Select TU showed correctly) but never wrote back to selectedNikshayBlock, so it rendered empty on Edit even though the TU/block was fully saved. Pre-fill it whenever exactly one TU is restored, the case for all live Stop TB rows. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The previous fix guessed selectedNikshayBlock off selectedNikshayTUs.length == 1, which left Block blank whenever a row had more than one TU (a real, observed case). blockID/blockName on m_userservicerolemapping ARE the saved Select Block value in their own right, stamped by onNikshayBlockChange() at save time independent of how many TUs later joined NikshayTUID. Use getNikshayUserMappingData's blockID directly to look up the matching entry in nikshayTUList instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Create's setWorkLocationObject and Edit's updateGroupedWorkLocation both wrote blockID/blockName from selectedNikshayTUs[0] — whichever TU happened to land first in the multi-select array — instead of the TU the admin actually picked in Select Block. That's order-dependent, not selection-dependent: adding a second TU after picking Block, or in a different order, silently changes what gets saved as the block with no relation to what Select Block showed on screen. Both paths now read selectedNikshayBlock.nikshayTUID/tUName directly, falling back to the first selected TU only when Block was never touched. Combined with the earlier edit-load fix (looking the saved blockID up in nikshayTUList), Select Block now round-trips correctly: whatever's picked is what's saved, and it's what shows back up next time the row is edited. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
getNikshayUserMappingData() (/admin-api/nikshay/location/userMapping) only returns nikshayTUID/nikshayFacilityID/districtID — verified against a live UAT response — it never carries blockID/blockName. The previous fix read data.blockID from exactly that response, so it was always undefined -> NaN -> the lookup silently no-op'd and Select Block stayed blank on every edit, regardless of what was actually saved. edit_Details already holds blockID/blockName intact — it's sourced from getUserRoleMapped (v_userservicerolemapping) when the row is opened for Edit, which does carry both columns. Pull savedBlockID from there instead. No backend change needed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Block not visible in work location mapping
…158) Locking a user sets deleted=true and lockedDueToFailedAttempts=true. The Unlock button required deleted !== true to show, so a locked account had no enabled control left to unlock it. Unlock now shows whenever lockedDueToFailedAttempts is true, regardless of deleted, matching the logic already on main/release-3.6.2. Co-authored-by: Sneha <sneha@ADMINs-MacBook-Pro.local> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Adds a dedicated Configuration screen (code 82) for renaming a user, kept separate from the employee edit form on purpose: a username change has to be propagated to every CreatedBy/ModifiedBy column recording it, which is a different operation from editing details. The screen previews impact before committing — Apply stays disabled until a preview has run, so the per-table row counts are always seen first. The contact-numbers option is only for deployments where the username is the user's mobile number; it also rewrites ContactNo and EmergencyContactNo, which caps the new username at 12 characters because m_user.ContactNo is varchar(12). Consumes Admin-API's /username/renameUsername endpoints. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Removes the preview step: the button, the per-table results block, the service call and the gate that kept Apply disabled until a preview had run. Apply now goes straight to the confirmation dialog. The dialog quoted the preview's row count, so it now names the effect instead — that the rename also repoints the Created By and Modified By records the user owns, and cannot be undone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Employee ID was previously overwritten with the new username on every rename, with no way to opt out. It now defaults to untouched: ticking "Also update Employee ID" reveals the current value alongside a field for the new one, so a username change no longer forces an Employee ID change. SearchEmployee4 does not return employeeID (V_Showuser omits it), so the current value is fetched per user via FindEmployeeDetailsByUserName and shown as "Not set" where the user has none. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both identifier fields now verify against the server on every edit and surface "already in use" before submit, instead of only failing once Apply Rename is pressed. Submit is blocked while a check is in flight, and any pending verdict is cleared on each keystroke so a stale "available" can never gate a submit. Checks go through the rename API's own /username/checkAvailability rather than m/FindEmployeeByName. That endpoint filters on deleted=false, but m_user's UNIQUE keys do not exclude soft-deleted rows — it would report a name as free that the rename then rejects. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both fields can now be filled in or left blank — whatever is entered is updated, the rest is left alone. Select User is the only required field; the new username and new employee ID inputs are no longer mandatory, and the employee ID opt-in checkbox is gone since entering a value is itself the opt-in. Duplicate checks now use the same endpoints as the Employee Master screen — m/FindEmployeeByName and m/FindEmployeeDetails on keyup — with the same guard it uses: skip the check when the value still equals the user's own current one, which would otherwise always report "exists" and wrongly block the save. This replaces /username/checkAvailability, which is not deployed. The current Employee ID is always shown now rather than only behind the checkbox, and the confirmation names only what is actually changing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
SearchEmployee4 already returns userID on each row, so the selected user's ID goes with the request. oldUserName is still sent — the audit sweep matches on the username string — but the m_user row is now addressed by its primary key. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The result summary now spells out each change separately — username before/after, employee ID before/after — and says explicitly when the employee ID was left unchanged, rather than only naming the username. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Removes the results table and its row/column helpers. The summary now just confirms what changed — username before/after, employee ID before/after — instead of listing every table touched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pure deletions — no code changed. GPL license headers kept. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Renames the button from "Apply Rename" to "Update" and switches it from Material's warn palette to the app's existing mat_green class, which other Configuration screens already use and which carries a disabled state. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
vanitha1822
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



📋 Description
JIRA ID:
AMM-2434
✅ Type of Change
ℹ️ Additional Information
BE pr :(PSMRI/Admin-API#146)